| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.3 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2013 | |
| 7 | +--------------------------------------------------------------------+ |
| 8 | | This file is a part of CiviCRM. | |
| 9 | | | |
| 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. | |
| 13 | | | |
| 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. | |
| 18 | | | |
| 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 | +--------------------------------------------------------------------+ |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * |
| 30 | * @package CRM |
| 31 | * @copyright CiviCRM LLC (c) 2004-2013 |
| 32 | * $Id$ |
| 33 | * |
| 34 | */ |
| 35 | class CRM_UF_Form_AdvanceSetting extends CRM_UF_Form_Group { |
| 36 | |
| 37 | /** |
| 38 | * Function to build the form for Advance Settings. |
| 39 | * |
| 40 | * @access public |
| 41 | * |
| 42 | * @return None |
| 43 | */ |
| 44 | public static function buildAdvanceSetting(&$form) { |
| 45 | // should mapping be enabled for this group |
| 46 | $form->addElement('checkbox', 'is_map', ts('Enable mapping for this profile?')); |
| 47 | |
| 48 | // should we allow updates on a exisitng contact |
| 49 | $options = array(); |
| 50 | $options[] = $form->createElement('radio', NULL, NULL, ts('Issue warning and do not save'), 0); |
| 51 | $options[] = $form->createElement('radio', NULL, NULL, ts('Update the matching contact'), 1); |
| 52 | $options[] = $form->createElement('radio', NULL, NULL, ts('Allow duplicate contact to be created'), 2); |
| 53 | |
| 54 | $form->addGroup($options, 'is_update_dupe', ts('What to do upon duplicate match')); |
| 55 | // we do not have any url checks to allow relative urls |
| 56 | $form->addElement('text', 'post_URL', ts('Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'post_URL')); |
| 57 | $form->addElement('text', 'cancel_URL', ts('Cancel Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'cancel_URL')); |
| 58 | |
| 59 | // add select for groups |
| 60 | $group = array( |
| 61 | '' => ts('- select -')) + $form->_group; |
| 62 | $form->_groupElement = &$form->addElement('select', 'group', ts('Limit listings to a specific Group?'), $group); |
| 63 | |
| 64 | //add notify field |
| 65 | $form->addElement('text', 'notify', ts('Notify when profile form is submitted?')); |
| 66 | |
| 67 | //group where new contacts are directed. |
| 68 | $form->addElement('select', 'add_contact_to_group', ts('Add new contacts to a Group?'), $group); |
| 69 | |
| 70 | // add CAPTCHA To this group ? |
| 71 | $form->addElement('checkbox', 'add_captcha', ts('Include reCAPTCHA?')); |
| 72 | |
| 73 | // should we display an edit link |
| 74 | $form->addElement('checkbox', 'is_edit_link', ts('Include profile edit links in search results?')); |
| 75 | |
| 76 | // should we display a link to the website profile |
| 77 | $config = CRM_Core_Config::singleton(); |
| 78 | $form->addElement('checkbox', 'is_uf_link', ts('Include %1 user account information links in search results?', array(1 => $config->userFramework))); |
| 79 | |
| 80 | // want to create cms user |
| 81 | $session = CRM_Core_Session::singleton(); |
| 82 | $cmsId = FALSE; |
| 83 | if ($form->_cId = $session->get('userID')) { |
| 84 | $form->_cmsId = TRUE; |
| 85 | } |
| 86 | |
| 87 | $options = array(); |
| 88 | $options[] = $form->createElement('radio', NULL, NULL, ts('No account create option'), 0); |
| 89 | $options[] = $form->createElement('radio', NULL, NULL, ts('Give option, but not required'), 1); |
| 90 | $options[] = $form->createElement('radio', NULL, NULL, ts('Account creation required'), 2); |
| 91 | |
| 92 | $form->addGroup($options, 'is_cms_user', ts('%1 user account registration option?', array(1 => $config->userFramework))); |
| 93 | |
| 94 | // options for including Proximity Search in the profile search form |
| 95 | $proxOptions = array(); |
| 96 | $proxOptions[] = $form->createElement('radio', NULL, NULL, ts('None'), 0); |
| 97 | $proxOptions[] = $form->createElement('radio', NULL, NULL, ts('Optional'), 1); |
| 98 | $proxOptions[] = $form->createElement('radio', NULL, NULL, ts('Required'), 2); |
| 99 | |
| 100 | $form->addGroup($proxOptions, 'is_proximity_search', ts('Proximity search')); |
| 101 | } |
| 102 | } |
| 103 | |