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 class CRM_Event_StateMachine_Search
extends CRM_Core_StateMachine
{
22 * The task that the wizard is currently processing.
31 * @param object $controller
34 public function __construct($controller, $action = CRM_Core_Action
::NONE
) {
35 parent
::__construct($controller, $action);
39 $this->_pages
['CRM_Event_Form_Search'] = NULL;
40 list($task, $result) = $this->taskName($controller, 'Search');
43 if (is_array($task)) {
44 foreach ($task as $t) {
45 $this->_pages
[$t] = NULL;
49 $this->_pages
[$task] = NULL;
53 $this->_pages
['CRM_Event_Form_Task_Result'] = NULL;
56 $this->addSequentialPages($this->_pages
, $action);
60 * Determine the form name based on the action. This allows us
61 * to avoid using conditional state machine, much more efficient
64 * @param CRM_Core_Controller $controller
65 * The controller object.
67 * @param string $formName
70 * the name of the form that will handle the task
72 public function taskName($controller, $formName = 'Search') {
73 // total hack, check POST vars and then session to determine stuff
74 $value = CRM_Utils_Array
::value('task', $_POST);
76 $value = $this->_controller
->get('task');
78 $this->_controller
->set('task', $value);
79 return CRM_Event_Task
::getTask($value);
83 * Return the form name of the task.
87 public function getTaskFormName() {
88 return CRM_Utils_String
::getClassName($this->_task
);
92 * Since this is a state machine for search and we want to come back to the same state
93 * we dont want to issue a reset of the state session when we are done processing a task
95 public function shouldReset() {