3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for case report.
21 class CRM_Case_Form_Report
extends CRM_Core_Form
{
27 public $_caseID = NULL;
33 public $_clientID = NULL;
39 public $_activitySetName = NULL;
41 public $_report = NULL;
44 * Build the form object.
46 public function preProcess() {
47 $this->_caseID
= CRM_Utils_Request
::retrieve('caseid', 'Integer', $this, TRUE);
48 $this->_clientID
= CRM_Utils_Request
::retrieve('cid', 'Integer', $this, TRUE);
49 $this->_activitySetName
= CRM_Utils_Request
::retrieve('asn', 'String', $this, TRUE);
51 $this->_report
= $this->get('report');
53 $this->assign_by_ref('report', $this->_report
);
57 $url = CRM_Utils_System
::url('civicrm/contact/view/case',
58 "reset=1&action=view&cid={$this->_clientID}&id={$this->_caseID}&show=1"
60 $session = CRM_Core_Session
::singleton();
61 $session->pushUserContext($url);
64 public function buildQuickForm() {
70 1 => ts('All Activities'),
71 2 => ts('Exclude Completed Activities'),
73 $includeActivitesGroup = $this->addRadio('include_activities',
80 $includeActivitesGroup->setValue(1);
82 $this->add('checkbox',
84 ts('Redact (hide) Client and Service Provider Data')
90 'name' => ts('Generate Report'),
95 'name' => ts('Cancel'),
98 // We want this form to redirect to a full page
99 $this->preventAjaxSubmit();
103 * Process the form submission.
105 public function postProcess() {
106 // store the submitted values in an array
107 $params = $this->controller
->exportValues($this->_name
);
109 // this is either a 1 or a 2, but the url expects a 1 or 0
110 $all = ($params['include_activities'] == 1) ?
1 : 0;
112 // similar but comes from a checkbox that's either 1 or not present
113 $is_redact = empty($params['is_redact']) ?
0 : 1;
115 $asn = rawurlencode($this->_activitySetName
);
117 CRM_Utils_System
::redirect(
118 CRM_Utils_System
::url(
119 'civicrm/case/report/print',
120 "caseID={$this->_caseID}&cid={$this->_clientID}&asn={$asn}&redact={$is_redact}&all={$all}"