Merge pull request #17968 from eileenmcnaughton/cont_page
[civicrm-core.git] / CRM / Contribute / 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 */
17
18/**
07f8d162 19 * This class provides the functionality to print contribution records.
6a488035
TO
20 */
21class CRM_Contribute_Form_Task_Print extends CRM_Contribute_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 parent::preprocess();
28
29 // set print view, so that print templates are called
30 $this->controller->setPrint(1);
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_Contribute_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 /**
347e061b 49 * Build the form object.
50 *
51 * It consists of
6a488035
TO
52 * - displaying the QILL (query in local language)
53 * - displaying elements for saving the search
6a488035 54 */
00be9182 55 public function buildQuickForm() {
6a488035 56 //
347e061b 57 // just need to add a javascript to popup the window for printing
6a488035 58 //
be2fb01f 59 $this->addButtons([
1330f57a
SL
60 [
61 'type' => 'next',
62 'name' => ts('Print Contributions'),
63 'js' => ['onclick' => 'window.print()'],
64 'isDefault' => TRUE,
65 ],
66 [
67 'type' => 'back',
68 'name' => ts('Done'),
69 ],
70 ]);
6a488035
TO
71 }
72
73 /**
fe482240 74 * Process the form after the input has been submitted and validated.
6a488035
TO
75 */
76 public function postProcess() {
77 // redirect to the main search page after printing is over
78 }
96025800 79
6a488035 80}