Merge pull request #6446 from colemanw/CRM-13160
[civicrm-core.git] / CRM / Admin / Form / Setting / Search.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
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
e7112fa7 31 * @copyright CiviCRM LLC (c) 2004-2015
6a488035
TO
32 * $Id$
33 *
34 */
35
36/**
37 * This class generates form components for Search Parameters
38 *
39 */
40class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting {
41
42 protected $_settings = array(
43 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
56c2750b 44 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
6a488035
TO
45 );
46
47 /**
eceb18cc 48 * Build the form object.
6a488035 49 *
355ba699 50 * @return void
6a488035
TO
51 */
52 public function buildQuickForm() {
53 CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
54
55 $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
56 $this->addYesNo('includeEmailInName', ts('Include Email'));
57 $this->addYesNo('includeNickNameInName', ts('Include Nickname'));
58
59 $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
60 $this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
61
62 $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'),
63 array('size' => 3, 'maxlength' => 5)
64 );
65
66 $types = array('Contact', 'Individual', 'Organization', 'Household');
67 $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
68
69 $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'),
0f352c3a 70 array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge')
6a488035
TO
71 );
72
73 // Autocomplete for Contact Search (quick search etc.)
74 $options = array(
28a04ea9 75 ts('Contact Name') => 1,
76 ) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options',
6a488035
TO
77 FALSE, FALSE, TRUE
78 ));
79 $this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options,
80 NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;')
81 );
82 $element = $this->getElement('autocompleteContactSearch');
83 $element->_elements[0]->_flagFrozen = TRUE;
84
85 // Autocomplete for Contact Reference (custom fields)
86 $optionsCR = array(
28a04ea9 87 ts('Contact Name') => 1,
88 ) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options',
6a488035
TO
89 FALSE, FALSE, TRUE
90 ));
91 $this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR,
92 NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;')
93 );
94 $element = $this->getElement('autocompleteContactReference');
95 $element->_elements[0]->_flagFrozen = TRUE;
96
97 parent::buildQuickForm();
98 }
96025800 99
6a488035 100}