CRM-12595 fix formatting in CRM/Upgrade files
[civicrm-core.git] / CRM / Report / Page / List.php
CommitLineData
6a488035
TO
1<?php
2// $Id$
3
4/*
5 +--------------------------------------------------------------------+
6 | CiviCRM version 4.3 |
7 +--------------------------------------------------------------------+
8 | Copyright CiviCRM LLC (c) 2004-2013 |
9 +--------------------------------------------------------------------+
10 | This file is a part of CiviCRM. |
11 | |
12 | CiviCRM is free software; you can copy, modify, and distribute it |
13 | under the terms of the GNU Affero General Public License |
14 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | |
16 | CiviCRM is distributed in the hope that it will be useful, but |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
19 | See the GNU Affero General Public License for more details. |
20 | |
21 | You should have received a copy of the GNU Affero General Public |
22 | License and the CiviCRM Licensing Exception along |
23 | with this program; if not, contact CiviCRM LLC |
24 | at info[AT]civicrm[DOT]org. If you have questions about the |
25 | GNU Affero General Public License or the licensing of CiviCRM, |
26 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
27 +--------------------------------------------------------------------+
28*/
29
30/**
31 *
32 * @package CRM
33 * @copyright CiviCRM LLC (c) 2004-2013
34 * $Id$
35 *
36 */
37
38/**
39 * Page for displaying list of Reprot templates available
40 */
41class CRM_Report_Page_List extends CRM_Core_Page {
42
43 public static function &info() {
44 $sql = "
45SELECT v.id, v.value, v.label, v.description, v.component_id,
46 inst.id as instance_id, ifnull( SUBSTRING(comp.name, 5), 'Contact' ) as component_name
47FROM civicrm_option_value v
48INNER JOIN civicrm_option_group g
49 ON (v.option_group_id = g.id AND g.name = 'report_list')
50LEFT JOIN civicrm_report_instance inst
51 ON v.value = inst.report_id
52LEFT JOIN civicrm_component comp
53 ON v.component_id = comp.id
54WHERE v.is_active = 1
55ORDER BY v.weight";
56
57 $dao = CRM_Core_DAO::executeQuery($sql);
58 $rows = array();
59 while ($dao->fetch()) {
60 $url = 'civicrm/report/';
61 $rows[$dao->component_name][$dao->value]['title'] = $dao->label;
62 $rows[$dao->component_name][$dao->value]['description'] = $dao->description;
63 $rows[$dao->component_name][$dao->value]['url'] = CRM_Utils_System::url('civicrm/report/' . trim($dao->value, '/'), 'reset=1');
64 if ($dao->instance_id) {
65 $rows[$dao->component_name][$dao->value]['instanceUrl'] = CRM_Utils_System::url('civicrm/report/instance/list',
66 "reset=1&ovid={$dao->id}"
67 );
68 }
69 }
70
71 return $rows;
72 }
73
74 /**
75 * run this page (figure out the action needed and perform it).
76 *
77 * @return void
78 */
79 function run() {
80 $rows = self::info();
81 $this->assign('list', $rows);
82
83 return parent::run();
84 }
85}
86