_caseID = CRM_Utils_Request::retrieve('caseid', 'Integer', $this, TRUE); $this->_clientID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE); $this->_activitySetName = CRM_Utils_Request::retrieve('asn', 'String', $this, TRUE); $this->_report = $this->get('report'); if ($this->_report) { $this->assign_by_ref('report', $this->_report); } // user context $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_clientID}&id={$this->_caseID}&show=1" ); $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); } public function buildQuickForm() { if ($this->_report) { return; } $includeActivites = array( 1 => ts('All Activities'), 2 => ts('Exclude Completed Activities'), ); $includeActivitesGroup = $this->addRadio('include_activities', NULL, $includeActivites, NULL, ' ', TRUE ); $includeActivitesGroup->setValue(1); $this->add('checkbox', 'is_redact', ts('Redact (hide) Client and Service Provider Data') ); $this->addButtons(array( array( 'type' => 'refresh', 'name' => ts('Generate Report'), 'isDefault' => TRUE, ), array( 'type' => 'cancel', 'name' => ts('Cancel'), ), ) ); // We want this form to redirect to a full page $this->preventAjaxSubmit(); } /** * Process the form submission. * * * @return void */ public function postProcess() { // store the submitted values in an array $params = $this->controller->exportValues($this->_name); $xmlProcessor = new CRM_Case_XMLProcessor_Report(); $contents = $xmlProcessor->run($this->_clientID, $this->_caseID, $this->_activitySetName, $params ); $this->set('report', $contents); } }