3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
37 * Page for displaying list of Reprot templates available
39 class CRM_Report_Page_TemplateList
extends CRM_Core_Page
{
43 * @param null $grouping
47 public static function &info($compID = NULL, $grouping = NULL) {
48 $all = CRM_Utils_Request
::retrieve('all', 'Boolean', CRM_Core_DAO
::$_nullObject,
55 $compClause = " AND v.component_id IS NULL ";
58 $compClause = " AND v.component_id = {$compID} ";
62 $compClause = " AND v.grouping = '{$grouping}' ";
65 SELECT v.id, v.value, v.label, v.description, v.component_id,
67 WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
68 WHEN v.grouping IS NOT NULL THEN v.grouping
70 END as component_name,
72 inst.id as instance_id
73 FROM civicrm_option_value v
74 INNER JOIN civicrm_option_group g
75 ON (v.option_group_id = g.id AND g.name = 'report_template')
76 LEFT JOIN civicrm_report_instance inst
77 ON v.value = inst.report_id
78 LEFT JOIN civicrm_component comp
79 ON v.component_id = comp.id
83 $sql .= " WHERE v.is_active = 1 {$compClause}";
85 $sql .= " ORDER BY v.weight ";
87 $dao = CRM_Core_DAO
::executeQuery($sql);
89 $config = CRM_Core_Config
::singleton();
90 while ($dao->fetch()) {
91 if ($dao->component_name
!= 'Contact' && $dao->component_name
!= $dao->grouping
&&
92 !in_array("Civi{$dao->component_name}", $config->enableComponents
)
96 $rows[$dao->component_name
][$dao->value
]['title'] = $dao->label
;
97 $rows[$dao->component_name
][$dao->value
]['description'] = $dao->description
;
98 $rows[$dao->component_name
][$dao->value
]['url'] = CRM_Utils_System
::url('civicrm/report/' . trim($dao->value
, '/'), 'reset=1');
99 if ($dao->instance_id
) {
100 $rows[$dao->component_name
][$dao->value
]['instanceUrl'] = CRM_Utils_System
::url('civicrm/report/list',
101 "reset=1&ovid={$dao->id}"
110 * Run this page (figure out the action needed and perform it).
114 public function run() {
115 $compID = CRM_Utils_Request
::retrieve('compid', 'Positive', $this);
116 $grouping = CRM_Utils_Request
::retrieve('grp', 'String', $this);
117 $rows = self
::info($compID, $grouping);
118 $this->assign('list', $rows);
120 return parent
::run();