-
Notifications
You must be signed in to change notification settings - Fork 0
/
civiawards.php
199 lines (171 loc) · 5.31 KB
/
civiawards.php
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
/**
* @file
* CiviAwards Extension.
*/
require_once 'civiawards.civix.php';
/**
* Implements hook_civicrm_config().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
*/
function civiawards_civicrm_config(&$config) {
_civiawards_civix_civicrm_config($config);
Civi::dispatcher()->addListener(
'civi.api.prepare',
['CRM_CiviAwards_Event_Listener_AwardCaseFilter', 'onPrepare'],
10
);
Civi::dispatcher()->addListener(
'civi.api.authorize',
['CRM_CiviAwards_Event_Listener_AlterPermission', 'authorize'],
10
);
}
/**
* Implements hook_civicrm_install().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function civiawards_civicrm_install() {
_civiawards_civix_civicrm_install();
}
/**
* Implements hook_civicrm_enable().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
*/
function civiawards_civicrm_enable() {
_civiawards_civix_civicrm_enable();
}
/**
* Implements hook_civicrm_buildForm().
*/
function civiawards_civicrm_buildForm($formName, &$form) {
$hooks = [
new CRM_CiviAwards_Hook_BuildForm_SetCustomGroupSubTypeValues(),
new CRM_CiviAwards_Hook_BuildForm_AddFinanceManagementField(),
];
foreach ($hooks as $hook) {
$hook->run($form, $formName);
}
}
/**
* Implements hook_civicrm_buildForm().
*/
function civiawards_civicrm_postProcess($formName, &$form) {
$hooks = [
new CRM_CiviAwards_Hook_PostProcess_SaveFinanceManagement(),
new CRM_CiviAwards_Hook_PostProcess_EnableBankDetailsFieldSet(),
];
foreach ($hooks as $hook) {
$hook->run($form, $formName);
}
}
/**
* Implements hook_civicrm_apiWrappers().
*/
function civiawards_civicrm_apiWrappers(&$wrappers, $apiRequest) {
if ($apiRequest['entity'] == 'AwardDetail') {
$wrappers[] = new CRM_CiviAwards_Api_Wrapper_AwardDetailExtraFields();
}
if ($apiRequest['entity'] == 'AwardReviewPanel') {
$wrappers[] = new CRM_CiviAwards_Api_Wrapper_AwardReviewPanelFormatSettingFields();
}
}
/**
* Implements hook_civicrm_permission().
*/
function civiawards_civicrm_permission(&$permissions) {
// Add permission defined by this extension.
$permissions['access awards panel portal'] = [
ts('CiviAwards: Access awards panel portal'),
ts('Allows a user to access the awards panel portal'),
];
$permissions['access applicant portal'] = [
ts('CiviAwards: Access applicant portal'),
ts('Allows a user to access the awards applicant portal'),
];
$permissions['create/edit awards'] = [
ts('CiviAwards: Create/Edit awards'),
ts('Allows a user to create or edit awards'),
];
$permissions[CRM_CiviAwards_Hook_AlterAPIPermissions_Award::REVIEW_FIELD_SET_PERM] = [
ts('CiviAwards: Access review fields '),
ts(
"This allows the user to view any review field sets on the reserved review activity type.
Note that this can also be done through ACLs or allocating the user 'Access all custom data' permission"
),
];
$permissions[CRM_CiviAwards_Hook_AlterAPIPermissions_Award::PAYMENT_FIELD_SET_PERM] = [
ts('CiviAwards: Access Payment custom fields '),
ts(
"This allows the user to view any payment field sets on the related payment activity types.
Note that this can also be done through ACLs or allocating the user 'Access all custom data' permission"
),
];
}
/**
* Implements hook_civicrm_alterAPIPermissions().
*
* @link https://docs.civicrm.org/dev/en/master/hooks/hook_civicrm_alterAPIPermissions/
*/
function civiawards_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions) {
$hooks = [
new CRM_CiviAwards_Hook_AlterAPIPermissions_Award(),
];
foreach ($hooks as $hook) {
$hook->run($entity, $action, $params, $permissions);
}
}
/**
* Implements hook_civicrm_aclGroup().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_aclGroup/
*/
function civiawards_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
$hooks = [
new CRM_CiviAwards_Hook_AclGroup_AllowAccessToApplicantReviewGroups(),
new CRM_CiviAwards_Hook_AclGroup_AllowAccessToPaymentGroups(),
];
foreach ($hooks as $hook) {
$hook->run($type, $contactID, $tableName, $allGroups, $currentGroups);
}
}
/**
* Implements hook_civicrm_post().
*/
function civiawards_civicrm_post($op, $objectName, $objectId, &$objectRef) {
$hooks = [
new CRM_CiviAwards_Hook_Post_UpdateCaseTypeListForCustomGroup(),
];
foreach ($hooks as $hook) {
$hook->run($op, $objectName, $objectId, $objectRef);
}
}
/**
* Implements addCiviCaseDependentAngularModules().
*/
function civiawards_addCiviCaseDependentAngularModules(&$dependentModules) {
$dependentModules[] = "civiawards";
$hooks = [
new CRM_CiviAwardsPaymentsTab_Hook_AddCiviCaseDependentAngularModules_PaymentsTabModule(),
];
foreach ($hooks as $hook) {
$hook->run($dependentModules);
}
}
/**
* Implements addWorkflowDependentAngularModules().
*/
function civiawards_addWorkflowDependentAngularModules(&$dependentModules) {
$dependentModules[] = "civiawards-workflow";
}
/**
* Implements hook_civicrm_alterMenu().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterMenu
*/
function civiawards_civicrm_alterMenu(&$items) {
$items['civicrm/awardreview']['ids_arguments']['json'][] = 'civicase_reload';
}