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