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
17 class CRM_Contribute_StateMachine_Search
extends CRM_Core_StateMachine
{
20 * The task that the wizard is currently processing
29 * @param object $controller
30 * @param \const|int $action
32 public function __construct($controller, $action = CRM_Core_Action
::NONE
) {
33 parent
::__construct($controller, $action);
37 $this->_pages
['CRM_Contribute_Form_Search'] = NULL;
38 list($task, $result) = $this->taskName($controller, 'Search');
41 if (is_array($task)) {
42 foreach ($task as $t) {
43 $this->_pages
[$t] = NULL;
47 $this->_pages
[$task] = NULL;
50 $this->_pages
['CRM_Contribute_Form_Task_Result'] = NULL;
52 $this->addSequentialPages($this->_pages
, $action);
56 * Determine the form name based on the action. This allows us
57 * to avoid using conditional state machine, much more efficient
60 * @param CRM_Core_Controller $controller
61 * The controller object.
63 * @param string $formName
66 * [ 'class' => task classname, 'result' => TRUE ]
67 * the name of the form that will handle the task
69 public function taskName($controller, $formName = 'Search') {
70 // total hack, check POST vars and then session to determine stuff
71 $value = $_POST['task'] ??
NULL;
73 $value = $this->_controller
->get('task');
75 $this->_controller
->set('task', $value);
76 return CRM_Contribute_Task
::getTask($value);
80 * Return the form name of the task.
84 public function getTaskFormName() {
85 return CRM_Utils_String
::getClassName($this->_task
);
89 * Since this is a state machine for search and we want to come back to the same state
90 * we dont want to issue a reset of the state session when we are done processing a task
92 public function shouldReset() {