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
41 * Base Search / View form for *all* listing of multiple
44 class CRM_Contact_Form_Search
extends CRM_Core_Form_Search
{
47 * list of valid contexts
52 static $_validContext = NULL;
55 * List of values used when we want to display other objects
60 static $_modeValues = NULL;
67 protected $_contextMenu;
70 * The groupId retrieved from the GET vars
77 * The Group ID belonging to Add Member to group ID
78 * retrieved from the GET vars
85 * The saved search ID retrieved from the GET vars
97 public $_groupElement;
98 public $_groupIterator;
109 * The params used for search
116 * The return properties used for search
120 protected $_returnProperties;
123 * The sort by character
127 protected $_sortByCharacter;
130 * The profile group id used for display
134 protected $_ufGroupID;
137 * Csv - common search values
142 static $csv = array('contact_type', 'group', 'tag');
145 * @var string how to display the results. Should we display as
146 * contributons, members, cases etc
148 protected $_componentMode;
151 * @var string what operator should we use, AND or OR
153 protected $_operator;
155 protected $_modeValue;
158 * Name of the selector to use
160 static $_selectorName = 'CRM_Contact_Selector';
161 protected $_customSearchID = NULL;
162 protected $_customSearchClass = NULL;
164 protected $_openedPanes = array();
167 * Define the set of valid contexts that the search form operates on
170 * the valid context set and the titles
173 public static function &validContext() {
174 if (!(self
::$_validContext)) {
175 self
::$_validContext = array(
176 'smog' => 'Show members of group',
177 'amtg' => 'Add members to group',
178 'basic' => 'Basic Search',
179 'search' => 'Search',
180 'builder' => 'Search Builder',
181 'advanced' => 'Advanced Search',
182 'custom' => 'Custom Search',
185 return self
::$_validContext;
193 public static function isSearchContext($context) {
194 $searchContext = CRM_Utils_Array
::value($context, self
::validContext());
195 return $searchContext ?
TRUE : FALSE;
198 public static function setModeValues() {
199 if (!self
::$_modeValues) {
200 self
::$_modeValues = array(
202 'selectorName' => self
::$_selectorName,
203 'selectorLabel' => ts('Contacts'),
204 'taskFile' => 'CRM/Contact/Form/Search/ResultTasks.tpl',
205 'taskContext' => NULL,
206 'resultFile' => 'CRM/Contact/Form/Selector.tpl',
207 'resultContext' => NULL,
208 'taskClassName' => 'CRM_Contact_Task',
211 'selectorName' => 'CRM_Contribute_Selector_Search',
212 'selectorLabel' => ts('Contributions'),
213 'taskFile' => 'CRM/common/searchResultTasks.tpl',
214 'taskContext' => 'Contribution',
215 'resultFile' => 'CRM/Contribute/Form/Selector.tpl',
216 'resultContext' => 'Search',
217 'taskClassName' => 'CRM_Contribute_Task',
220 'selectorName' => 'CRM_Event_Selector_Search',
221 'selectorLabel' => ts('Event Participants'),
222 'taskFile' => 'CRM/common/searchResultTasks.tpl',
223 'taskContext' => NULL,
224 'resultFile' => 'CRM/Event/Form/Selector.tpl',
225 'resultContext' => 'Search',
226 'taskClassName' => 'CRM_Event_Task',
229 'selectorName' => 'CRM_Activity_Selector_Search',
230 'selectorLabel' => ts('Activities'),
231 'taskFile' => 'CRM/common/searchResultTasks.tpl',
232 'taskContext' => NULL,
233 'resultFile' => 'CRM/Activity/Form/Selector.tpl',
234 'resultContext' => 'Search',
235 'taskClassName' => 'CRM_Activity_Task',
238 'selectorName' => 'CRM_Member_Selector_Search',
239 'selectorLabel' => ts('Memberships'),
240 'taskFile' => "CRM/common/searchResultTasks.tpl",
241 'taskContext' => NULL,
242 'resultFile' => 'CRM/Member/Form/Selector.tpl',
243 'resultContext' => 'Search',
244 'taskClassName' => 'CRM_Member_Task',
247 'selectorName' => 'CRM_Case_Selector_Search',
248 'selectorLabel' => ts('Cases'),
249 'taskFile' => "CRM/common/searchResultTasks.tpl",
250 'taskContext' => NULL,
251 'resultFile' => 'CRM/Case/Form/Selector.tpl',
252 'resultContext' => 'Search',
253 'taskClassName' => 'CRM_Case_Task',
256 'selectorName' => self
::$_selectorName,
257 'selectorLabel' => ts('Related Contacts'),
258 'taskFile' => 'CRM/Contact/Form/Search/ResultTasks.tpl',
259 'taskContext' => NULL,
260 'resultFile' => 'CRM/Contact/Form/Selector.tpl',
261 'resultContext' => NULL,
262 'taskClassName' => 'CRM_Contact_Task',
265 'selectorName' => 'CRM_Mailing_Selector_Search',
266 'selectorLabel' => ts('Mailings'),
267 'taskFile' => "CRM/common/searchResultTasks.tpl",
268 'taskContext' => NULL,
269 'resultFile' => 'CRM/Mailing/Form/Selector.tpl',
270 'resultContext' => 'Search',
271 'taskClassName' => 'CRM_Mailing_Task',
282 public static function getModeValue($mode = 1) {
283 self
::setModeValues();
285 if (!array_key_exists($mode, self
::$_modeValues)) {
289 return self
::$_modeValues[$mode];
295 public static function getModeSelect() {
296 self
::setModeValues();
299 foreach (self
::$_modeValues as $id => & $value) {
300 $select[$id] = $value['selectorLabel'];
303 // unset contributions or participants if user does not have
304 // permission on them
305 if (!CRM_Core_Permission
::access('CiviContribute')) {
309 if (!CRM_Core_Permission
::access('CiviEvent')) {
313 if (!CRM_Core_Permission
::check('view all activities')) {
320 * Build the common elements between the search/advanced form
325 public function buildQuickForm() {
326 parent
::buildQuickForm();
327 CRM_Core_Resources
::singleton()
328 // jsTree is needed for tags popup
329 ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
330 ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
331 $permission = CRM_Core_Permission
::getPermission();
332 // some tasks.. what do we want to do with the selected contacts ?
334 if ($this->_componentMode
== 1 ||
$this->_componentMode
== 7) {
335 $tasks +
= CRM_Contact_Task
::permissionedTaskTitles($permission,
336 CRM_Utils_Array
::value('deleted_contacts', $this->_formValues
)
340 $className = $this->_modeValue
['taskClassName'];
341 $tasks +
= $className::permissionedTaskTitles($permission, FALSE);
344 if (isset($this->_ssID
)) {
345 if ($permission == CRM_Core_Permission
::EDIT
) {
346 $tasks = $tasks + CRM_Contact_Task
::optionalTaskTitle();
350 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID
, 'search_custom_id');
352 $savedSearchValues = array(
353 'id' => $this->_ssID
,
354 'name' => CRM_Contact_BAO_SavedSearch
::getName($this->_ssID
, 'title'),
355 'search_custom_id' => $search_custom_id,
357 $this->assign_by_ref('savedSearch', $savedSearchValues);
358 $this->assign('ssID', $this->_ssID
);
361 if ($this->_context
=== 'smog') {
362 // CRM-11788, we might want to do this for all of search where force=1
363 $formQFKey = CRM_Utils_Array
::value('qfKey', $this->_formValues
);
364 $getQFKey = CRM_Utils_Array
::value('qfKey', $_GET);
365 $postQFKey = CRM_Utils_Array
::value('qfKey', $_POST);
366 if ($formQFKey && empty($getQFKey) && empty($postQFKey)) {
367 $url = CRM_Utils_System
::makeURL('qfKey') . $formQFKey;
368 CRM_Utils_System
::redirect($url);
370 $permissionForGroup = FALSE;
372 if (!empty($this->_groupID
)) {
373 // check if user has permission to edit members of this group
374 $permission = CRM_Contact_BAO_Group
::checkPermission($this->_groupID
);
375 if ($permission && in_array(CRM_Core_Permission
::EDIT
, $permission)) {
376 $permissionForGroup = TRUE;
379 // check if _groupID exists, it might not if
380 // we are displaying a hidden group
381 if (!isset($this->_group
[$this->_groupID
])) {
382 $this->_group
[$this->_groupID
] =
383 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'title');
386 // set the group title
387 $groupValues = array('id' => $this->_groupID
, 'title' => $this->_group
[$this->_groupID
]);
388 $this->assign_by_ref('group', $groupValues);
390 // also set ssID if this is a saved search
391 $ssID = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'saved_search_id');
392 $this->assign('ssID', $ssID);
394 //get the saved search mapping id
396 $this->_ssID
= $ssID;
397 $ssMappingId = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $ssID, 'mapping_id');
398 $this->assign('ssMappingID', $ssMappingId);
401 // Set dynamic page title for 'Show Members of Group'
402 CRM_Utils_System
::setTitle(ts('Contacts in Group: %1', array(1 => $this->_group
[$this->_groupID
])));
405 $group_contact_status = array();
406 foreach (CRM_Core_SelectValues
::groupContactStatus() as $k => $v) {
408 $group_contact_status[] = $this->createElement('checkbox', $k, NULL, $v);
411 $this->addGroup($group_contact_status,
412 'group_contact_status', ts('Group Status')
415 $this->assign('permissionedForGroup', $permissionForGroup);
418 // add the go button for the action form, note it is of type 'next' rather than of type 'submit'
419 if ($this->_context
=== 'amtg') {
420 // check if _groupID exists, it might not if
421 // we are displaying a hidden group
422 if (!isset($this->_group
[$this->_amtgID
])) {
423 $this->assign('permissionedForGroup', FALSE);
424 $this->_group
[$this->_amtgID
] =
425 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_amtgID
, 'title');
428 // Set dynamic page title for 'Add Members Group'
429 CRM_Utils_System
::setTitle(ts('Add to Group: %1', array(1 => $this->_group
[$this->_amtgID
])));
430 // also set the group title and freeze the action task with Add Members to Group
431 $groupValues = array('id' => $this->_amtgID
, 'title' => $this->_group
[$this->_amtgID
]);
432 $this->assign_by_ref('group', $groupValues);
433 $this->add('submit', $this->_actionButtonName
, ts('Add Contacts to %1', array(1 => $this->_group
[$this->_amtgID
])),
435 'class' => 'crm-form-submit',
438 $this->add('hidden', 'task', CRM_Contact_Task
::GROUP_CONTACTS
);
439 $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked'));
440 $allRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all');
441 $this->assign('ts_sel_id', $selectedRowsRadio->_attributes
['id']);
442 $this->assign('ts_all_id', $allRowsRadio->_attributes
['id']);
445 $this->addTaskMenu($tasks);
448 $selectedContactIds = array();
449 $qfKeyParam = CRM_Utils_Array
::value('qfKey', $this->_formValues
);
450 // We use ajax to handle selections only if the search results component_mode is set to "contacts"
451 if ($qfKeyParam && ($this->get('component_mode') <= 1 ||
$this->get('component_mode') == 7)) {
452 $this->addClass('crm-ajax-selection-form');
453 $qfKeyParam = "civicrm search {$qfKeyParam}";
454 $selectedContactIdsArr = CRM_Core_BAO_PrevNextCache
::getSelection($qfKeyParam);
455 $selectedContactIds = array_keys($selectedContactIdsArr[$qfKeyParam]);
458 $this->assign_by_ref('selectedContactIds', $selectedContactIds);
460 $rows = $this->get('rows');
462 if (is_array($rows)) {
463 $this->addRowSelectors($rows);
469 * Processing needed for buildForm and later
473 public function preProcess() {
474 // set the various class variables
476 $this->_group
= CRM_Core_PseudoConstant
::group();
478 $this->_groupIterator
= CRM_Core_PseudoConstant
::groupIterator();
479 $this->_tag
= CRM_Core_BAO_Tag
::getTags();
480 $this->_done
= FALSE;
483 * we allow the controller to set force/reset externally, useful when we are being
484 * driven by the wizard framework
487 $this->_reset
= CRM_Utils_Request
::retrieve('reset', 'Boolean',
488 CRM_Core_DAO
::$_nullObject
491 $this->_force
= CRM_Utils_Request
::retrieve('force', 'Boolean', CRM_Core_DAO
::$_nullObject);
492 $this->_groupID
= CRM_Utils_Request
::retrieve('gid', 'Positive', $this);
493 $this->_amtgID
= CRM_Utils_Request
::retrieve('amtgID', 'Positive', $this);
494 $this->_ssID
= CRM_Utils_Request
::retrieve('ssID', 'Positive', $this);
495 $this->_sortByCharacter
= CRM_Utils_Request
::retrieve('sortByCharacter', 'String', $this);
496 $this->_ufGroupID
= CRM_Utils_Request
::retrieve('id', 'Positive', $this);
497 $this->_componentMode
= CRM_Utils_Request
::retrieve('component_mode', 'Positive', $this, FALSE, 1, $_REQUEST);
498 $this->_operator
= CRM_Utils_Request
::retrieve('operator', 'String', $this, FALSE, 1, $_REQUEST, 'AND');
501 * set the button names
503 $this->_searchButtonName
= $this->getButtonName('refresh');
504 $this->_actionButtonName
= $this->getButtonName('next', 'action');
506 $this->assign('actionButtonName', $this->_actionButtonName
);
508 // reset from session, CRM-3526
509 $session = CRM_Core_Session
::singleton();
510 if ($this->_force
&& $session->get('selectedSearchContactIds')) {
511 $session->resetScope('selectedSearchContactIds');
514 // if we dont get this from the url, use default if one exsts
515 $config = CRM_Core_Config
::singleton();
516 if ($this->_ufGroupID
== NULL &&
517 $config->defaultSearchProfileID
!= NULL
519 $this->_ufGroupID
= $config->defaultSearchProfileID
;
522 // assign context to drive the template display, make sure context is valid
523 $this->_context
= CRM_Utils_Request
::retrieve('context', 'String', $this, FALSE, 'search');
524 if (!CRM_Utils_Array
::value($this->_context
, self
::validContext())) {
525 $this->_context
= 'search';
527 $this->set('context', $this->_context
);
528 $this->assign('context', $this->_context
);
530 $this->_modeValue
= self
::getModeValue($this->_componentMode
);
531 $this->assign($this->_modeValue
);
533 $this->set('selectorName', self
::$_selectorName);
535 // get user submitted values
536 // get it from controller only if form has been submitted, else preProcess has set this
537 // $this->controller->isModal( ) returns TRUE if page is
538 // valid, i.e all the validations are TRUE
540 if (!empty($_POST) && !$this->controller
->isModal()) {
541 $this->_formValues
= $this->controller
->exportValues($this->_name
);
543 $this->normalizeFormValues();
544 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
545 $this->_returnProperties
= &$this->returnProperties();
547 // also get the uf group id directly from the post value
548 $this->_ufGroupID
= CRM_Utils_Array
::value('uf_group_id', $_POST, $this->_ufGroupID
);
549 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
550 $this->set('id', $this->_ufGroupID
);
552 // also get the object mode directly from the post value
553 $this->_componentMode
= CRM_Utils_Array
::value('component_mode', $_POST, $this->_componentMode
);
555 // also get the operator from the post value if set
556 $this->_operator
= CRM_Utils_Array
::value('operator', $_POST, $this->_operator
);
557 $this->_formValues
['operator'] = $this->_operator
;
558 $this->set('operator', $this->_operator
);
561 $this->_formValues
= $this->get('formValues');
562 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
563 $this->_returnProperties
= &$this->returnProperties();
564 if (!empty($this->_ufGroupID
)) {
565 $this->set('id', $this->_ufGroupID
);
569 if (empty($this->_formValues
)) {
570 //check if group is a smart group (fix for CRM-1255)
571 if ($this->_groupID
) {
572 if ($ssId = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'saved_search_id')) {
573 $this->_ssID
= $ssId;
578 if (isset($this->_ssID
) && $this->_context
!= 'smog') {
579 // we only retrieve the saved search values if out current values are null
580 $this->_formValues
= CRM_Contact_BAO_SavedSearch
::getFormValues($this->_ssID
);
583 if (CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID
, 'mapping_id')) {
584 $this->_params
= CRM_Contact_BAO_SavedSearch
::getSearchParams($this->_ssID
);
587 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
589 $this->_returnProperties
= &$this->returnProperties();
592 if (isset($this->_ufGroupID
)) {
593 // also set the uf group id if not already present
594 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
596 if (isset($this->_componentMode
)) {
597 $this->_formValues
['component_mode'] = $this->_componentMode
;
599 if (isset($this->_operator
)) {
600 $this->_formValues
['operator'] = $this->_operator
;
603 // FIXME: we should generalise in a way that components could inject url-filters
604 // just like they build their own form elements
607 'mailing_delivery_status',
608 'mailing_open_status',
609 'mailing_click_status',
610 'mailing_reply_status',
613 'mailing_unsubscribe',
616 ) as $mailingFilter) {
618 if ($mailingFilter == 'mailing_id' &&
619 $filterVal = CRM_Utils_Request
::retrieve('mailing_id', 'Positive', $this)
621 $this->_formValues
[$mailingFilter] = array($filterVal);
623 elseif ($filterVal = CRM_Utils_Request
::retrieve($mailingFilter, $type, $this)) {
624 $this->_formValues
[$mailingFilter] = $filterVal;
627 $this->_openedPanes
['Mailings'] = 1;
628 $this->_formValues
['hidden_CiviMail'] = 1;
634 CRM_Utils_Array
::value('uf_group_id', $this->_formValues
)
636 $operator = CRM_Utils_Array
::value('operator', $this->_formValues
, 'AND');
637 $this->set('queryOperator', $operator);
638 if ($operator == 'OR') {
639 $this->assign('operator', ts('OR'));
642 $this->assign('operator', ts('AND'));
645 // show the context menu only when we’re not searching for deleted contacts; CRM-5673
646 if (empty($this->_formValues
['deleted_contacts'])) {
647 $menuItems = CRM_Contact_BAO_Contact
::contextMenu();
648 $primaryActions = CRM_Utils_Array
::value('primaryActions', $menuItems, array());
649 $this->_contextMenu
= CRM_Utils_Array
::value('moreActions', $menuItems, array());
650 $this->assign('contextMenu', $primaryActions +
$this->_contextMenu
);
653 if (!isset($this->_componentMode
)) {
654 $this->_componentMode
= CRM_Contact_BAO_Query
::MODE_CONTACTS
;
656 $modeValues = self
::getModeValue($this->_componentMode
);
658 self
::$_selectorName = $this->_modeValue
['selectorName'];
661 if (strpos(self
::$_selectorName, 'CRM_Contact_Selector') !== FALSE) {
662 $selector = new self
::$_selectorName(
663 $this->_customSearchClass
,
666 $this->_returnProperties
,
675 $selector = new self
::$_selectorName(
683 $selector->setKey($this->controller
->_key
);
685 $controller = new CRM_Contact_Selector_Controller($selector,
686 $this->get(CRM_Utils_Pager
::PAGE_ID
),
687 $this->get(CRM_Utils_Sort
::SORT_ID
),
688 CRM_Core_Action
::VIEW
,
690 CRM_Core_Selector_Controller
::TRANSFER
692 $controller->setEmbedded(TRUE);
693 $controller->setDynamicAction($setDynamic);
697 $this->postProcess();
700 * Note that we repeat this, since the search creates and stores
701 * values that potentially change the controller behavior. i.e. things
702 * like totalCount etc
705 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
706 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
707 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
710 $controller = new CRM_Contact_Selector_Controller($selector,
711 $this->get(CRM_Utils_Pager
::PAGE_ID
),
713 CRM_Core_Action
::VIEW
, $this, CRM_Core_Selector_Controller
::TRANSFER
715 $controller->setEmbedded(TRUE);
716 $controller->setDynamicAction($setDynamic);
719 $controller->moveFromSessionToTemplate();
725 public function &getFormValues() {
726 return $this->_formValues
;
730 * Common post processing
734 public function postProcess() {
736 * sometime we do a postProcess early on, so we dont need to repeat it
737 * this will most likely introduce some more bugs :(
745 //for prev/next pagination
746 $crmPID = CRM_Utils_Request
::retrieve('crmPID', 'Integer', CRM_Core_DAO
::$_nullObject);
748 if (array_key_exists($this->_searchButtonName
, $_POST) ||
749 ($this->_force
&& !$crmPID)
751 //reset the cache table for new search
752 $cacheKey = "civicrm search {$this->controller->_key}";
753 CRM_Core_BAO_PrevNextCache
::deleteItem(NULL, $cacheKey);
756 //get the button name
757 $buttonName = $this->controller
->getButtonName();
759 if (isset($this->_ufGroupID
) && empty($this->_formValues
['uf_group_id'])) {
760 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
763 if (isset($this->_componentMode
) && empty($this->_formValues
['component_mode'])) {
764 $this->_formValues
['component_mode'] = $this->_componentMode
;
767 if (isset($this->_operator
) && empty($this->_formValues
['operator'])) {
768 $this->_formValues
['operator'] = $this->_operator
;
771 if (empty($this->_formValues
['qfKey'])) {
772 $this->_formValues
['qfKey'] = $this->controller
->_key
;
775 if (!CRM_Core_Permission
::check('access deleted contacts')) {
776 unset($this->_formValues
['deleted_contacts']);
779 $this->set('type', $this->_action
);
780 $this->set('formValues', $this->_formValues
);
781 $this->set('queryParams', $this->_params
);
782 $this->set('returnProperties', $this->_returnProperties
);
784 if ($buttonName == $this->_actionButtonName
) {
785 // check actionName and if next, then do not repeat a search, since we are going to the next page
786 // hack, make sure we reset the task values
787 $stateMachine = $this->controller
->getStateMachine();
788 $formName = $stateMachine->getTaskFormName();
789 $this->controller
->resetPage($formName);
793 $output = CRM_Core_Selector_Controller
::SESSION
;
795 // create the selector, controller and run - store results in session
796 $searchChildGroups = TRUE;
797 if ($this->get('isAdvanced')) {
798 $searchChildGroups = FALSE;
803 if (strpos(self
::$_selectorName, 'CRM_Contact_Selector') !== FALSE) {
804 $selector = new self
::$_selectorName (
805 $this->_customSearchClass
,
808 $this->_returnProperties
,
818 $selector = new self
::$_selectorName(
829 $selector->setKey($this->controller
->_key
);
831 // added the sorting character to the form array
832 $config = CRM_Core_Config
::singleton();
833 // do this only for contact search
834 if ($setDynamic && $config->includeAlphabeticalPager
) {
835 // Don't recompute if we are just paging/sorting
836 if ($this->_reset ||
(empty($_GET['crmPID']) && empty($_GET['crmSID']) && !$this->_sortByCharacter
)) {
837 $aToZBar = CRM_Utils_PagerAToZ
::getAToZBar($selector, $this->_sortByCharacter
);
838 $this->set('AToZBar', $aToZBar);
843 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
844 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
845 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
848 $controller = new CRM_Contact_Selector_Controller($selector,
849 $this->get(CRM_Utils_Pager
::PAGE_ID
),
851 CRM_Core_Action
::VIEW
,
855 $controller->setEmbedded(TRUE);
856 $controller->setDynamicAction($setDynamic);
864 public function &returnProperties() {
865 return CRM_Core_DAO
::$_nullObject;
869 * Return a descriptive name for the page, used in wizard header
873 public function getTitle() {