@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | api_protect_admin_script(); |
20 | 20 | |
21 | 21 | // Setting breadcrumbs. |
22 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | -$interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('AdminClasses')); |
|
22 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => 'class_list.php', 'name' => get_lang('AdminClasses')); |
|
24 | 24 | |
25 | 25 | |
26 | 26 | // Setting the name of the tool. |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $class_id = intval($_GET['idclass']); |
31 | 31 | $class = ClassManager :: get_class_info($class_id); |
32 | 32 | $form = new FormValidator('edit_class', 'post', 'class_edit.php?idclass='.$class_id); |
33 | -$form->addText('name',get_lang('ClassName')); |
|
33 | +$form->addText('name', get_lang('ClassName')); |
|
34 | 34 | $form->addButtonUpdate(get_lang('Ok')); |
35 | 35 | $form->setDefaults(array('name'=>$class['name'])); |
36 | -if($form->validate()) |
|
36 | +if ($form->validate()) |
|
37 | 37 | { |
38 | 38 | $values = $form->exportValues(); |
39 | 39 | ClassManager :: set_name($values['name'], $class_id); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
21 | 21 | |
22 | 22 | // setting breadcrumbs |
23 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
24 | 24 | |
25 | 25 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
26 | 26 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | $token = Security::get_token(); |
29 | 29 | |
30 | 30 | if ($action == 'add') { |
31 | - $interbreadcrumb[]=array('url' => 'grade_models.php','name' => get_lang('GradeModel')); |
|
32 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add')); |
|
31 | + $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel')); |
|
32 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add')); |
|
33 | 33 | } elseif ($action == 'edit') { |
34 | - $interbreadcrumb[]=array('url' => 'grade_models.php','name' => get_lang('GradeModel')); |
|
35 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit')); |
|
34 | + $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel')); |
|
35 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); |
|
36 | 36 | } else { |
37 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('GradeModel')); |
|
37 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradeModel')); |
|
38 | 38 | } |
39 | 39 | |
40 | -$htmlHeadXtra[]= '<script> |
|
40 | +$htmlHeadXtra[] = '<script> |
|
41 | 41 | |
42 | 42 | function plusItem(item) { |
43 | 43 | if (item != 1) { |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | |
78 | 78 | //Column config |
79 | 79 | $column_model = array( |
80 | - array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'), |
|
81 | - array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left','sortable'=>'false'), |
|
82 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') |
|
80 | + array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'), |
|
81 | + array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left', 'sortable'=>'false'), |
|
82 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false') |
|
83 | 83 | ); |
84 | 84 | //Autowidth |
85 | 85 | $extra_params['autowidth'] = 'true'; |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | |
89 | 89 | //With this function we can add actions to the jgrid (edit, delete, etc) |
90 | 90 | $action_links = 'function action_formatter(cellvalue, options, rowObject) { |
91 | - return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
92 | - ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
91 | + return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'. |
|
92 | + ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'. |
|
93 | 93 | '\'; |
94 | 94 | }'; |
95 | 95 | ?> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $(function() { |
98 | 98 | <?php |
99 | 99 | // grid definition see the $obj->display() function |
100 | - echo Display::grid_js('grade_model', $url, $columns, $column_model, $extra_params, array(), $action_links,true); |
|
100 | + echo Display::grid_js('grade_model', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
101 | 101 | ?> |
102 | 102 | }); |
103 | 103 | </script> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $obj->display(); |
126 | 126 | } else { |
127 | 127 | echo '<div class="actions">'; |
128 | - echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
128 | + echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
129 | 129 | echo '</div>'; |
130 | 130 | $form->addElement('hidden', 'sec_token'); |
131 | 131 | $form->setConstants(array('sec_token' => $token)); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $obj->display(); |
148 | 148 | } else { |
149 | 149 | echo '<div class="actions">'; |
150 | - echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
150 | + echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
151 | 151 | echo '</div>'; |
152 | 152 | $form->addElement('hidden', 'sec_token'); |
153 | 153 | $form->setConstants(array('sec_token' => $token)); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Code |
10 | 10 | */ |
11 | 11 | // resetting the course id |
12 | -$cidReset=true; |
|
12 | +$cidReset = true; |
|
13 | 13 | require_once('../inc/global.inc.php'); |
14 | 14 | // setting the section (for the tabs) |
15 | 15 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | api_protect_admin_script(); |
19 | 19 | require('../auth/ldap/authldap.php'); |
20 | 20 | |
21 | -$annee_base=date('Y'); |
|
21 | +$annee_base = date('Y'); |
|
22 | 22 | |
23 | 23 | $tool_name = get_lang('LDAPImport'); |
24 | 24 | // setting breadcrumbs |
25 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
25 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
26 | 26 | |
27 | 27 | $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> |
28 | 28 | var buttoncheck = 1; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $annee = $_GET['annee']; |
50 | 50 | $composante = $_GET['composante']; |
51 | -$etape = $_GET['etape']; |
|
51 | +$etape = $_GET['etape']; |
|
52 | 52 | $course = $_POST['course']; |
53 | 53 | |
54 | 54 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | echo '</div>'; |
199 | 199 | } |
200 | 200 | */ |
201 | -elseif(!empty($annee) && empty($course)) |
|
201 | +elseif (!empty($annee) && empty($course)) |
|
202 | 202 | { |
203 | 203 | Display::display_header($tool_name); |
204 | 204 | echo '<div style="align:center">'; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
207 | 207 | echo '<select name="course">'; |
208 | 208 | $courses = CourseManager::get_courses_list(); |
209 | - foreach($courses as $row) |
|
209 | + foreach ($courses as $row) |
|
210 | 210 | { |
211 | 211 | echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>'; |
212 | 212 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $info = ldap_get_entries($ds, $sr); |
241 | 241 | |
242 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
242 | + for ($key = 0; $key < $info["count"]; $key++) { |
|
243 | 243 | $nom_form[] = $info[$key]["sn"][0]; |
244 | 244 | $prenom_form[] = $info[$key]["givenname"][0]; |
245 | 245 | $email_form[] = $info[$key]["mail"][0]; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | asort($nom_form); |
260 | 260 | reset($nom_form); |
261 | 261 | |
262 | - $statut=5; |
|
262 | + $statut = 5; |
|
263 | 263 | include ('ldap_form_add_users_group.php'); |
264 | 264 | } else { |
265 | 265 | echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
@@ -270,25 +270,25 @@ discard block |
||
270 | 270 | echo '</div>'; |
271 | 271 | |
272 | 272 | } |
273 | -elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes')) |
|
273 | +elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes')) |
|
274 | 274 | { |
275 | - $id=$_POST['username_form']; |
|
276 | - $UserList=array(); |
|
275 | + $id = $_POST['username_form']; |
|
276 | + $UserList = array(); |
|
277 | 277 | $userid_match_login = array(); |
278 | 278 | foreach ($id as $form_index=>$user_id) |
279 | 279 | { |
280 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
280 | + if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) |
|
281 | 281 | { |
282 | 282 | $tmp = ldap_add_user($user_id); |
283 | - $UserList[]= $tmp; |
|
283 | + $UserList[] = $tmp; |
|
284 | 284 | $userid_match_login[$tmp] = $user_id; |
285 | 285 | } |
286 | 286 | } |
287 | 287 | if (!empty($_POST['course'])) |
288 | 288 | { |
289 | - foreach($UserList as $user_id) |
|
289 | + foreach ($UserList as $user_id) |
|
290 | 290 | { |
291 | - CourseManager::add_user_to_course($user_id,$_POST['course']); |
|
291 | + CourseManager::add_user_to_course($user_id, $_POST['course']); |
|
292 | 292 | } |
293 | 293 | header('Location: course_information.php?code='.Security::remove_XSS($_POST['course'])); |
294 | 294 | } |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | else |
315 | 315 | { |
316 | 316 | Display::display_header($tool_name); |
317 | - $message=get_lang('NoUserAdded'); |
|
318 | - Display :: display_normal_message($message,false); |
|
317 | + $message = get_lang('NoUserAdded'); |
|
318 | + Display :: display_normal_message($message, false); |
|
319 | 319 | } |
320 | 320 | echo '<br /><br />'; |
321 | 321 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); |
31 | 31 | |
32 | 32 | $tool_name = get_lang('AddUserGroupToURL'); |
33 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | -$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
33 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | +$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
35 | 35 | |
36 | 36 | Display::display_header($tool_name); |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | if (isset($_POST['form_sent']) && $_POST['form_sent']) { |
48 | 48 | $form_sent = $_POST['form_sent']; |
49 | - $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ; |
|
50 | - $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
49 | + $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array(); |
|
50 | + $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array(); |
|
51 | 51 | $firstLetterUserGroup = $_POST['first_letter_user_group']; |
52 | 52 | |
53 | 53 | if ($form_sent == 1) { |
@@ -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,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 | ?> |
@@ -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 |
@@ -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__); |
@@ -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) { |