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