-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanagegroup.php
123 lines (114 loc) · 3.5 KB
/
managegroup.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
<?php
require_once 'managegroup.civix.php';
// phpcs:disable
use CRM_Managegroup_ExtensionUtil as E;
// phpcs:enable
/**
* Implements hook_civicrm_config().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
*/
function managegroup_civicrm_config(&$config) {
_managegroup_civix_civicrm_config($config);
}
/**
* Implements hook_civicrm_install().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function managegroup_civicrm_install() {
_managegroup_civix_civicrm_install();
}
/**
* Implements hook_civicrm_enable().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
*/
function managegroup_civicrm_enable() {
_managegroup_civix_civicrm_enable();
}
/**
* Implements hook_civicrm_entityTypes().
*
* Declare entity types provided by this module.
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
*/
function managegroup_civicrm_entityTypes(&$entityTypes) {
$entityTypes['CRM_Contact_DAO_Group']['fields_callback'][]
= function ($class, &$fields) {
$fields['inactive_date'] = [
'name' => 'inactive_date',
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('When Group should be Inactive'),
'description' => 'Date for settng Group Inactive.',
'required' => FALSE,
'where' => 'civicrm_group.inactive_date',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_DAO_Group',
'localizable' => 0,
];
$fields['inactive_action'] = [
'name' => 'inactive_action',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Action on Inactive'),
'description' => 'Action on Inactive',
'required' => FALSE,
'where' => 'civicrm_group.inactive_action',
'table_name' => 'civicrm_group',
'entity' => 'Group',
'bao' => 'CRM_Contact_DAO_Group',
'localizable' => 0,
'default' => '1',
'html' => [
'type' => 'Select',
],
'pseudoconstant' => [
'callback' => 'CRM_Managegroup_Utils::getInactiveAction',
],
];
};
}
function managegroup_civicrm_buildForm($formName, &$form) {
if ($formName == 'CRM_Group_Form_Edit' &&
($form->getAction() == CRM_Core_Action::ADD ||
$form->getAction() == CRM_Core_Action::UPDATE)) {
$list = CRM_Managegroup_Utils::getInactiveAction();
$form->add('datepicker', 'inactive_date', ts('InActive Date'), [], FALSE,
['time' => TRUE]);
$form->add('select', 'inactive_action', ts('InActive Action'), ['' =>
'- select -'] + $list, FALSE);
}
}
/**
* Implementation of hook_civicrm_links
*/
function managegroup_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &$values) {
if ($objectName == 'Group' && in_array($op, ['group.selector.row'])) {
$values['id'] = $objectId;
$links[] = [
'name' => ts('Associated Mailings'),
'url' => 'civicrm/group/mailinglist',
'qs' => 'reset=1&id=%%id%%',
'title' => ts('Associated Mailings'),
'extra' => "target='_blank'",
//'class' => ['no-popup'],
];
$links[] = [
'name' => ts('Associated Reminder'),
'url' => 'civicrm/group/reminderlist',
'qs' => 'reset=1&id=%%id%%',
'title' => ts('Associated Reminder'),
'extra' => "target='_blank'",
//'class' => ['no-popup'],
];
}
}
/**
* Implements hook_civicrm_check().
*/
function managegroup_civicrm_check(&$messages) {
$checks = new CRM_Managegroup_Check($messages);
$messages = $checks->checkRequirements();
}