Cleanup phpdoc comments
[civicrm-core.git] / CRM / Contact / Form / Task / PDF.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2014
32 * $Id$
33 *
34 */
35
36 /**
37 * This class provides the functionality to create PDF letter for a group of
38 * contacts or a single contact.
39 */
40 class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
41
42 /**
43 * All the existing templates in the system
44 *
45 * @var array
46 */
47 public $_templates = NULL;
48
49 public $_single = NULL;
50
51 public $_cid = NULL;
52
53 public $_activityId = NULL;
54
55 /**
56 * Build all the data structures needed to build the form
57 *
58 * @return void
59 * @access public
60 */
61 function preProcess() {
62
63 $this->skipOnHold = $this->skipDeceased = FALSE;
64 CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
65
66 // store case id if present
67 $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, FALSE);
68
69 // retrieve contact ID if this is 'single' mode
70 $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
71
72 if ($cid) {
73 // this is true in non-search context / single mode
74 // in search context 'id' is the default profile id for search display
75 // CRM-11227
76 $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
77 }
78
79 if ($cid) {
80 CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid);
81 $this->_single = TRUE;
82 $this->_cid = $cid;
83 }
84 else {
85 parent::preProcess();
86 }
87 $this->assign('single', $this->_single);
88 }
89
90 /**
91 * Set default values for the form. Relationship that in edit/view action
92 * the default values are retrieved from the database
93 *
94 * @access public
95 *
96 * @return void
97 */
98 /**
99 *
100 */
101 function setDefaultValues() {
102 $defaults = array();
103 if (isset($this->_activityId)) {
104 $params = array('id' => $this->_activityId);
105 CRM_Activity_BAO_Activity::retrieve($params, $defaults);
106 $defaults['html_message'] = CRM_Utils_Array::value('details', $defaults);
107 }
108 $defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
109 return $defaults;
110 }
111
112 /**
113 * Build the form object
114 *
115 * @access public
116 *
117 * @return void
118 */
119 public function buildQuickForm() {
120 //enable form element
121 $this->assign('suppressForm', FALSE);
122 CRM_Contact_Form_Task_PDFLetterCommon::buildQuickForm($this);
123 }
124
125 /**
126 * Process the form after the input has been submitted and validated
127 *
128 * @access public
129 *
130 * @return void
131 */
132 public function postProcess() {
133 CRM_Contact_Form_Task_PDFLetterCommon::postProcess($this);
134 }
135 }
136