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 * This class is used by the Search functionality.
21 * - the search controller is used for building/processing multiform
24 * Typically the first form will display the search criteria and it's results
26 * The second form is used to process search results with the associated actions.
28 class CRM_Contact_Controller_Search
extends CRM_Core_Controller
{
33 * @param string $title
35 * @param int|mixed|null $action
37 public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action
::NONE
) {
38 parent
::__construct($title, $modal);
40 $this->_stateMachine
= new CRM_Contact_StateMachine_Search($this, $action);
42 // create and instantiate the pages
43 $this->addPages($this->_stateMachine
, $action);
45 // add all the actions
52 public function selectorName() {
53 return $this->get('selectorName');
56 public function invalidKey() {
57 $message = ts('Because your session timed out, we have reset the search page.');
58 CRM_Core_Session
::setStatus($message);
60 // see if we can figure out the url and redirect to the right search form
61 // note that this happens really early on, so we can't use any of the form or controller
63 $qString = CRM_Utils_System
::currentPath();
65 $path = 'civicrm/contact/search/advanced';
66 if (strpos($qString, 'basic') !== FALSE) {
67 $path = 'civicrm/contact/search/basic';
69 elseif (strpos($qString, 'builder') !== FALSE) {
70 $path = 'civicrm/contact/search/builder';
73 strpos($qString, 'custom') !== FALSE &&
74 isset($_REQUEST['csid'])
76 $path = 'civicrm/contact/search/custom';
77 $args = "reset=1&csid={$_REQUEST['csid']}";
80 $url = CRM_Utils_System
::url($path, $args);
81 CRM_Utils_System
::redirect($url);