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 * Page for invoking report templates.
21 class CRM_Report_Page_Report
extends CRM_Core_Page
{
24 * Run this page (figure out the action needed and perform it).
26 public function run() {
27 if (!CRM_Core_Permission
::check('administer Reports')) {
28 return CRM_Utils_System
::redirect(CRM_Utils_System
::url('civicrm/report/list', 'reset=1'));
31 $optionVal = CRM_Report_Utils_Report
::getValueFromUrl();
33 $templateInfo = CRM_Core_OptionGroup
::getRowValues('report_template', "{$optionVal}", 'value',
37 $extKey = strpos(CRM_Utils_Array
::value('name', $templateInfo), '.');
41 if ($extKey !== FALSE) {
42 $ext = CRM_Extension_System
::singleton()->getMapper();
43 $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
44 $templateInfo['name'] = $reportClass;
47 if (strstr(CRM_Utils_Array
::value('name', $templateInfo), '_Form') ||
!is_null($reportClass)) {
48 CRM_Utils_System
::setTitle(ts('%1 - Template', [1 => $templateInfo['label']]));
49 $this->assign('reportTitle', $templateInfo['label']);
51 $session = CRM_Core_Session
::singleton();
52 $session->set('reportDescription', $templateInfo['description']);
54 $wrapper = new CRM_Utils_Wrapper();
56 return $wrapper->run($templateInfo['name'], NULL, NULL);
60 CRM_Core_Session
::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error');
62 return CRM_Utils_System
::redirect(CRM_Utils_System
::url('civicrm/report/list', 'reset=1'));