[REF] dev/core#2790 move preProcess static to the trait
[civicrm-core.git] / CRM / Case / Form / Task / PDF.php
CommitLineData
8ffa3b7c 1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
8ffa3b7c 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 |
8ffa3b7c 9 +--------------------------------------------------------------------+
10 */
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
8ffa3b7c 16 */
17
18/**
19 * This class provides the functionality to create PDF letter for a group of contacts.
20 */
13e6f3e9 21class CRM_Case_Form_Task_PDF extends CRM_Case_Form_Task {
fc34a273
EM
22
23 use CRM_Contact_Form_Task_PDFTrait;
24
8ffa3b7c 25 /**
26 * All the existing templates in the system.
27 *
28 * @var array
29 */
30 public $_templates = NULL;
31
32 public $_single = NULL;
33
34 public $_cid = NULL;
35
36 /**
37 * Build all the data structures needed to build the form.
38 */
39 public function preProcess() {
c97bfeff 40 $this->preProcessPDF();
8ffa3b7c 41 $this->skipOnHold = $this->skipDeceased = FALSE;
42 parent::preProcess();
43 $this->setContactIDs();
8ffa3b7c 44 }
45
8ffa3b7c 46 /**
47 * Process the form after the input has been submitted and validated.
48 */
49 public function postProcess() {
50 CRM_Contact_Form_Task_PDFLetterCommon::postProcess($this);
51 }
52
53 /**
54 * List available tokens for this form.
55 *
56 * @return array
57 */
58 public function listTokens() {
59 $tokens = CRM_Core_SelectValues::contactTokens();
6e3090fb 60 foreach ($this->_entityIds as $key => $caseId) {
8ffa3b7c 61 $caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'case_type_id');
62 $tokens += CRM_Core_SelectValues::caseTokens($caseTypeId);
63 }
64 return $tokens;
65 }
66
67}