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
{
30 protected $entity = 'Contact';
35 * @param string $title
37 * @param int|mixed|null $action
39 public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action
::NONE
) {
40 parent
::__construct($title, $modal);
42 $this->_stateMachine
= new CRM_Contact_StateMachine_Search($this, $action);
44 // create and instantiate the pages
45 $this->addPages($this->_stateMachine
, $action);
47 // add all the actions
49 $this->set('entity', $this->entity
);
55 public function selectorName() {
56 return $this->get('selectorName');
59 public function invalidKey() {
60 $message = ts('Because your session timed out, we have reset the search page.');
61 CRM_Core_Session
::setStatus($message);
63 // see if we can figure out the url and redirect to the right search form
64 // note that this happens really early on, so we can't use any of the form or controller
66 $qString = CRM_Utils_System
::currentPath();
68 $path = 'civicrm/contact/search/advanced';
69 if (strpos($qString, 'basic') !== FALSE) {
70 $path = 'civicrm/contact/search/basic';
72 elseif (strpos($qString, 'builder') !== FALSE) {
73 $path = 'civicrm/contact/search/builder';
75 $url = CRM_Utils_System
::url($path, $args);
76 CRM_Utils_System
::redirect($url);