3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components generic to all the contact types.
21 * It delegates the work to lower level subclasses and integrates the changes
22 * back in. It also uses a lot of functionality with the CRM API's, so any change
23 * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
25 class CRM_Profile_Form_Search
extends CRM_Profile_Form
{
28 * Pre processing work done here.
30 public function preProcess() {
31 $this->_mode
= CRM_Profile_Form
::MODE_SEARCH
;
36 * Set the default form values.
39 * the default array reference
41 public function setDefaultValues() {
43 // note we intentionally overwrite value since we use it as defaults
44 // and its all pass by value
45 // we need to figure out the type, so we can either set an array element
46 // or a scalar -- FIX ME sometime please
47 foreach ($_GET as $key => $value) {
48 if (substr($key, 0, 7) == 'custom_' ||
$key == "preferred_communication_method") {
49 if (strpos($value, CRM_Core_DAO
::VALUE_SEPARATOR
) !== FALSE) {
50 $v = explode(CRM_Core_DAO
::VALUE_SEPARATOR
, $value);
52 foreach ($v as $item) {
54 $value[$item] = $item;
59 elseif ($key == 'group' ||
$key == 'tag') {
60 $v = explode(',', $value);
62 foreach ($v as $item) {
66 elseif (in_array($key, [
70 list($value) = CRM_Utils_Date
::setDateDefaults($value);
73 $defaults[$key] = $value;
79 * Build the form object.
81 public function buildQuickForm() {
82 // Is proximity search enabled for this profile?
83 $proxSearch = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_UFGroup',
85 'is_proximity_search', 'id'
88 CRM_Contact_Form_Task_ProximityCommon
::buildQuickForm($this, $proxSearch);
94 'name' => ts('Search'),
99 parent
::buildQuickForm();
103 * Post process function.
105 public function postProcess() {