/**
* Report hooks that allow extending a particular report.
- * Example: Adding new tables to log reports
+ * Example: Adding new tables to log reports
*/
class CRM_Report_BAO_Hook {
return $this->_queryObjects;
}
+ /**
+ * @param $reportObj
+ * @param $logTables
+ */
public function alterLogTables(&$reportObj, &$logTables) {
foreach (self::getSearchQueryObjects() as $obj) {
$obj->alterLogTables($reportObj, $logTables);
}
}
+ /**
+ * @param $reportObj
+ * @param $table
+ *
+ * @return array
+ */
public function logDiffClause(&$reportObj, $table) {
$contactIdClause = $join = '';
foreach (self::getSearchQueryObjects() as $obj) {
list($cidClause, $joinClause) = $obj->logDiffClause($reportObj, $table);
- if ($joinClause)
+ if ($joinClause)
$join .= $joinClause;
- if ($cidClause)
+ if ($cidClause)
$contactIdClause .= $cidClause;
}
return array($contactIdClause, $join);
*/
class CRM_Report_BAO_HookInterface {
+ /**
+ * @param $reportObj
+ * @param $logTables
+ *
+ * @return null
+ */
public function alterLogTables(&$reportObj, &$logTables) {
return NULL;
}
- public function logDiffClause(&$reportObj, $table) {
+
+ /**
+ * @param $reportObj
+ * @param $table
+ *
+ * @return array
+ */public function logDiffClause(&$reportObj, $table) {
return array();
}
}
return $dao->delete();
}
+ /**
+ * @param $params
+ * @param $defaults
+ *
+ * @return CRM_Report_DAO_ReportInstance|null
+ */
static function retrieve($params, &$defaults) {
$instance = new CRM_Report_DAO_ReportInstance();
$instance->copyValues($params);
}
}
+ /**
+ * @param bool $freeze
+ *
+ * @return array
+ */
function setDefaultValues($freeze = TRUE) {
$freezeGroup = array();
return $this->_defaults;
}
+ /**
+ * @param $group
+ * @param $grpFieldName
+ *
+ * @return bool
+ */
function getElementFromGroup($group, $grpFieldName) {
$eleObj = $this->getElement($group);
foreach ($eleObj->_elements as $index => $obj) {
// a formrule function to ensure that fields selected in group_by
// (if any) should only be the ones present in display/select fields criteria;
// note: works if and only if any custom field selected in group_by.
+ /**
+ * @param $fields
+ * @param array $ignoreFields
+ *
+ * @return array
+ */
function customDataFormRule($fields, $ignoreFields = array( )) {
$errors = array();
if (!empty($this->_customGroupExtends) && $this->_customGroupGroupBy && !empty($fields['group_bys'])) {
// Note: $fieldName param allows inheriting class to build operationPairs
// specific to a field.
+ /**
+ * @param string $type
+ * @param null $fieldName
+ *
+ * @return array
+ */
function getOperationPair($type = "string", $fieldName = NULL) {
// FIXME: At some point we should move these key-val pairs
// to option_group and option_value table.
}
}
+ /**
+ * @param string $operator
+ *
+ * @return string
+ */
function getSQLOperator($operator = "like") {
switch ($operator) {
case 'eq':
}
}
+ /**
+ * @param $field
+ * @param $op
+ * @param $value
+ * @param $min
+ * @param $max
+ *
+ * @return null|string
+ */
function whereClause(&$field, $op,
$value, $min, $max
) {
return $clause;
}
+ /**
+ * @param $fieldName
+ * @param $relative
+ * @param $from
+ * @param $to
+ * @param null $type
+ * @param null $fromTime
+ * @param null $toTime
+ *
+ * @return null|string
+ */
function dateClause($fieldName,
$relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
) {
return NULL;
}
+ /**
+ * @param $relative
+ * @param $from
+ * @param $to
+ * @param null $fromtime
+ * @param null $totime
+ *
+ * @return array
+ */
function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) {
if (empty($totime)) {
$totime = '235959';
return array($from, $to);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
}
+ /**
+ * @param $rows
+ */
function alterCustomDataDisplay(&$rows) {
// custom code to alter rows having custom values
if (empty($this->_customGroupExtends)) {
}
}
+ /**
+ * @param $value
+ * @param $customField
+ * @param $fieldValueMap
+ *
+ * @return float|string
+ */
function formatCustomValues($value, $customField, $fieldValueMap) {
if (CRM_Utils_System::isNull($value)) {
return;
return $retValue;
}
+ /**
+ * @param $rows
+ */
function removeDuplicates(&$rows) {
if (empty($this->_noRepeats)) {
return;
}
}
+ /**
+ * @param $row
+ * @param $fields
+ * @param bool $subtotal
+ */
function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
foreach ($row as $colName => $colVal) {
if (in_array($colName, $fields)) {
}
}
+ /**
+ * @param $rows
+ *
+ * @return bool
+ */
function grandTotal(&$rows) {
if (!$this->_rollup || ($this->_rollup == '') ||
($this->_limit && count($rows) >= self::ROW_COUNT_LIMIT)
return TRUE;
}
+ /**
+ * @param $rows
+ * @param bool $pager
+ */
function formatDisplay(&$rows, $pager = TRUE) {
// set pager based on if any limit was applied in the query.
if ($pager) {
$this->alterCustomDataDisplay($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
// override this method for building charts.
}
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $tableName
+ * @param $tableKey
+ * @param $fieldName
+ * @param $field
+ *
+ * @return bool
+ */
function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
return FALSE;
}
}
+ /**
+ * @param bool $applyLimit
+ *
+ * @return string
+ */
function buildQuery($applyLimit = TRUE) {
$this->select();
$this->from();
$this->assign('sections', $this->_sections);
}
+ /**
+ * @return array
+ */
function unselectedSectionColumns() {
$selectColumns = array();
foreach ($this->_columns as $tableName => $table) {
}
}
+ /**
+ * @param $sql
+ * @param $rows
+ */
function buildRows($sql, &$rows) {
$dao = CRM_Core_DAO::executeQuery($sql);
if (!is_array($rows)) {
// use this method to modify $this->_columnHeaders
}
+ /**
+ * @param $rows
+ */
function doTemplateAssignment(&$rows) {
$this->assign_by_ref('columnHeaders', $this->_columnHeaders);
$this->assign_by_ref('rows', $rows);
}
// override this method to build your own statistics
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = array();
return $statistics;
}
+ /**
+ * @param $statistics
+ * @param $count
+ */
function countStat(&$statistics, $count) {
$statistics['counts']['rowCount'] = array('title' => ts('Row(s) Listed'),
'value' => $count,
}
}
+ /**
+ * @param $statistics
+ */
function groupByStat(&$statistics) {
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
}
}
+ /**
+ * @param $statistics
+ */
function filterStat(&$statistics) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
+ /**
+ * @param null $rows
+ */
function endPostProcess(&$rows = NULL) {
if ( $this->_storeResultSet ) {
$this->_resultSet = $rows;
$this->_storeResultSet = TRUE;
}
+ /**
+ * @return bool
+ */
function getResultSet() {
return $this->_resultSet;
}
* Get Template file name - use default form template if a specific one has not been set up for this report
*
*/
+ /**
+ * Use the form name to create the tpl file name
+ *
+ * @return string
+ * @access public
+ */
+ /**
+ * @return string
+ */
function getTemplateFileName(){
$defaultTpl = parent::getTemplateFileName();
$template = CRM_Core_Smarty::singleton();
*
* Although this function is super-short it is useful to keep separate so it can be over-ridden by report classes.
*/
+ /**
+ * @return string
+ */
function compileContent(){
$templateFile = $this->getHookedTemplateFileName();
return $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch($templateFile) . $this->_formValues['report_footer'];
$this->endPostProcess($rows);
}
+ /**
+ * @param int $rowCount
+ */
function limit($rowCount = self::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
}
}
+ /**
+ * @param int $rowCount
+ */
function setPager($rowCount = self::ROW_COUNT_LIMIT) {
// CRM-14115, over-ride row count if rowCount is specified in URL
}
}
+ /**
+ * @param $field
+ * @param $value
+ * @param $op
+ *
+ * @return string
+ */
function whereGroupClause($field, $value, $op) {
$smartGroupQuery = "";
{$smartGroupQuery} ) ";
}
+ /**
+ * @param $field
+ * @param $value
+ * @param $op
+ *
+ * @return string
+ */
function whereTagClause($field, $value, $op) {
// not using left join in query because if any contact
// belongs to more than one tag, results duplicate
WHERE entity_table = 'civicrm_contact' AND {$clause} ) ";
}
+ /**
+ * @param string $tableAlias
+ */
function buildACLClause($tableAlias = 'contact_a') {
list($this->_aclFrom, $this->_aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause($tableAlias);
}
+ /**
+ * @param bool $addFields
+ * @param array $permCustomGroupIds
+ */
function addCustomDataToColumns($addFields = TRUE, $permCustomGroupIds = array()) {
if (empty($this->_customGroupExtends)) {
return;
}
}
+ /**
+ * @param $prop
+ *
+ * @return bool
+ */
function isFieldSelected($prop) {
if (empty($prop)) {
return FALSE;
/*
* Do AlterDisplay processing on Address Fields
*/
+ /**
+ * @param $row
+ * @param $rows
+ * @param $rowNum
+ * @param $baseUrl
+ * @param $urltxt
+ *
+ * @return bool
+ */
function alterDisplayAddressFields(&$row, &$rows, &$rowNum, $baseUrl, $urltxt) {
$criteriaQueryParams = CRM_Report_Utils_Report::getPreviewCriteriaQueryParams($this->_defaults, $this->_params);
$entryFound = FALSE;
/*
* Adjusts dates passed in to YEAR() for fiscal year.
*/
+ /**
+ * @param $fieldName
+ *
+ * @return string
+ */
function fiscalYearOffset($fieldName) {
$config = CRM_Core_Config::singleton();
$fy = $config->fiscalYearStart;
}
+ /**
+ * @param $groupID
+ */
function add2group($groupID) {
if (is_numeric($groupID) && isset($this->_aliases['civicrm_contact'])) {
$select = "SELECT DISTINCT {$this->_aliases['civicrm_contact']}.id AS addtogroup_contact_id, ";
protected $_nonDisplayFields = array();
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
parent::__construct();
}
+ /**
+ * @param null $recordType
+ */
function select($recordType = NULL) {
if (!array_key_exists("contact_{$recordType}", $this->_params['fields']) && $recordType != 'final') {
$this->_nonDisplayFields[] = "civicrm_contact_contact_{$recordType}";
}
}
+ /**
+ * @param $recordType
+ */
function from($recordType) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$this->addAddressFromClause();
}
+ /**
+ * @param null $recordType
+ */
function where($recordType = NULL) {
$this->_where = " WHERE {$this->_aliases['civicrm_activity']}.is_test = 0 AND
{$this->_aliases['civicrm_activity']}.is_deleted = 0 AND
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_activity']}.id";
}
+ /**
+ * @param string $tableAlias
+ */
function buildACLClause($tableAlias = 'contact_a') {
//override for ACL( Since Contact may be source
//contact/assignee or target also it may be null )
$this->_aclWhere = NULL;
}
+ /**
+ * @param $groupID
+ *
+ * @throws Exception
+ */
function add2group($groupID) {
if (CRM_Utils_Array::value("contact_target_op", $this->_params) == 'nll') {
CRM_Core_Error::fatal(ts('Current filter criteria didn\'t have any target contact to add to group'));
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
protected $_emailField = FALSE;
protected $_phoneField = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
}
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
function formRule($fields, $files, $self) {
$errors = array();
$contactFields = array('sort_name', 'email', 'phone');
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
private static $_surveyRespondentStatus;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
//filter options for survey activity status.
$responseStatus = array('' => '- Any -');
}
+ /**
+ * @return bool|mixed|null|string
+ */
private function _surveyCoverSheet() {
$coverSheet = NULL;
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
return $coverSheet;
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
//format the survey result data.
}
}
+ /**
+ * @param $rows
+ */
private function _formatSurveyResult(&$rows) {
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['result']) ||
}
}
+ /**
+ * @param $rows
+ */
private function _formatSurveyResponseData(&$rows) {
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
protected $_emailField = FALSE;
protected $_phoneField = FALSE;
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
}
}
+ /**
+ * @param $fname
+ * @param $val
+ *
+ * @return null|string
+ */
function getCustomFieldLabel($fname, $val) {
$query = "
SELECT v.label
protected $_caseDetailExtra = array(
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->case_statuses = CRM_Case_PseudoConstant::caseStatus();
$this->case_types = CRM_Case_PseudoConstant::caseType();
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_case']}.id";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
$entryFound = FALSE;
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
protected $_summary = NULL;
protected $_relField = FALSE;
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->case_types = CRM_Case_PseudoConstant::caseType();
$this->case_statuses = CRM_Case_PseudoConstant::caseStatus();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
if (empty($fields['relationship_type_id_value']) && (array_key_exists('sort_name', $fields['fields']) || array_key_exists('label_b_a', $fields['fields']))) {
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
*
*/
class CRM_Report_Form_Case_TimeSpent extends CRM_Report_Form {
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
parent::postProcess();
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['group_bys']) &&
return $errors;
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
protected $_customGroupExtends = array(
'Contact', 'Individual', 'Household', 'Organization');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
'dao' => 'CRM_Core_DAO_Phone',
'fields' =>
array(
- 'phone' => NULL,
+ 'phone' => NULL,
'phone_ext' =>
array(
'title' => ts('Phone Extension')
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
return $errors;
$this->_where .= " GROUP BY {$this->_aliases['civicrm_contact']}.id ";
}
+ /**
+ * @return array
+ */
function clauseComponent() {
$selectedContacts = implode(',', $this->_contactSelected);
$contribution = $membership = $participant = NULL;
return $rows;
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = array();
}
//Override to set limit is 10
+ /**
+ * @param int $rowCount
+ */
function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
}
//Override to set pager with limit is 10
+ /**
+ * @param int $rowCount
+ */
function setPager($rowCount = self::ROW_COUNT_LIMIT) {
parent::setPager($rowCount);
}
$this->endPostProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
}
}
+ /**
+ * @param $componentRows
+ */
function alterComponentDisplay(&$componentRows) {
// custom code to alter rows
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
class CRM_Report_Form_Contact_Log extends CRM_Report_Form {
protected $_summary = NULL;
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
";
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
*
*/
class CRM_Report_Form_Contact_LoggingDetail extends CRM_Logging_ReportDetail {
+ /**
+ *
+ */
function __construct() {
$logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contact';
*
*/
class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
+ /**
+ *
+ */
function __construct() {
parent::__construct();
);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
$isDeleted = array();
$rows = $newRows;
}
+ /**
+ * @param null $logTable
+ */
function from( $logTable = null ) {
static $entity = null;
if ( $logTable ) {
'Relationship');
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$contact_type = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '_');
'alias' => 'phone_a',
'fields' =>
array(
- 'phone_a' =>
+ 'phone_a' =>
array(
'title' => ts('Phone (Contact A)'),
'name' => 'phone',
),
- 'phone_ext_a' =>
+ 'phone_ext_a' =>
array(
'title' => ts('Phone Ext (Contact A)'),
'name' => 'phone_ext',
'alias' => 'phone_b',
'fields' =>
array(
- 'phone_b' =>
+ 'phone_b' =>
array(
'title' => ts('Phone (Contact B)'),
'name' => 'phone'
),
- 'phone_ext_b' =>
+ 'phone_ext_b' =>
array(
'title' => ts('Phone Ext (Contact B)'),
'name' => 'phone_ext'
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
'dao' => 'CRM_Core_DAO_Phone',
'fields' =>
array(
- 'phone' => NULL,
+ 'phone' => NULL,
'phone_ext' =>
array(
'title' => ts('Phone Extension')
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_customGroupExtends = array(
'Membership');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
parent::postProcess();
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
return $statistics;
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
protected $_customGroupExtends = array( 'Contribution');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
}
}
+ /**
+ * @param bool $softcredit
+ */
function from($softcredit = FALSE) {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_contribution']}.id ";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
protected $_yearStatisticsFrom = '';
protected $_yearStatisticsTo = '';
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$yearsInPast = 4;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0);
}
//Override to set limit is 10
+ /**
+ * @param int $rowCount
+ */
function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
}
//Override to set pager with limit is 10
+ /**
+ * @param int $rowCount
+ */
function setPager($rowCount = self::ROW_COUNT_LIMIT) {
parent::setPager($rowCount);
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$count = 0;
return $statistics;
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['this_year_value']) && !empty($fields['other_year_value']) &&
}
}
+ /**
+ * @param $rows
+ */
function buildRows(&$rows) {
$contactIds = array();
}
}
+ /**
+ * @param $contactIds
+ *
+ * @return array
+ */
function buildContributionRows($contactIds) {
$rows = array();
if (empty($contactIds)) {
return $rows;
}
+ /**
+ * @param $contactIds
+ *
+ * @return array
+ */
function buildRelationshipRows($contactIds) {
$relationshipRows = $relatedContactIds = array();
if (empty($contactIds)) {
}
// Override "This Year" $op options
+ /**
+ * @param string $type
+ * @param null $fieldName
+ *
+ * @return array
+ */
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'this_year' || $fieldName == 'other_year') {
return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
return parent::getOperationPair($type, $fieldName);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
if (empty($rows)) {
return;
protected $_summary = NULL;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
self::validRelationships();
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_household']}.household_name, {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$type = substr($this->_params['relationship_type_id_value'], -3);
*
*/
class CRM_Report_Form_Contribute_LoggingDetail extends CRM_Logging_ReportDetail {
+ /**
+ *
+ */
function __construct() {
$logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contribution';
*
*/
class CRM_Report_Form_Contribute_LoggingSummary extends CRM_Logging_ReportSummary {
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact_altered_contact' => array(
parent::__construct();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
$isDeleted = array();
protected $lifeTime_from = NULL;
protected $lifeTime_where = NULL;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$yearsInPast = 10;
$yearsInFuture = 1;
$this->assign('chartSupported', TRUE);
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
if (!empty($rows)) {
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$graphRows = array();
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
}
// Override "This Year" $op options
+ /**
+ * @param string $type
+ * @param null $fieldName
+ *
+ * @return array
+ */
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
protected $_summary = NULL;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
self::validRelationships();
$config = CRM_Core_Config::singleton();
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_organization']}.organization_name, {$this->_aliases['civicrm_relationship']}.$this->orgContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$type = substr($this->_params['relationship_type_id_value'], -3);
*
*/
class CRM_Report_Form_Contribute_PCP extends CRM_Report_Form {
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
);
return $statistics;
}
+
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
parent::preProcess();
}
+ /**
+ * @param bool $freeze
+ *
+ * @return array
+ */
function setDefaultValues($freeze = TRUE) {
return parent::setDefaultValues($freeze);
}
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param bool $tableCol
+ */
function groupBy($tableCol = FALSE) {
$this->_groupBy = "";
if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys'])) {
ON $fromAlias.$fromCol = {$this->_aliases['civicrm_contribution']}2.$contriCol";
}
+ /**
+ * @param string $replaceAliasWith
+ *
+ * @return mixed|string
+ */
function whereContribution($replaceAliasWith = 'contribution1') {
$clauses = array("is_test" => "{$this->_aliases['civicrm_contribution']}.is_test = 0");
$this->_where = !empty($clauses) ? "WHERE " . implode(' AND ', $clauses) : '';
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
function formRule($fields, $files, $self) {
$errors = $checkDate = $errorCount = array();
return $errors;
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
list($from1, $to1) = $this->getFromTo(CRM_Utils_Array::value("receive_date1_relative", $this->_params),
);
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->_where .= " AND {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
parent::preProcess();
}
+ /**
+ * @param bool $freeze
+ *
+ * @return array
+ */
function setDefaultValues($freeze = TRUE) {
return parent::setDefaultValues($freeze);
}
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$graphRows = array();
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_add2groupSupported = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$yearsInPast = 10;
$yearsInFuture = 1;
function from() {
- $this->_from = "
+ $this->_from = "
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
$this->_groupBy = "Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " . self::fiscalYearOffset($this->_aliases['civicrm_contribution'] . '.receive_date') . " WITH ROLLUP ";
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$graphRows = array();
$count = 0;
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
}
// Override "This Year" $op options
+ /**
+ * @param string $type
+ * @param null $fieldName
+ *
+ * @return array
+ */
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
'pieChart' => 'Pie Chart',
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
$this->_select = " SELECT * FROM ( SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
$this->endPostProcess($rows);
}
+ /**
+ * @param $groupID
+ */
function add2group($groupID) {
if (is_numeric($groupID)) {
}
}
+ /**
+ * @param int $rowCount
+ */
function limit($rowCount = CRM_Report_Form::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
-
+
// CRM-14115, over-ride row count if rowCount is specified in URL
if ($this->_dashBoardRowCount) {
$rowCount = $this->_dashBoardRowCount;
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
protected $_add2groupSupported = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
parent::preProcess();
}
+ /**
+ * @param $eventIDs
+ */
function buildEventReport($eventIDs) {
$this->assign('events', $eventIDs);
$this->assign('statistics', $this->statistics($eventIDs));
}
+ /**
+ * @param $eventIDs
+ *
+ * @return array
+ */
function statistics(&$eventIDs) {
$statistics = array();
$count = count($eventIDs);
return $statistics;
}
+ /**
+ * @param int $rowCount
+ */
function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
$this->_limit = ($pageId - 1) * self::ROW_COUNT_LIMIT;
}
+ /**
+ * @param int $rowCount
+ */
function setPager($rowCount = self::ROW_COUNT_LIMIT) {
$params = array(
'total' => $this->_rowsFound,
public $_drilldownReport = array('event/participantlist' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
$this->_where = "WHERE " . implode(' AND ', $clauses);
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$this->_interval = 'events';
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
if (is_array($rows)) {
);
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
}
//Add The statistics
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
$entryFound = FALSE;
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
parent::__construct();
}
+ /**
+ * @return array
+ */
function getPriceLevels() {
$query = "
SELECT DISTINCT cv.label, cv.id
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
'Event');
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
}
//get participants information for events
+ /**
+ * @return array
+ */
function participantInfo() {
$statusType1 = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$this->_interval = 'events';
$countEvent = NULL;
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
if (is_array($rows)) {
protected $_customGroupExtends = array();
protected $_baseTable = 'civicrm_contact';
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
parent::__construct();
}
/*
* Define any from clauses in use (child classes to override)
*/
+ /**
+ * @return array
+ */
function fromClauses() {
return array();
}
parent::orderBy();
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
return parent::statistics($rows);
}
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
parent::alterDisplay($rows);
}
}
+ /**
+ * @return array
+ */
function getLineItemColumns() {
return array(
'civicrm_line_item' =>
);
}
+ /**
+ * @return array
+ */
function getPriceFieldValueColumns() {
return array(
'civicrm_price_field_value' =>
);
}
+ /**
+ * @return array
+ */
function getPriceFieldColumns() {
return array(
'civicrm_price_field' =>
);
}
+ /**
+ * @return array
+ */
function getParticipantColumns() {
static $_events = array();
if (!isset($_events['all'])) {
);
}
+ /**
+ * @return array
+ */
function getMembershipColumns() {
return array(
'civicrm_membership' => array(
);
}
+ /**
+ * @return array
+ */
function getMembershipTypeColumns() {
return array(
'civicrm_membership_type' => array(
);
}
+ /**
+ * @return array
+ */
function getEventColumns() {
return array(
'civicrm_event' => array(
);
}
+ /**
+ * @return array
+ */
function getContributionColumns() {
return array(
'civicrm_contribution' =>
);
}
+ /**
+ * @return array
+ */
function getContactColumns() {
return array(
'civicrm_contact' => array(
);
}
+ /**
+ * @return array
+ */
function getCaseColumns() {
return array(
'civicrm_case' => array(
* - defaults - (is this working?) values to pre-populate
* @return array address fields for construct clause
*/
+ /**
+ * 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
+ *
+ * @return array
+ */
function getAddressColumns($options = array()) {
$defaultOptions = array(
'prefix' => '',
/*
* Get Information about advertised Joins
*/
+ /**
+ * @return array
+ */
function getAvailableJoins() {
return array(
'priceFieldValue_from_lineItem' => array(
* 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 = '') {
$this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix . 'civicrm_address']}
ON {$this->_aliases[$prefix . 'civicrm_address']}.contact_id = {$this->_aliases[$prefix . 'civicrm_contact']}.id";
/*
* Retrieve text for financial type from pseudoconstant
*/
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return string
+ */
function alterNickName($value, &$row) {
if(empty($row['civicrm_contact_id'])){
return;
/*
* Retrieve text for contribution type from pseudoconstant
*/
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array|string
+ */
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
*/
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array
+ */
function alterContributionStatus($value, &$row) {
return CRM_Contribute_PseudoConstant::contributionStatus($value);
}
/*
* Retrieve text for payment instrument from pseudoconstant
*/
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array
+ */
function alterEventType($value, &$row) {
return CRM_Event_PseudoConstant::eventType($value);
}
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array|string
+ */
function alterEventID($value, &$row) {
return is_string(CRM_Event_PseudoConstant::event($value, FALSE)) ? CRM_Event_PseudoConstant::event($value, FALSE) : '';
}
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array|string
+ */
function alterMembershipTypeID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipType($value, FALSE)) ? CRM_Member_PseudoConstant::membershipType($value, FALSE) : '';
}
+ /**
+ * @param $value
+ * @param $row
+ *
+ * @return array|string
+ */
function alterMembershipStatusID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipStatus($value, FALSE)) ? CRM_Member_PseudoConstant::membershipStatus($value, FALSE) : '';
}
+ /**
+ * @param $value
+ * @param $row
+ * @param $selectedfield
+ * @param $criteriaFieldName
+ *
+ * @return array
+ */
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;
}
}
+ /**
+ * @param $value
+ * @param $row
+ * @param $selectedfield
+ * @param $criteriaFieldName
+ *
+ * @return array
+ */
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;
}
}
+ /**
+ * @param $value
+ * @param $row
+ * @param $selectedfield
+ * @param $criteriaFieldName
+ *
+ * @return array
+ */
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;
}
}
+ /**
+ * @param $value
+ * @param $row
+ * @param $fieldname
+ *
+ * @return mixed
+ */
function alterContactID($value, &$row, $fieldname) {
$row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $value, $this->_absoluteUrl);
return $value;
}
+ /**
+ * @param $value
+ *
+ * @return array
+ */
function alterParticipantStatus($value) {
if (empty($value)) {
return;
return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
}
+ /**
+ * @param $value
+ *
+ * @return string
+ */
function alterParticipantRole($value) {
if (empty($value)) {
return;
return implode(', ', $value);
}
+ /**
+ * @param $value
+ *
+ * @return mixed
+ */
function alterPaymentType($value) {
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
return $paymentInstruments[$value];
protected $_customGroupExtends = array(
'Grant');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
}
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_customGroupExtends = array('Grant');
protected $_add2groupSupported = FALSE;
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_grant' =>
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
$totalStatistics = $grantStatistics = array();
$totalStatistics = parent::statistics($rows);
}
}
+ /**
+ * @param $grantStatistics
+ * @param $fieldValue
+ * @param $values
+ * @param $awardedGrants
+ * @param $awardedGrantsAmount
+ * @param bool $customData
+ */
static function getStatistics(&$grantStatistics, $fieldValue, $values,
$awardedGrants, $awardedGrantsAmount, $customData = FALSE
) {
if (!$customData) {
- if (!isset($grantStatistics['value'][$fieldValue]['currency'][$currency])
+ if (!isset($grantStatistics['value'][$fieldValue]['currency'][$currency])
|| !isset($grantStatistics['value'][$fieldValue]['currency'][$currency]['value'])) {
$grantStatistics['value'][$fieldValue]['currency'][$currency]['value'] = 0;
}
$grantStatistics['value'][$fieldValue]['percentage'] = round(($grantStatistics['value'][$fieldValue]['count'] / $awardedGrants) * 100);
}
else {
- if (!isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency])
+ if (!isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency])
|| !isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'])) {
$grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] = 0;
- }
+ }
$grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] += $values['civicrm_grant_amount_total'];
$grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['percentage'] = round(($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] / $awardedGrantsAmount) * 100);
$grantStatistics['value'][$fieldValue]['unassigned_count']++;
*/
class CRM_Report_Form_Instance {
+ /**
+ * @param $form
+ */
static function buildForm(&$form) {
// we should not build form elements in dashlet mode
if ($form->_section) {
ts('CC'),
$attributes['email_subject']
);
-
+
$form->add('text',
'row_count',
ts('Limit Dashboard Results'),
array('maxlength' => 64,
'size' => 5
- )
+ )
);
-
+
$form->add('textarea',
'report_header',
ts('Report Header'),
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
+ /**
+ * @param $fields
+ * @param $errors
+ * @param $self
+ *
+ * @return array|bool
+ */
static function formRule($fields, $errors, $self) {
$buttonName = $self->controller->getButtonName();
$selfButtonName = $self->getVar('_instanceButtonName');
return empty($errors) ? TRUE : $errors;
}
+ /**
+ * @param $form
+ * @param $defaults
+ */
static function setDefaultValues(&$form, &$defaults) {
// we should not build form elements in dashlet mode
if ($form->_section) {
}
}
+ /**
+ * @param $form
+ * @param bool $redirect
+ */
static function postProcess(&$form, $redirect = TRUE) {
$params = $form->getVar('_params');
$instanceID = $form->getVar('_id');
'pieChart' => 'Pie Chart',
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
if (empty($rows)) {
return;
$this->assign('chartType', $this->_params['charts']);
}
+ /**
+ * @return array
+ */
function bounce_type() {
$data = array('' => '--Please Select--');
return $data;
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
'pieChart' => 'Pie Chart',
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
if (empty($rows)) {
return;
$this->assign('chartType', $this->_params['charts']);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_exposeContactID = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array();
$this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
}
+ /**
+ * @return array
+ */
function mailingList() {
$data = array();
return $data;
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
'pieChart' => 'Pie Chart',
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
if (empty($rows)) {
return;
$this->assign('chartType', $this->_params['charts']);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
public $campaignEnabled = False;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array();
parent::__construct();
}
+ /**
+ * @return array
+ */
function mailing_select() {
$data = array();
$this->endPostProcess($rows);
}
+ /**
+ * @return array
+ */
static function getChartCriteria() {
return array('count' => array('civicrm_mailing_event_delivered_delivered_count' => ts('Delivered'),
'civicrm_mailing_event_bounce_bounce_count' => ts('Bounce'),
);
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
function formRule($fields, $files, $self) {
$errors = array();
return $errors;
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
if (empty($rows)) {
return;
$this->assign('chartType', $this->_params['charts']);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_customGroupExtends = array(
'Contribution', 'Membership');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
}
}
+ /**
+ * @param bool $applyLimit
+ */
function tempTable($applyLimit = TRUE) {
// create temp table with contact ids,contribtuion id,membership id
$dropTempTable = 'DROP TABLE IF EXISTS civireport_membership_contribution_detail';
CRM_Core_DAO::executeQuery($fillTemp);
}
+ /**
+ * @param bool $applyLimit
+ *
+ * @return string
+ */
function buildQuery($applyLimit = TRUE) {
$this->select();
//create temp table to be used as base table
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
protected $_customGroupExtends = array('Membership', 'Contribution');
protected $_customGroupGroupBy = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
'Membership');
public $_drilldownReport = array('member/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_customGroupGroupBy = FALSE;
public $_drilldownReport = array('member/detail' => 'Link to Detail Report');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// UI for selecting columns to appear in the report list
// end of from
function where() {
- $this->_whereClauses[] = "{$this->_aliases['civicrm_membership']}.is_test = 0 AND
+ $this->_whereClauses[] = "{$this->_aliases['civicrm_membership']}.is_test = 0 AND
{$this->_aliases['civicrm_contact']}.is_deleted = 0";
parent::where();
}
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function buildChart(&$rows) {
$graphRows = array();
$count = 0;
$this->assign('chartType', $this->_params['charts']);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
'pieChart' => 'Pie Chart',
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// UI for selecting columns to appear in the report list
// array conatining the columns, group_bys and filters build and provided to Form
parent::preProcess();
}
+ /**
+ * @return array
+ */
function setDefaultValues() {
return parent::setDefaultValues();
}
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = array();
$statistics[] = array('title' => ts('Row(s) Listed'),
parent::endPostProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
'Pledge',
'Individual'
);
+
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
// Check if CiviCampaign is a) enabled and b) has active campaigns
/*
* If we are retrieving total paid we need to define the inclusion of pledge_payment
*/
+ /**
+ * @param $tableName
+ * @param $tableKey
+ * @param $fieldName
+ * @param $field
+ *
+ * @return bool|string
+ */
function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
if($fieldName == 'total_paid'){
$this->_totalPaid = TRUE; // add pledge_payment join
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
//regenerate the from field without extra left join on pledge payments
$this->endPostProcess($rows);
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_customGroupExtends = array(
'Pledge');
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
parent::PostProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $_addressField = FALSE;
protected $_emailField = FALSE;
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
}
}
+ /**
+ * @param $rows
+ *
+ * @return array
+ */
function statistics(&$rows) {
$statistics = parent::statistics($rows);
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$instanceInfo = array();
}
+ /**
+ * This virtual function is used to set the default values of
+ * various form elements
+ *
+ * access public
+ *
+ * @return array reference to the array of default values
+ *
+ */
+ /**
+ * @return array
+ */
function setDefaultValues() {
$defaults = array();
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addFormRule(array('CRM_Report_Form_Register', 'formRule'), $this);
}
+ /**
+ * @param $fields
+ * @param $files
+ * @param $self
+ *
+ * @return array
+ */
static function formRule($fields, $files, $self) {
$errors = array();
$dupeClass = FALSE;
'Contact', 'Individual', 'Household', 'Organization'
);
+ /**
+ *
+ */
+ /**
+ *
+ */
function __construct() {
$this->_columns = array(
'civicrm_contact' =>
parent::postProcess();
}
+ /**
+ * @param $rows
+ */
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
protected $keyword = 'report';
// docs inherited from interface
+ /**
+ * Provides base information about the component.
+ * Needs to be implemented in component's information
+ * class.
+ *
+ * @return array collection of required component settings
+ * @access public
+ *
+ */
+ /**
+ * @return array
+ */
public function getInfo() {
return array(
'name' => 'CiviReport',
// docs inherited from interface
+ /**
+ * Provides permissions that are used by component.
+ * Needs to be implemented in component's information
+ * class.
+ *
+ * NOTE: if using conditionally permission return,
+ * implementation of $getAllUnconditionally is required.
+ *
+ * @param bool $getAllUnconditionally
+ *
+ * @return array|null collection of permissions, null if none
+ * @access public
+ */
+ /**
+ * @param bool $getAllUnconditionally
+ *
+ * @return array|null
+ */
public function getPermissions($getAllUnconditionally = FALSE) {
return array('access CiviReport', 'access Report Criteria', 'administer reserved reports', 'administer Reports');
}
// docs inherited from interface
+ /**
+ * Provides information about user dashboard element
+ * offered by this component.
+ *
+ * @return array|null collection of required dashboard settings,
+ * null if no element offered
+ * @access public
+ *
+ */
+ /**
+ * @return array|null
+ */
public function getUserDashboardElement() {
// no dashboard element for this component
return NULL;
}
+ /**
+ * Provides component's user dashboard page object.
+ *
+ * @return mixed component's User Dashboard applet object
+ * @access public
+ *
+ */
+ /**
+ * @return mixed
+ */
public function getUserDashboardObject() {
// no dashboard element for this component
return NULL;
}
// docs inherited from interface
+ /**
+ * Provides information about user dashboard element
+ * offered by this component.
+ *
+ * @return array|null collection of required dashboard settings,
+ * null if no element offered
+ * @access public
+ *
+ */
+ /**
+ * @return array|null
+ */
public function registerTab() {
// this component doesn't use contact record tabs
return NULL;
}
// docs inherited from interface
+ /**
+ * Provides information about advanced search pane
+ * offered by this component.
+ *
+ * @return array|null collection of required pane settings,
+ * null if no element offered
+ * @access public
+ *
+ */
+ /**
+ * @return array|null
+ */
public function registerAdvancedSearchPane() {
// this component doesn't use advanced search
return NULL;
}
// docs inherited from interface
+ /**
+ * Provides potential activity types that this
+ * component might want to register in activity history.
+ * Needs to be implemented in component's information
+ * class.
+ *
+ * @return array|null collection of activity types
+ * @access public
+ *
+ */
+ /**
+ * @return array|null
+ */
public function getActivityTypes() {
return NULL;
}
// add shortcut to Create New
+ /**
+ * @param $shortCuts
+ */
public function creatNewShortcut(&$shortCuts) {}
}
*/
class CRM_Report_Page_List extends CRM_Core_Page {
+ /**
+ * @return array
+ */
public static function &info() {
$sql = "
SELECT v.id, v.value, v.label, v.description, v.component_id,
*/
class CRM_Report_Page_TemplateList extends CRM_Core_Page {
+ /**
+ * @param null $compID
+ * @param null $grouping
+ *
+ * @return array
+ */
public static function &info($compID = NULL, $grouping = NULL) {
$all = CRM_Utils_Request::retrieve('all', 'Boolean', CRM_Core_DAO::$_nullObject,
FALSE, NULL, 'GET'
*/
class CRM_Report_Utils_Get {
+ /**
+ * @param $name
+ * @param $type
+ *
+ * @return mixed|null
+ */
static function getTypedValue($name, $type) {
$value = CRM_Utils_Array::value($name, $_GET);
if ($value === NULL) {
);
}
+ /**
+ * @param $fieldName
+ * @param $field
+ * @param $defaults
+ */
static function dateParam($fieldName, &$field, &$defaults) {
// type = 12 (datetime) is not recognized by Utils_Type::escape() method,
// and therefore the below hack
}
}
+ /**
+ * @param $fieldName
+ * @param $field
+ * @param $defaults
+ */
static function stringParam($fieldName, &$field, &$defaults) {
$fieldOP = CRM_Utils_Array::value("{$fieldName}_op", $_GET, 'like');
}
}
+ /**
+ * @param $fieldName
+ * @param $field
+ * @param $defaults
+ */
static function intParam($fieldName, &$field, &$defaults) {
$fieldOP = CRM_Utils_Array::value("{$fieldName}_op", $_GET, 'eq');
}
}
+ /**
+ * @param $defaults
+ */
static function processChart(&$defaults) {
$chartType = CRM_Utils_Array::value("charts", $_GET);
if (in_array($chartType, array(
}
}
+ /**
+ * @param $fieldGrp
+ * @param $defaults
+ */
static function processFilter(&$fieldGrp, &$defaults) {
// process only filters for now
foreach ($fieldGrp as $tableName => $fields) {
}
//unset default filters
+ /**
+ * @param $defaults
+ */
static function unsetFilters(&$defaults) {
static $unsetFlag = TRUE;
if ($unsetFlag) {
}
}
+ /**
+ * @param $fieldGrp
+ * @param $defaults
+ */
static function processGroupBy(&$fieldGrp, &$defaults) {
// process only group_bys for now
$flag = FALSE;
}
}
+ /**
+ * @param $reportFields
+ * @param $defaults
+ */
static function processFields(&$reportFields, &$defaults) {
//add filters from url
if (is_array($reportFields)) {
*/
class CRM_Report_Utils_Report {
+ /**
+ * @param null $instanceID
+ *
+ * @return null|string
+ */
static function getValueFromUrl($instanceID = NULL) {
if ($instanceID) {
$optionVal = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance',
return $optionVal;
}
+ /**
+ * @param null $instanceID
+ *
+ * @return array|bool
+ */
static function getValueIDFromUrl($instanceID = NULL) {
$optionVal = self::getValueFromUrl($instanceID);
return FALSE;
}
+ /**
+ * @param $optionVal
+ *
+ * @return mixed
+ */
static function getInstanceIDForValue($optionVal) {
static $valId = array();
return $valId[$optionVal];
}
+ /**
+ * @param null $path
+ *
+ * @return mixed
+ */
static function getInstanceIDForPath($path = NULL) {
static $valId = array();
return CRM_Utils_Array::value($path, $valId);
}
+ /**
+ * @param $urlValue
+ * @param string $query
+ * @param bool $absolute
+ * @param null $instanceID
+ * @param array $drilldownReport
+ *
+ * @return bool|string
+ */
static function getNextUrl($urlValue, $query = 'reset=1', $absolute = FALSE, $instanceID = NULL, $drilldownReport = array()) {
if ($instanceID) {
$drilldownInstanceID = false;
}
// get instance count for a template
+ /**
+ * @param $optionVal
+ *
+ * @return int|null|string
+ */
static function getInstanceCount($optionVal) {
if (empty($optionVal)) return 0;
return $count;
}
+ /**
+ * @param $fileContent
+ * @param null $instanceID
+ * @param string $outputMode
+ * @param array $attachments
+ *
+ * @return bool
+ */
static function mailReport($fileContent, $instanceID = NULL, $outputMode = 'html', $attachments = array(
)) {
if (!$instanceID) {
return CRM_Utils_Mail::send($params);
}
+ /**
+ * @param $form
+ * @param $rows
+ */
static function export2csv(&$form, &$rows) {
//Mark as a CSV file.
header('Content-Type: text/csv');
return $csv;
}
+ /**
+ * @return mixed
+ */
static function getInstanceID() {
$config = CRM_Core_Config::singleton();
}
}
+ /**
+ * @return string
+ */
static function getInstancePath() {
$config = CRM_Core_Config::singleton();
$arg = explode('/', $_GET[$config->userFrameworkURLVar]);
}
}
+ /**
+ * @param $instanceId
+ *
+ * @return bool
+ */
static function isInstancePermissioned($instanceId) {
if (!$instanceId) {
return TRUE;
return TRUE;
}
+ /**
+ * @param $params
+ *
+ * @return array
+ */
static function processReport($params) {
$instanceId = CRM_Utils_Array::value('instanceId', $params);
return $query_string;
}
+ /**
+ * @param $reportUrl
+ *
+ * @return mixed
+ */
static function getInstanceList($reportUrl) {
static $instanceDetails = array();