-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnodrilldown.php
More file actions
121 lines (111 loc) · 3.65 KB
/
nodrilldown.php
File metadata and controls
121 lines (111 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
require_once 'nodrilldown.civix.php';
/**
* Implements hook_civicrm_alterReportVar().
*
* @link
* http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterReportVar
*/
function nodrilldown_civicrm_alterReportVar($varType, &$var, &$object) {
if ($varType == 'rows') {
//WordPress URLs are constructed a bit differently - let's ID and modify accordingly.
$cms = CRM_Core_Config::singleton()->userFramework;
$separator = ($cms == 'WordPress' ? '&' : '?');
$doReplace = FALSE;
/* $pattern = '/civicrm\/report\/instance\/\d*(\?|&)reset=1&force=1&id_op=eq&id_value=/'; */
$pattern = '/civicrm(\/|%2F)report(\/|%2F)instance(\/|%2F)\d*(\?|&|&)reset=1(&|&)force=1(&|&)id_op=eq(&|&)id_value=/';
$replace = "civicrm/contact/view{$separator}reset=1&cid=";
$link = 'civicrm_contact_sort_name_link';
if ($object instanceOf CRM_Report_Form_Campaign_SurveyDetails) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contact_CurrentEmployer) {
$link = 'civicrm_employer_organization_name_link';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contact_Relationship) {
$link = 'civicrm_contact_sort_name_a_link';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contact_Summary) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_Sybunt) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_HouseholdSummary) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_Repeat) {
$link = 'contact_civireport_sort_name_link';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_Summary) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_History) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_SoftCredit) {
$link = 'civicrm_contact_display_name_constituent_link';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_OrganizationSummary) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_Lybunt) {
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Contribute_TopDonor) {
$link = 'civicrm_contact_display_name_link';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Event_ParticipantListing) {
$link = 'civicrm_contact_sort_name_linked';
$doReplace = TRUE;
}
if ($object instanceOf CRM_Report_Form_Member_Lapse) {
$doReplace = TRUE;
}
if ($doReplace) {
foreach ($var as $i => $row) {
if (array_key_exists($link, $row)) {
$var[$i][$link] = preg_replace($pattern, $replace, $row[$link]);
}
}
}
}
}
/**
* Implements hook_civicrm_config().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
*/
function nodrilldown_civicrm_config(&$config) {
_nodrilldown_civix_civicrm_config($config);
}
/**
* Implements hook_civicrm_install().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function nodrilldown_civicrm_install() {
_nodrilldown_civix_civicrm_install();
}
/**
* Implements hook_civicrm_enable().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
*/
function nodrilldown_civicrm_enable() {
_nodrilldown_civix_civicrm_enable();
}
/**
* Functions below this ship commented out. Uncomment as required.
*
/**
* Implements hook_civicrm_preProcess().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
*
*/