From 4912f69c5b3a885d78a8a7f5fad079ab97b24aa7 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Thu, 8 Sep 2016 12:33:05 +0200 Subject: [PATCH] Minor - format code --- main/inc/lib/exercise.lib.php | 11 +++---- main/mySpace/course.php | 4 ++- main/mySpace/student.php | 59 +++++++++++++++++++++++++---------- main/work/work.php | 1 - 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index 3765aceb06..02a1eca48b 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -1546,8 +1546,7 @@ HOTSPOT; $exercise_id, $extra_where_conditions = null, $get_count = false - ) - { + ) { //@todo replace all this globals global $documentPath, $filter; @@ -1618,7 +1617,6 @@ HOTSPOT; } if (strpos($extra_where_conditions, 'group_all')) { - $extra_where_conditions = str_replace( "AND ( group_id = 'group_all' )", '', @@ -1733,7 +1731,8 @@ HOTSPOT; WHERE te.status != 'incomplete' AND te.c_id = " . $course_id . " $session_id_and AND - ce.active <>-1 AND ce.c_id = " . $course_id . " + ce.active <>-1 AND + ce.c_id = " . $course_id . " $exercise_where $extra_where_conditions "; @@ -1763,9 +1762,7 @@ HOTSPOT; AND tth.c_id = " . $course_id . " $hotpotatoe_where $sqlWhereOption - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( - 'string' - ) . ") + AND user.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") ORDER BY tth.c_id ASC, tth.exe_date DESC"; diff --git a/main/mySpace/course.php b/main/mySpace/course.php index 96f50d8cfb..e05b6b52cc 100755 --- a/main/mySpace/course.php +++ b/main/mySpace/course.php @@ -114,7 +114,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { $actionsLeft .= $item; } } - + if (count($a_courses) > 0) { $actionsRight .= Display::url( Display::return_icon('printer.png', get_lang('Print'), array(), 32), @@ -242,6 +242,8 @@ function get_courses($from, $limit, $column, $direction) $assignmentsInCourse = 0; $avgTimeSpentInCourse = 0; $avgProgressInCourse = 0; + $countStudents = 0; + $avgScoreInCourse = 0; if (count($userIdList) > 0) { $countStudents = count($userIdList); diff --git a/main/mySpace/student.php b/main/mySpace/student.php index 98a6f66e7f..84ee992f53 100755 --- a/main/mySpace/student.php +++ b/main/mySpace/student.php @@ -19,21 +19,27 @@ api_block_anonymous_users(); $this_section = SECTION_TRACKING; -$interbreadcrumb[] = array ("url" => api_is_student_boss()?"#":"index.php", "name" => get_lang('MySpace')); +$interbreadcrumb[] = array( + "url" => api_is_student_boss() ? "#" : "index.php", + "name" => get_lang('MySpace') +); if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && !isset($_GET["type"])) { - $interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers')); + $interbreadcrumb[] = array( + "url" => "teachers.php", + "name" => get_lang('Teachers') + ); } if (isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $_GET["type"] == "coach") { - $interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors')); + $interbreadcrumb[] = array("url" => "coaches.php", "name" => get_lang('Tutors')); } function get_count_users() { $keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null; - $active = isset($_GET['active']) ? intval($_GET['active']) : 1; - $sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null; + $active = isset($_GET['active']) ? (int) $_GET['active'] : 1; + $sleepingDays = isset($_GET['sleeping_days']) ? (int) $_GET['sleeping_days'] : null; $lastConnectionDate = null; if (!empty($sleepingDays)) { @@ -55,7 +61,7 @@ function get_users($from, $limit, $column, $direction) { $active = isset($_GET['active']) ? $_GET['active'] : 1; $keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null; - $sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null; + $sleepingDays = isset($_GET['sleeping_days']) ? (int) $_GET['sleeping_days'] : null; $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0; $lastConnectionDate = null; @@ -108,7 +114,6 @@ function get_users($from, $limit, $column, $direction) } $all_datas = array(); - foreach ($students as $student_data) { $student_id = $student_data['user_id']; if (isset($_GET['id_session'])) { @@ -169,9 +174,9 @@ function get_users($from, $limit, $column, $direction) $lostPasswordLink = ''; if (api_is_drh() || api_is_platform_admin()) { $lostPasswordLink = ' '.Display::url( - Display::return_icon('edit.png', get_lang('Edit')), - api_get_path(WEB_CODE_PATH).'mySpace/user_edit.php?user_id='.$student_id - ); + Display::return_icon('edit.png', get_lang('Edit')), + api_get_path(WEB_CODE_PATH).'mySpace/user_edit.php?user_id='.$student_id + ); } $row[] = $lostPasswordLink.$detailsLink; @@ -191,11 +196,26 @@ $actionsLeft = ''; if (api_is_drh()) { $menu_items = array( - Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ), - Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#'), - Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'), - Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'), - Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php'), + Display::url( + Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH)."auth/my_progress.php" + ), + Display::url( + Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), + '#' + ), + Display::url( + Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), + 'teachers.php' + ), + Display::url( + Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), + 'course.php' + ), + Display::url( + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), + 'session.php' + ), Display::url( Display::return_icon('skills.png', get_lang('Skills'), array(), ICON_SIZE_MEDIUM), 'skills.php' @@ -234,7 +254,8 @@ if (api_is_drh()) { $actionsRight = ''; $actionsRight .= Display::url( - Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), 'javascript: void(0);', + Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), + 'javascript: void(0);', array('onclick'=>'javascript: window.print();') ); $actionsRight .= Display::url( @@ -289,7 +310,11 @@ if ($export_csv) { } } -$form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH).'mySpace/student.php'); +$form = new FormValidator( + 'search_user', + 'get', + api_get_path(WEB_CODE_PATH).'mySpace/student.php' +); $form = Tracking::setUserSearchForm($form); $form->setDefaults($params); diff --git a/main/work/work.php b/main/work/work.php index 6158cef624..e9094a22e6 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -177,7 +177,6 @@ switch ($action) { $form->addButtonCreate(get_lang('CreateDirectory')); if ($form->validate()) { - $result = addDir( $_POST, $user_id,