3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2015
35 * Form helper class for an Email object.
37 class CRM_Contact_Form_Edit_Email
{
40 * Build the form object elements for an email object.
42 * @param CRM_Core_Form $form
43 * Reference to the form object.
44 * @param int $blockCount
45 * Block number to build.
46 * @param bool $blockEdit
49 public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
50 // passing this via the session is AWFUL. we need to fix this
52 $blockId = ($form->get('Email_Block_Count')) ?
$form->get('Email_Block_Count') : 1;
55 $blockId = $blockCount;
58 $form->applyFilter('__ALL__', 'trim');
61 $form->addField("email[$blockId][email]", array('entity' => 'email'));
62 $form->addRule("email[$blockId][email]", ts('Email is not valid.'), 'email');
63 if (isset($form->_contactType
) ||
$blockEdit) {
65 $form->addField("email[$blockId][location_type_id]", array('entity' => 'email', 'placeholder' => NULL, 'class' => 'eight'));
67 //TODO: Refactor on_hold field to select.
68 $multipleBulk = CRM_Core_BAO_Email
::isMultipleBulkMail();
73 0 => ts('- select -'),
74 1 => ts('On Hold Bounce'),
75 2 => ts('On Hold Opt Out'),
77 $form->addElement('select', "email[$blockId][on_hold]", '', $holdOptions);
80 $form->addField("email[$blockId][on_hold]", array('entity' => 'email'));
84 $form->assign('multipleBulk', $multipleBulk);
86 $js = array('id' => "Email_" . $blockId . "_IsBulkmail");
87 $form->addElement('advcheckbox', "email[$blockId][is_bulkmail]", NULL, '', $js);
90 $js = array('id' => "Email_" . $blockId . "_IsBulkmail");
92 $js['onClick'] = 'singleSelect( this.id );';
94 $form->addElement('radio', "email[$blockId][is_bulkmail]", '', '', '1', $js);
98 $js = array('id' => "Email_" . $blockId . "_IsPrimary");
100 $js['onClick'] = 'singleSelect( this.id );';
103 $form->addElement('radio', "email[$blockId][is_primary]", '', '', '1', $js);
105 if (CRM_Utils_System
::getClassName($form) == 'CRM_Contact_Form_Contact') {
107 $form->add('textarea', "email[$blockId][signature_text]", ts('Signature (Text)'),
108 array('rows' => 2, 'cols' => 40)
111 $form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'),
112 array('rows' => 2, 'cols' => 40)