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 $config = CRM_Core_Config
::singleton();
64 $qString = $_GET[$config->userFrameworkURLVar
];
66 $path = 'civicrm/contact/search/advanced';
67 if (strpos($qString, 'basic') !== FALSE) {
68 $path = 'civicrm/contact/search/basic';
70 elseif (strpos($qString, 'builder') !== FALSE) {
71 $path = 'civicrm/contact/search/builder';
74 strpos($qString, 'custom') !== FALSE &&
75 isset($_REQUEST['csid'])
77 $path = 'civicrm/contact/search/custom';
78 $args = "reset=1&csid={$_REQUEST['csid']}";
81 $url = CRM_Utils_System
::url($path, $args);
82 CRM_Utils_System
::redirect($url);