/** * Create links to detailed report for various numbers * (non-PHPdoc) * @see CRM_Extendedreport_Form_Report_Contribute_ContributionAggregates::alterDisplay() */ function alterDisplay(&$rows) { foreach ($rows as &$row) { $availableKpi = array_flip($this->_kpiDescriptors); //kpiName looks like 'total_amount__individual' $kpiName = $availableKpi[$row['description']]; $kpiDetails = explode('__', $kpiName); if ($this->_kpiSpecs[$kpiDetails[0]]['type'] == CRM_Utils_Type::T_MONEY) { $row['this_year'] = CRM_Utils_Money::format($row['this_year']); $row['last_year'] = CRM_Utils_Money::format($row['last_year']); } if ($row['percent_change'] == 0 && $row['this_year'] != $row['last_year']) { $row['percent_change'] = 'n/a'; } else { $row['percent_change'] = $row['percent_change'] . '%'; } if (!$this->_kpiSpecs[$kpiDetails[0]]['link_status']) { // spec specifies no link continue; } // we are dealing with rows not columns so this differs from parent approach $queryURL = "reset=1&force=1"; foreach ($this->_potentialCriteria as $criterion) { if (empty($this->_params[$criterion])) { continue; } $criterionValue = is_array($this->_params[$criterion]) ? implode(',', $this->_params[$criterion]) : $this->_params[$criterion]; $queryURL .= "&{$criterion}=" . $criterionValue; } if (!empty($kpiDetails[1])) { // we are going to do some extra handling in case of unexpected case for contact type $contactTypes = $this->getContactTypeOptions(); $contactTypes = array_keys($contactTypes); $lcKey = array_search(strtolower($kpiDetails[1]), array_map('strtolower', $contactTypes)); $contactType = $contactTypes[$lcKey]; $queryURL .= "&contact_type_value=" . $contactType . "&contact_type_op=in"; } $years = array(0 => 'this_year', 1 => 'last_year'); foreach ($years as $interval => $year) { $queryURLYear = "&comparison_date_from=" . date('YmdHis', strtotime($this->_ranges['interval_' . $interval]['comparison_from_date'])) . "&comparison_date_to=" . date('YmdHis', strtotime($this->_ranges['interval_' . $interval]['comparison_to_date'])) . "&receive_date_from=" . date('YmdHis', strtotime($this->_ranges['interval_' . $interval]['from_date'])) . "&receive_date_to=" . date('YmdHis', strtotime($this->_ranges['interval_' . $interval]['to_date'])); $url = CRM_Report_Utils_Report::getNextUrl('contribute/aggregatedetails', $queryURL . "&behaviour_type_value=" . $this->_kpiSpecs[$kpiDetails[0]]['link_status'] . $queryURLYear, $this->_absoluteUrl, NULL, $this->_drilldownReport); $row[$year . '_link'] = $url; } } parent::alterDisplay($rows); }