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 displaying list of Report templates available.
21 class CRM_Report_Page_TemplateList
extends CRM_Core_Page
{
25 * @param null $grouping
29 public static function &info($compID = NULL, $grouping = NULL) {
30 $all = CRM_Utils_Request
::retrieve('all', 'Boolean', CRM_Core_DAO
::$_nullObject,
37 $compClause = " AND v.component_id IS NULL ";
40 $compClause = " AND v.component_id = {$compID} ";
44 $compClause = " AND v.grouping = '{$grouping}' ";
47 SELECT v.id, v.value, v.label, v.description, v.component_id,
49 WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
50 WHEN v.grouping IS NOT NULL THEN v.grouping
52 END as component_name,
54 inst.id as instance_id
55 FROM civicrm_option_value v
56 INNER JOIN civicrm_option_group g
57 ON (v.option_group_id = g.id AND g.name = 'report_template')
58 LEFT JOIN civicrm_report_instance inst
59 ON v.value = inst.report_id
60 LEFT JOIN civicrm_component comp
61 ON v.component_id = comp.id
65 $sql .= " WHERE v.is_active = 1 {$compClause}";
67 $sql .= " ORDER BY v.weight ";
69 $dao = CRM_Core_DAO
::executeQuery($sql);
71 $config = CRM_Core_Config
::singleton();
72 while ($dao->fetch()) {
73 if ($dao->component_name
!= 'Contact' && $dao->component_name
!= $dao->grouping
&&
74 !in_array("Civi{$dao->component_name}", $config->enableComponents
)
78 $rows[$dao->component_name
][$dao->value
]['title'] = ts($dao->label
);
79 $rows[$dao->component_name
][$dao->value
]['description'] = ts($dao->description
);
80 $rows[$dao->component_name
][$dao->value
]['url'] = CRM_Utils_System
::url('civicrm/report/' . trim($dao->value
, '/'), 'reset=1');
81 $rows[$dao->component_name
][$dao->value
]['instanceUrl'] = $dao->instance_id ? CRM_Utils_System
::url(
82 'civicrm/report/list',
83 "reset=1&ovid=$dao->id"
91 * Run this page (figure out the action needed and perform it).
93 public function run() {
94 $compID = CRM_Utils_Request
::retrieve('compid', 'Positive', $this);
95 $grouping = CRM_Utils_Request
::retrieve('grp', 'String', $this);
96 $rows = self
::info($compID, $grouping);
97 $this->assign('list', $rows);