1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
*/
|
6
|
|
7
|
define('LDAP_QUERY_MENU_BASE_PATH', 'admin/config/people/ldap');
|
8
|
define('LDAP_QUERY_INDEX_BASE_PATH', 'admin/config/people/ldap/query');
|
9
|
// For argument offsets.
|
10
|
define('LDAP_QUERY_MENU_BASE_PATH_PARTS', 4);
|
11
|
|
12
|
/**
|
13
|
*
|
14
|
*/
|
15
|
function ldap_query_menu() {
|
16
|
$menu_offset = 4;
|
17
|
|
18
|
$items['admin/config/people/ldap/query'] = [
|
19
|
'title' => 'Queries',
|
20
|
'page callback' => 'ldap_query_index',
|
21
|
'page arguments' => [],
|
22
|
'weight' => 6,
|
23
|
'type' => MENU_LOCAL_TASK,
|
24
|
'access arguments' => ['administer site configuration'],
|
25
|
'file' => 'ldap_query.admin.inc',
|
26
|
];
|
27
|
|
28
|
$items['admin/config/people/ldap/query/list'] = [
|
29
|
'title' => 'Queries',
|
30
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
31
|
];
|
32
|
|
33
|
$items['admin/config/people/ldap/query/add'] = [
|
34
|
'title' => 'Add LDAP Query',
|
35
|
'page callback' => 'drupal_get_form',
|
36
|
'page arguments' => ['ldap_query_admin_form', 'add'],
|
37
|
'type' => MENU_LOCAL_TASK + MENU_CONTEXT_INLINE,
|
38
|
'weight' => 3,
|
39
|
'access arguments' => ['administer site configuration'],
|
40
|
'file' => 'ldap_query.admin.inc',
|
41
|
];
|
42
|
|
43
|
$items['admin/config/people/ldap/query/edit/%'] = [
|
44
|
'title' => 'Edit LDAP Query',
|
45
|
'page callback' => 'drupal_get_form',
|
46
|
'page arguments' => ['ldap_query_admin_form', 'edit', $menu_offset + 2],
|
47
|
'access arguments' => ['administer site configuration'],
|
48
|
'file' => 'ldap_query.admin.inc',
|
49
|
];
|
50
|
|
51
|
$items['admin/config/people/ldap/query/test/%'] = [
|
52
|
'title' => 'Test LDAP Query',
|
53
|
'page callback' => 'ldap_query_test',
|
54
|
'page arguments' => [$menu_offset + 2],
|
55
|
'access arguments' => ['administer site configuration'],
|
56
|
'file' => 'ldap_query.admin.inc',
|
57
|
];
|
58
|
|
59
|
$items['admin/config/people/ldap/query/delete/%'] = [
|
60
|
'title' => 'Delete LDAP Query',
|
61
|
'page callback' => 'drupal_get_form',
|
62
|
'page arguments' => ['ldap_query_admin_delete', $menu_offset + 1, $menu_offset + 2],
|
63
|
'access arguments' => ['administer site configuration'],
|
64
|
'file' => 'ldap_query.admin.inc',
|
65
|
];
|
66
|
|
67
|
$items['admin/config/people/ldap/query/enable/%'] = [
|
68
|
'title' => 'Enable LDAP Query',
|
69
|
'page callback' => 'drupal_get_form',
|
70
|
'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
|
71
|
'access arguments' => ['administer site configuration'],
|
72
|
'file' => 'ldap_query.admin.inc',
|
73
|
];
|
74
|
|
75
|
$items['admin/config/people/ldap/query/disable/%'] = [
|
76
|
'title' => 'Enable LDAP Query',
|
77
|
'page callback' => 'drupal_get_form',
|
78
|
'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
|
79
|
'access arguments' => ['administer site configuration'],
|
80
|
'file' => 'ldap_query.admin.inc',
|
81
|
];
|
82
|
|
83
|
return $items;
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
*
|
88
|
*/
|
89
|
function ldap_query_theme() {
|
90
|
return [
|
91
|
'ldap_query_list' => [
|
92
|
'variables' => ['ldap_query' => NULL, 'actions' => TRUE, 'type' => 'table'],
|
93
|
'render element' => 'element',
|
94
|
'file' => 'ldap_query.theme.inc',
|
95
|
],
|
96
|
'ldap_query' => [
|
97
|
'variables' => ['ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'],
|
98
|
'render element' => 'element',
|
99
|
'file' => 'ldap_query.theme.inc',
|
100
|
],
|
101
|
'ldap_query_results' => [
|
102
|
'variables' => ['ldap_query' => NULL, 'result' => FALSE, 'show_query' => TRUE],
|
103
|
'render element' => 'element',
|
104
|
'file' => 'ldap_query.theme.inc',
|
105
|
],
|
106
|
];
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
*
|
111
|
*/
|
112
|
function ldap_query_cache_clear() {
|
113
|
$discard = ldap_query_get_queries(NULL, 'all', FALSE, TRUE);
|
114
|
}
|
115
|
|
116
|
/**
|
117
|
* Return ldap query objects.
|
118
|
*
|
119
|
* @param string $qid
|
120
|
* @param string $type
|
121
|
* 'all', 'enabled',.
|
122
|
* @param bool $flatten
|
123
|
* signifies if array or single object returned. Only works if sid is specified.
|
124
|
* @param bool $reset
|
125
|
* do not use cached or static result.
|
126
|
*
|
127
|
* @return array
|
128
|
* of server conf object keyed on sid
|
129
|
* - single server conf object (if flatten == TRUE)
|
130
|
*/
|
131
|
function ldap_query_get_queries($qid = NULL, $type, $flatten = FALSE, $reset = FALSE) {
|
132
|
ldap_servers_module_load_include('inc', 'ldap_query', 'ldap_query');
|
133
|
return _ldap_query_get_queries($qid, $type, $flatten, $reset);
|
134
|
}
|
135
|
|
136
|
/**
|
137
|
*
|
138
|
*/
|
139
|
function ldap_query_fields() {
|
140
|
ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class');
|
141
|
return LdapQuery::fields();
|
142
|
}
|
143
|
|
144
|
/**
|
145
|
*
|
146
|
*/
|
147
|
function ldap_query_help($path, $arg) {
|
148
|
|
149
|
$help = '<h3>' . t('LDAP Query Module') . '</h3><p>' .
|
150
|
t('This module does nothing in and of itself. It should only be
|
151
|
enabled and configured if another module requires it.') . '</p>';
|
152
|
|
153
|
switch ($path) {
|
154
|
case 'admin/config/people/ldap/query':
|
155
|
$output = '<p>' . $help . '</p>';
|
156
|
return $output;
|
157
|
|
158
|
case 'admin/help#ldap_query':
|
159
|
$output = '<p>' . $help . '</p>';
|
160
|
return $output;
|
161
|
}
|
162
|
|
163
|
}
|