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_Member_StateMachine_Search
extends CRM_Core_StateMachine
{
22 * The task that the wizard is currently processing.
31 * @param object $controller
32 * @param \const|int $action
34 public function __construct($controller, $action = CRM_Core_Action
::NONE
) {
35 parent
::__construct($controller, $action);
39 $this->_pages
['CRM_Member_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;
52 $this->_pages
['CRM_Member_Form_Task_Result'] = NULL;
54 $this->addSequentialPages($this->_pages
, $action);
58 * Determine the form name based on the action. This allows us
59 * to avoid using conditional state machine, much more efficient
62 * @param CRM_Core_Controller $controller
63 * The controller object.
65 * @param string $formName
68 * the name of the form that will handle the task
70 public function taskName($controller, $formName = 'Search') {
71 // total hack, check POST vars and then session to determine stuff
72 $value = CRM_Utils_Array
::value('task', $_POST);
74 $value = $this->_controller
->get('task');
76 $this->_controller
->set('task', $value);
77 return CRM_Member_Task
::getTask($value);
81 * Return the form name of the task.
85 public function getTaskFormName() {
86 return CRM_Utils_String
::getClassName($this->_task
);
90 * Since this is a state machine for search and we want to come back to the same state
91 * we dont want to issue a reset of the state session when we are done processing a task
93 public function shouldReset() {