Merge pull request #17390 from mattwire/api3activitydatetimedefault
[civicrm-core.git] / CRM / Event / 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 * This class is used by the Search functionality.
14 *
15 * - the search controller is used for building/processing multiform
16 * searches.
17 *
18 * Typically the first form will display the search criteria and its results
19 *
20 * The second form is used to process search results with the associated actions
21 *
22 */
23 class CRM_Event_Controller_Search extends CRM_Core_Controller {
24
25 /**
26 * Class constructor.
27 *
28 * @param string $title
29 * @param bool|int $action
30 * @param bool $modal
31 *
32 * @throws \CRM_Core_Exception
33 */
34 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
35
36 parent::__construct($title, $modal);
37
38 $this->_stateMachine = new CRM_Event_StateMachine_Search($this, $action);
39
40 // create and instantiate the pages
41 $this->addPages($this->_stateMachine, $action);
42
43 $session = CRM_Core_Session::singleton();
44 $uploadNames = $session->get('uploadNames');
45 if (!empty($uploadNames)) {
46 $uploadNames = array_merge($uploadNames,
47 CRM_Core_BAO_File::uploadNames()
48 );
49 }
50 else {
51 $uploadNames = CRM_Core_BAO_File::uploadNames();
52 }
53
54 $config = CRM_Core_Config::singleton();
55 $uploadDir = $config->uploadDir;
56
57 // add all the actions
58 $this->addActions($uploadDir, $uploadNames);
59 }
60
61 }