Пример #1
0
 function postProcess()
 {
     $this->_params = $this->controller->exportValues($this->_name);
     if (empty($this->_params) && $this->_force) {
         $this->_params = $this->_formValues;
     }
     $this->_formValues = $this->_params;
     $this->processReportMode();
     $this->select();
     $this->from();
     $this->where();
     $this->groupBy();
     $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
     $dao = CRM_Core_DAO::executeQuery($sql);
     $rows = $graphRows = array();
     $count = 0;
     while ($dao->fetch()) {
         $row = array();
         foreach ($this->_columnHeaders as $key => $value) {
             $row[$key] = $dao->{$key};
         }
         if (!empty($this->_params['charts']) && $row['civicrm_contribution_receive_date_subtotal']) {
             $graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start'];
             $graphRows[$this->_interval][] = $row['civicrm_contribution_receive_date_interval'];
             $graphRows['value'][] = $row['civicrm_contribution_total_amount_sum'];
             $count++;
         }
         $rows[] = $row;
     }
     $this->formatDisplay($rows);
     $this->assign_by_ref('columnHeaders', $this->_columnHeaders);
     $this->assign_by_ref('rows', $rows);
     $this->assign('statistics', $this->statistics($rows));
     if (!empty($this->_params['charts'])) {
         foreach (array('receive_date', $this->_interval, 'value') as $ignore) {
             unset($graphRows[$ignore][$count - 1]);
         }
         // build chart.
         CRM_Utils_OpenFlashChart::chart($graphRows, $this->_params['charts'], $this->_interval);
     }
     parent::endPostProcess();
 }
Пример #2
0
 function postProcess()
 {
     $this->beginPostProcess();
     $this->_setVariable = TRUE;
     if (empty($this->_params['id_value'][0])) {
         $this->_params['id_value'] = array();
         $this->_setVariable = FALSE;
         $events = CRM_Event_PseudoConstant::event(NULL, NULL, "is_template IS NULL OR is_template = 0");
         if (empty($events)) {
             return FALSE;
         }
         foreach ($events as $key => $dnt) {
             $this->_params['id_value'][] = $key;
         }
     }
     $this->_rowsFound = count($this->_params['id_value']);
     //set pager and limit if output mode is html
     if ($this->_outputMode == 'html') {
         $this->limit();
         $this->setPager();
         $showEvents = array();
         $count = 0;
         $numRows = $this->_limit;
         while ($count < self::ROW_COUNT_LIMIT) {
             if (!isset($this->_params['id_value'][$numRows])) {
                 break;
             }
             $showEvents[] = $this->_params['id_value'][$numRows];
             $count++;
             $numRows++;
         }
         $this->buildEventReport($showEvents);
     } else {
         $this->buildEventReport($this->_params['id_value']);
     }
     parent::endPostProcess();
 }
Пример #3
0
 function endPostProcess(&$rows = NULL)
 {
     $csvRows = array();
     $count = 0;
     foreach ($rows as $year => $yearlyRecord) {
         foreach ($yearlyRecord as $month => $monthlyrecord) {
             if (!array_key_exists('contacts', $monthlyrecord)) {
                 continue;
             }
             foreach ($monthlyrecord['contacts'] as $contact_id => $record) {
                 $csvRows[$count]['year'] = $year;
                 $csvRows[$count]['month'] = $monthlyrecord['month_name'];
                 $csvRows[$count]['contact_id'] = $contact_id;
                 $csvRows[$count]['individual'] = CRM_Contact_BAO_Contact::displayName($contact_id);
                 for ($i = 1; $i <= 31; $i++) {
                     $csvRows[$count]['day_' . $i] = "";
                 }
                 foreach ($record as $day => $dayRecord) {
                     if ($day == 'link') {
                         continue;
                     }
                     if (array_key_exists($dayRecord['activity_type_id'], $this->activityTypes)) {
                         $csvRows[$count]['day_' . $day] = $this->activityTypes[$dayRecord['activity_type_id']];
                     } else {
                         $csvRows[$count]['day_' . $day] = $dayRecord['activity_type_id'];
                     }
                 }
                 $count++;
             }
         }
     }
     parent::endPostProcess($csvRows);
 }