3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
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;
68 protected $_contextMenu;
71 * the groupId retrieved from the GET vars
79 * the Group ID belonging to Add Member to group ID
80 * retrieved from the GET vars
88 * the saved search ID retrieved from the GET vars
102 public $_groupElement;
103 public $_groupIterator;
115 * The params used for search
123 * The return properties used for search
128 protected $_returnProperties;
131 * The sort by character
136 protected $_sortByCharacter;
139 * The profile group id used for display
144 protected $_ufGroupID;
147 * csv - common search values
154 static $csv = array('contact_type', 'group', 'tag');
157 * @var string how to display the results. Should we display as
158 * contributons, members, cases etc
160 protected $_componentMode;
163 * @var string what operator should we use, AND or OR
165 protected $_operator;
167 protected $_modeValue;
170 * name of the selector to use
172 static $_selectorName = 'CRM_Contact_Selector';
173 protected $_customSearchID = NULL;
174 protected $_customSearchClass = NULL;
176 protected $_openedPanes = array();
179 * define the set of valid contexts that the search form operates on
181 * @return array the valid context set and the titles
185 static function &validContext() {
186 if (!(self
::$_validContext)) {
187 self
::$_validContext = array(
188 'smog' => 'Show members of group',
189 'amtg' => 'Add members to group',
190 'basic' => 'Basic Search',
191 'search' => 'Search',
192 'builder' => 'Search Builder',
193 'advanced' => 'Advanced Search',
194 'custom' => 'Custom Search',
197 return self
::$_validContext;
205 static function isSearchContext($context) {
206 $searchContext = CRM_Utils_Array
::value($context, self
::validContext());
207 return $searchContext ?
TRUE : FALSE;
210 static function setModeValues() {
211 if (!self
::$_modeValues) {
212 self
::$_modeValues = array(
214 'selectorName' => self
::$_selectorName,
215 'selectorLabel' => ts('Contacts'),
216 'taskFile' => 'CRM/Contact/Form/Search/ResultTasks.tpl',
217 'taskContext' => NULL,
218 'resultFile' => 'CRM/Contact/Form/Selector.tpl',
219 'resultContext' => NULL,
220 'taskClassName' => 'CRM_Contact_Task',
223 'selectorName' => 'CRM_Contribute_Selector_Search',
224 'selectorLabel' => ts('Contributions'),
225 'taskFile' => 'CRM/common/searchResultTasks.tpl',
226 'taskContext' => 'Contribution',
227 'resultFile' => 'CRM/Contribute/Form/Selector.tpl',
228 'resultContext' => 'Search',
229 'taskClassName' => 'CRM_Contribute_Task',
232 'selectorName' => 'CRM_Event_Selector_Search',
233 'selectorLabel' => ts('Event Participants'),
234 'taskFile' => 'CRM/common/searchResultTasks.tpl',
235 'taskContext' => NULL,
236 'resultFile' => 'CRM/Event/Form/Selector.tpl',
237 'resultContext' => 'Search',
238 'taskClassName' => 'CRM_Event_Task',
241 'selectorName' => 'CRM_Activity_Selector_Search',
242 'selectorLabel' => ts('Activities'),
243 'taskFile' => 'CRM/common/searchResultTasks.tpl',
244 'taskContext' => NULL,
245 'resultFile' => 'CRM/Activity/Form/Selector.tpl',
246 'resultContext' => 'Search',
247 'taskClassName' => 'CRM_Activity_Task',
250 'selectorName' => 'CRM_Member_Selector_Search',
251 'selectorLabel' => ts('Memberships'),
252 'taskFile' => "CRM/common/searchResultTasks.tpl",
253 'taskContext' => NULL,
254 'resultFile' => 'CRM/Member/Form/Selector.tpl',
255 'resultContext' => 'Search',
256 'taskClassName' => 'CRM_Member_Task',
259 'selectorName' => 'CRM_Case_Selector_Search',
260 'selectorLabel' => ts('Cases'),
261 'taskFile' => "CRM/common/searchResultTasks.tpl",
262 'taskContext' => NULL,
263 'resultFile' => 'CRM/Case/Form/Selector.tpl',
264 'resultContext' => 'Search',
265 'taskClassName' => 'CRM_Case_Task',
268 'selectorName' => self
::$_selectorName,
269 'selectorLabel' => ts('Related Contacts'),
270 'taskFile' => 'CRM/Contact/Form/Search/ResultTasks.tpl',
271 'taskContext' => NULL,
272 'resultFile' => 'CRM/Contact/Form/Selector.tpl',
273 'resultContext' => NULL,
274 'taskClassName' => 'CRM_Contact_Task',
277 'selectorName' => 'CRM_Mailing_Selector_Search',
278 'selectorLabel' => ts('Mailings'),
279 'taskFile' => "CRM/common/searchResultTasks.tpl",
280 'taskContext' => NULL,
281 'resultFile' => 'CRM/Mailing/Form/Selector.tpl',
282 'resultContext' => 'Search',
283 'taskClassName' => 'CRM_Mailing_Task',
294 static function getModeValue($mode = 1) {
295 self
::setModeValues();
297 if (!array_key_exists($mode, self
::$_modeValues)) {
301 return self
::$_modeValues[$mode];
307 static function getModeSelect() {
308 self
::setModeValues();
311 foreach (self
::$_modeValues as $id => & $value) {
312 $select[$id] = $value['selectorLabel'];
315 // unset contributions or participants if user does not have
316 // permission on them
317 if (!CRM_Core_Permission
::access('CiviContribute')) {
321 if (!CRM_Core_Permission
::access('CiviEvent')) {
325 if (!CRM_Core_Permission
::check('view all activities')) {
332 * Build the common elements between the search/advanced form
338 function buildQuickForm() {
339 parent
::buildQuickForm();
340 $this->setAttribute('class', 'crm-search-form crm-ajax-selection-form');
341 CRM_Core_Resources
::singleton()
342 // jsTree is needed for tags popup
343 ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
344 ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
345 $permission = CRM_Core_Permission
::getPermission();
346 // some tasks.. what do we want to do with the selected contacts ?
348 if ($this->_componentMode
== 1 ||
$this->_componentMode
== 7) {
349 $tasks +
= CRM_Contact_Task
::permissionedTaskTitles($permission,
350 CRM_Utils_Array
::value('deleted_contacts', $this->_formValues
)
354 $className = $this->_modeValue
['taskClassName'];
355 $tasks +
= $className::permissionedTaskTitles($permission, false);
358 if (isset($this->_ssID
)) {
359 if ($permission == CRM_Core_Permission
::EDIT
) {
360 $tasks = $tasks + CRM_Contact_Task
::optionalTaskTitle();
364 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID
, 'search_custom_id');
366 $savedSearchValues = array(
367 'id' => $this->_ssID
,
368 'name' => CRM_Contact_BAO_SavedSearch
::getName($this->_ssID
, 'title'),
369 'search_custom_id' => $search_custom_id,
371 $this->assign_by_ref('savedSearch', $savedSearchValues);
372 $this->assign('ssID', $this->_ssID
);
375 if ($this->_context
=== 'smog') {
376 // CRM-11788, we might want to do this for all of search where force=1
377 $formQFKey = CRM_Utils_Array
::value('qfKey', $this->_formValues
);
378 $getQFKey = CRM_Utils_Array
::value('qfKey', $_GET);
379 $postQFKey = CRM_Utils_Array
::value('qfKey', $_POST);
380 if ($formQFKey && empty($getQFKey) && empty($postQFKey)) {
381 $url = CRM_Utils_System
::makeURL('qfKey') . $formQFKey;
382 CRM_Utils_System
::redirect($url);
384 $permissionForGroup = FALSE;
386 if (!empty($this->_groupID
)) {
387 // check if user has permission to edit members of this group
388 $permission = CRM_Contact_BAO_Group
::checkPermission($this->_groupID
);
389 if ($permission && in_array(CRM_Core_Permission
::EDIT
, $permission)) {
390 $permissionForGroup = TRUE;
393 // check if _groupID exists, it might not if
394 // we are displaying a hidden group
395 if (!isset($this->_group
[$this->_groupID
])) {
396 $this->_group
[$this->_groupID
] =
397 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'title');
400 // set the group title
401 $groupValues = array('id' => $this->_groupID
, 'title' => $this->_group
[$this->_groupID
]);
402 $this->assign_by_ref('group', $groupValues);
404 // also set ssID if this is a saved search
405 $ssID = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'saved_search_id');
406 $this->assign('ssID', $ssID);
408 //get the saved search mapping id
410 $this->_ssID
= $ssID;
411 $ssMappingId = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $ssID, 'mapping_id');
412 $this->assign('ssMappingID', $ssMappingId);
415 // Set dynamic page title for 'Show Members of Group'
416 CRM_Utils_System
::setTitle(ts('Contacts in Group: %1', array(1 => $this->_group
[$this->_groupID
])));
419 $group_contact_status = array();
420 foreach (CRM_Core_SelectValues
::groupContactStatus() as $k => $v) {
422 $group_contact_status[] = $this->createElement('checkbox', $k, NULL, $v);
425 $this->addGroup($group_contact_status,
426 'group_contact_status', ts('Group Status')
429 $this->assign('permissionedForGroup', $permissionForGroup);
432 // add the go button for the action form, note it is of type 'next' rather than of type 'submit'
433 if ($this->_context
=== 'amtg') {
434 // check if _groupID exists, it might not if
435 // we are displaying a hidden group
436 if (!isset($this->_group
[$this->_amtgID
])) {
437 $this->assign('permissionedForGroup', FALSE);
438 $this->_group
[$this->_amtgID
] =
439 CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_amtgID
, 'title');
442 // Set dynamic page title for 'Add Members Group'
443 CRM_Utils_System
::setTitle(ts('Add to Group: %1', array(1 => $this->_group
[$this->_amtgID
])));
444 // also set the group title and freeze the action task with Add Members to Group
445 $groupValues = array('id' => $this->_amtgID
, 'title' => $this->_group
[$this->_amtgID
]);
446 $this->assign_by_ref('group', $groupValues);
447 $this->add('submit', $this->_actionButtonName
, ts('Add Contacts to %1', array(1 => $this->_group
[$this->_amtgID
])),
449 'class' => 'form-submit',
452 $this->add('hidden', 'task', CRM_Contact_Task
::GROUP_CONTACTS
);
455 $this->addTaskMenu($tasks);
458 if ($qfKeyParam = CRM_Utils_Array
::value('qfKey', $this->_formValues
)) {
459 $qfKeyParam = "civicrm search {$qfKeyParam}";
460 $selectedContactIdsArr = CRM_Core_BAO_PrevNextCache
::getSelection($qfKeyParam);
461 $selectedContactIds = array_keys($selectedContactIdsArr[$qfKeyParam]);
464 $this->assign_by_ref('selectedContactIds', $selectedContactIds);
466 $rows = $this->get('rows');
468 if (is_array($rows)) {
469 $this->addRowSelectors($rows);
475 * processing needed for buildForm and later
480 function preProcess() {
481 // set the various class variables
483 $this->_group
= CRM_Core_PseudoConstant
::group();
485 $this->_groupIterator
= CRM_Core_PseudoConstant
::groupIterator();
486 $this->_tag
= CRM_Core_BAO_Tag
::getTags();
487 $this->_done
= FALSE;
490 * we allow the controller to set force/reset externally, useful when we are being
491 * driven by the wizard framework
494 $this->_reset
= CRM_Utils_Request
::retrieve('reset', 'Boolean',
495 CRM_Core_DAO
::$_nullObject
498 $this->_force
= CRM_Utils_Request
::retrieve('force', 'Boolean', CRM_Core_DAO
::$_nullObject);
499 $this->_groupID
= CRM_Utils_Request
::retrieve('gid', 'Positive', $this);
500 $this->_amtgID
= CRM_Utils_Request
::retrieve('amtgID', 'Positive', $this);
501 $this->_ssID
= CRM_Utils_Request
::retrieve('ssID', 'Positive', $this);
502 $this->_sortByCharacter
= CRM_Utils_Request
::retrieve('sortByCharacter', 'String', $this);
503 $this->_ufGroupID
= CRM_Utils_Request
::retrieve('id', 'Positive', $this);
504 $this->_componentMode
= CRM_Utils_Request
::retrieve('component_mode', 'Positive', $this, FALSE, 1, $_REQUEST);
505 $this->_operator
= CRM_Utils_Request
::retrieve('operator', 'String', $this, FALSE, 1, $_REQUEST, 'AND');
508 * set the button names
510 $this->_searchButtonName
= $this->getButtonName('refresh');
511 $this->_actionButtonName
= $this->getButtonName('next', 'action');
513 $this->assign('actionButtonName', $this->_actionButtonName
);
515 // reset from session, CRM-3526
516 $session = CRM_Core_Session
::singleton();
517 if ($this->_force
&& $session->get('selectedSearchContactIds')) {
518 $session->resetScope('selectedSearchContactIds');
521 // if we dont get this from the url, use default if one exsts
522 $config = CRM_Core_Config
::singleton();
523 if ($this->_ufGroupID
== NULL &&
524 $config->defaultSearchProfileID
!= NULL
526 $this->_ufGroupID
= $config->defaultSearchProfileID
;
529 // assign context to drive the template display, make sure context is valid
530 $this->_context
= CRM_Utils_Request
::retrieve('context', 'String', $this, FALSE, 'search');
531 if (!CRM_Utils_Array
::value($this->_context
, self
::validContext())) {
532 $this->_context
= 'search';
534 $this->set('context', $this->_context
);
535 $this->assign('context', $this->_context
);
537 $this->_modeValue
= self
::getModeValue($this->_componentMode
);
538 $this->assign($this->_modeValue
);
540 $this->set('selectorName', self
::$_selectorName);
542 // get user submitted values
543 // get it from controller only if form has been submitted, else preProcess has set this
544 // $this->controller->isModal( ) returns true if page is
545 // valid, i.e all the validations are true
547 if (!empty($_POST) && !$this->controller
->isModal()) {
548 $this->_formValues
= $this->controller
->exportValues($this->_name
);
550 $this->normalizeFormValues();
551 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
552 $this->_returnProperties
= &$this->returnProperties();
554 // also get the uf group id directly from the post value
555 $this->_ufGroupID
= CRM_Utils_Array
::value('uf_group_id', $_POST, $this->_ufGroupID
);
556 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
557 $this->set('id', $this->_ufGroupID
);
559 // also get the object mode directly from the post value
560 $this->_componentMode
= CRM_Utils_Array
::value('component_mode', $_POST, $this->_componentMode
);
562 // also get the operator from the post value if set
563 $this->_operator
= CRM_Utils_Array
::value('operator', $_POST, $this->_operator
);
564 $this->_formValues
['operator'] = $this->_operator
;
565 $this->set('operator', $this->_operator
);
568 $this->_formValues
= $this->get('formValues');
569 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
570 $this->_returnProperties
= &$this->returnProperties();
571 if (!empty($this->_ufGroupID
)) {
572 $this->set('id', $this->_ufGroupID
);
576 if (empty($this->_formValues
)) {
577 //check if group is a smart group (fix for CRM-1255)
578 if ($this->_groupID
) {
579 if ($ssId = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID
, 'saved_search_id')) {
580 $this->_ssID
= $ssId;
585 if (isset($this->_ssID
) && $this->_context
!= 'smog') {
586 // we only retrieve the saved search values if out current values are null
587 $this->_formValues
= CRM_Contact_BAO_SavedSearch
::getFormValues($this->_ssID
);
590 if (CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID
, 'mapping_id')) {
591 $this->_params
= CRM_Contact_BAO_SavedSearch
::getSearchParams($this->_ssID
);
594 $this->_params
= CRM_Contact_BAO_Query
::convertFormValues($this->_formValues
);
596 $this->_returnProperties
= &$this->returnProperties();
599 if (isset($this->_ufGroupID
)) {
600 // also set the uf group id if not already present
601 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
603 if (isset($this->_componentMode
)) {
604 $this->_formValues
['component_mode'] = $this->_componentMode
;
606 if (isset($this->_operator
)) {
607 $this->_formValues
['operator'] = $this->_operator
;
610 // FIXME: we should generalise in a way that components could inject url-filters
611 // just like they build their own form elements
613 'mailing_id', 'mailing_delivery_status', 'mailing_open_status',
614 'mailing_click_status', 'mailing_reply_status', 'mailing_optout',
615 'mailing_forward', 'mailing_unsubscribe', 'mailing_date_low',
617 ) as $mailingFilter) {
619 if ($mailingFilter == 'mailing_id' &&
620 $filterVal = CRM_Utils_Request
::retrieve('mailing_id', 'Positive', $this)
622 $this->_formValues
[$mailingFilter] = array($filterVal);
624 elseif ($filterVal = CRM_Utils_Request
::retrieve($mailingFilter, $type, $this)) {
625 $this->_formValues
[$mailingFilter] = $filterVal;
628 $this->_openedPanes
['Mailings'] = 1;
629 $this->_formValues
['hidden_CiviMail'] = 1;
635 CRM_Utils_Array
::value('uf_group_id', $this->_formValues
)
637 $operator = CRM_Utils_Array
::value('operator', $this->_formValues
, 'AND');
638 $this->set('queryOperator', $operator);
639 if ($operator == 'OR') {
640 $this->assign('operator', ts('OR'));
643 $this->assign('operator', ts('AND'));
646 // show the context menu only when we’re not searching for deleted contacts; CRM-5673
647 if (empty($this->_formValues
['deleted_contacts'])) {
648 $menuItems = CRM_Contact_BAO_Contact
::contextMenu();
649 $primaryActions = CRM_Utils_Array
::value('primaryActions', $menuItems, array());
650 $this->_contextMenu
= CRM_Utils_Array
::value('moreActions', $menuItems, array());
651 $this->assign('contextMenu', $primaryActions +
$this->_contextMenu
);
654 if (!isset($this->_componentMode
)) {
655 $this->_componentMode
= CRM_Contact_BAO_Query
::MODE_CONTACTS
;
657 $modeValues = self
::getModeValue($this->_componentMode
);
659 self
::$_selectorName = $this->_modeValue
['selectorName'];
662 if (strpos(self
::$_selectorName, 'CRM_Contact_Selector') !== FALSE) {
663 $selector = new self
::$_selectorName(
664 $this->_customSearchClass
,
667 $this->_returnProperties
,
676 $selector = new self
::$_selectorName(
684 $selector->setKey($this->controller
->_key
);
686 $controller = new CRM_Contact_Selector_Controller($selector,
687 $this->get(CRM_Utils_Pager
::PAGE_ID
),
688 $this->get(CRM_Utils_Sort
::SORT_ID
),
689 CRM_Core_Action
::VIEW
,
691 CRM_Core_Selector_Controller
::TRANSFER
693 $controller->setEmbedded(TRUE);
694 $controller->setDynamicAction($setDynamic);
698 $this->postProcess();
701 * Note that we repeat this, since the search creates and stores
702 * values that potentially change the controller behavior. i.e. things
703 * like totalCount etc
706 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
707 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
708 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
711 $controller = new CRM_Contact_Selector_Controller($selector,
712 $this->get(CRM_Utils_Pager
::PAGE_ID
),
714 CRM_Core_Action
::VIEW
, $this, CRM_Core_Selector_Controller
::TRANSFER
716 $controller->setEmbedded(TRUE);
717 $controller->setDynamicAction($setDynamic);
720 $controller->moveFromSessionToTemplate();
726 function &getFormValues() {
727 return $this->_formValues
;
731 * Common post processing
736 function postProcess() {
738 * sometime we do a postProcess early on, so we dont need to repeat it
739 * this will most likely introduce some more bugs :(
747 //for prev/next pagination
748 $crmPID = CRM_Utils_Request
::retrieve('crmPID', 'Integer', CRM_Core_DAO
::$_nullObject);
750 if (array_key_exists($this->_searchButtonName
, $_POST) ||
751 ($this->_force
&& !$crmPID)) {
752 //reset the cache table for new search
753 $cacheKey = "civicrm search {$this->controller->_key}";
754 CRM_Core_BAO_PrevNextCache
::deleteItem(NULL, $cacheKey);
757 //get the button name
758 $buttonName = $this->controller
->getButtonName();
760 if (isset($this->_ufGroupID
) && empty($this->_formValues
['uf_group_id'])) {
761 $this->_formValues
['uf_group_id'] = $this->_ufGroupID
;
764 if (isset($this->_componentMode
) && empty($this->_formValues
['component_mode'])) {
765 $this->_formValues
['component_mode'] = $this->_componentMode
;
768 if (isset($this->_operator
) && empty($this->_formValues
['operator'])) {
769 $this->_formValues
['operator'] = $this->_operator
;
772 if (empty($this->_formValues
['qfKey'])) {
773 $this->_formValues
['qfKey'] = $this->controller
->_key
;
776 if (!CRM_Core_Permission
::check('access deleted contacts')) {
777 unset($this->_formValues
['deleted_contacts']);
780 $this->set('type', $this->_action
);
781 $this->set('formValues', $this->_formValues
);
782 $this->set('queryParams', $this->_params
);
783 $this->set('returnProperties', $this->_returnProperties
);
785 if ($buttonName == $this->_actionButtonName
) {
786 // check actionName and if next, then do not repeat a search, since we are going to the next page
787 // hack, make sure we reset the task values
788 $stateMachine = $this->controller
->getStateMachine();
789 $formName = $stateMachine->getTaskFormName();
790 $this->controller
->resetPage($formName);
794 $output = CRM_Core_Selector_Controller
::SESSION
;
796 // create the selector, controller and run - store results in session
797 $searchChildGroups = TRUE;
798 if ($this->get('isAdvanced')) {
799 $searchChildGroups = FALSE;
804 if (strpos(self
::$_selectorName, 'CRM_Contact_Selector') !== FALSE) {
805 $selector = new self
::$_selectorName (
806 $this->_customSearchClass
,
809 $this->_returnProperties
,
819 $selector = new self
::$_selectorName (
830 $selector->setKey($this->controller
->_key
);
832 // added the sorting character to the form array
833 $config = CRM_Core_Config
::singleton();
834 // do this only for contact search
835 if ($setDynamic && $config->includeAlphabeticalPager
) {
836 // Don't recompute if we are just paging/sorting
837 if ($this->_reset ||
(empty($_GET['crmPID']) && empty($_GET['crmSID']) && !$this->_sortByCharacter
)) {
838 $aToZBar = CRM_Utils_PagerAToZ
::getAToZBar($selector, $this->_sortByCharacter
);
839 $this->set('AToZBar', $aToZBar);
844 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
845 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
846 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
849 $controller = new CRM_Contact_Selector_Controller($selector,
850 $this->get(CRM_Utils_Pager
::PAGE_ID
),
852 CRM_Core_Action
::VIEW
,
856 $controller->setEmbedded(TRUE);
857 $controller->setDynamicAction($setDynamic);
865 function &returnProperties() {
866 return CRM_Core_DAO
::$_nullObject;
870 * Return a descriptive name for the page, used in wizard header
875 function getTitle() {