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