| 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 email a group of contacts. |
| 20 | */ |
| 21 | class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task { |
| 22 | |
| 23 | /** |
| 24 | * Are we operating in "single mode", i.e. sending email to one |
| 25 | * specific contact? |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public $_single = FALSE; |
| 30 | |
| 31 | public $_noEmails = FALSE; |
| 32 | |
| 33 | /** |
| 34 | * All the existing templates in the system. |
| 35 | * |
| 36 | * @var array |
| 37 | */ |
| 38 | public $_templates = NULL; |
| 39 | |
| 40 | /** |
| 41 | * Build all the data structures needed to build the form. |
| 42 | */ |
| 43 | public function preProcess() { |
| 44 | CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this); |
| 45 | parent::preProcess(); |
| 46 | |
| 47 | // we have all the contribution ids, so now we get the contact ids |
| 48 | parent::setContactIDs(); |
| 49 | |
| 50 | $this->assign('single', $this->_single); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Build the form object. |
| 55 | */ |
| 56 | public function buildQuickForm() { |
| 57 | // Enable form element. |
| 58 | $this->assign('emailTask', TRUE); |
| 59 | |
| 60 | CRM_Contact_Form_Task_EmailCommon::buildQuickForm($this); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Process the form after the input has been submitted and validated. |
| 65 | */ |
| 66 | public function postProcess() { |
| 67 | CRM_Contact_Form_Task_EmailCommon::postProcess($this); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * List available tokens for this form. |
| 72 | * |
| 73 | * @return array |
| 74 | */ |
| 75 | public function listTokens() { |
| 76 | $tokens = CRM_Core_SelectValues::contactTokens(); |
| 77 | return $tokens; |
| 78 | } |
| 79 | |
| 80 | } |