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 | * This class provides the functionality to print members | |
20 | */ | |
21 | class CRM_Member_Form_Task_Print extends CRM_Member_Form_Task { | |
22 | ||
23 | /** | |
fe482240 | 24 | * Build all the data structures needed to build the form. |
6a488035 TO |
25 | * |
26 | * @return void | |
6a488035 | 27 | */ |
00be9182 | 28 | public function preProcess() { |
6a488035 TO |
29 | parent::preprocess(); |
30 | ||
31 | // set print view, so that print templates are called | |
2beb47b8 | 32 | $this->controller->setPrint(CRM_Core_Smarty::PRINT_PAGE); |
6a488035 TO |
33 | |
34 | // get the formatted params | |
35 | $queryParams = $this->get('queryParams'); | |
36 | ||
37 | $sortID = NULL; | |
38 | if ($this->get(CRM_Utils_Sort::SORT_ID)) { | |
39 | $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), | |
40 | $this->get(CRM_Utils_Sort::SORT_DIRECTION) | |
41 | ); | |
42 | } | |
43 | ||
44 | $selector = new CRM_Member_Selector_Search($queryParams, $this->_action, $this->_componentClause); | |
45 | $controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN); | |
46 | $controller->setEmbedded(TRUE); | |
47 | $controller->run(); | |
48 | } | |
49 | ||
50 | /** | |
c490a46a | 51 | * Build the form object - it consists of |
6a488035 TO |
52 | * - displaying the QILL (query in local language) |
53 | * - displaying elements for saving the search | |
54 | * | |
6a488035 TO |
55 | * |
56 | * @return void | |
57 | */ | |
00be9182 | 58 | public function buildQuickForm() { |
6a488035 TO |
59 | // |
60 | // just need to add a javacript to popup the window for printing | |
61 | // | |
be2fb01f CW |
62 | $this->addButtons([ |
63 | [ | |
c5c263ca AH |
64 | 'type' => 'next', |
65 | 'name' => ts('Print Members'), | |
be2fb01f | 66 | 'js' => ['onclick' => 'window.print()'], |
c5c263ca | 67 | 'isDefault' => TRUE, |
be2fb01f CW |
68 | ], |
69 | [ | |
c5c263ca AH |
70 | 'type' => 'back', |
71 | 'name' => ts('Done'), | |
be2fb01f CW |
72 | ], |
73 | ]); | |
6a488035 TO |
74 | } |
75 | ||
76 | /** | |
fe482240 | 77 | * Process the form after the input has been submitted and validated. |
6a488035 | 78 | * |
6a488035 TO |
79 | * |
80 | * @return void | |
81 | */ | |
82 | public function postProcess() { | |
83 | // redirect to the main search page after printing is over | |
84 | } | |
96025800 | 85 | |
6a488035 | 86 | } |