3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
37 * This class provides the functionality to create PDF letter for a group of
38 * contacts or a single contact.
40 class CRM_Contact_Form_Task_PDF
extends CRM_Contact_Form_Task
{
43 * all the existing templates in the system
47 public $_templates = NULL;
49 public $_single = NULL;
53 public $_activityId = NULL;
56 * build all the data structures needed to build the form
61 function preProcess() {
63 $this->skipOnHold
= $this->skipDeceased
= FALSE;
64 CRM_Contact_Form_Task_PDFLetterCommon
::preProcess($this);
66 // store case id if present
67 $this->_caseId
= CRM_Utils_Request
::retrieve('caseid', 'Positive', $this, FALSE);
69 // retrieve contact ID if this is 'single' mode
70 $cid = CRM_Utils_Request
::retrieve('cid', 'Positive', $this, FALSE);
73 // this is true in non-search context / single mode
74 // in search context 'id' is the default profile id for search display
76 $this->_activityId
= CRM_Utils_Request
::retrieve('id', 'Positive', $this, FALSE);
80 CRM_Contact_Form_Task_PDFLetterCommon
::preProcessSingle($this, $cid);
81 $this->_single
= TRUE;
87 $this->assign('single', $this->_single
);
91 * This function sets the default values for the form. Relationship that in edit/view action
92 * the default values are retrieved from the database
101 function setDefaultValues() {
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);
108 $defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon
::setDefaultValues();
119 public function buildQuickForm() {
120 //enable form element
121 $this->assign('suppressForm', FALSE);
122 CRM_Contact_Form_Task_PDFLetterCommon
::buildQuickForm($this);
126 * process the form after the input has been submitted and validated
132 public function postProcess() {
133 CRM_Contact_Form_Task_PDFLetterCommon
::postProcess($this);