Révision 32700c57
Ajouté par Assos Assos il y a environ 5 ans
drupal7/sites/all/modules/ldap/ldap_user/ldap_user.theme.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* theme functions for ldap_user module
|
|
5 |
* Theme functions for ldap_user module.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* turns array of variables to a form embedded in one table for each ldap server
|
|
9 |
* Turns array of variables to a form embedded in one table for each ldap server.
|
|
10 | 10 |
*/ |
11 | 11 |
function theme_ldap_user_conf_form($variables) { |
12 | 12 |
|
13 | 13 |
$form = $variables['form']; |
14 |
$tables = array();
|
|
14 |
$tables = [];
|
|
15 | 15 |
|
16 | 16 |
foreach ($form as $key => $element) { |
17 | 17 |
$parts = explode('__', $key); |
... | ... | |
19 | 19 |
list($direction, $discard, $column_name, $i) = $parts; |
20 | 20 |
$row = $element['#row']; |
21 | 21 |
$col = $element['#col']; |
22 |
$tables[$direction]['rows'][$row][$col] = array('data' => drupal_render($form[$key]), 'class' => array('module'), 'colspan' => 1);
|
|
22 |
$tables[$direction]['rows'][$row][$col] = ['data' => drupal_render($form[$key]), 'class' => ['module'], 'colspan' => 1];
|
|
23 | 23 |
} |
24 | 24 |
} |
25 | 25 |
|
... | ... | |
31 | 31 |
|
32 | 32 |
$direction_text = 'todrupal'; |
33 | 33 |
|
34 |
$header = array(
|
|
35 |
array(
|
|
34 |
$header = [
|
|
35 |
[
|
|
36 | 36 |
'data' => t('Remove'), |
37 | 37 |
'rowspan' => 1, |
38 |
'class' => 'mixedcase' |
|
39 |
),
|
|
40 |
array(
|
|
38 |
'class' => 'mixedcase',
|
|
39 |
],
|
|
40 |
[
|
|
41 | 41 |
'data' => t('Source LDAP Tokens. (See http://drupal.org/node/1245736) ') , |
42 | 42 |
'class' => 'mixedcase', |
43 | 43 |
'rowspan' => 1, |
44 | 44 |
'colspan' => 2, |
45 |
),
|
|
46 |
array(
|
|
45 |
],
|
|
46 |
[
|
|
47 | 47 |
'data' => t('Target Drupal Attribute'), |
48 | 48 |
'rowspan' => 1, |
49 | 49 |
'class' => 'mixedcase', |
50 |
), |
|
51 |
array('data' => t('When Should Attribute Be Synchronized to Drupal?'), |
|
50 |
], |
|
51 |
[ |
|
52 |
'data' => t('When Should Attribute Be Synchronized to Drupal?'), |
|
52 | 53 |
'colspan' => count($ldap_user_conf_admin->provisionsDrupalEvents), |
53 | 54 |
'rowspan' => 1, |
54 |
'class' => 'mixedcase' |
|
55 |
),
|
|
55 |
'class' => 'mixedcase',
|
|
56 |
],
|
|
56 | 57 |
|
57 |
);
|
|
58 |
];
|
|
58 | 59 |
|
59 |
$second_header = array( |
|
60 |
array('data' => t(''), |
|
61 |
'header' => TRUE, |
|
62 |
'class' => 'mixedcase', |
|
63 |
), |
|
64 |
array('data' => t('e.g: "[sn]", "[mail:0]", "[ou:last]", "[sn], [givenName]" etc. |
|
60 |
$second_header = [ |
|
61 |
[ |
|
62 |
'data' => t(''), |
|
63 |
'header' => TRUE, |
|
64 |
'class' => 'mixedcase', |
|
65 |
], |
|
66 |
[ |
|
67 |
'data' => t('e.g: "[sn]", "[mail:0]", "[ou:last]", "[sn], [givenName]" etc. |
|
65 | 68 |
Constants such as "17" or "imported" should not be enclosed in [].'), |
66 |
'header' => TRUE, |
|
67 |
'class' => 'mixedcase', |
|
68 |
), |
|
69 |
array('data' => t('Convert From Binary?'), |
|
70 |
'class' => 'mixedcase', |
|
71 |
'header' => TRUE |
|
72 |
), |
|
73 |
array('data' => "", |
|
74 |
'header' => TRUE, |
|
75 |
), |
|
76 |
); |
|
69 |
'header' => TRUE, |
|
70 |
'class' => 'mixedcase', |
|
71 |
], |
|
72 |
[ |
|
73 |
'data' => t('Convert From Binary?'), |
|
74 |
'class' => 'mixedcase', |
|
75 |
'header' => TRUE, |
|
76 |
], |
|
77 |
[ |
|
78 |
'data' => "", |
|
79 |
'header' => TRUE, |
|
80 |
], |
|
81 |
]; |
|
77 | 82 |
|
78 | 83 |
foreach ($ldap_user_conf_admin->provisionsDrupalEvents as $col_id => $col_name) { |
79 |
$second_header[] = array('data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase');
|
|
84 |
$second_header[] = ['data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase'];
|
|
80 | 85 |
} |
81 | 86 |
} |
82 |
else { // to ldap |
|
87 |
// To ldap. |
|
88 |
else { |
|
83 | 89 |
|
84 | 90 |
$direction_text = 'toldap'; |
85 | 91 |
|
86 |
$header = array(
|
|
87 |
array(
|
|
92 |
$header = [
|
|
93 |
[
|
|
88 | 94 |
'data' => t('Remove'), |
89 | 95 |
'rowspan' => 1, |
90 |
'class' => 'mixedcase' |
|
91 |
),
|
|
92 |
array(
|
|
96 |
'class' => 'mixedcase',
|
|
97 |
],
|
|
98 |
[
|
|
93 | 99 |
'data' => t('Source Drupal User Attribute') , |
94 | 100 |
'class' => 'mixedcase', |
95 | 101 |
'rowspan' => 1, |
96 | 102 |
'colspan' => 3, |
97 |
),
|
|
98 |
array(
|
|
103 |
],
|
|
104 |
[
|
|
99 | 105 |
'data' => t('Target LDAP Token'), |
100 | 106 |
'rowspan' => 1, |
101 | 107 |
'class' => 'mixedcase', |
102 |
),
|
|
103 |
array(
|
|
108 |
],
|
|
109 |
[
|
|
104 | 110 |
'data' => t('When Should Attribute Be Synchronized to LDAP?'), |
105 | 111 |
'colspan' => count($ldap_user_conf_admin->provisionsLdapEvents), |
106 | 112 |
'rowspan' => 1, |
107 | 113 |
'class' => 'mixedcase', |
108 |
),
|
|
109 |
);
|
|
114 |
],
|
|
115 |
];
|
|
110 | 116 |
|
111 |
$second_header = array(
|
|
112 |
array(
|
|
117 |
$second_header = [
|
|
118 |
[
|
|
113 | 119 |
'data' => t(''), |
114 |
'header' => TRUE |
|
115 |
),
|
|
116 |
array(
|
|
120 |
'header' => TRUE,
|
|
121 |
],
|
|
122 |
[
|
|
117 | 123 |
'data' => t('(Select "user tokens" to use token field)'), |
118 | 124 |
'header' => TRUE, |
119 |
'class' => 'mixedcase' |
|
120 |
),
|
|
121 |
array(
|
|
125 |
'class' => 'mixedcase',
|
|
126 |
],
|
|
127 |
[
|
|
122 | 128 |
'data' => t('Source Drupal User tokens such as: "[property.name]", "[field.field_fname] [field.field_lname]". Constants such as "from_drupal" or "18" should not be enclosed in []'), |
123 | 129 |
'header' => TRUE, |
124 |
'class' => 'mixedcase' |
|
125 |
),
|
|
126 |
array(
|
|
130 |
'class' => 'mixedcase',
|
|
131 |
],
|
|
132 |
[
|
|
127 | 133 |
'data' => t('Convert From Binary'), |
128 | 134 |
'header' => TRUE, |
129 |
'class' => 'mixedcase' |
|
130 |
),
|
|
131 |
array(
|
|
135 |
'class' => 'mixedcase',
|
|
136 |
],
|
|
137 |
[
|
|
132 | 138 |
'data' => t('Use singular token format such as [sn], [givenName], etc.'), |
133 | 139 |
'header' => TRUE, |
134 |
'class' => 'mixedcase' |
|
135 |
),
|
|
136 |
);
|
|
140 |
'class' => 'mixedcase',
|
|
141 |
],
|
|
142 |
];
|
|
137 | 143 |
foreach ($ldap_user_conf_admin->provisionsLdapEvents as $col_id => $col_name) { |
138 |
$second_header[] = array('data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase');
|
|
144 |
$second_header[] = ['data' => $col_name, 'header' => TRUE, 'class' => 'mixedcase'];
|
|
139 | 145 |
} |
140 | 146 |
} |
141 | 147 |
|
142 |
// #col is ignored, so sort table columns here |
|
148 |
// #col is ignored, so sort table columns here.
|
|
143 | 149 |
foreach ($table['rows'] as $row_id => $row) { |
144 | 150 |
$discard = ksort($row); |
145 | 151 |
$table['rows'][$row_id] = $row; |
146 | 152 |
} |
147 | 153 |
|
148 | 154 |
$table['header'] = $header; |
149 |
$table['attributes'] = array('class' => array('ldap-provision-' . $direction_text));
|
|
155 |
$table['attributes'] = ['class' => ['ldap-provision-' . $direction_text]];
|
|
150 | 156 |
array_unshift($table['rows'], $second_header); |
151 | 157 |
$table_themed = theme('table', $table); |
152 | 158 |
$rendered_table = theme('table', $table); |
153 |
$output = str_replace( '[replace_with_table__' . $direction . ']', $rendered_table, $output);
|
|
159 |
$output = str_replace('[replace_with_table__' . $direction . ']', $rendered_table, $output); |
|
154 | 160 |
} |
155 | 161 |
|
156 | 162 |
return $output; |
Formats disponibles : Unified diff
Weekly update of contrib modules