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