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 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
19 | * Used for displaying results | |
6a488035 TO |
20 | */ |
21 | class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task { | |
22 | ||
23 | /** | |
fe482240 | 24 | * Build all the data structures needed to build the form. |
6a488035 | 25 | */ |
00be9182 | 26 | public function preProcess() { |
6a488035 TO |
27 | $session = CRM_Core_Session::singleton(); |
28 | ||
29 | //this is done to unset searchRows variable assign during AddToHousehold and AddToOrganization | |
30 | $this->set('searchRows', ''); | |
31 | ||
32 | $context = $this->get('context'); | |
be2fb01f | 33 | if (in_array($context, [ |
353ffa53 | 34 | 'smog', |
7c550ca0 | 35 | 'amtg', |
be2fb01f | 36 | ])) { |
6a488035 TO |
37 | $urlParams = 'reset=1&force=1&context=smog&gid='; |
38 | $urlParams .= ($context == 'smog') ? $this->get('gid') : $this->get('amtgID'); | |
39 | $session->replaceUserContext(CRM_Utils_System::url('civicrm/group/search', $urlParams)); | |
40 | return; | |
41 | } | |
42 | ||
43 | $ssID = $this->get('ssID'); | |
44 | ||
45 | if ($this->_action == CRM_Core_Action::BASIC) { | |
46 | $fragment = 'search'; | |
47 | } | |
48 | elseif ($this->_action == CRM_Core_Action::PROFILE) { | |
49 | $fragment = 'search/builder'; | |
50 | } | |
51 | elseif ($this->_action == CRM_Core_Action::ADVANCED) { | |
52 | $fragment = 'search/advanced'; | |
53 | } | |
54 | else { | |
55 | $fragment = 'search/custom'; | |
56 | } | |
57 | ||
58 | $path = 'force=1'; | |
59 | if (isset($ssID)) { | |
60 | $path .= "&reset=1&ssID={$ssID}"; | |
61 | } | |
62 | if (!CRM_Contact_Form_Search::isSearchContext($context)) { | |
63 | $context = 'search'; | |
64 | } | |
65 | $path .= "&context=$context"; | |
66 | ||
67 | //set the user context for redirection of task actions | |
68 | $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); | |
69 | if (CRM_Utils_Rule::qfKey($qfKey)) { | |
70 | $path .= "&qfKey=$qfKey"; | |
71 | } | |
72 | ||
73 | $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $path); | |
74 | $session->replaceUserContext($url); | |
6a488035 TO |
75 | } |
76 | ||
77 | /** | |
fe482240 | 78 | * Build the form object. |
6a488035 TO |
79 | */ |
80 | public function buildQuickForm() { | |
be2fb01f | 81 | $this->addButtons([ |
69078420 SL |
82 | [ |
83 | 'type' => 'done', | |
84 | 'name' => ts('Done'), | |
85 | 'isDefault' => TRUE, | |
86 | ], | |
87 | ]); | |
6a488035 | 88 | } |
96025800 | 89 | |
6a488035 | 90 | } |