Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
8c9251b3 | 6 | | Copyright CiviCRM LLC (c) 2004-2018 | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
8c9251b3 | 31 | * @copyright CiviCRM LLC (c) 2004-2018 |
6a488035 TO |
32 | */ |
33 | ||
34 | /** | |
35 | * This class generates form components for Search Parameters | |
36 | * | |
37 | */ | |
38 | class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { | |
39 | ||
40 | protected $_settings = array( | |
d434f797 TO |
41 | 'contact_reference_options' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
42 | 'contact_autocomplete_options' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
6a488035 | 43 | 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
56c2750b | 44 | 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
dc378d98 TO |
45 | 'includeWildCardInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
46 | 'includeEmailInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
47 | 'includeNickNameInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
48 | 'includeAlphabeticalPager' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
49 | 'includeOrderByClause' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
50 | 'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
51 | 'defaultSearchProfileID' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, | |
a3fccfc7 | 52 | 'searchPrimaryDetailsOnly' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
4235341b | 53 | 'quicksearch_options' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, |
6a488035 TO |
54 | ); |
55 | ||
56 | /** | |
eceb18cc | 57 | * Build the form object. |
6a488035 TO |
58 | */ |
59 | public function buildQuickForm() { | |
60 | CRM_Utils_System::setTitle(ts('Settings - Search Preferences')); | |
61 | ||
d434f797 TO |
62 | parent::buildQuickForm(); |
63 | ||
c3bc1eaf | 64 | // @todo remove the following adds in favour of setting via the settings array (above). |
6a488035 TO |
65 | |
66 | // Autocomplete for Contact Search (quick search etc.) | |
d434f797 | 67 | $element = $this->getElement('contact_autocomplete_options'); |
6a488035 TO |
68 | $element->_elements[0]->_flagFrozen = TRUE; |
69 | ||
70 | // Autocomplete for Contact Reference (custom fields) | |
d434f797 | 71 | $element = $this->getElement('contact_reference_options'); |
6a488035 | 72 | $element->_elements[0]->_flagFrozen = TRUE; |
4235341b CW |
73 | |
74 | // Freeze first element of quicksearch options | |
75 | $element = $this->getElement('quicksearch_options'); | |
76 | $element->_elements[0]->_flagFrozen = TRUE; | |
d434f797 | 77 | } |
6a488035 | 78 | |
d434f797 TO |
79 | /** |
80 | * @return array | |
81 | */ | |
82 | public static function getContactAutocompleteOptions() { | |
83 | return array( | |
84 | ts('Contact Name') => 1, | |
85 | ) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', | |
86 | FALSE, FALSE, TRUE | |
87 | )); | |
6a488035 | 88 | } |
96025800 | 89 | |
dc378d98 TO |
90 | /** |
91 | * @return array | |
92 | */ | |
93 | public static function getAvailableProfiles() { | |
94 | return array('' => ts('- none -')) + CRM_Core_BAO_UFGroup::getProfiles(array( | |
95 | 'Contact', | |
96 | 'Individual', | |
97 | 'Organization', | |
98 | 'Household', | |
99 | )); | |
100 | } | |
101 | ||
d434f797 TO |
102 | /** |
103 | * @return array | |
104 | */ | |
105 | public static function getContactReferenceOptions() { | |
106 | return array( | |
107 | ts('Contact Name') => 1, | |
108 | ) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', | |
109 | FALSE, FALSE, TRUE | |
110 | )); | |
111 | } | |
112 | ||
6a488035 | 113 | } |