Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * This is the base Action class for all actions which we redefine. This is | |
14 | * integrated with the StateMachine, Controller and State objects | |
15 | * | |
16 | * @package CRM | |
ca5cec67 | 17 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
18 | */ |
19 | require_once 'HTML/QuickForm/Action.php'; | |
28518c90 EM |
20 | |
21 | /** | |
22 | * Class CRM_Core_QuickForm_Action | |
23 | */ | |
6a488035 TO |
24 | class CRM_Core_QuickForm_Action extends HTML_QuickForm_Action { |
25 | ||
26 | /** | |
d09edf64 | 27 | * Reference to the state machine i belong to. |
6a488035 TO |
28 | * @var object |
29 | */ | |
30 | protected $_stateMachine; | |
31 | ||
32 | /** | |
d09edf64 | 33 | * Constructor. |
6a488035 | 34 | * |
6a0b768e TO |
35 | * @param object $stateMachine |
36 | * Reference to state machine object. | |
6a488035 | 37 | * |
77b97be7 | 38 | * @return \CRM_Core_QuickForm_Action |
77b97be7 | 39 | */ |
00be9182 | 40 | public function __construct(&$stateMachine) { |
6a488035 TO |
41 | $this->_stateMachine = &$stateMachine; |
42 | } | |
43 | ||
44 | /** | |
100fef9d | 45 | * Returns the user to the top of the user context stack. |
6a488035 | 46 | */ |
00be9182 | 47 | public function popUserContext() { |
6a488035 TO |
48 | $session = CRM_Core_Session::singleton(); |
49 | $config = CRM_Core_Config::singleton(); | |
50 | ||
51 | // check if destination is set, if so goto destination | |
52 | $destination = $this->_stateMachine->getDestination(); | |
53 | if ($destination) { | |
54 | $destination = urldecode($destination); | |
55 | } | |
56 | else { | |
57 | $destination = $session->popUserContext(); | |
58 | ||
59 | if (empty($destination)) { | |
60 | $destination = $config->userFrameworkBaseURL; | |
61 | } | |
62 | } | |
63 | ||
64 | //CRM-5839 -do not redirect control. | |
65 | if (!$this->_stateMachine->getSkipRedirection()) { | |
66 | CRM_Utils_System::redirect($destination); | |
67 | } | |
68 | } | |
96025800 | 69 | |
6a488035 | 70 | } |