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