Commit | Line | Data |
---|---|---|
2cc569f2 PJ |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
2cc569f2 | 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 | | |
2cc569f2 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
2cc569f2 PJ |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
2cc569f2 PJ |
16 | */ |
17 | ||
18 | /** | |
e4a22519 | 19 | * This class provides the functionality to print mailing recipient records |
2cc569f2 PJ |
20 | */ |
21 | class CRM_Mailing_Form_Task_Print extends CRM_Mailing_Form_Task { | |
22 | ||
23 | /** | |
fe482240 | 24 | * Build all the data structures needed to build the form. |
2cc569f2 | 25 | */ |
00be9182 | 26 | public function preProcess() { |
2cc569f2 PJ |
27 | parent::preprocess(); |
28 | ||
29 | // set print view, so that print templates are called | |
2beb47b8 | 30 | $this->controller->setPrint(CRM_Core_Smarty::PRINT_PAGE); |
2cc569f2 PJ |
31 | |
32 | // get the formatted params | |
33 | $queryParams = $this->get('queryParams'); | |
34 | ||
35 | $sortID = NULL; | |
36 | if ($this->get(CRM_Utils_Sort::SORT_ID)) { | |
37 | $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), | |
38 | $this->get(CRM_Utils_Sort::SORT_DIRECTION) | |
39 | ); | |
40 | } | |
41 | ||
42 | $selector = new CRM_Mailing_Selector_Search($queryParams, $this->_action, $this->_componentClause); | |
43 | $controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN); | |
44 | $controller->setEmbedded(TRUE); | |
45 | $controller->run(); | |
46 | } | |
47 | ||
48 | /** | |
c490a46a | 49 | * Build the form object - it consists of |
2cc569f2 | 50 | * - displaying the QILL (query in local language) |
25606795 | 51 | * - displaying elements for saving the search. |
2cc569f2 | 52 | */ |
00be9182 | 53 | public function buildQuickForm() { |
2cc569f2 PJ |
54 | // |
55 | // just need to add a javacript to popup the window for printing | |
56 | // | |
be2fb01f | 57 | $this->addButtons([ |
7e8c8317 SL |
58 | [ |
59 | 'type' => 'next', | |
60 | 'name' => ts('Print Mailing Recipients'), | |
61 | 'js' => ['onclick' => 'window.print()'], | |
62 | 'isDefault' => TRUE, | |
63 | ], | |
64 | [ | |
65 | 'type' => 'back', | |
66 | 'name' => ts('Done'), | |
67 | ], | |
68 | ]); | |
2cc569f2 PJ |
69 | } |
70 | ||
71 | /** | |
fe482240 | 72 | * Process the form after the input has been submitted and validated. |
2cc569f2 PJ |
73 | */ |
74 | public function postProcess() { | |
75 | // redirect to the main search page after printing is over | |
76 | } | |
96025800 | 77 | |
ef10e0b5 | 78 | } |