Merge pull request #18360 from colemanw/fixMultiInProfile
[civicrm-core.git] / CRM / Contact / Form / Task / SMS.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class provides the functionality to sms a group of contacts.
20 */
21 class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task {
22
23 /**
24 * Are we operating in "single mode", i.e. sending sms to one
25 * specific contact?
26 *
27 * @var bool
28 */
29 public $_single = FALSE;
30
31 /**
32 * All the existing templates in the system.
33 *
34 * @var array
35 */
36 public $_templates = NULL;
37
38 public function preProcess() {
39
40 $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
41
42 $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
43
44 CRM_Contact_Form_Task_SMSCommon::preProcessProvider($this);
45
46 if (!$cid && $this->_context != 'standalone') {
47 parent::preProcess();
48 }
49
50 $this->assign('single', $this->_single);
51 if (CRM_Core_Permission::check('administer CiviCRM')) {
52 $this->assign('isAdmin', 1);
53 }
54 }
55
56 /**
57 * Build the form object.
58 */
59 public function buildQuickForm() {
60 //enable form element
61 $this->assign('suppressForm', FALSE);
62 $this->assign('SMSTask', TRUE);
63 CRM_Contact_Form_Task_SMSCommon::buildQuickForm($this);
64 }
65
66 /**
67 * Process the form after the input has been submitted and validated.
68 */
69 public function postProcess() {
70 CRM_Contact_Form_Task_SMSCommon::postProcess($this);
71 }
72
73 /**
74 * List available tokens for this form.
75 *
76 * @return array
77 */
78 public function listTokens() {
79 $tokens = CRM_Core_SelectValues::contactTokens();
80 return $tokens;
81 }
82
83 }