@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $message = null; |
29 | 29 | $content = null; |
30 | 30 | |
31 | -$currentUrl = api_get_self() . "?name=$pluginName"; |
|
31 | +$currentUrl = api_get_self()."?name=$pluginName"; |
|
32 | 32 | |
33 | 33 | if (isset($pluginInfo['settings_form'])) { |
34 | 34 | $form = $pluginInfo['settings_form']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ($values as $key => $value) { |
66 | 66 | api_add_setting( |
67 | - $value, Database::escape_string($pluginName . '_' . $key), |
|
67 | + $value, Database::escape_string($pluginName.'_'.$key), |
|
68 | 68 | $pluginName, |
69 | 69 | 'setting', |
70 | 70 | 'Plugins', |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $interbreadcrumb[] = array( |
102 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', |
|
102 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/index.php', |
|
103 | 103 | 'name' => get_lang('PlatformAdmin') |
104 | 104 | ); |
105 | 105 | $interbreadcrumb[] = array( |
106 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins', |
|
106 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins', |
|
107 | 107 | 'name' => get_lang('Plugins') |
108 | 108 | ); |
109 | 109 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | $from = intval($from); |
115 | 115 | $number_of_items = intval($number_of_items); |
116 | 116 | $column = intval($column); |
117 | - $direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction; |
|
117 | + $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction; |
|
118 | 118 | |
119 | 119 | $sql = "SELECT |
120 | 120 | id AS col0, |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | api_protect_admin_script(); |
11 | 11 | |
12 | -$new_language = Security::remove_XSS($_REQUEST['new_language']); |
|
13 | -$language_variable = Security::remove_XSS($_REQUEST['variable_language']); |
|
14 | -$file_id = intval($_REQUEST['file_id']); |
|
12 | +$new_language = Security::remove_XSS($_REQUEST['new_language']); |
|
13 | +$language_variable = Security::remove_XSS($_REQUEST['variable_language']); |
|
14 | +$file_id = intval($_REQUEST['file_id']); |
|
15 | 15 | /** |
16 | 16 | * Code |
17 | 17 | */ |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | //update variable language |
29 | 29 | // Replace double quotes to avoid parse errors |
30 | - $new_language = str_replace('"', '\"',$new_language); |
|
30 | + $new_language = str_replace('"', '\"', $new_language); |
|
31 | 31 | // Replace new line signs to avoid parse errors - see #6773 |
32 | - $new_language = str_replace("\n","\\n",$new_language); |
|
33 | - $all_file_of_directory[$language_variable]="\"".$new_language."\";"; |
|
32 | + $new_language = str_replace("\n", "\\n", $new_language); |
|
33 | + $all_file_of_directory[$language_variable] = "\"".$new_language."\";"; |
|
34 | 34 | $result_array = array(); |
35 | 35 | |
36 | 36 | foreach ($all_file_of_directory as $key_value=>$value_info) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (!empty($result_array)) { |
41 | 41 | foreach ($result_array as $key => $result) { |
42 | 42 | if ($result == false) { |
43 | - $variables_with_problems .=$key.' <br />'; |
|
43 | + $variables_with_problems .= $key.' <br />'; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -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> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $cidReset = true; |
10 | 10 | |
11 | 11 | require_once '../inc/global.inc.php'; |
12 | -$this_section=SECTION_PLATFORM_ADMIN; |
|
12 | +$this_section = SECTION_PLATFORM_ADMIN; |
|
13 | 13 | |
14 | 14 | api_protect_admin_script(); |
15 | 15 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $error_message = ''; |
19 | 19 | $first_letter_class = ''; |
20 | 20 | $first_letter_course = ''; |
21 | -$courses = array (); |
|
21 | +$courses = array(); |
|
22 | 22 | $classes = array(); |
23 | 23 | |
24 | 24 | $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $tool_name = get_lang('AddClassesToACourse'); |
28 | 28 | |
29 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
29 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
30 | 30 | |
31 | 31 | Display :: display_header($tool_name); |
32 | 32 | |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | -$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ". (count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name"; |
|
71 | +$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ".(count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name"; |
|
72 | 72 | $result = Database::query($sql); |
73 | 73 | $db_classes = Database::store_result($result); |
74 | -$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code"; |
|
74 | +$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ".(count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code"; |
|
75 | 75 | $result = Database::query($sql); |
76 | 76 | $db_courses = Database::store_result($result); |
77 | 77 | if (!empty ($error_message)) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | foreach ($db_classes as $class) |
115 | 115 | { |
116 | 116 | ?> |
117 | - <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
117 | + <option value="<?php echo $class['id']; ?>" <?php if (in_array($class['id'], $classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
118 | 118 | <?php |
119 | 119 | } |
120 | 120 | ?> |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | foreach ($db_courses as $course) |
132 | 132 | { |
133 | 133 | ?> |
134 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
134 | + <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
135 | 135 | <?php |
136 | 136 | } |
137 | 137 | ?> |
@@ -46,14 +46,15 @@ discard block |
||
46 | 46 | if (count($classes) == 0 || count($courses) == 0) |
47 | 47 | { |
48 | 48 | Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse')); |
49 | - } |
|
50 | - elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses |
|
49 | + } elseif (api_substr($_POST['formSubmit'], -2) == '>>') { |
|
50 | + // add classes to courses |
|
51 | 51 | { |
52 | 52 | foreach ($courses as $course_code) |
53 | 53 | { |
54 | 54 | foreach ($classes as $class_id) |
55 | 55 | { |
56 | 56 | ClassManager :: subscribe_to_course($class_id, $course_code); |
57 | + } |
|
57 | 58 | } |
58 | 59 | } |
59 | 60 | Display::display_normal_message(get_lang('ClassesSubscribed')); |
@@ -114,7 +115,10 @@ discard block |
||
114 | 115 | foreach ($db_classes as $class) |
115 | 116 | { |
116 | 117 | ?> |
117 | - <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
118 | + <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) { |
|
119 | + echo 'selected="selected"'; |
|
120 | +} |
|
121 | +?>><?php echo $class['name']; ?></option> |
|
118 | 122 | <?php |
119 | 123 | } |
120 | 124 | ?> |
@@ -131,7 +135,10 @@ discard block |
||
131 | 135 | foreach ($db_courses as $course) |
132 | 136 | { |
133 | 137 | ?> |
134 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
138 | + <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) { |
|
139 | + echo 'selected="selected"'; |
|
140 | +} |
|
141 | +?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
135 | 142 | <?php |
136 | 143 | } |
137 | 144 | ?> |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | |
68 | 68 | //Column config |
69 | 69 | $column_model = array( |
70 | - array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'), |
|
70 | + array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'), |
|
71 | 71 | // array('name'=>'message', 'index'=>'message', 'width'=>'500', 'align'=>'left','sortable'=>'false'), |
72 | - array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'), |
|
73 | - array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
|
74 | - array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
|
75 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
|
72 | + array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'), |
|
73 | + array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
|
74 | + array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
|
75 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
|
76 | 76 | ); |
77 | 77 | //Autowidth |
78 | 78 | $extra_params['autowidth'] = 'true'; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
83 | 83 | $htmlHeadXtra[] = '<script> |
84 | 84 | $(function() { |
85 | - '.Display::grid_js('event_email_template', $url,$columns,$column_model,$extra_params, array(), $action_links,true).' |
|
85 | + '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, array(), $action_links, true).' |
|
86 | 86 | }); |
87 | 87 | </script>'; |
88 | 88 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function deleteAction($id) { |
34 | - $event_email_template = new EventEmailTemplate(); |
|
34 | + $event_email_template = new EventEmailTemplate(); |
|
35 | 35 | return $event_email_template->delete($id); |
36 | 36 | } |
37 | 37 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
74 | 74 | array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
75 | 75 | array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
76 | - ); |
|
76 | + ); |
|
77 | 77 | //Autowidth |
78 | 78 | $extra_params['autowidth'] = 'true'; |
79 | 79 | //height auto |
@@ -90,26 +90,26 @@ |
||
90 | 90 | { |
91 | 91 | $baseDir = api_get_path(SYS_ARCHIVE_PATH); |
92 | 92 | $uploadPath = 'pdfimport/'; |
93 | - $errors = array (); |
|
93 | + $errors = array(); |
|
94 | 94 | if (!is_dir($baseDir.$uploadPath)) { |
95 | 95 | @mkdir($baseDir.$uploadPath); |
96 | 96 | } |
97 | - if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024*1024*1024)) { |
|
97 | + if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) { |
|
98 | 98 | error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__); |
99 | 99 | return $errors; |
100 | 100 | } |
101 | 101 | $list = scandir($baseDir.$uploadPath); |
102 | 102 | $i = 0; |
103 | 103 | foreach ($list as $file) { |
104 | - if (substr($file,0,1) == '.' or !is_file($baseDir.$uploadPath.$file)) { |
|
104 | + if (substr($file, 0, 1) == '.' or !is_file($baseDir.$uploadPath.$file)) { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | - $parts = preg_split('/_/',$file); |
|
107 | + $parts = preg_split('/_/', $file); |
|
108 | 108 | $course = api_get_course_info($parts[0]); |
109 | 109 | if (count($course) > 0) { |
110 | 110 | // Build file info because handle_uploaded_document() needs it (name, type, size, tmp_name) |
111 | 111 | $fileSize = filesize($baseDir.$uploadPath.$file); |
112 | - $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2],0,-4)); |
|
112 | + $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2], 0, -4)); |
|
113 | 113 | if ($docId > 0) { |
114 | 114 | if (!is_file($baseDir.$uploadPath.$file)) { |
115 | 115 | error_log($baseDir.$uploadPath.$file.' does not exists in '.__FILE__); |
@@ -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; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | } |
69 | 69 | </script>'; |
70 | 70 | |
71 | -$htmlHeadXtra[] = '<link href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
72 | -$htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
71 | +$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
72 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
73 | 73 | $htmlHeadXtra[] = '<script> |
74 | 74 | $(document).ready(function() { |
75 | 75 | var $image = $("#previewImage"); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | if (api_get_setting('login_is_email') == 'true') { |
196 | - $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
196 | + $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
197 | 197 | $form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']); |
198 | 198 | } |
199 | 199 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | // Picture |
209 | 209 | $form->addElement('file', 'picture', get_lang('AddPicture'), array('id' => 'picture', 'class' => 'picture-form')); |
210 | -$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
|
210 | +$allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); |
|
211 | 211 | |
212 | 212 | $form->addHtml('<div class="form-group"> |
213 | 213 | <label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label> |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if (api_get_setting('login_is_email') != 'true') { |
239 | 239 | $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
240 | 240 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
241 | - $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
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'); |
243 | 243 | $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']); |
244 | 244 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1); |
277 | 277 | $group = array(); |
278 | -$group[] =$form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2); |
|
278 | +$group[] = $form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2); |
|
279 | 279 | $group[] = $form->createElement( |
280 | 280 | 'password', |
281 | 281 | 'password', |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | // Platform admin |
310 | 310 | if (api_is_platform_admin()) { |
311 | 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); |
|
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 | 317 | $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
318 | 318 | $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | if (!$user_data['platform_admin']) { |
337 | 337 | // Expiration Date |
338 | 338 | $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
339 | - $group = array (); |
|
339 | + $group = array(); |
|
340 | 340 | $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
341 | 341 | $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
342 | 342 | $form->addGroup($group, 'max_member_group', null, '', false); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | if ($studentBoss) { |
355 | 355 | foreach ($studentBoss as $bossId => $userData) { |
356 | 356 | $bossInfo = api_get_user_info($userData['user_id']); |
357 | - $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username']; |
|
357 | + $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username']; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $jquery_ready_content = $returnParams['jquery_ready_content']; |
372 | 372 | |
373 | 373 | // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function |
374 | -$htmlHeadXtra[] ='<script> |
|
374 | +$htmlHeadXtra[] = '<script> |
|
375 | 375 | $(document).ready(function(){ |
376 | 376 | '.$jquery_ready_content.' |
377 | 377 | }); |
@@ -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"> |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | api_protect_admin_script(true); |
20 | 20 | |
21 | 21 | // Setting breadcrumbs. |
22 | -$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
23 | -$interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes')); |
|
22 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
24 | 24 | |
25 | 25 | // Setting the name of the tool. |
26 | 26 | $tool_name = get_lang('SubscribeClassToCourses'); |
27 | 27 | |
28 | 28 | $add_type = 'multiple'; |
29 | -if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ |
|
29 | +if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
|
30 | 30 | $add_type = Security::remove_XSS($_REQUEST['add_type']); |
31 | 31 | } |
32 | 32 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id); |
99 | 99 | $searchForm->addHeader(get_lang('AdvancedSearch')); |
100 | -$renderer =& $searchForm->defaultRenderer(); |
|
100 | +$renderer = & $searchForm->defaultRenderer(); |
|
101 | 101 | $searchForm->addElement('hidden', 'id', $id); |
102 | 102 | foreach ($filters as $param) { |
103 | 103 | $searchForm->addElement($param['type'], $param['name'], $param['label']); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | //checking for extra field with filter on |
143 | 143 | |
144 | -function search($needle,$type) |
|
144 | +function search($needle, $type) |
|
145 | 145 | { |
146 | 146 | global $elements_in; |
147 | 147 | $xajax_response = new xajaxResponse(); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } else { |
152 | 152 | $list = CourseManager::get_courses_list(0, 0, 2, 'ASC', -1, $needle); |
153 | 153 | } |
154 | - if ($type=='single') { |
|
154 | + if ($type == 'single') { |
|
155 | 155 | } else { |
156 | 156 | $return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">'; |
157 | 157 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | echo '<div class="actions">'; |
185 | -echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>'; |
|
185 | +echo '<a href="usergroups.php">'.Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>'; |
|
186 | 186 | echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search')); |
187 | 187 | echo '</div>'; |
188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | ?> |
194 | 194 | |
195 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
195 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>> |
|
196 | 196 | |
197 | 197 | <?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; |
198 | 198 | echo Display::input('hidden', 'id', $id); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | <td align="center"><b><?php echo get_lang('CoursesInGroup') ?> :</b></td> |
212 | 212 | </tr> |
213 | 213 | |
214 | -<?php if ($add_type=='multiple') { ?> |
|
214 | +<?php if ($add_type == 'multiple') { ?> |
|
215 | 215 | <tr> |
216 | 216 | <td align="center"> |
217 | 217 | <?php echo get_lang('FirstLetterCourseTitle'); ?> : |
@@ -229,7 +229,7 @@ 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> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } else { |
238 | 238 | ?> |
239 | 239 | <div id="ajax_list_multiple"> |
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); ?> |
|
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 | 243 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | </td> |
269 | 269 | <td align="center"> |
270 | 270 | <?php |
271 | - echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),false ); |
|
271 | + echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), false); |
|
272 | 272 | unset($sessionUsersList); |
273 | 273 | ?> |
274 | 274 | </td> |
@@ -144,7 +144,10 @@ |
||
144 | 144 | echo '</div>'; |
145 | 145 | ?> |
146 | 146 | |
147 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
147 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
148 | + echo '&add=true' ; |
|
149 | +} |
|
150 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
148 | 151 | <?php echo '<legend>'.$tool_name.' '.$promotion_data['name'].'</legend>'; |
149 | 152 | |
150 | 153 | if ($add_type=='multiple') { |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | |
23 | 23 | set_time_limit(0); |
24 | 24 | |
25 | -$courses = array (); |
|
25 | +$courses = array(); |
|
26 | 26 | $courses[''] = '--'; |
27 | 27 | $sql = "SELECT code,visual_code,title FROM $course_table ORDER BY visual_code"; |
28 | 28 | |
29 | 29 | global $_configuration; |
30 | 30 | |
31 | 31 | if (api_is_multiple_url_enabled()) { |
32 | - $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
32 | + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
33 | 33 | $access_url_id = api_get_current_access_url_id(); |
34 | - if ($access_url_id != -1){ |
|
34 | + if ($access_url_id != -1) { |
|
35 | 35 | $sql = "SELECT code,visual_code,title |
36 | 36 | FROM $course_table as c |
37 | 37 | INNER JOIN $tbl_course_rel_access_url as course_rel_url |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | $form = new FormValidator('export_users'); |
48 | 48 | $form->addElement('header', $tool_name); |
49 | -$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML','xml'); |
|
49 | +$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML', 'xml'); |
|
50 | 50 | $form->addElement('radio', 'file_type', null, 'CSV', 'csv'); |
51 | 51 | $form->addElement('radio', 'file_type', null, 'XLS', 'xls'); |
52 | 52 | |
53 | -$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'),'1'); |
|
53 | +$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'), '1'); |
|
54 | 54 | $form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses); |
55 | 55 | $form->addButtonExport(get_lang('Export')); |
56 | 56 | $form->setDefaults(array('file_type' => 'csv')); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | u.firstname AS FirstName, |
69 | 69 | u.email AS Email, |
70 | 70 | u.username AS UserName, |
71 | - ".(($_configuration['password_encryption']!='none')?" ":"u.password AS Password, ")." |
|
71 | + ".(($_configuration['password_encryption'] != 'none') ? " " : "u.password AS Password, ")." |
|
72 | 72 | u.auth_source AS AuthSource, |
73 | 73 | u.status AS Status, |
74 | 74 | u.official_code AS OfficialCode, |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | $filename = 'export_users_'.$course_code.'_'.api_get_local_time(); |
84 | 84 | } else { |
85 | 85 | if (api_is_multiple_url_enabled()) { |
86 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
86 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
87 | 87 | $access_url_id = api_get_current_access_url_id(); |
88 | 88 | if ($access_url_id != -1) { |
89 | - $sql.= " FROM $user_table u |
|
89 | + $sql .= " FROM $user_table u |
|
90 | 90 | INNER JOIN $tbl_user_rel_access_url as user_rel_url |
91 | 91 | ON (u.user_id= user_rel_url.user_id) |
92 | 92 | WHERE access_url_id = $access_url_id |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $filename = 'export_users_'.api_get_local_time(); |
99 | 99 | } |
100 | 100 | $data = array(); |
101 | - $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false); |
|
102 | - if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') { |
|
101 | + $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false); |
|
102 | + if ($export['addcsvheader'] == '1' AND $export['file_type'] == 'csv') { |
|
103 | 103 | if ($_configuration['password_encryption'] != 'none') { |
104 | 104 | $data[] = array( |
105 | 105 | 'UserId', |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | ); |
128 | 128 | } |
129 | 129 | |
130 | - foreach($extra_fields as $extra) { |
|
131 | - $data[0][]=$extra[1]; |
|
130 | + foreach ($extra_fields as $extra) { |
|
131 | + $data[0][] = $extra[1]; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | 135 | $res = Database::query($sql); |
136 | - while($user = Database::fetch_array($res,'ASSOC')) { |
|
136 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
137 | 137 | $student_data = UserManager:: get_extra_user_data( |
138 | 138 | $user['UserId'], |
139 | 139 | true, |
140 | 140 | false |
141 | 141 | ); |
142 | - foreach($student_data as $key=>$value) { |
|
142 | + foreach ($student_data as $key=>$value) { |
|
143 | 143 | $key = substr($key, 6); |
144 | 144 | if (is_array($value)) { |
145 | 145 | $user[$key] = $value[$key]; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $user[$key] = $value; |
148 | 148 | } |
149 | 149 | } |
150 | - $data[] = $user ; |
|
150 | + $data[] = $user; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | switch ($file_type) { |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | global $_configuration; |
30 | 30 | |
31 | 31 | if (api_is_multiple_url_enabled()) { |
32 | - $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
33 | - $access_url_id = api_get_current_access_url_id(); |
|
34 | - if ($access_url_id != -1){ |
|
35 | - $sql = "SELECT code,visual_code,title |
|
32 | + $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
33 | + $access_url_id = api_get_current_access_url_id(); |
|
34 | + if ($access_url_id != -1){ |
|
35 | + $sql = "SELECT code,visual_code,title |
|
36 | 36 | FROM $course_table as c |
37 | 37 | INNER JOIN $tbl_course_rel_access_url as course_rel_url |
38 | 38 | ON (c.id = course_rel_url.c_id) |
39 | 39 | WHERE access_url_id = $access_url_id |
40 | 40 | ORDER BY visual_code"; |
41 | - } |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | $result = Database::query($sql); |
44 | 44 | while ($course = Database::fetch_object($result)) { |
45 | - $courses[$course->code] = $course->visual_code.' - '.$course->title; |
|
45 | + $courses[$course->code] = $course->visual_code.' - '.$course->title; |
|
46 | 46 | } |
47 | 47 | $form = new FormValidator('export_users'); |
48 | 48 | $form->addElement('header', $tool_name); |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | $form->setDefaults(array('file_type' => 'csv')); |
57 | 57 | |
58 | 58 | if ($form->validate()) { |
59 | - $export = $form->exportValues(); |
|
60 | - $file_type = $export['file_type']; |
|
61 | - $course_code = Database::escape_string($export['course_code']); |
|
62 | - $courseInfo = api_get_course_info($course_code); |
|
63 | - $courseId = $courseInfo['real_id']; |
|
59 | + $export = $form->exportValues(); |
|
60 | + $file_type = $export['file_type']; |
|
61 | + $course_code = Database::escape_string($export['course_code']); |
|
62 | + $courseInfo = api_get_course_info($course_code); |
|
63 | + $courseId = $courseInfo['real_id']; |
|
64 | 64 | |
65 | - $sql = "SELECT |
|
65 | + $sql = "SELECT |
|
66 | 66 | u.user_id AS UserId, |
67 | 67 | u.lastname AS LastName, |
68 | 68 | u.firstname AS FirstName, |
@@ -73,96 +73,96 @@ discard block |
||
73 | 73 | u.status AS Status, |
74 | 74 | u.official_code AS OfficialCode, |
75 | 75 | u.phone AS Phone"; |
76 | - if (strlen($course_code) > 0) { |
|
77 | - $sql .= " FROM $user_table u, $course_user_table cu |
|
76 | + if (strlen($course_code) > 0) { |
|
77 | + $sql .= " FROM $user_table u, $course_user_table cu |
|
78 | 78 | WHERE |
79 | 79 | u.user_id = cu.user_id AND |
80 | 80 | cu.c_id = $courseId AND |
81 | 81 | cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." |
82 | 82 | ORDER BY lastname,firstname"; |
83 | - $filename = 'export_users_'.$course_code.'_'.api_get_local_time(); |
|
84 | - } else { |
|
85 | - if (api_is_multiple_url_enabled()) { |
|
86 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
87 | - $access_url_id = api_get_current_access_url_id(); |
|
88 | - if ($access_url_id != -1) { |
|
89 | - $sql.= " FROM $user_table u |
|
83 | + $filename = 'export_users_'.$course_code.'_'.api_get_local_time(); |
|
84 | + } else { |
|
85 | + if (api_is_multiple_url_enabled()) { |
|
86 | + $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
87 | + $access_url_id = api_get_current_access_url_id(); |
|
88 | + if ($access_url_id != -1) { |
|
89 | + $sql.= " FROM $user_table u |
|
90 | 90 | INNER JOIN $tbl_user_rel_access_url as user_rel_url |
91 | 91 | ON (u.user_id= user_rel_url.user_id) |
92 | 92 | WHERE access_url_id = $access_url_id |
93 | 93 | ORDER BY lastname,firstname"; |
94 | - } |
|
95 | - } else { |
|
96 | - $sql .= " FROM $user_table u ORDER BY lastname,firstname"; |
|
97 | - } |
|
98 | - $filename = 'export_users_'.api_get_local_time(); |
|
99 | - } |
|
100 | - $data = array(); |
|
101 | - $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false); |
|
102 | - if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') { |
|
103 | - if ($_configuration['password_encryption'] != 'none') { |
|
104 | - $data[] = array( |
|
105 | - 'UserId', |
|
106 | - 'LastName', |
|
107 | - 'FirstName', |
|
108 | - 'Email', |
|
109 | - 'UserName', |
|
110 | - 'AuthSource', |
|
111 | - 'Status', |
|
112 | - 'OfficialCode', |
|
113 | - 'PhoneNumber', |
|
114 | - ); |
|
115 | - } else { |
|
116 | - $data[] = array( |
|
117 | - 'UserId', |
|
118 | - 'LastName', |
|
119 | - 'FirstName', |
|
120 | - 'Email', |
|
121 | - 'UserName', |
|
122 | - 'Password', |
|
123 | - 'AuthSource', |
|
124 | - 'Status', |
|
125 | - 'OfficialCode', |
|
126 | - 'PhoneNumber', |
|
127 | - ); |
|
128 | - } |
|
129 | - |
|
130 | - foreach($extra_fields as $extra) { |
|
131 | - $data[0][]=$extra[1]; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - $res = Database::query($sql); |
|
136 | - while($user = Database::fetch_array($res,'ASSOC')) { |
|
137 | - $student_data = UserManager:: get_extra_user_data( |
|
138 | - $user['UserId'], |
|
139 | - true, |
|
140 | - false |
|
141 | - ); |
|
142 | - foreach($student_data as $key=>$value) { |
|
143 | - $key = substr($key, 6); |
|
144 | - if (is_array($value)) { |
|
145 | - $user[$key] = $value[$key]; |
|
146 | - } else { |
|
147 | - $user[$key] = $value; |
|
148 | - } |
|
149 | - } |
|
150 | - $data[] = $user ; |
|
151 | - } |
|
152 | - |
|
153 | - switch ($file_type) { |
|
154 | - case 'xml': |
|
155 | - Export::arrayToXml($data, $filename, 'Contact', 'Contacts'); |
|
156 | - exit; |
|
157 | - break; |
|
158 | - case 'csv': |
|
159 | - Export::arrayToCsv($data, $filename); |
|
160 | - exit; |
|
161 | - case 'xls': |
|
162 | - Export::arrayToXls($data, $filename); |
|
163 | - exit; |
|
164 | - break; |
|
165 | - } |
|
94 | + } |
|
95 | + } else { |
|
96 | + $sql .= " FROM $user_table u ORDER BY lastname,firstname"; |
|
97 | + } |
|
98 | + $filename = 'export_users_'.api_get_local_time(); |
|
99 | + } |
|
100 | + $data = array(); |
|
101 | + $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false); |
|
102 | + if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') { |
|
103 | + if ($_configuration['password_encryption'] != 'none') { |
|
104 | + $data[] = array( |
|
105 | + 'UserId', |
|
106 | + 'LastName', |
|
107 | + 'FirstName', |
|
108 | + 'Email', |
|
109 | + 'UserName', |
|
110 | + 'AuthSource', |
|
111 | + 'Status', |
|
112 | + 'OfficialCode', |
|
113 | + 'PhoneNumber', |
|
114 | + ); |
|
115 | + } else { |
|
116 | + $data[] = array( |
|
117 | + 'UserId', |
|
118 | + 'LastName', |
|
119 | + 'FirstName', |
|
120 | + 'Email', |
|
121 | + 'UserName', |
|
122 | + 'Password', |
|
123 | + 'AuthSource', |
|
124 | + 'Status', |
|
125 | + 'OfficialCode', |
|
126 | + 'PhoneNumber', |
|
127 | + ); |
|
128 | + } |
|
129 | + |
|
130 | + foreach($extra_fields as $extra) { |
|
131 | + $data[0][]=$extra[1]; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + $res = Database::query($sql); |
|
136 | + while($user = Database::fetch_array($res,'ASSOC')) { |
|
137 | + $student_data = UserManager:: get_extra_user_data( |
|
138 | + $user['UserId'], |
|
139 | + true, |
|
140 | + false |
|
141 | + ); |
|
142 | + foreach($student_data as $key=>$value) { |
|
143 | + $key = substr($key, 6); |
|
144 | + if (is_array($value)) { |
|
145 | + $user[$key] = $value[$key]; |
|
146 | + } else { |
|
147 | + $user[$key] = $value; |
|
148 | + } |
|
149 | + } |
|
150 | + $data[] = $user ; |
|
151 | + } |
|
152 | + |
|
153 | + switch ($file_type) { |
|
154 | + case 'xml': |
|
155 | + Export::arrayToXml($data, $filename, 'Contact', 'Contacts'); |
|
156 | + exit; |
|
157 | + break; |
|
158 | + case 'csv': |
|
159 | + Export::arrayToCsv($data, $filename); |
|
160 | + exit; |
|
161 | + case 'xls': |
|
162 | + Export::arrayToXls($data, $filename); |
|
163 | + exit; |
|
164 | + break; |
|
165 | + } |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | Display :: display_header($tool_name); |