Newer
Older
<?php
require_once 'nbrpanelconsentpack.civix.php';
// phpcs:disable
use CRM_Nbrpanelconsentpack_ExtensionUtil as E;
// phpcs:enable
/**
* Implements hook_civicrm_config().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
*/
function nbrpanelconsentpack_civicrm_config(&$config) {
_nbrpanelconsentpack_civix_civicrm_config($config);
}
/**
* Implements hook_civicrm_postProcess().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postProcess
*/
function nbrpanelconsentpack_civicrm_postProcess($formName, $form) {
if ($form instanceof CRM_Case_Form_Activity) {
// only if consent activity and create or edit
if ($form->_action == CRM_Core_Action::ADD || $form->_action == CRM_Core_Action::UPDATE) {
$activityTypeId = (int) $form->getVar('_activityTypeId');
if (CRM_Nbrpanelconsentpack_Utils::isValidActivityType($activityTypeId)) {
$contactId = (int) $form->getVar('_currentlyViewedContactId');
$activityId = (int) $form->getVar('_activityId');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/nbrpanelconsentpack/form/panelpacklink', 'reset=1&cid='
. $contactId . '&aid=' . $activityId . '&action=' . $form->_action, TRUE));
}
/**
* Implements hook_civicrm_buildForm().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm
*/
function nbrpanelconsentpack_civicrm_buildForm($formName, &$form) {
if ($form instanceof CRM_Case_Form_ActivityView) {
$activityId = (int) CRM_Utils_Request::retrieveValue('aid', "Integer");
$activityTypeId = CRM_Nbrpanelconsentpack_Utils::getActivityTypeId((int) $activityId);
if (CRM_Nbrpanelconsentpack_Utils::isValidActivityType($activityTypeId)) {
CRM_Nbrpanelconsentpack_BAO_ConsentPackLink::addPackLinksToView($form);
CRM_Nbrpanelconsentpack_BAO_ConsentPanelLink::addPanelLinksToView($form);
CRM_Core_Region::instance('page-body')->add(['template' => 'CRM/Nbrpanelconsentpack/ActivityViewLinks.tpl']);
}
if ($form instanceof CRM_Case_Form_Activity) {
CRM_Nbrpanelconsentpack_BAO_ConsentPanelLink::addPanelPackLinksToConsent($form);
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
/**
* Implements hook_civicrm_install().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function nbrpanelconsentpack_civicrm_install() {
_nbrpanelconsentpack_civix_civicrm_install();
}
/**
* Implements hook_civicrm_postInstall().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
*/
function nbrpanelconsentpack_civicrm_postInstall() {
_nbrpanelconsentpack_civix_civicrm_postInstall();
}
/**
* Implements hook_civicrm_uninstall().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
*/
function nbrpanelconsentpack_civicrm_uninstall() {
_nbrpanelconsentpack_civix_civicrm_uninstall();
}
/**
* Implements hook_civicrm_enable().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
*/
function nbrpanelconsentpack_civicrm_enable() {
_nbrpanelconsentpack_civix_civicrm_enable();
}
/**
* Implements hook_civicrm_disable().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
*/
function nbrpanelconsentpack_civicrm_disable() {
_nbrpanelconsentpack_civix_civicrm_disable();
}
/**
* Implements hook_civicrm_upgrade().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
*/
function nbrpanelconsentpack_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
return _nbrpanelconsentpack_civix_civicrm_upgrade($op, $queue);
}
/**
* Implements hook_civicrm_entityTypes().
*
* Declare entity types provided by this module.
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
*/
function nbrpanelconsentpack_civicrm_entityTypes(&$entityTypes) {
_nbrpanelconsentpack_civix_civicrm_entityTypes($entityTypes);
}
function nbrpanelconsentpack_civicrm_xmlMenu(&$files) {
foreach (glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
$files[] = $file;
}
}
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
// --- Functions below this ship commented out. Uncomment as required. ---
/**
* Implements hook_civicrm_preProcess().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_preProcess
*/
//function nbrpanelconsentpack_civicrm_preProcess($formName, &$form) {
//
//}
/**
* Implements hook_civicrm_navigationMenu().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu
*/
//function nbrpanelconsentpack_civicrm_navigationMenu(&$menu) {
// _nbrpanelconsentpack_civix_insert_navigation_menu($menu, 'Mailings', [
// 'label' => E::ts('New subliminal message'),
// 'name' => 'mailing_subliminal_message',
// 'url' => 'civicrm/mailing/subliminal',
// 'permission' => 'access CiviMail',
// 'operator' => 'OR',
// 'separator' => 0,
// ]);
// _nbrpanelconsentpack_civix_navigationMenu($menu);
//}