public function postProcess() { // get the acl clauses built before we assemble the query $this->buildACLClause($this->_aliases['civicrm_contact']); parent::postProcess(); }
public function preProcess() { parent::preProcess(); }
public function groupBy() { // We override this function because we use GROUP functions in the // SELECT clause, therefore we have to group by *something*. If the // user doesn't select a column to group by, we should group by participant id. parent::groupBy(); if (empty($this->_groupBy)) { $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id"; } }
/** * @param $rows * * @return array */ public function statistics(&$rows) { $statistics = parent::statistics($rows); $select = "\n SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,\n SUM( {$this->_aliases['civicrm_line_item']}.line_total ) as amount"; $sql = "{$select} {$this->_from} {$this->_where}"; $dao = CRM_Core_DAO::executeQuery($sql); if ($dao->fetch()) { $avg = 0; if ($dao->count && $dao->amount) { $avg = $dao->amount / $dao->count; } $statistics['counts']['count'] = array('value' => $dao->count, 'title' => ts('Total Participants'), 'type' => CRM_Utils_Type::T_INT); $statistics['counts']['amount'] = array('value' => $dao->amount, 'title' => ts('Total Income'), 'type' => CRM_Utils_Type::T_MONEY); $statistics['counts']['avg'] = array('value' => $avg, 'title' => ts('Average'), 'type' => CRM_Utils_Type::T_MONEY); } return $statistics; }
public function storeWhereHavingClauseArray() { parent::storeWhereHavingClauseArray(); $this->_whereClauses[] = "{$this->_aliases['civicrm_participant']}.is_test = 0"; }
/** * Form post process function. * * @return bool */ public function postProcess() { $this->beginPostProcess(); $this->_setVariable = TRUE; $noSelection = FALSE; if (empty($this->_params['id_value'])) { $this->_params['id_value'] = array(); $this->_setVariable = FALSE; $events = CRM_Event_PseudoConstant::event(NULL, NULL, "is_template = 0"); if (empty($events)) { return FALSE; } foreach ($events as $key => $dnt) { $this->_params['id_value'][] = $key; } $noSelection = TRUE; } elseif (!is_array($this->_params['id_value'])) { $this->_params['id_value'] = explode(',', $this->_params['id_value']); } $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; if (CRM_Utils_Array::value('id_op', $this->_params, 'in') == 'in' || $noSelection) { while ($count < self::ROW_COUNT_LIMIT) { if (!isset($this->_params['id_value'][$numRows])) { break; } $showEvents[] = $this->_params['id_value'][$numRows]; $count++; $numRows++; } } elseif ($this->_params['id_op'] == 'notin') { $events = CRM_Event_PseudoConstant::event(NULL, NULL, "is_template = 0"); $showEvents = array_diff(array_keys($events), $this->_params['id_value']); } $this->buildEventReport($showEvents); } else { $this->buildEventReport($this->_params['id_value']); } parent::endPostProcess(); }
public function groupBy() { // We override this function because we use GROUP functions in the // SELECT clause, therefore we have to group by *something*. If the // user doesn't select a column to group by, we should group by participant id. parent::groupBy(); if (empty($this->_groupBy)) { $this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, "{$this->_aliases['civicrm_participant']}.id"); } }