3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
37 * This class generates form components generic to all the contact types.
39 * It delegates the work to lower level subclasses and integrates the changes
40 * back in. It also uses a lot of functionality with the CRM API's, so any change
41 * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
44 class CRM_Profile_Form_Search
extends CRM_Profile_Form
{
47 * Pre processing work done here.
53 public function preProcess() {
54 $this->_mode
= CRM_Profile_Form
::MODE_SEARCH
;
59 * Set the default form values.
63 * the default array reference
65 public function setDefaultValues() {
67 // note we intentionally overwrite value since we use it as defaults
68 // and its all pass by value
69 // we need to figure out the type, so we can either set an array element
70 // or a scalar -- FIX ME sometime please
71 foreach ($_GET as $key => $value) {
72 if (substr($key, 0, 7) == 'custom_' ||
$key == "preferred_communication_method") {
73 if (strpos($value, CRM_Core_DAO
::VALUE_SEPARATOR
) !== FALSE) {
74 $v = explode(CRM_Core_DAO
::VALUE_SEPARATOR
, $value);
76 foreach ($v as $item) {
78 $value[$item] = $item;
83 elseif ($key == 'group' ||
$key == 'tag') {
84 $v = explode(',', $value);
86 foreach ($v as $item) {
90 elseif (in_array($key, array(
94 list($value) = CRM_Utils_Date
::setDateDefaults($value);
97 $defaults[$key] = $value;
103 * Build the form object.
107 public function buildQuickForm() {
108 // Is proximity search enabled for this profile?
109 $proxSearch = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_UFGroup',
111 'is_proximity_search', 'id'
114 CRM_Contact_Form_Task_ProximityCommon
::buildQuickForm($this, $proxSearch);
117 $this->addButtons(array(
120 'name' => ts('Search'),
125 parent
::buildQuickForm();
134 public function postProcess() {