<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
/**
*
*/
- /**
- *
- */
- function __construct() {
+ public function __construct() {
parent::__construct();
}
- function preProcess() {
+ /**
+ *
+ */
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ /**
+ *
+ */
+ public function select() {
parent::select();
}
- /*
+ /**
* From clause build where baseTable & fromClauses are defined
*/
- function from() {
+ public function from() {
if (!empty($this->_baseTable)) {
$this->buildACLClause($this->_aliases['civicrm_contact']);
$this->_from = "FROM {$this->_baseTable} {$this->_aliases[$this->_baseTable]}";
}
}
- /*
- * Define any from clauses in use (child classes to override)
- */
/**
+ * Define any from clauses in use (child classes to override)
+ *
* @return array
*/
- function fromClauses() {
+ public function fromClauses() {
return array();
}
- function groupBy() {
+ public function groupBy() {
parent::groupBy();
//@todo - need to re-visit this - bad behaviour from pa
if ($this->_groupBy == 'GROUP BY') {
}
}
- function orderBy() {
+ public function orderBy() {
parent::orderBy();
}
/**
- * @param $rows
+ * @param array $rows
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
return parent::statistics($rows);
}
- function postProcess() {
+ public function postProcess() {
if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) {
$this->buildACLClause($this->_aliases[$this->_aclTable]);
}
}
/**
- * @param $rows
+ * Alter display of rows.
+ *
+ * Iterate through the rows retrieved via SQL and make changes for display purposes,
+ * such as rendering contacts as links.
+ *
+ * @param array $rows
+ * Rows generated by SQL, with an array for each row.
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
parent::alterDisplay($rows);
//THis is all generic functionality which can hopefully go into the parent class
/**
* @return array
*/
- function getLineItemColumns() {
+ public function getLineItemColumns() {
return array(
'civicrm_line_item' => array(
'dao' => 'CRM_Price_BAO_LineItem',
/**
* @return array
*/
- function getPriceFieldValueColumns() {
+ public function getPriceFieldValueColumns() {
return array(
'civicrm_price_field_value' => array(
'dao' => 'CRM_Price_BAO_PriceFieldValue',
'title' => ts('Price Field Value Label'),
),
),
- 'group_bys' => //note that we have a requirement to group by label such that all 'Promo book' lines
+ 'group_bys' => //note that we have a requirement to group by label such that all 'Promo book' lines
// are grouped together across price sets but there may be a separate need to group
// by id so that entries in one price set are distinct from others. Not quite sure what
// to call the distinction for end users benefit
- array(
- 'price_field_value_label' => array(
- 'title' => ts('Price Field Value Label'),
- 'name' => 'label',
- ),
+ array(
+ 'price_field_value_label' => array(
+ 'title' => ts('Price Field Value Label'),
+ 'name' => 'label',
),
+ ),
),
);
}
/**
* @return array
*/
- function getPriceFieldColumns() {
+ public function getPriceFieldColumns() {
return array(
'civicrm_price_field' => array(
'dao' => 'CRM_Price_BAO_PriceField',
/**
* @return array
*/
- function getParticipantColumns() {
+ public function getParticipantColumns() {
static $_events = array();
if (!isset($_events['all'])) {
CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
'event_id' => array(
'title' => ts('Event'),
'default_weight' => '1',
- 'default_order' => 'ASC'
+ 'default_order' => 'ASC',
),
),
'group_bys' => array(
/**
* @return array
*/
- function getMembershipColumns() {
+ public function getMembershipColumns() {
return array(
'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
/**
* @return array
*/
- function getMembershipTypeColumns() {
+ public function getMembershipTypeColumns() {
return array(
'civicrm_membership_type' => array(
'dao' => 'CRM_Member_DAO_MembershipType',
/**
* @return array
*/
- function getEventColumns() {
+ public function getEventColumns() {
return array(
'civicrm_event' => array(
'dao' => 'CRM_Event_DAO_Event',
/**
* @return array
*/
- function getContributionColumns() {
+ public function getContributionColumns() {
return array(
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
/**
* @return array
*/
- function getContactColumns() {
+ public function getContactColumns() {
return array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'filters' => array(
'id' => array(
'title' => ts('Contact ID'),
- )
- ,
+ ),
'sort_name' => array(
'title' => ts('Contact Name'),
),
/**
* @return array
*/
- function getCaseColumns() {
+ public function getCaseColumns() {
return array(
'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
'fields' => array(
'id' => array(
'title' => ts('Case ID'),
- 'required' => FALSE
+ 'required' => FALSE,
),
'subject' => array(
'title' => ts('Case Subject'),
- 'default' => TRUE
+ 'default' => TRUE,
),
'status_id' => array(
'title' => ts('Status'),
- 'default' => TRUE
+ 'default' => TRUE,
),
'case_type_id' => array(
'title' => ts('Case Type'),
- 'default' => TRUE
+ 'default' => TRUE,
),
'case_start_date' => array(
'title' => ts('Case Start Date'),
'name' => 'start_date',
- 'default' => TRUE
+ 'default' => TRUE,
),
'case_end_date' => array(
'title' => ts('Case End Date'),
'name' => 'end_date',
- 'default' => TRUE
+ 'default' => TRUE,
),
'case_duration' => array(
'name' => 'duration',
'title' => ts('Duration (Days)'),
- 'default' => FALSE
+ 'default' => FALSE,
),
'case_is_deleted' => array(
'name' => 'is_deleted',
'title' => ts('Case Deleted?'),
'default' => FALSE,
- 'type' => CRM_Utils_Type::T_INT
- )
+ 'type' => CRM_Utils_Type::T_INT,
+ ),
),
'filters' => array(
'case_start_date' => array(
'title' => ts('Case End Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
- 'name' => 'end_date'
+ 'name' => 'end_date',
),
'case_type_id' => array(
'title' => ts('Case Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $this->case_types
+ 'options' => $this->case_types,
),
'case_status_id' => array(
'title' => ts('Case Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_statuses,
- 'name' => 'status_id'
+ 'name' => 'status_id',
),
'case_is_deleted' => array(
'title' => ts('Case Deleted?'),
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $this->deleted_labels,
'default' => 0,
- 'name' => 'is_deleted'
- )
- )
- )
+ 'name' => 'is_deleted',
+ ),
+ ),
+ ),
);
}
- /*
- * adding address fields to construct function in reports
- * @param array $options Options for the report
- * - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
- * - prefix_label optional prefix lable eg. "Honoree " for front end
- * - group_by enable these fields for group by - default false
- * - order_by enable these fields for order by
- * - filters enable these fields for filtering
- * - defaults - (is this working?) values to pre-populate
- * @return array address fields for construct clause
- */
/**
- * Get address columns to add to array
+ * Get address columns to add to array.
*
* @param array $options
- * - prefix Prefix to add to table (in case of more than one instance of the table)
- * - prefix_label Label to give columns from this address table instance
- *
- * @return array address columns definition
- */
- /**
- * @param array $options
+ * Options for the report.
+ * - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
+ * - prefix_label optional prefix lable eg. "Honoree " for front end
+ * - group_by enable these fields for group by - default false
+ * - order_by enable these fields for order by
+ * - filters enable these fields for filtering
+ * - defaults - (is this working?) values to pre-populate
*
* @return array
+ * address columns definition
*/
- function getAddressColumns($options = array()) {
+ public function getAddressColumns($options = array()) {
$defaultOptions = array(
'prefix' => '',
'prefix_label' => '',
'order_by' => TRUE,
'filters' => TRUE,
'defaults' => array(
- 'country_id' => TRUE
+ 'country_id' => TRUE,
),
);
'title' => ts($options['prefix_label'] . 'Street Number'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_number', $options['defaults'], FALSE),
- 'name' => 'street_number',
),
$options['prefix'] . 'street_name' => array(
'name' => 'street_name',
'title' => ts($options['prefix_label'] . 'Street Name'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_name', $options['defaults'], FALSE),
- 'name' => 'street_name',
),
$options['prefix'] . 'street_unit' => array(
'name' => 'street_unit',
'title' => ts($options['prefix_label'] . 'Street Unit'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_unit', $options['defaults'], FALSE),
- 'name' => 'street_unit',
),
$options['prefix'] . 'city' => array(
'title' => ts($options['prefix_label'] . 'City'),
return $addressFields;
}
- /*
- * Get Information about advertised Joins
- */
/**
+ * Get Information about advertised Joins.
+ *
* @return array
*/
- function getAvailableJoins() {
+ public function getAvailableJoins() {
return array(
'priceFieldValue_from_lineItem' => array(
'leftTable' => 'civicrm_line_item',
);
}
- /*
+ /**
* Add join from contact table to address. Prefix will be added to both tables
* as it's assumed you are using it to get address of a secondary contact
- */
- /**
+ *
* @param string $prefix
*/
- function joinAddressFromContact($prefix = '') {
+ public function joinAddressFromContact($prefix = '') {
$this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix .
'civicrm_address']}
ON {$this->_aliases[$prefix .
'civicrm_contact']}.id";
}
- function joinPriceFieldValueFromLineItem() {
+ public function joinPriceFieldValueFromLineItem() {
$this->_from .= " LEFT JOIN civicrm_price_field_value {$this->_aliases['civicrm_price_field_value']}
ON {$this->_aliases['civicrm_line_item']}.price_field_value_id = {$this->_aliases['civicrm_price_field_value']}.id";
}
- function joinPriceFieldFromLineItem() {
+ public function joinPriceFieldFromLineItem() {
$this->_from .= "
LEFT JOIN civicrm_price_field {$this->_aliases['civicrm_price_field']}
ON {$this->_aliases['civicrm_line_item']}.price_field_id = {$this->_aliases['civicrm_price_field']}.id
";
}
- /*
- * Define join from line item table to participant table
+ /**
+ * Define join from line item table to participant table.
*/
- function joinParticipantFromLineItem() {
+ public function joinParticipantFromLineItem() {
$this->_from .= " LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_participant']}.id
AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant')
";
}
- /*
+ /**
* Define join from line item table to Membership table. Seems to be still via contribution
* as the entity. Have made 'inner' to restrict does that make sense?
*/
- function joinMembershipFromLineItem() {
+ public function joinMembershipFromLineItem() {
$this->_from .= " INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_contribution']}.id
AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_contribution')
";
}
- /*
- * Define join from Participant to Contribution table
+ /**
+ * Define join from Participant to Contribution table.
*/
- function joinContributionFromParticipant() {
+ public function joinContributionFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_participant_payment pp
ON {$this->_aliases['civicrm_participant']}.id = pp.participant_id
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
";
}
- /*
- * Define join from Membership to Contribution table
+ /**
+ * Define join from Membership to Contribution table.
*/
- function joinContributionFromMembership() {
+ public function joinContributionFromMembership() {
$this->_from .= " LEFT JOIN civicrm_membership_payment pp
ON {$this->_aliases['civicrm_membership']}.id = pp.membership_id
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
";
}
- function joinParticipantFromContribution() {
+ public function joinParticipantFromContribution() {
$this->_from .= " LEFT JOIN civicrm_participant_payment pp
ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
ON pp.participant_id = {$this->_aliases['civicrm_participant']}.id";
}
- function joinMembershipFromContribution() {
+ public function joinMembershipFromContribution() {
$this->_from .= "
LEFT JOIN civicrm_membership_payment pp
ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
ON pp.membership_id = {$this->_aliases['civicrm_membership']}.id";
}
- function joinMembershipTypeFromMembership() {
+ public function joinMembershipTypeFromMembership() {
$this->_from .= "
LEFT JOIN civicrm_membership_type {$this->_aliases['civicrm_membership_type']}
ON {$this->_aliases['civicrm_membership']}.membership_type_id = {$this->_aliases['civicrm_membership_type']}.id
";
}
- function joinContributionFromLineItem() {
+ public function joinContributionFromLineItem() {
// this can be stored as a temp table & indexed for more speed. Not done at this state.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinLineItemFromContribution() {
+ public function joinLineItemFromContribution() {
// this can be stored as a temp table & indexed for more speed. Not done at this stage.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinLineItemFromMembership() {
+ public function joinLineItemFromMembership() {
// this can be stored as a temp table & indexed for more speed. Not done at this stage.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinContactFromParticipant() {
+ public function joinContactFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_participant']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinContactFromMembership() {
+ public function joinContactFromMembership() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinContactFromContribution() {
+ public function joinContactFromContribution() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinEventFromParticipant() {
+ public function joinEventFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
ON ({$this->_aliases['civicrm_event']}.id = {$this->_aliases['civicrm_participant']}.event_id ) AND
({$this->_aliases['civicrm_event']}.is_template IS NULL OR
{$this->_aliases['civicrm_event']}.is_template = 0)";
}
- /*
- * Retrieve text for financial type from pseudoconstant
- */
/**
+ * Retrieve text for financial type from pseudoconstant.
+ *
* @param $value
- * @param $row
+ * @param array $row
*
* @return string
*/
- function alterNickName($value, &$row) {
+ public function alterNickName($value, &$row) {
if (empty($row['civicrm_contact_id'])) {
- return;
+ return NULL;
}
$contactID = $row['civicrm_contact_id'];
return "<div id=contact-{$contactID} class='crm-entity'>
" . $value . "</span></div>";
}
- /*
- * Retrieve text for contribution type from pseudoconstant
- */
/**
+ * Retrieve text for contribution type from pseudoconstant.
+ *
* @param $value
- * @param $row
+ * @param array $row
*
* @return array|string
*/
- function alterContributionType($value, &$row) {
+ public function alterContributionType($value, &$row) {
return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
}
- /*
- * Retrieve text for contribution status from pseudoconstant
- */
/**
+ * Retrieve text for contribution status from pseudoconstant.
+ *
* @param $value
- * @param $row
+ * @param array $row
*
* @return array
*/
- function alterContributionStatus($value, &$row) {
+ public function alterContributionStatus($value, &$row) {
return CRM_Contribute_PseudoConstant::contributionStatus($value);
}
- /*
- * Retrieve text for payment instrument from pseudoconstant
- */
/**
+ * Retrieve text for payment instrument from pseudoconstant.
+ *
* @param $value
- * @param $row
+ * @param array $row
*
* @return array
*/
- function alterEventType($value, &$row) {
+ public function alterEventType($value, &$row) {
return CRM_Event_PseudoConstant::eventType($value);
}
/**
* @param $value
- * @param $row
+ * @param array $row
*
* @return array|string
*/
- function alterEventID($value, &$row) {
+ public function alterEventID($value, &$row) {
return is_string(CRM_Event_PseudoConstant::event($value, FALSE)) ? CRM_Event_PseudoConstant::event($value, FALSE) : '';
}
/**
* @param $value
- * @param $row
+ * @param array $row
*
* @return array|string
*/
- function alterMembershipTypeID($value, &$row) {
+ public function alterMembershipTypeID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipType($value, FALSE)) ? CRM_Member_PseudoConstant::membershipType($value, FALSE) : '';
}
/**
* @param $value
- * @param $row
+ * @param array $row
*
* @return array|string
*/
- function alterMembershipStatusID($value, &$row) {
+ public function alterMembershipStatusID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipStatus($value, FALSE)) ? CRM_Member_PseudoConstant::membershipStatus($value, FALSE) : '';
}
/**
* @param $value
- * @param $row
+ * @param array $row
* @param $selectedfield
* @param string $criteriaFieldName
*
* @return array
*/
- function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
/**
* @param $value
- * @param $row
+ * @param array $row
* @param $selectedfield
* @param string $criteriaFieldName
*
* @return array
*/
- function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
/**
* @param $value
- * @param $row
+ * @param array $row
* @param $selectedfield
* @param string $criteriaFieldName
*
* @return array
*/
- function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
/**
* @param $value
- * @param $row
+ * @param array $row
* @param string $fieldname
*
* @return mixed
*/
- function alterContactID($value, &$row, $fieldname) {
+ public function alterContactID($value, &$row, $fieldname) {
$row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view",
'reset=1&cid=' . $value, $this->_absoluteUrl);
return $value;
*
* @return array
*/
- function alterParticipantStatus($value) {
+ public function alterParticipantStatus($value) {
if (empty($value)) {
- return;
+ return NULL;
}
return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
}
/**
* @param $value
*
- * @return string
+ * @return string|void
*/
- function alterParticipantRole($value) {
+ public function alterParticipantRole($value) {
if (empty($value)) {
- return;
+ return NULL;
}
$roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
$value = array();
*
* @return mixed
*/
- function alterPaymentType($value) {
+ public function alterPaymentType($value) {
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
return $paymentInstruments[$value];
}
-}
+}