more comment fixes
[civicrm-core.git] / CRM / Case / Form / Report.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
7e9e8871 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 *
30 * @package CRM
e7112fa7 31 * @copyright CiviCRM LLC (c) 2004-2015
6a488035
TO
32 */
33
34/**
df371444 35 * This class generates form components for case report.
6a488035
TO
36 */
37class CRM_Case_Form_Report extends CRM_Core_Form {
38
39 /**
40 * Case Id
41 */
42 public $_caseID = NULL;
43
44 /**
45 * Client Id
46 */
47 public $_clientID = NULL;
48
49 /**
100fef9d 50 * Activity set name
6a488035
TO
51 */
52 public $_activitySetName = NULL;
53
54 public $_report = NULL;
55
56 /**
fe482240 57 * Build the form object.
95ea96be 58 */
e7483cbe 59 public function preProcess() {
6a488035
TO
60 $this->_caseID = CRM_Utils_Request::retrieve('caseid', 'Integer', $this, TRUE);
61 $this->_clientID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
62 $this->_activitySetName = CRM_Utils_Request::retrieve('asn', 'String', $this, TRUE);
63
64 $this->_report = $this->get('report');
65 if ($this->_report) {
66 $this->assign_by_ref('report', $this->_report);
67 }
68
69 // user context
70 $url = CRM_Utils_System::url('civicrm/contact/view/case',
71 "reset=1&action=view&cid={$this->_clientID}&id={$this->_caseID}&show=1"
72 );
73 $session = CRM_Core_Session::singleton();
74 $session->pushUserContext($url);
75 }
76
77 public function buildQuickForm() {
78 if ($this->_report) {
79 return;
80 }
81
e547f744 82 $includeActivites = array(
353ffa53 83 1 => ts('All Activities'),
f7737fc0 84 2 => ts('Exclude Completed Activities'),
6a488035
TO
85 );
86 $includeActivitesGroup = $this->addRadio('include_activities',
87 NULL,
88 $includeActivites,
89 NULL,
90 '&nbsp;',
91 TRUE
92 );
93 $includeActivitesGroup->setValue(1);
94
95 $this->add('checkbox',
96 'is_redact',
97 ts('Redact (hide) Client and Service Provider Data')
98 );
99
100 $this->addButtons(array(
101 array(
102 'type' => 'refresh',
103 'name' => ts('Generate Report'),
6a488035
TO
104 'isDefault' => TRUE,
105 ),
106 array(
107 'type' => 'cancel',
108 'name' => ts('Cancel'),
109 ),
110 )
111 );
2a06342c
CW
112 // We want this form to redirect to a full page
113 $this->preventAjaxSubmit();
6a488035
TO
114 }
115
116 /**
fe482240 117 * Process the form submission.
6a488035
TO
118 */
119 public function postProcess() {
120 // store the submitted values in an array
121 $params = $this->controller->exportValues($this->_name);
122
123 $xmlProcessor = new CRM_Case_XMLProcessor_Report();
124 $contents = $xmlProcessor->run($this->_clientID,
125 $this->_caseID,
126 $this->_activitySetName,
127 $params
128 );
129 $this->set('report', $contents);
130 }
96025800 131
6a488035 132}