3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2018
35 * Page for displaying list of Report templates available.
37 class CRM_Report_Page_TemplateList
extends CRM_Core_Page
{
41 * @param null $grouping
45 public static function &info($compID = NULL, $grouping = NULL) {
46 $all = CRM_Utils_Request
::retrieve('all', 'Boolean', CRM_Core_DAO
::$_nullObject,
53 $compClause = " AND v.component_id IS NULL ";
56 $compClause = " AND v.component_id = {$compID} ";
60 $compClause = " AND v.grouping = '{$grouping}' ";
63 SELECT v.id, v.value, v.label, v.description, v.component_id,
65 WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
66 WHEN v.grouping IS NOT NULL THEN v.grouping
68 END as component_name,
70 inst.id as instance_id
71 FROM civicrm_option_value v
72 INNER JOIN civicrm_option_group g
73 ON (v.option_group_id = g.id AND g.name = 'report_template')
74 LEFT JOIN civicrm_report_instance inst
75 ON v.value = inst.report_id
76 LEFT JOIN civicrm_component comp
77 ON v.component_id = comp.id
81 $sql .= " WHERE v.is_active = 1 {$compClause}";
83 $sql .= " ORDER BY v.weight ";
85 $dao = CRM_Core_DAO
::executeQuery($sql);
87 $config = CRM_Core_Config
::singleton();
88 while ($dao->fetch()) {
89 if ($dao->component_name
!= 'Contact' && $dao->component_name
!= $dao->grouping
&&
90 !in_array("Civi{$dao->component_name}", $config->enableComponents
)
94 $rows[$dao->component_name
][$dao->value
]['title'] = ts($dao->label
);
95 $rows[$dao->component_name
][$dao->value
]['description'] = ts($dao->description
);
96 $rows[$dao->component_name
][$dao->value
]['url'] = CRM_Utils_System
::url('civicrm/report/' . trim($dao->value
, '/'), 'reset=1');
97 if ($dao->instance_id
) {
98 $rows[$dao->component_name
][$dao->value
]['instanceUrl'] = CRM_Utils_System
::url('civicrm/report/list',
99 "reset=1&ovid={$dao->id}"
108 * Run this page (figure out the action needed and perform it).
110 public function run() {
111 $compID = CRM_Utils_Request
::retrieve('compid', 'Positive', $this);
112 $grouping = CRM_Utils_Request
::retrieve('grp', 'String', $this);
113 $rows = self
::info($compID, $grouping);
114 $this->assign('list', $rows);
116 return parent
::run();