[Import] Fix Contribution Import mapping fields to use labels
[civicrm-core.git] / CRM / Contact / Controller / Search.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class is used by the Search functionality.
20 *
21 * - the search controller is used for building/processing multiform
22 * searches.
23 *
24 * Typically the first form will display the search criteria and it's results
25 *
26 * The second form is used to process search results with the associated actions.
27 */
28 class CRM_Contact_Controller_Search extends CRM_Core_Controller {
29
30 protected $entity = 'Contact';
31
32 /**
33 * Class constructor.
34 *
35 * @param string $title
36 * @param bool $modal
37 * @param int|mixed|null $action
38 */
39 public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
40 parent::__construct($title, $modal);
41
42 $this->_stateMachine = new CRM_Contact_StateMachine_Search($this, $action);
43
44 // create and instantiate the pages
45 $this->addPages($this->_stateMachine, $action);
46
47 // add all the actions
48 $this->addActions();
49 $this->set('entity', $this->entity);
50 }
51
52 /**
53 * @return mixed
54 */
55 public function selectorName() {
56 return $this->get('selectorName');
57 }
58
59 public function invalidKey() {
60 $message = ts('Because your session timed out, we have reset the search page.');
61 CRM_Core_Session::setStatus($message);
62
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
65 // variables
66 $qString = CRM_Utils_System::currentPath();
67 $args = "reset=1";
68 $path = 'civicrm/contact/search/advanced';
69 if (strpos($qString, 'basic') !== FALSE) {
70 $path = 'civicrm/contact/search/basic';
71 }
72 elseif (strpos($qString, 'builder') !== FALSE) {
73 $path = 'civicrm/contact/search/builder';
74 }
75 $url = CRM_Utils_System::url($path, $args);
76 CRM_Utils_System::redirect($url);
77 }
78
79 }