@@ -87,7 +87,7 @@ |
||
87 | 87 | <?php |
88 | 88 | echo Display::get_alphabet_options($firstLetterUserGroup); |
89 | 89 | echo Display::get_numeric_options(0, 9, $firstLetterUserGroup); |
90 | - ?> |
|
90 | + ?> |
|
91 | 91 | </select> |
92 | 92 | </td> |
93 | 93 | <td width="20%"> </td> |
@@ -18,93 +18,93 @@ discard block |
||
18 | 18 | |
19 | 19 | $defaults = array(); |
20 | 20 | $term_preview = array( |
21 | - 'type' => 0, |
|
22 | - 'content' => '', |
|
23 | - 'changes' => '', |
|
21 | + 'type' => 0, |
|
22 | + 'content' => '', |
|
23 | + 'changes' => '', |
|
24 | 24 | ); |
25 | 25 | if ($form->validate()) { |
26 | - $check = Security::check_token('post'); |
|
27 | - if ($check) { |
|
28 | - $values = $form->getSubmitValues(); |
|
29 | - $lang = $values['language']; |
|
30 | - //language id |
|
31 | - $lang = api_get_language_id($lang); |
|
32 | - |
|
33 | - if (isset($values['type'])) { |
|
34 | - $type = $values['type']; |
|
35 | - } else { |
|
36 | - $type = 0; |
|
37 | - } |
|
38 | - if (isset($values['content'])) { |
|
39 | - $content = $values['content']; |
|
40 | - } else { |
|
41 | - $content = ''; |
|
42 | - } |
|
43 | - if (isset($values['changes'])) { |
|
44 | - $changes = $values['changes']; |
|
45 | - } else { |
|
46 | - $changes = ''; |
|
47 | - } |
|
48 | - $navigator_info = api_get_navigator(); |
|
49 | - |
|
50 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
51 | - if (isset($values['preview'])) { |
|
52 | - $submit ='preview'; |
|
53 | - } elseif (isset($values['save'])) { |
|
54 | - $submit ='save'; |
|
55 | - } elseif (isset($values['back'])) { |
|
56 | - $submit ='back'; |
|
57 | - } |
|
58 | - } else { |
|
59 | - $submit = $values['send']; |
|
60 | - } |
|
61 | - |
|
62 | - $default['content'] = $content; |
|
63 | - if (isset($values['language'])) { |
|
64 | - if ($submit == 'back') { |
|
65 | - header('Location: legal_add.php'); |
|
66 | - exit; |
|
67 | - } elseif ($submit == 'save') { |
|
68 | - $insert_result = LegalManager::add($lang, $content, $type, $changes); |
|
69 | - if ($insert_result ) { |
|
70 | - $message = get_lang('TermAndConditionSaved'); |
|
71 | - } else { |
|
72 | - $message = get_lang('TermAndConditionNotSaved'); |
|
73 | - } |
|
74 | - Security::clear_token(); |
|
75 | - $tok = Security::get_token(); |
|
76 | - header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
77 | - exit(); |
|
78 | - } elseif ($submit=='preview') { |
|
79 | - $defaults['type'] = $type; |
|
80 | - $defaults['content'] = $content; |
|
81 | - $defaults['changes'] = $changes; |
|
82 | - $term_preview = $defaults; |
|
83 | - $term_preview['type'] = intval($_POST['type']); |
|
84 | - } else { |
|
85 | - $my_lang = $_POST['language']; |
|
86 | - if (isset($_POST['language'])){ |
|
87 | - $all_langs = api_get_languages(); |
|
88 | - if (in_array($my_lang, $all_langs['folder'])){ |
|
89 | - $language = api_get_language_id($my_lang); |
|
90 | - $term_preview = LegalManager::get_last_condition($language); |
|
91 | - $defaults = $term_preview; |
|
92 | - if (!$term_preview) { |
|
93 | - // there are not terms and conditions |
|
94 | - $term_preview['type']=-1; |
|
95 | - $defaults['type']=0; |
|
96 | - } |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
26 | + $check = Security::check_token('post'); |
|
27 | + if ($check) { |
|
28 | + $values = $form->getSubmitValues(); |
|
29 | + $lang = $values['language']; |
|
30 | + //language id |
|
31 | + $lang = api_get_language_id($lang); |
|
32 | + |
|
33 | + if (isset($values['type'])) { |
|
34 | + $type = $values['type']; |
|
35 | + } else { |
|
36 | + $type = 0; |
|
37 | + } |
|
38 | + if (isset($values['content'])) { |
|
39 | + $content = $values['content']; |
|
40 | + } else { |
|
41 | + $content = ''; |
|
42 | + } |
|
43 | + if (isset($values['changes'])) { |
|
44 | + $changes = $values['changes']; |
|
45 | + } else { |
|
46 | + $changes = ''; |
|
47 | + } |
|
48 | + $navigator_info = api_get_navigator(); |
|
49 | + |
|
50 | + if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
51 | + if (isset($values['preview'])) { |
|
52 | + $submit ='preview'; |
|
53 | + } elseif (isset($values['save'])) { |
|
54 | + $submit ='save'; |
|
55 | + } elseif (isset($values['back'])) { |
|
56 | + $submit ='back'; |
|
57 | + } |
|
58 | + } else { |
|
59 | + $submit = $values['send']; |
|
60 | + } |
|
61 | + |
|
62 | + $default['content'] = $content; |
|
63 | + if (isset($values['language'])) { |
|
64 | + if ($submit == 'back') { |
|
65 | + header('Location: legal_add.php'); |
|
66 | + exit; |
|
67 | + } elseif ($submit == 'save') { |
|
68 | + $insert_result = LegalManager::add($lang, $content, $type, $changes); |
|
69 | + if ($insert_result ) { |
|
70 | + $message = get_lang('TermAndConditionSaved'); |
|
71 | + } else { |
|
72 | + $message = get_lang('TermAndConditionNotSaved'); |
|
73 | + } |
|
74 | + Security::clear_token(); |
|
75 | + $tok = Security::get_token(); |
|
76 | + header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
77 | + exit(); |
|
78 | + } elseif ($submit=='preview') { |
|
79 | + $defaults['type'] = $type; |
|
80 | + $defaults['content'] = $content; |
|
81 | + $defaults['changes'] = $changes; |
|
82 | + $term_preview = $defaults; |
|
83 | + $term_preview['type'] = intval($_POST['type']); |
|
84 | + } else { |
|
85 | + $my_lang = $_POST['language']; |
|
86 | + if (isset($_POST['language'])){ |
|
87 | + $all_langs = api_get_languages(); |
|
88 | + if (in_array($my_lang, $all_langs['folder'])){ |
|
89 | + $language = api_get_language_id($my_lang); |
|
90 | + $term_preview = LegalManager::get_last_condition($language); |
|
91 | + $defaults = $term_preview; |
|
92 | + if (!$term_preview) { |
|
93 | + // there are not terms and conditions |
|
94 | + $term_preview['type']=-1; |
|
95 | + $defaults['type']=0; |
|
96 | + } |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $form->setDefaults($defaults); |
105 | 105 | |
106 | 106 | if (isset($_POST['send'])) { |
107 | - Security::clear_token(); |
|
107 | + Security::clear_token(); |
|
108 | 108 | } |
109 | 109 | $token = Security::get_token(); |
110 | 110 | |
@@ -115,34 +115,34 @@ discard block |
||
115 | 115 | |
116 | 116 | if (isset($_POST['language'])) { |
117 | 117 | |
118 | - $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
119 | - $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
120 | - $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
|
118 | + $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
119 | + $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
120 | + $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
|
121 | 121 | |
122 | - $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | - $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | - $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
122 | + $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | + $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | + $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
125 | 125 | |
126 | - $preview = LegalManager::show_last_condition($term_preview); |
|
126 | + $preview = LegalManager::show_last_condition($term_preview); |
|
127 | 127 | |
128 | - if ($term_preview['type']!=-1) { |
|
129 | - $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | - } |
|
128 | + if ($term_preview['type']!=-1) { |
|
129 | + $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | + } |
|
131 | 131 | |
132 | - // Submit & preview button |
|
132 | + // Submit & preview button |
|
133 | 133 | $navigator_info = api_get_navigator(); |
134 | 134 | |
135 | 135 | //ie6 fix |
136 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
137 | - $buttons = '<div class="row" align="center"> |
|
136 | + if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
137 | + $buttons = '<div class="row" align="center"> |
|
138 | 138 | <div class="formw"> |
139 | 139 | <input type="submit" name="back" value="'.get_lang('Back').'"/> |
140 | 140 | <input type="submit" name="preview" value="'.get_lang('Preview').'"/> |
141 | 141 | <input type="submit" name="save" value="'.get_lang('Save').'"/> |
142 | 142 | </div> |
143 | 143 | </div>'; |
144 | - $form->addElement('html',$buttons); |
|
145 | - } else { |
|
144 | + $form->addElement('html',$buttons); |
|
145 | + } else { |
|
146 | 146 | $buttons = '<div class="row" align="center"> |
147 | 147 | <div class="formw"> |
148 | 148 | <button type="submit" class="back" name="send" value="back">'.get_lang('Back').'</button> |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | <button type="submit" class="save" name="send" value="save">'.get_lang('Save').'</button> |
151 | 151 | </div> |
152 | 152 | </div>'; |
153 | - $form->addElement('html',$buttons); |
|
154 | - } |
|
153 | + $form->addElement('html',$buttons); |
|
154 | + } |
|
155 | 155 | } else { |
156 | - $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
157 | - $form->addElement('button', 'send', get_lang('Load')); |
|
156 | + $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
157 | + $form->addElement('button', 'send', get_lang('Load')); |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | echo '</div>'; |
177 | 177 | |
178 | 178 | if (isset ($_GET['action'])) { |
179 | - switch ($_GET['action']) { |
|
180 | - case 'show_message' : |
|
181 | - Display :: display_normal_message(stripslashes($_GET['message'])); |
|
182 | - break; |
|
183 | - } |
|
179 | + switch ($_GET['action']) { |
|
180 | + case 'show_message' : |
|
181 | + Display :: display_normal_message(stripslashes($_GET['message'])); |
|
182 | + break; |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $form->setDefaults($defaults); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | <select name="firstLetterClass" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();"> |
91 | 91 | <option value="">--</option> |
92 | 92 | <?php |
93 | - echo Display::get_alphabet_options($first_letter_class); |
|
94 | - ?> |
|
93 | + echo Display::get_alphabet_options($first_letter_class); |
|
94 | + ?> |
|
95 | 95 | </select> |
96 | 96 | </td> |
97 | 97 | <td width="20%"> </td> |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | <select name="firstLetterCourse" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();"> |
103 | 103 | <option value="">--</option> |
104 | 104 | <?php |
105 | - echo Display::get_alphabet_options($first_letter_course); |
|
106 | - ?> |
|
105 | + echo Display::get_alphabet_options($first_letter_course); |
|
106 | + ?> |
|
107 | 107 | </select> |
108 | 108 | </td> |
109 | 109 | </tr> |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | $form->addElement('hidden', 'user_id', $user_id); |
158 | 158 | |
159 | 159 | if (api_is_western_name_order()) { |
160 | - // Firstname |
|
161 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
162 | - $form->applyFilter('firstname', 'html_filter'); |
|
163 | - $form->applyFilter('firstname', 'trim'); |
|
164 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
165 | - // Lastname |
|
166 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
167 | - $form->applyFilter('lastname', 'html_filter'); |
|
168 | - $form->applyFilter('lastname', 'trim'); |
|
169 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
160 | + // Firstname |
|
161 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
162 | + $form->applyFilter('firstname', 'html_filter'); |
|
163 | + $form->applyFilter('firstname', 'trim'); |
|
164 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
165 | + // Lastname |
|
166 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
167 | + $form->applyFilter('lastname', 'html_filter'); |
|
168 | + $form->applyFilter('lastname', 'trim'); |
|
169 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
170 | 170 | } else { |
171 | - // Lastname |
|
172 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
173 | - $form->applyFilter('lastname', 'html_filter'); |
|
174 | - $form->applyFilter('lastname', 'trim'); |
|
175 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
176 | - // Firstname |
|
177 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
178 | - $form->applyFilter('firstname', 'html_filter'); |
|
179 | - $form->applyFilter('firstname', 'trim'); |
|
180 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
171 | + // Lastname |
|
172 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
173 | + $form->applyFilter('lastname', 'html_filter'); |
|
174 | + $form->applyFilter('lastname', 'trim'); |
|
175 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
176 | + // Firstname |
|
177 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
178 | + $form->applyFilter('firstname', 'html_filter'); |
|
179 | + $form->applyFilter('firstname', 'trim'); |
|
180 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Official code |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // OpenID |
201 | 201 | if (api_get_setting('openid_authentication') == 'true') { |
202 | - $form->addElement('text', 'openid', get_lang('OpenIDURL')); |
|
202 | + $form->addElement('text', 'openid', get_lang('OpenIDURL')); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Phone |
@@ -225,18 +225,18 @@ discard block |
||
225 | 225 | $form->addHidden('cropResult', ''); |
226 | 226 | |
227 | 227 | $form->addRule( |
228 | - 'picture', |
|
229 | - get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
230 | - 'filetype', |
|
231 | - $allowed_picture_types |
|
228 | + 'picture', |
|
229 | + get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
230 | + 'filetype', |
|
231 | + $allowed_picture_types |
|
232 | 232 | ); |
233 | 233 | if (strlen($user_data['picture_uri']) > 0) { |
234 | - $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
234 | + $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Username |
238 | 238 | if (api_get_setting('login_is_email') != 'true') { |
239 | - $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
|
239 | + $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
|
240 | 240 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
241 | 241 | $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
242 | 242 | $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | |
309 | 309 | // Platform admin |
310 | 310 | if (api_is_platform_admin()) { |
311 | - $group = array(); |
|
312 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
311 | + $group = array(); |
|
312 | + $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | + $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
314 | 314 | |
315 | - $user_data['status'] == 1 ? $display = 'block':$display = 'none'; |
|
315 | + $user_data['status'] == 1 ? $display = 'block':$display = 'none'; |
|
316 | 316 | |
317 | - $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
|
318 | - $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
|
319 | - $form->addElement('html', '</div>'); |
|
317 | + $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
|
318 | + $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
|
319 | + $form->addElement('html', '</div>'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | //Language |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | $form->addElement('label', get_lang('RegistrationDate'), $date); |
335 | 335 | |
336 | 336 | if (!$user_data['platform_admin']) { |
337 | - // Expiration Date |
|
338 | - $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
|
339 | - $group = array (); |
|
340 | - $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
|
341 | - $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
|
342 | - $form->addGroup($group, 'max_member_group', null, '', false); |
|
343 | - |
|
344 | - // Active account or inactive account |
|
345 | - $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); |
|
346 | - $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); |
|
337 | + // Expiration Date |
|
338 | + $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
|
339 | + $group = array (); |
|
340 | + $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
|
341 | + $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
|
342 | + $form->addGroup($group, 'max_member_group', null, '', false); |
|
343 | + |
|
344 | + // Active account or inactive account |
|
345 | + $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); |
|
346 | + $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // EXTRA FIELDS |
@@ -366,18 +366,18 @@ discard block |
||
366 | 366 | $expiration_date = $user_data['expiration_date']; |
367 | 367 | |
368 | 368 | if (empty($expiration_date)) { |
369 | - $user_data['radio_expiration_date'] = 0; |
|
370 | - $user_data['expiration_date'] = api_get_local_time(); |
|
369 | + $user_data['radio_expiration_date'] = 0; |
|
370 | + $user_data['expiration_date'] = api_get_local_time(); |
|
371 | 371 | } else { |
372 | - $user_data['radio_expiration_date'] = 1; |
|
373 | - $user_data['expiration_date'] = api_get_local_time($expiration_date); |
|
372 | + $user_data['radio_expiration_date'] = 1; |
|
373 | + $user_data['expiration_date'] = api_get_local_time($expiration_date); |
|
374 | 374 | } |
375 | 375 | $form->setDefaults($user_data); |
376 | 376 | |
377 | 377 | $error_drh = false; |
378 | 378 | // Validate form |
379 | 379 | if ($form->validate()) { |
380 | - $user = $form->getSubmitValues(1); |
|
380 | + $user = $form->getSubmitValues(1); |
|
381 | 381 | $reset_password = intval($user['reset_password']); |
382 | 382 | if ($reset_password == 2 && empty($user['password'])) { |
383 | 383 | Display::addFlash(Display::return_message(get_lang('PasswordIsTooShort'))); |
@@ -385,18 +385,18 @@ discard block |
||
385 | 385 | exit(); |
386 | 386 | } |
387 | 387 | |
388 | - $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']); |
|
388 | + $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']); |
|
389 | 389 | |
390 | - if ($user['status'] == DRH && $is_user_subscribed_in_course) { |
|
391 | - $error_drh = true; |
|
392 | - } else { |
|
393 | - $picture_element = $form->getElement('picture'); |
|
394 | - $picture = $picture_element->getValue(); |
|
390 | + if ($user['status'] == DRH && $is_user_subscribed_in_course) { |
|
391 | + $error_drh = true; |
|
392 | + } else { |
|
393 | + $picture_element = $form->getElement('picture'); |
|
394 | + $picture = $picture_element->getValue(); |
|
395 | 395 | |
396 | - $picture_uri = $user_data['picture_uri']; |
|
397 | - if (isset($user['delete_picture']) && $user['delete_picture']) { |
|
398 | - $picture_uri = UserManager::delete_user_picture($user_id); |
|
399 | - } elseif (!empty($picture['name'])) { |
|
396 | + $picture_uri = $user_data['picture_uri']; |
|
397 | + if (isset($user['delete_picture']) && $user['delete_picture']) { |
|
398 | + $picture_uri = UserManager::delete_user_picture($user_id); |
|
399 | + } elseif (!empty($picture['name'])) { |
|
400 | 400 | $picture_uri = UserManager::update_user_picture( |
401 | 401 | $user_id, |
402 | 402 | $_FILES['picture']['name'], |
@@ -404,30 +404,30 @@ discard block |
||
404 | 404 | $user['cropResult'] |
405 | 405 | |
406 | 406 | ); |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | - $lastname = $user['lastname']; |
|
410 | - $firstname = $user['firstname']; |
|
409 | + $lastname = $user['lastname']; |
|
410 | + $firstname = $user['firstname']; |
|
411 | 411 | $password = $user['password']; |
412 | 412 | $auth_source = isset($user['auth_source']) ? $user['auth_source'] : $userInfo['auth_source']; |
413 | - $official_code = $user['official_code']; |
|
414 | - $email = $user['email']; |
|
415 | - $phone = $user['phone']; |
|
416 | - $username = isset($user['username']) ? $user['username'] : $userInfo['username']; |
|
417 | - $status = intval($user['status']); |
|
418 | - $platform_admin = intval($user['platform_admin']); |
|
419 | - $send_mail = intval($user['send_mail']); |
|
420 | - $reset_password = intval($user['reset_password']); |
|
421 | - $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null; |
|
422 | - $language = $user['language']; |
|
423 | - |
|
424 | - if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) { |
|
413 | + $official_code = $user['official_code']; |
|
414 | + $email = $user['email']; |
|
415 | + $phone = $user['phone']; |
|
416 | + $username = isset($user['username']) ? $user['username'] : $userInfo['username']; |
|
417 | + $status = intval($user['status']); |
|
418 | + $platform_admin = intval($user['platform_admin']); |
|
419 | + $send_mail = intval($user['send_mail']); |
|
420 | + $reset_password = intval($user['reset_password']); |
|
421 | + $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null; |
|
422 | + $language = $user['language']; |
|
423 | + |
|
424 | + if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) { |
|
425 | 425 | $expiration_date = $user['expiration_date']; |
426 | - } else { |
|
427 | - $expiration_date = null; |
|
428 | - } |
|
426 | + } else { |
|
427 | + $expiration_date = null; |
|
428 | + } |
|
429 | 429 | |
430 | - $active = $user_data['platform_admin'] ? 1 : intval($user['active']); |
|
430 | + $active = $user_data['platform_admin'] ? 1 : intval($user['active']); |
|
431 | 431 | |
432 | 432 | //If the user is set to admin the status will be overwrite by COURSEMANAGER = 1 |
433 | 433 | if ($platform_admin == 1) { |
@@ -461,31 +461,31 @@ discard block |
||
461 | 461 | $reset_password |
462 | 462 | ); |
463 | 463 | |
464 | - if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) { |
|
465 | - $up = UserManager::update_openid($user_id, $user['openid']); |
|
466 | - } |
|
464 | + if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) { |
|
465 | + $up = UserManager::update_openid($user_id, $user['openid']); |
|
466 | + } |
|
467 | 467 | $currentUserId = api_get_user_id(); |
468 | - if ($user_id != $currentUserId) { |
|
469 | - if ($platform_admin == 1) { |
|
468 | + if ($user_id != $currentUserId) { |
|
469 | + if ($platform_admin == 1) { |
|
470 | 470 | UserManager::add_user_as_admin($user_id); |
471 | - } else { |
|
471 | + } else { |
|
472 | 472 | UserManager::remove_user_admin($user_id); |
473 | - } |
|
474 | - } |
|
473 | + } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | $extraFieldValue = new ExtraFieldValue('user'); |
477 | 477 | $extraFieldValue->saveFieldValues($user); |
478 | 478 | |
479 | - $tok = Security::get_token(); |
|
480 | - header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok); |
|
481 | - exit(); |
|
482 | - } |
|
479 | + $tok = Security::get_token(); |
|
480 | + header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok); |
|
481 | + exit(); |
|
482 | + } |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | $message = null; |
486 | 486 | if ($error_drh) { |
487 | - $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager'); |
|
488 | - $message = Display::return_message($err_msg, 'error'); |
|
487 | + $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager'); |
|
488 | + $message = Display::return_message($err_msg, 'error'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | $content = null; |
@@ -229,31 +229,31 @@ discard block |
||
229 | 229 | <td align="center"> |
230 | 230 | <div id="content_source"> |
231 | 231 | <?php |
232 | - if (!($add_type=='multiple')) { |
|
232 | + if (!($add_type=='multiple')) { |
|
233 | 233 | ?> |
234 | 234 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
235 | 235 | <div id="ajax_list_users_single"></div> |
236 | 236 | <?php |
237 | - } else { |
|
238 | - ?> |
|
237 | + } else { |
|
238 | + ?> |
|
239 | 239 | <div id="ajax_list_multiple"> |
240 | 240 | <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?> |
241 | 241 | </div> |
242 | 242 | <?php |
243 | - } |
|
244 | - ?> |
|
243 | + } |
|
244 | + ?> |
|
245 | 245 | </div> |
246 | 246 | </td> |
247 | 247 | <td width="10%" valign="middle" align="center"> |
248 | 248 | <?php |
249 | - if ($ajax_search) { |
|
250 | - ?> |
|
249 | + if ($ajax_search) { |
|
250 | + ?> |
|
251 | 251 | <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" > |
252 | 252 | <em class="fa fa-arrow-left"></em> |
253 | 253 | </button> |
254 | 254 | <?php |
255 | - } else { |
|
256 | - ?> |
|
255 | + } else { |
|
256 | + ?> |
|
257 | 257 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))"> |
258 | 258 | <em class="fa fa-arrow-right"></em> |
259 | 259 | </button> |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | <em class="fa fa-arrow-left"></em> |
263 | 263 | </button> |
264 | 264 | <?php |
265 | - } |
|
266 | - ?> |
|
265 | + } |
|
266 | + ?> |
|
267 | 267 | <br /><br /><br /><br /><br /><br /> |
268 | 268 | </td> |
269 | 269 | <td align="center"> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $courses = $course_list; |
47 | 47 | } |
48 | 48 | |
49 | - if (!empty($courses)) { |
|
49 | + if (!empty($courses)) { |
|
50 | 50 | |
51 | 51 | $archiveFile = 'export_courses_list_'.api_get_local_time(); |
52 | 52 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | Export::arrayToXls($listToExport, $archiveFile); |
99 | 99 | break; |
100 | 100 | } |
101 | - } else { |
|
101 | + } else { |
|
102 | 102 | Display::addFlash( |
103 | 103 | Display::return_message( |
104 | 104 | get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty') |
105 | 105 | ) |
106 | 106 | ); |
107 | - } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,29 +114,29 @@ discard block |
||
114 | 114 | $form->addHeader($tool_name); |
115 | 115 | $form->addHidden('formSent', 1); |
116 | 116 | $form->addElement( |
117 | - 'radio', |
|
118 | - 'select_type', |
|
119 | - get_lang('Option'), |
|
120 | - get_lang('ExportAllCoursesList'), |
|
121 | - '1', |
|
122 | - ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"] |
|
117 | + 'radio', |
|
118 | + 'select_type', |
|
119 | + get_lang('Option'), |
|
120 | + get_lang('ExportAllCoursesList'), |
|
121 | + '1', |
|
122 | + ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"] |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | $form->addElement( |
126 | - 'radio', |
|
127 | - 'select_type', |
|
128 | - '', |
|
129 | - get_lang('ExportSelectedCoursesFromCoursesList'), |
|
130 | - '2', |
|
131 | - ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"] |
|
126 | + 'radio', |
|
127 | + 'select_type', |
|
128 | + '', |
|
129 | + get_lang('ExportSelectedCoursesFromCoursesList'), |
|
130 | + '2', |
|
131 | + ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"] |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | if (!empty($course_list)) { |
135 | - $form->addHtml('<div id="div-course-list" style="display:none">'); |
|
136 | - $coursesInList = []; |
|
137 | - foreach ($course_list as $course) { |
|
138 | - $coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')'; |
|
139 | - } |
|
135 | + $form->addHtml('<div id="div-course-list" style="display:none">'); |
|
136 | + $coursesInList = []; |
|
137 | + foreach ($course_list as $course) { |
|
138 | + $coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')'; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | $form->addSelect( |
142 | 142 | 'course_code', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ['multiple' => 'multiple'] |
146 | 146 | ); |
147 | 147 | |
148 | - $form->addHtml('</div>'); |
|
148 | + $form->addHtml('</div>'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV' , 'csv', null); |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | if (isset($keywordListValues['keyword_status']) && |
240 | 240 | $keywordListValues['keyword_status'] == PLATFORM_ADMIN |
241 | 241 | ) { |
242 | - $query_admin_table = " , $admin_table a "; |
|
243 | - $keyword_admin = ' AND a.user_id = u.id '; |
|
242 | + $query_admin_table = " , $admin_table a "; |
|
243 | + $keyword_admin = ' AND a.user_id = u.id '; |
|
244 | 244 | $keywordListValues['keyword_status'] = '%'; |
245 | 245 | } |
246 | 246 | |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | $firstname = $userInfo['firstname']; |
307 | 307 | $lastname = $userInfo['lastname']; |
308 | 308 | |
309 | - if (api_is_western_name_order()) { |
|
310 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId); |
|
311 | - } else { |
|
312 | - $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
313 | - } |
|
309 | + if (api_is_western_name_order()) { |
|
310 | + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId); |
|
311 | + } else { |
|
312 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
313 | + } |
|
314 | 314 | |
315 | - if ($userId) { |
|
315 | + if ($userId) { |
|
316 | 316 | |
317 | 317 | // Logout the current user |
318 | 318 | LoginDelete(api_get_user_id()); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | Display :: display_footer(); |
348 | 348 | exit; |
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | }*/ |
386 | 386 | |
387 | 387 | if (!in_array($direction, array('ASC','DESC'))) { |
388 | - $direction = 'ASC'; |
|
388 | + $direction = 'ASC'; |
|
389 | 389 | } |
390 | 390 | $column = intval($column); |
391 | 391 | $from = intval($from); |
@@ -396,23 +396,23 @@ discard block |
||
396 | 396 | $sql .= " WHERE u.creator_id = ".api_get_user_id(); |
397 | 397 | } |
398 | 398 | |
399 | - $sql .= " ORDER BY col$column $direction "; |
|
400 | - $sql .= " LIMIT $from,$number_of_items"; |
|
399 | + $sql .= " ORDER BY col$column $direction "; |
|
400 | + $sql .= " LIMIT $from,$number_of_items"; |
|
401 | 401 | |
402 | - $res = Database::query($sql); |
|
402 | + $res = Database::query($sql); |
|
403 | 403 | |
404 | - $users = array (); |
|
404 | + $users = array (); |
|
405 | 405 | $t = time(); |
406 | - while ($user = Database::fetch_row($res)) { |
|
407 | - $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
408 | - $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
406 | + while ($user = Database::fetch_row($res)) { |
|
407 | + $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
408 | + $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
409 | 409 | |
410 | 410 | if ($user[7] == 1 && !empty($user[10])) { |
411 | 411 | // check expiration date |
412 | 412 | $expiration_time = convert_sql_date($user[10]); |
413 | 413 | // if expiration date is passed, store a special value for active field |
414 | 414 | if ($expiration_time < $t) { |
415 | - $user[7] = '-1'; |
|
415 | + $user[7] = '-1'; |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | api_get_local_time($user[9]), |
431 | 431 | $user[0] |
432 | 432 | ); |
433 | - } |
|
433 | + } |
|
434 | 434 | |
435 | - return $users; |
|
435 | + return $users; |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * @return string HTML-code with a mailto-link |
442 | 442 | */ |
443 | 443 | function email_filter($email) { |
444 | - return Display :: encrypted_mailto_link($email, $email); |
|
444 | + return Display :: encrypted_mailto_link($email, $email); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @return string HTML-code with a mailto-link |
451 | 451 | */ |
452 | 452 | function user_filter($name, $params, $row) { |
453 | - return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
453 | + return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -461,84 +461,84 @@ discard block |
||
461 | 461 | * @return string Some HTML-code with modify-buttons |
462 | 462 | */ |
463 | 463 | function modify_filter($user_id, $url_params, $row) { |
464 | - global $charset, $_admins_list; |
|
465 | - $is_admin = in_array($user_id,$_admins_list); |
|
466 | - $statusname = api_get_status_langvars(); |
|
467 | - $user_is_anonymous = false; |
|
464 | + global $charset, $_admins_list; |
|
465 | + $is_admin = in_array($user_id,$_admins_list); |
|
466 | + $statusname = api_get_status_langvars(); |
|
467 | + $user_is_anonymous = false; |
|
468 | 468 | $current_user_status_label = $row['7']; |
469 | 469 | |
470 | - if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
471 | - $user_is_anonymous =true; |
|
472 | - } |
|
473 | - $result = ''; |
|
474 | - if (!$user_is_anonymous) { |
|
475 | - $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
476 | - $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
470 | + if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
471 | + $user_is_anonymous =true; |
|
472 | + } |
|
473 | + $result = ''; |
|
474 | + if (!$user_is_anonymous) { |
|
475 | + $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
476 | + $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
477 | 477 | '.$icon.' |
478 | 478 | <div class="blackboard_hide" id="div_'.$user_id.'"> </div> |
479 | 479 | </a>'; |
480 | 480 | |
481 | 481 | $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')')); |
482 | - $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
482 | + $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
483 | 483 | '.$icon.' |
484 | 484 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
485 | 485 | </a>'; |
486 | - } else { |
|
487 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
488 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
489 | - } |
|
486 | + } else { |
|
487 | + $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
488 | + $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
489 | + } |
|
490 | 490 | |
491 | - if (api_is_platform_admin()) { |
|
492 | - if (!$user_is_anonymous) { |
|
493 | - $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
494 | - } else { |
|
495 | - $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
496 | - } |
|
497 | - } |
|
491 | + if (api_is_platform_admin()) { |
|
492 | + if (!$user_is_anonymous) { |
|
493 | + $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
494 | + } else { |
|
495 | + $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
496 | + } |
|
497 | + } |
|
498 | 498 | |
499 | 499 | //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins) |
500 | 500 | if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) { |
501 | - if (!$user_is_anonymous) { |
|
501 | + if (!$user_is_anonymous) { |
|
502 | 502 | if (api_global_admin_can_edit_admin($user_id)) { |
503 | 503 | $result .= '<a href="user_list.php?action=login_as&user_id='.$user_id.'&sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.png', get_lang('LoginAs')).'</a> '; |
504 | 504 | } else { |
505 | 505 | $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
506 | 506 | } |
507 | - } else { |
|
508 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
509 | - } |
|
507 | + } else { |
|
508 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
509 | + } |
|
510 | 510 | } else { |
511 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
511 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
512 | 512 | } |
513 | 513 | |
514 | - if ($current_user_status_label != $statusname[STUDENT]) { |
|
515 | - $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
516 | - } else { |
|
517 | - $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
518 | - } |
|
514 | + if ($current_user_status_label != $statusname[STUDENT]) { |
|
515 | + $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
516 | + } else { |
|
517 | + $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
518 | + } |
|
519 | 519 | |
520 | - if (api_is_platform_admin(true)) { |
|
520 | + if (api_is_platform_admin(true)) { |
|
521 | 521 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
522 | 522 | |
523 | 523 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
524 | 524 | $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
525 | - } else { |
|
525 | + } else { |
|
526 | 526 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
527 | - } |
|
528 | - } |
|
527 | + } |
|
528 | + } |
|
529 | 529 | |
530 | - if ($is_admin) { |
|
531 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
532 | - } else { |
|
533 | - $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
534 | - } |
|
530 | + if ($is_admin) { |
|
531 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
532 | + } else { |
|
533 | + $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
534 | + } |
|
535 | 535 | |
536 | - // actions for assigning sessions, courses or users |
|
537 | - if (api_is_session_admin()) { |
|
538 | - /*if ($row[0] == api_get_user_id()) { |
|
536 | + // actions for assigning sessions, courses or users |
|
537 | + if (api_is_session_admin()) { |
|
538 | + /*if ($row[0] == api_get_user_id()) { |
|
539 | 539 | $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a> '; |
540 | 540 | }*/ |
541 | - } else { |
|
541 | + } else { |
|
542 | 542 | if ($current_user_status_label == $statusname[SESSIONADMIN]) { |
543 | 543 | $result .= Display::url( |
544 | 544 | Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')), |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | ); |
569 | 569 | } |
570 | 570 | } |
571 | - } |
|
571 | + } |
|
572 | 572 | |
573 | 573 | if (api_is_platform_admin()) { |
574 | 574 | $result .= ' <a href="'.api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?a=get_user_agenda&user_id='.$user_id.'&modal_size=lg" class="agenda_opener ajax">'. |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | } |
587 | 587 | } |
588 | 588 | } |
589 | - return $result; |
|
589 | + return $result; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | if ($action == 'edit') { |
620 | 620 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
621 | 621 | } elseif ($row['0']<>$_user['user_id']) { |
622 | - // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
623 | - $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
624 | - } |
|
625 | - return $result; |
|
622 | + // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
623 | + $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
624 | + } |
|
625 | + return $result; |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
636 | 636 | */ |
637 | 637 | function status_filter($status) { |
638 | - $statusname = api_get_status_langvars(); |
|
639 | - return $statusname[$status]; |
|
638 | + $statusname = api_get_status_langvars(); |
|
639 | + return $statusname[$status]; |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | |
653 | 653 | if (!empty($action)) { |
654 | 654 | $check = Security::check_token('get'); |
655 | - if ($check) { |
|
656 | - switch ($action) { |
|
655 | + if ($check) { |
|
656 | + switch ($action) { |
|
657 | 657 | case 'add_user_to_my_url': |
658 | 658 | $user_id = $_REQUEST["user_id"]; |
659 | 659 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $message = Display::return_message($message, 'confirmation'); |
664 | 664 | } |
665 | 665 | break; |
666 | - case 'show_message' : |
|
666 | + case 'show_message' : |
|
667 | 667 | if (!empty($_GET['warn'])) { |
668 | 668 | // to prevent too long messages |
669 | 669 | if ($_GET['warn'] == 'session_message') { |
@@ -681,46 +681,46 @@ discard block |
||
681 | 681 | $message .= Display::return_message(stripslashes($_GET['message']), 'confirmation'); |
682 | 682 | } |
683 | 683 | |
684 | - break; |
|
685 | - case 'delete_user' : |
|
686 | - if (api_is_platform_admin()) { |
|
684 | + break; |
|
685 | + case 'delete_user' : |
|
686 | + if (api_is_platform_admin()) { |
|
687 | 687 | $user_to_delete = $_GET['user_id']; |
688 | 688 | $current_user_id = api_get_user_id(); |
689 | 689 | |
690 | - if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
691 | - if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
692 | - $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
693 | - } else { |
|
694 | - $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
695 | - } |
|
696 | - } else { |
|
697 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
698 | - } |
|
699 | - } |
|
700 | - break; |
|
690 | + if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
691 | + if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
692 | + $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
693 | + } else { |
|
694 | + $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
695 | + } |
|
696 | + } else { |
|
697 | + $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
698 | + } |
|
699 | + } |
|
700 | + break; |
|
701 | 701 | case 'delete' : |
702 | - if (api_is_platform_admin()) { |
|
703 | - $number_of_selected_users = count($_POST['id']); |
|
704 | - $number_of_deleted_users = 0; |
|
705 | - if (is_array($_POST['id'])) { |
|
706 | - foreach ($_POST['id'] as $index => $user_id) { |
|
707 | - if($user_id != $_user['user_id']) { |
|
708 | - if(UserManager :: delete_user($user_id)) { |
|
709 | - $number_of_deleted_users++; |
|
710 | - } |
|
711 | - } |
|
712 | - } |
|
713 | - } |
|
714 | - if ($number_of_selected_users == $number_of_deleted_users) { |
|
702 | + if (api_is_platform_admin()) { |
|
703 | + $number_of_selected_users = count($_POST['id']); |
|
704 | + $number_of_deleted_users = 0; |
|
705 | + if (is_array($_POST['id'])) { |
|
706 | + foreach ($_POST['id'] as $index => $user_id) { |
|
707 | + if($user_id != $_user['user_id']) { |
|
708 | + if(UserManager :: delete_user($user_id)) { |
|
709 | + $number_of_deleted_users++; |
|
710 | + } |
|
711 | + } |
|
712 | + } |
|
713 | + } |
|
714 | + if ($number_of_selected_users == $number_of_deleted_users) { |
|
715 | 715 | $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation'); |
716 | - } else { |
|
716 | + } else { |
|
717 | 717 | $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error'); |
718 | - } |
|
719 | - } |
|
720 | - break; |
|
721 | - } |
|
722 | - Security::clear_token(); |
|
723 | - } |
|
718 | + } |
|
719 | + } |
|
720 | + break; |
|
721 | + } |
|
722 | + Security::clear_token(); |
|
723 | + } |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | // Create a search-box |
@@ -740,24 +740,24 @@ discard block |
||
740 | 740 | |
741 | 741 | $actions = ''; |
742 | 742 | if (api_is_platform_admin()) { |
743 | - $actions .= '<div style="float:right;">'. |
|
744 | - '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
745 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
746 | - '</div>'; |
|
743 | + $actions .= '<div style="float:right;">'. |
|
744 | + '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
745 | + Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
746 | + '</div>'; |
|
747 | 747 | } |
748 | 748 | $actions .= $form->return_form(); |
749 | 749 | |
750 | 750 | if (isset ($_GET['keyword'])) { |
751 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
751 | + $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
752 | 752 | } elseif (isset ($_GET['keyword_firstname'])) { |
753 | - $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
754 | - $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
755 | - $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
756 | - $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
757 | - $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
758 | - $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
759 | - $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
760 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
753 | + $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
754 | + $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
755 | + $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
756 | + $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
757 | + $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
758 | + $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
759 | + $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
760 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
761 | 761 | } |
762 | 762 | // Create a sortable table with user-data |
763 | 763 | $parameters['sec_token'] = Security::get_token(); |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $res_admin = Database::query($sql_admin); |
769 | 769 | $_admins_list = array(); |
770 | 770 | while ($row_admin = Database::fetch_row($res_admin)) { |
771 | - $_admins_list[] = $row_admin[0]; |
|
771 | + $_admins_list[] = $row_admin[0]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | // Display Advanced search form. |
@@ -824,11 +824,11 @@ discard block |
||
824 | 824 | $table->set_header(2, get_lang('OfficialCode')); |
825 | 825 | |
826 | 826 | if (api_is_western_name_order()) { |
827 | - $table->set_header(3, get_lang('FirstName')); |
|
828 | - $table->set_header(4, get_lang('LastName')); |
|
827 | + $table->set_header(3, get_lang('FirstName')); |
|
828 | + $table->set_header(4, get_lang('LastName')); |
|
829 | 829 | } else { |
830 | - $table->set_header(3, get_lang('LastName')); |
|
831 | - $table->set_header(4, get_lang('FirstName')); |
|
830 | + $table->set_header(3, get_lang('LastName')); |
|
831 | + $table->set_header(4, get_lang('FirstName')); |
|
832 | 832 | } |
833 | 833 | $table->set_header(5, get_lang('LoginName')); |
834 | 834 | $table->set_header(6, get_lang('Email')); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This tool allows platform admins to add users by uploading a CSV or XML file |
|
5 | - * @package chamilo.admin |
|
6 | - */ |
|
4 | + * This tool allows platform admins to add users by uploading a CSV or XML file |
|
5 | + * @package chamilo.admin |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Validate the imported data. |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
61 | 61 | $errors[] = $user; |
62 | 62 | } |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | // 3. Check status. |
67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | return $users; |
243 | 243 | } |
244 | 244 | /** |
245 | - * XML-parser: handle start of element |
|
246 | - * @param string $parser Deprecated? |
|
247 | - * @param string $data The data to be parsed |
|
248 | - */ |
|
245 | + * XML-parser: handle start of element |
|
246 | + * @param string $parser Deprecated? |
|
247 | + * @param string $data The data to be parsed |
|
248 | + */ |
|
249 | 249 | function element_start($parser, $data) |
250 | 250 | { |
251 | 251 | $data = api_utf8_decode($data); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $add_type = 'multiple'; |
56 | 56 | if (isset($_GET['add_type']) && $_GET['add_type']!='') { |
57 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
57 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!api_is_platform_admin()) { |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | "; |
121 | 121 | } |
122 | 122 | |
123 | - $rs = Database::query($sql); |
|
124 | - $xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
123 | + $rs = Database::query($sql); |
|
124 | + $xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
125 | 125 | |
126 | 126 | if ($type == 'single') { |
127 | 127 | $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $return .= '...<br />'; |
161 | 161 | } |
162 | 162 | } |
163 | - $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
163 | + $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
164 | 164 | } else { |
165 | 165 | $return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">'; |
166 | 166 | while($user = Database :: fetch_array($rs)) { |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | $return .= '</select>'; |
171 | 171 | $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return)); |
172 | 172 | } |
173 | - } |
|
174 | - return $xajax_response; |
|
173 | + } |
|
174 | + return $xajax_response; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $xajax->processRequests(); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $msg = ''; |
286 | 286 | if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) { |
287 | - $user_list = $_POST['UsersList']; |
|
287 | + $user_list = $_POST['UsersList']; |
|
288 | 288 | |
289 | 289 | switch ($userStatus) { |
290 | 290 | case DRH: |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | $assigned_users_id = array_keys($assigned_users_to_hrm); |
350 | 350 | $without_assigned_users = ''; |
351 | 351 | if (count($assigned_users_id) > 0) { |
352 | - $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
352 | + $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $search_user = ''; |
356 | 356 | if (!empty($firstLetterUser)) { |
357 | - $needle = Database::escape_string($firstLetterUser); |
|
358 | - $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
357 | + $needle = Database::escape_string($firstLetterUser); |
|
358 | + $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $sqlConditions = null; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | if (api_is_multiple_url_enabled()) { |
378 | - $sql = "SELECT user.user_id, username, lastname, firstname |
|
378 | + $sql = "SELECT user.user_id, username, lastname, firstname |
|
379 | 379 | FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id) |
380 | 380 | WHERE |
381 | 381 | $without_assigned_users |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $sqlConditions |
386 | 386 | ORDER BY firstname"; |
387 | 387 | } else { |
388 | - $sql = "SELECT user_id, username, lastname, firstname |
|
388 | + $sql = "SELECT user_id, username, lastname, firstname |
|
389 | 389 | FROM $tbl_user user |
390 | 390 | WHERE |
391 | 391 | $without_assigned_users |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | <input type="hidden" name="formSent" value="1" /> |
402 | 402 | <?php |
403 | 403 | if(!empty($msg)) { |
404 | - Display::display_normal_message($msg); //main API |
|
404 | + Display::display_normal_message($msg); //main API |
|
405 | 405 | } |
406 | 406 | ?> |
407 | 407 | |
@@ -454,26 +454,26 @@ discard block |
||
454 | 454 | </div> |
455 | 455 | |
456 | 456 | <?php |
457 | - } |
|
458 | - ?> |
|
457 | + } |
|
458 | + ?> |
|
459 | 459 | <div class="separate-action"> |
460 | 460 | <?php |
461 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
461 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
462 | 462 | ?> |
463 | 463 | </div> |
464 | 464 | </div> |
465 | 465 | </div> |
466 | 466 | <div class="col-md-4"> |
467 | 467 | <?php |
468 | - if (UserManager::is_admin($user_id)) { |
|
469 | - echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
468 | + if (UserManager::is_admin($user_id)) { |
|
469 | + echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
470 | 470 | } else if ($user_info['status'] == SESSIONADMIN) { |
471 | 471 | echo get_lang('AssignedUsersListToSessionsAdministrator'); |
472 | 472 | } else if ($user_info['status'] == STUDENT_BOSS) { |
473 | 473 | echo get_lang('AssignedUsersListToStudentBoss'); |
474 | 474 | } else { |
475 | 475 | echo get_lang('AssignedUsersListToHumanResourcesManager'); |
476 | - } |
|
476 | + } |
|
477 | 477 | ?> |
478 | 478 | <div class="form-group"> |
479 | 479 | <div class="col-sm-12"> |