/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
*/
class CRM_Report_Page_TemplateList extends CRM_Core_Page {
- public static function &info($compID = NULL) {
+ /**
+ * @param null $compID
+ * @param null $grouping
+ *
+ * @return array
+ */
+ public static function &info($compID = NULL, $grouping = NULL) {
$all = CRM_Utils_Request::retrieve('all', 'Boolean', CRM_Core_DAO::$_nullObject,
FALSE, NULL, 'GET'
);
$compClause = " AND v.component_id = {$compID} ";
}
}
-
+ elseif ($grouping) {
+ $compClause = " AND v.grouping = '{$grouping}' ";
+ }
$sql = "
SELECT v.id, v.value, v.label, v.description, v.component_id,
- inst.id as instance_id, ifnull( SUBSTRING(comp.name, 5), 'Contact' ) as component_name
+ CASE
+ WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
+ WHEN v.grouping IS NOT NULL THEN v.grouping
+ ELSE 'Contact'
+ END as component_name,
+ v.grouping,
+ inst.id as instance_id
FROM civicrm_option_value v
INNER JOIN civicrm_option_group g
ON (v.option_group_id = g.id AND g.name = 'report_template')
$rows = array();
$config = CRM_Core_Config::singleton();
while ($dao->fetch()) {
- if ($dao->component_name != 'Contact' &&
+ if ($dao->component_name != 'Contact' && $dao->component_name != $dao->grouping &&
!in_array("Civi{$dao->component_name}", $config->enableComponents)
) {
continue;
*/
function run() {
$compID = CRM_Utils_Request::retrieve('compid', 'Positive', $this);
- $rows = self::info($compID);
+ $grouping = CRM_Utils_Request::retrieve('grp', 'String', $this);
+ $rows = self::info($compID, $grouping);
$this->assign('list', $rows);
return parent::run();