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 class CRM_Group_Form_Search
extends CRM_Core_Form
{
21 public function preProcess() {
24 CRM_Core_Resources
::singleton()->addPermissions('edit groups');
30 public function setDefaultValues() {
32 $defaults['group_status[1]'] = 1;
36 public function buildQuickForm() {
37 $this->add('text', 'title', ts('Find'),
38 CRM_Core_DAO
::getAttribute('CRM_Contact_DAO_Group', 'title')
41 $this->add('text', 'created_by', ts('Created By'),
42 CRM_Core_DAO
::getAttribute('CRM_Contact_DAO_Group', 'title')
45 $groupTypes = CRM_Core_OptionGroup
::values('group_type', TRUE);
46 $config = CRM_Core_Config
::singleton();
47 if ($config->userFramework
== 'Joomla') {
48 unset($groupTypes['Access Control']);
51 $this->addCheckBox('group_type_search',
54 NULL, NULL, NULL, NULL, ' '
57 $this->add('select', 'visibility', ts('Visibility'),
58 ['' => ts('- any visibility -')] + CRM_Core_SelectValues
::ufVisibility(TRUE)
61 $groupStatuses = [ts('Enabled') => 1, ts('Disabled') => 2];
62 $this->addCheckBox('group_status',
65 NULL, NULL, NULL, NULL, ' '
68 $componentModes = CRM_Contact_Form_Search
::getModeSelect();
69 if (count($componentModes) > 1) {
72 ts('View Results As'),
75 ['class' => 'crm-select2']
82 'name' => ts('Search'),
87 parent
::buildQuickForm();
88 $this->assign('suppressForm', TRUE);
91 public function postProcess() {
92 $params = $this->controller
->exportValues($this->_name
);
93 $parent = $this->controller
->getParent();
94 if (!empty($params)) {
95 $fields = ['title', 'created_by', 'group_type', 'visibility', 'active_status', 'inactive_status', 'component_mode'];
96 foreach ($fields as $field) {
97 if (isset($params[$field]) &&
98 !CRM_Utils_System
::isNull($params[$field])
100 $parent->set($field, $params[$field]);
103 $parent->set($field, NULL);