/** * Class constructor. */ public function __construct() { $this->_customGroupExtended['civicrm_event'] = array( 'extends' => array('Event'), 'filters' => TRUE, 'title' => ts('Event'), ); $this->_customGroupExtended['civicrm_participant'] = array( 'extends' => array('Participant'), 'filters' => TRUE, 'title' => ts('Participant'), ); $this->_columns = $this->getColumns('Event', array( 'fields' => FALSE, ) ) + $this->getColumns('Participant', array('fields' => FALSE,)) + $this->getColumns('Contact', array('fields' => FALSE,)); $this->_columns['civicrm_event']['fields']['id']['required'] = TRUE; $this->_columns['civicrm_event']['fields']['id']['alter_display'] = 'alterEventID'; $this->_columns['civicrm_event']['fields']['id']['title'] = 'Event'; $this->_aggregateRowFields = array( 'event:id' => 'Event', ); $this->_aggregateColumnHeaderFields = array( 'participant:status_id' => ts('Participant Status'), ); $this->_groupFilter = TRUE; parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_customGroupExtended['civicrm_contribution'] = array( 'extends' => array('Contribution'), 'filters' => TRUE, 'title' => ts('Contribution'), ); $this->_columns = $this->getColumns('Contribution', array( 'fields' => FALSE, )) + $this->_columns = $this->getColumns('Contact', array( 'fields' => FALSE, )) + $this->_columns = $this->getColumns('Address', array( 'fields' => FALSE, )); $this->_aggregateRowFields = array( 'contribution:contribution_campaign_id' => 'Campaign', 'address:address_county_id' => 'County', 'address:address_city' => 'City', 'contribution:contribution_financial_type_id' => 'Financial Type', ); $this->_aggregateColumnHeaderFields = array( 'contribution:contribution_financial_type_id' => 'Financial Type', 'contribution:contribution_campaign_id' => 'Campaign', ); parent::__construct(); }
/** * */ function __construct() { $this->_customGroupExtended['civicrm_activity'] = array( 'extends' => array('Activity'), 'filters' => TRUE, 'title' => ts('Activity'), ); $this->_columns = $this->getColumns('Activity', array( 'fields' => FALSE, ) )// + $this->getColumns('Contact', array()) ; // $this->_columns['civicrm_contact']['fields']['id']['required'] = true; // $this->_columns['civicrm_contact']['fields']['gender_id']['no_display'] = true; // $this->_columns['civicrm_contact']['fields']['gender_id']['title'] = 'Gender'; $this->_aggregateRowFields = array( 'activity:activity_activity_type_id' => 'Activity Type', 'activity:activity_activity_status_id' => 'Activity Status', 'activity:activity_result' => 'Activity Result', 'activity:activity_subject' => 'Activity Subject', // 'civicrm_contact_civireport:gender_id' => 'Gender', ); $this->_aggregateColumnHeaderFields = array( 'activity:activity_activity_type_id' => 'Activity Type', 'activity:activity_activity_status_id' => 'Activity Status', ); parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_templates = array( 'default' => 'default template', 'PhoneBank' => 'Phone Bank template - Phone.tpl', ); $this->_columns = $this->getColumns('Contact', array( 'fields' => TRUE, 'order_by' => FALSE, ) ) + $this->getColumns('Address', array( 'fields' => TRUE, 'order_by' => FALSE, ) ) + $this->getColumns('Email', array( 'fields' => TRUE, 'order_by' => FALSE, ) ) + $this->getColumns('LatestActivity', array( 'filters' => FALSE, 'fields' => array('activity_type' => array('title' => 'Latest Activity')), )) + $this->getColumns('Tag') + $this->getColumns('Phone'); $this->_columns['civicrm_contact']['fields']['id']['required'] = TRUE; $this->addTemplateSelector(); $this->_groupFilter = TRUE; parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_customGroupExtended['civicrm_membership'] = array( 'extends' => array('Membership'), 'filters' => TRUE, 'title' => ts('Membership'), ); $this->_columns = $this->getColumns('membership', array( 'fields' => FALSE, 'order_by' => FALSE, ) ) + $this->getColumns('contact', array( 'fields' => FALSE, 'order_by' => FALSE, ) ); $this->_columns['civicrm_membership']['fields']['id']['required'] = TRUE; $this->_aggregateRowFields = array( 'membership:membership_membership_type_id' => 'Membership Type', 'membership:membership_membership_status_id' => 'Membership Status', ); $this->_aggregateColumnHeaderFields = array( 'membership:membership_membership_type_id' => 'Membership Type', 'membership:membership_membership_status_id' => 'Membership Status', ); parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_columns = $this->getColumns('Event'); $this->_columns['civicrm_event']['fields']['id'] = array( 'title' => 'id', 'required' => TRUE, ); parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_columns = $this->getColumns('Contact', array( 'fields' => FALSE, 'order_by' => FALSE, ) ); $this->_columns['civicrm_contact']['fields']['id']['required'] = TRUE; parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_columns = $this->getColumns('Contact') + $this->getColumns('Contribution') + $this->getColumns('PriceField') + $this->getColumns('PriceFieldValue') + $this->getColumns('LineItem'); parent::__construct(); }
/** * Class constructor. */ public function __construct() { $this->_columns = $this->getColumns('Activity') + $this->getColumns('Contact', array('prefix' => 'target_',)); $this->_columns['civicrm_activity']['fields']['id'] = array( 'title' => 'id', 'required' => TRUE, ); parent::__construct(); }
/** * */ function __construct() { $this->_customGroupExtended['civicrm_case'] = array( 'extends' => array('Case'), 'filters' => TRUE, 'title' => ts('Case'), ); $this->_columns = $this->getColumns('Case', array( 'fields' => FALSE, ) ) + $this->getColumns('Contact', array()); $this->_columns['civicrm_case']['fields']['id']['required'] = TRUE; $this->_columns['civicrm_contact']['fields']['id']['required'] = TRUE; // $this->_columns['civicrm_case']['fields']['id']['alter_display'] = 'alterCaseID'; $this->_columns['civicrm_case']['fields']['id']['title'] = 'Case'; $this->_columns['civicrm_contact']['fields']['gender_id']['no_display'] = TRUE; $this->_columns['civicrm_contact']['fields']['gender_id']['title'] = 'Gender'; $this->_columns['civicrm_contact']['fields']['gender_id']['alter_display'] = 'alterGenderID'; $this->_columns['civicrm_case']['fields']['case_status_id']['title'] = ts('Case Status'); $this->_columns['civicrm_case']['fields']['case_status_id']['options'] = CRM_Case_BAO_Case::buildOptions('status_id'); $this->_columns['civicrm_contact']['fields']['case_status_id']['no_display'] = TRUE; $this->_columns['civicrm_case']['fields']['case_status_id']['name'] = 'status_id'; $this->_columns['civicrm_case']['filters']['case_is_deleted']['default'] = 0; $this->_aggregateRowFields = array( 'case_civireport:id' => 'Case', 'case_civireport:case_status_id' => 'Case Status', 'civicrm_contact_civireport:gender_id' => 'Gender', ); $this->_aggregateColumnHeaderFields = array( 'civicrm_contact_civireport:gender_id' => 'Gender', 'case_civireport:case_status_id' => 'Case Status', ); $this->_tagFilter = TRUE; $this->_groupFilter = TRUE; parent::__construct(); }
/** * */ function __construct() { $this->_customGroupExtended['civicrm_case'] = array( 'extends' => array('Case'), 'filters' => TRUE, 'title' => ts('Case'), ); $this->_customGroupExtended['civicrm_activity'] = array( 'extends' => array('Activity'), 'filters' => TRUE, 'title' => ts('Activity'), ); $this->_columns = $this->getColumns('Case', array( 'fields' => FALSE, ) ) + $this->getColumns('Contact', array()) + $this->_columns = $this->getColumns('Activity', array( 'fields' => FALSE, ) ); $this->_columns['civicrm_case']['fields']['id']['required'] = TRUE; $this->_columns['civicrm_contact']['fields']['id']['required'] = TRUE; // $this->_columns['civicrm_case']['fields']['id']['alter_display'] = 'alterCaseID'; $this->_columns['civicrm_case']['fields']['id']['title'] = 'Case'; $this->_columns['civicrm_contact']['fields']['gender_id']['no_display'] = TRUE; $this->_columns['civicrm_contact']['fields']['gender_id']['title'] = 'Gender'; $this->_aggregateRowFields = array( 'case_civireport:id' => 'Case', 'civicrm_contact_civireport:gender_id' => 'Gender', ); $this->_aggregateColumnHeaderFields = array( 'civicrm_contact_civireport:gender_id' => 'Gender', ); $this->_tagFilter = TRUE; $this->_groupFilter = TRUE; parent::__construct(); }
/** * @param $rows */ function alterDisplay(&$rows) { $contributionTypes = CRM_Contribute_PseudoConstant::financialType(); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); foreach ($rows as $rowNum => $row) { // convert display name to links if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row) ) { $url = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['civicrm_contact_id'], $this->_absoluteUrl ); $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url; $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts('View Contact Summary for this Contact.'); } // handle contribution status id if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) { $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = $contributionStatus[$value]; } // handle financial type id if ($value = CRM_Utils_Array::value('civicrm_line_item_financial_type_id', $row)) { $rows[$rowNum]['civicrm_line_item_financial_type_id'] = $contributionTypes[$value]; } if ($value = CRM_Utils_Array::value('civicrm_entity_financial_trxn_amount', $row)) { $rows[$rowNum]['civicrm_entity_financial_trxn_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_entity_financial_trxn_amount'], $rows[$rowNum]['civicrm_financial_trxn_currency']); } } parent::alterDisplay($rows); }
/** * Class constructor. */ public function __construct() { $this->_columns = $this->getColumns('Event', array()) + $this->getColumns('EventSummary'); parent::__construct(); }
/** * Alter row display. * * @param array $rows */ public function alterDisplay(&$rows) { // custom code to alter rows $entryFound = FALSE; $eventType = CRM_Core_OptionGroup::values('event_type'); $financialTypes = CRM_Contribute_PseudoConstant::financialType(); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument(); $honorTypes = CRM_Core_OptionGroup::values('honor_type', FALSE, FALSE, FALSE, NULL, 'label'); $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE)); foreach ($rows as $rowNum => $row) { // make count columns point to detail report // convert display name to links if (array_key_exists('civicrm_participant_event_id', $row)) { if ($value = $row['civicrm_participant_event_id']) { $rows[$rowNum]['civicrm_participant_event_id'] = CRM_Event_PseudoConstant::event($value, FALSE); $url = CRM_Report_Utils_Report::getNextUrl('event/income', 'reset=1&force=1&id_op=in&id_value=' . $value, $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); $rows[$rowNum]['civicrm_participant_event_id_link'] = $url; $rows[$rowNum]['civicrm_participant_event_id_hover'] = ts("View Event Income Details for this Event"); } $entryFound = TRUE; } // handle event type id if (array_key_exists('civicrm_event_event_type_id', $row)) { if ($value = $row['civicrm_event_event_type_id']) { $rows[$rowNum]['civicrm_event_event_type_id'] = $eventType[$value]; } $entryFound = TRUE; } // handle participant status id if (array_key_exists('civicrm_participant_status_id', $row)) { if ($value = $row['civicrm_participant_status_id']) { $rows[$rowNum]['civicrm_participant_status_id'] = CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label'); } $entryFound = TRUE; } // handle participant role id if (array_key_exists('civicrm_participant_role_id', $row)) { if ($value = $row['civicrm_participant_role_id']) { $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value); $value = array(); foreach ($roles as $role) { $value[$role] = CRM_Event_PseudoConstant::participantRole($role, FALSE); } $rows[$rowNum]['civicrm_participant_role_id'] = implode(', ', $value); } $entryFound = TRUE; } // Handle value separator in Fee Level if (array_key_exists('civicrm_participant_participant_fee_level', $row)) { if ($value = $row['civicrm_participant_participant_fee_level']) { CRM_Event_BAO_Participant::fixEventLevel($value); $rows[$rowNum]['civicrm_participant_participant_fee_level'] = $value; } $entryFound = TRUE; } // Convert display name to link if (($displayName = CRM_Utils_Array::value('civicrm_contact_sort_name', $row)) && ($cid = CRM_Utils_Array::value('civicrm_contact_id', $row)) && ($id = CRM_Utils_Array::value('civicrm_participant_participant_record', $row)) ) { $url = CRM_Report_Utils_Report::getNextUrl('contact/detail', "reset=1&force=1&id_op=eq&id_value=$cid", $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); $viewUrl = CRM_Utils_System::url("civicrm/contact/view/participant", "reset=1&id=$id&cid=$cid&action=view&context=participant" ); $contactTitle = ts('View Contact Details'); $participantTitle = ts('View Participant Record'); $rows[$rowNum]['civicrm_contact_sort_name'] = "<a title='$contactTitle' href=$url>$displayName</a>"; if ($this->_outputMode !== 'csv' && $this->_outputMode !== 'pdf' && $this->_outputMode !== 'print') { $rows[$rowNum]['civicrm_contact_sort_name'] .= "<span style='float: right;'> <a title='$participantTitle' href=$viewUrl> " . ts('View') . "</a></span>"; } $entryFound = TRUE; } // Handle country id if (array_key_exists('civicrm_address_country_id', $row)) { if ($value = $row['civicrm_address_country_id']) { $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, TRUE); } $entryFound = TRUE; } // Handle state/province id if (array_key_exists('civicrm_address_state_province_id', $row)) { if ($value = $row['civicrm_address_state_province_id']) { $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, TRUE); } $entryFound = TRUE; } // Handle employer id if (array_key_exists('civicrm_contact_employer_id', $row)) { if ($value = $row['civicrm_contact_employer_id']) { $rows[$rowNum]['civicrm_contact_employer_id'] = CRM_Contact_BAO_Contact::displayName($value); $url = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $value, $this->_absoluteUrl ); $rows[$rowNum]['civicrm_contact_employer_id_link'] = $url; $rows[$rowNum]['civicrm_contact_employer_id_hover'] = ts('View Contact Summary for this Contact.'); } } // Convert campaign_id to campaign title if (array_key_exists('civicrm_participant_campaign_id', $row)) { if ($value = $row['civicrm_participant_campaign_id']) { $rows[$rowNum]['civicrm_participant_campaign_id'] = $this->activeCampaigns[$value]; $entryFound = TRUE; } } // handle contribution status if (array_key_exists('civicrm_contribution_contribution_status_id', $row)) { if ($value = $row['civicrm_contribution_contribution_status_id']) { $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = $contributionStatus[$value]; } $entryFound = TRUE; } // handle payment instrument if (array_key_exists('civicrm_contribution_payment_instrument_id', $row)) { if ($value = $row['civicrm_contribution_payment_instrument_id']) { $rows[$rowNum]['civicrm_contribution_payment_instrument_id'] = $paymentInstruments[$value]; } $entryFound = TRUE; } // handle financial type if (array_key_exists('civicrm_contribution_financial_type_id', $row)) { if ($value = $row['civicrm_contribution_financial_type_id']) { $rows[$rowNum]['civicrm_contribution_financial_type_id'] = $financialTypes[$value]; } $entryFound = TRUE; } if (array_key_exists('civicrm_contribution_honor_type_id', $row)) { if ($value = $row['civicrm_contribution_honor_type_id']) { $rows[$rowNum]['civicrm_contribution_honor_type_id'] = $honorTypes[$value]; } $entryFound = TRUE; } if (array_key_exists('civicrm_contact_gender_id', $row)) { if ($value = $row['civicrm_contact_gender_id']) { $rows[$rowNum]['civicrm_contact_gender_id'] = $genders[$value]; } $entryFound = TRUE; } // display birthday in the configured custom format if (array_key_exists('civicrm_contact_birth_date', $row)) { if ($value = $row['civicrm_contact_birth_date']) { $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($row['civicrm_contact_birth_date'], '%Y%m%d'); } $entryFound = TRUE; } if (array_key_exists('civicrm_phone_phone', $row)) { $rows[$rowNum]['civicrm_phone_phone'] = $this->alterPhoneGroup($row['civicrm_phone_phone']); } // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { break; } } parent::alterDisplay($rows); }
/** * @param $rows */ function alterDisplay(&$rows) { parent::alterDisplay($rows); // custom code to alter rows $entryFound = TRUE; foreach ($rows as $rowNum => $row) { if (array_key_exists('civicrm_case_status_id', $row)) { if ($value = $row['civicrm_case_status_id']) { $this->case_statuses = CRM_Case_PseudoConstant::caseStatus(); $rows[$rowNum]['civicrm_case_status_id'] = $this->case_statuses[$value]; $entryFound = TRUE; } } if (array_key_exists('civicrm_contact_sort_name_a', $row) && array_key_exists('civicrm_contact_id', $row)) { $url = CRM_Report_Utils_Report::getNextUrl('contact/detail', 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'], $this->_absoluteUrl, $this->_id); $rows[$rowNum]['civicrm_contact_sort_name_a_link'] = $url; $rows[$rowNum]['civicrm_contact_sort_name_a_hover'] = ts("View Contact details for this contact."); $entryFound = TRUE; } if (array_key_exists('civicrm_contact_b_sort_name_b', $row) && array_key_exists('civicrm_contact_b_id', $row)) { $url = CRM_Report_Utils_Report::getNextUrl('contact/detail', 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_b_id'], $this->_absoluteUrl, $this->_id); $rows[$rowNum]['civicrm_contact_b_sort_name_b_link'] = $url; $rows[$rowNum]['civicrm_contact_b_sort_name_b_hover'] = ts("View Contact details for this contact."); $entryFound = TRUE; } // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { break; } } }
/** * */ function postProcess() { // get the acl clauses built before we assemble the query //@todo - find out why the parent doesn't do this - or if it now does $this->buildACLClause($this->_aliases['civicrm_contact']); parent::postProcess(); }
/** * @param $rows * * @return mixed */ function statistics(&$rows) { $statistics = parent::statistics($rows); if (!empty($rows)) { $select = " SELECT SUM({$this->_aliases['civicrm_pledge']}.amount ) as amount "; $sql = "{$select} {$this->_from } {$this->_where}"; $dao = CRM_Core_DAO::executeQuery($sql); if ($dao->fetch()) { $statistics['counts']['amount'] = array( 'value' => $dao->amount, 'title' => 'Total LifeTime', 'type' => CRM_Utils_Type::T_MONEY ); } } return $statistics; }
/** * Overriding this is the best way to alter the where statement for an individual field. * * @param array $field Field specifications * @param string $op Query operator (not an exact match to sql) * @param mixed $value * @param float $min * @param float $max * * @return null|string */ function whereClause(&$field, $op, $value, $min, $max) { if ($field['name'] =='start_date') { return( "pledge_civireport.contact_id NOT IN (SELECT distinct cont.id FROM civicrm_contact cont, civicrm_pledge pledge WHERE cont.id = pledge.contact_id AND YEAR (pledge.start_date) = $value AND pledge.is_test = 0 )" ); } return parent::whereClause($field, $op, $value, $min, $max); }
/** * Alter rows display. * * @param $rows */ public function alterDisplay(&$rows) { parent::alterDisplay($rows); }
/** * PreProcess function. */ public function preProcess() { parent::preProcess(); }