Merge pull request #11086 from agileware/CRM-21277
[civicrm-core.git] / CRM / Event / Form / Task / PDF.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.7 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2018 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 *
31 * @package CRM
32 * @copyright CiviCRM LLC (c) 2004-2018
33 * $Id: PDF.php 45499 2013-02-08 12:31:05Z kurund $
34 */
35
36 /**
37 * This class provides the functionality to create PDF letter for a group of
38 * participants or a single participant.
39 */
40 class CRM_Event_Form_Task_PDF extends CRM_Event_Form_Task {
41
42 /**
43 * Are we operating in "single mode", i.e. printing letter to one
44 * specific participant?
45 *
46 * @var boolean
47 */
48 public $_single = FALSE;
49
50 /**
51 * All the existing templates in the system.
52 *
53 * @var array
54 */
55 public $_templates = NULL;
56 public $_cid = NULL;
57 public $_activityId = NULL;
58
59 /**
60 * Build all the data structures needed to build the form.
61 */
62 public function preProcess() {
63 CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
64 parent::preProcess();
65
66 // we have all the participant ids, so now we get the contact ids
67 parent::setContactIDs();
68
69 $this->assign('single', $this->_single);
70 }
71
72 /**
73 * Build the form object.
74 */
75 public function buildQuickForm() {
76 CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this);
77 }
78
79 /**
80 * Process the form after the input has been submitted and validated.
81 */
82 public function postProcess() {
83 CRM_Contact_Form_Task_PDFLetterCommon::postProcess($this);
84 }
85
86 /**
87 * Set default values for the form.
88 *
89 * @return void
90 */
91 public function setDefaultValues() {
92 return CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
93 }
94
95 /**
96 * List available tokens for this form.
97 *
98 * @return array
99 */
100 public function listTokens() {
101 $tokens = CRM_Core_SelectValues::contactTokens();
102 return $tokens;
103 }
104
105 }