diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php
index 19b84f8f7c..036f14065b 100755
--- a/main/exercice/exercise_result.php
+++ b/main/exercice/exercise_result.php
@@ -176,7 +176,7 @@ if ($origin != 'learnpath') {
Display::display_footer();
} else {
- $lp_mode = $_SESSION['lp_mode'];
+ $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php
index b71e720fd8..d5ff900ba4 100755
--- a/main/exercice/exercise_show.php
+++ b/main/exercice/exercise_show.php
@@ -62,7 +62,11 @@ if (empty($id)) {
api_not_allowed(true);
}
-if (api_is_course_session_coach(api_get_user_id(), api_get_course_id(), api_get_session_id())) {
+if (api_is_course_session_coach(
+ api_get_user_id(),
+ api_get_course_id(),
+ api_get_session_id()
+)) {
if (!api_coach_can_edit_view_results(api_get_course_id(), api_get_session_id())) {
api_not_allowed(true);
}
diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php
index d7d11051c0..6e5f3bec68 100755
--- a/main/exercice/exercise_submit.php
+++ b/main/exercice/exercise_submit.php
@@ -648,7 +648,11 @@ if (api_is_course_admin() && $origin != 'learnpath') {
echo '';
}
-$is_visible_return = $objExercise->is_visible($learnpath_id, $learnpath_item_id, $learnpath_item_view_id);
+$is_visible_return = $objExercise->is_visible(
+ $learnpath_id,
+ $learnpath_item_id,
+ $learnpath_item_view_id
+);
if ($is_visible_return['value'] == false) {
echo $is_visible_return['message'];
if ($origin != 'learnpath') {
diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php
index 7fe8192cb9..6c23c21c3a 100755
--- a/main/inc/lib/tracking.lib.php
+++ b/main/inc/lib/tracking.lib.php
@@ -2102,7 +2102,7 @@ class Tracking
$lp_list = $use_max_score = array();
while ($row_lp = Database::fetch_array($res_row_lp)) {
$lp_list[] = $row_lp['id'];
- $use_max_score[$row_lp['id']] = $row_lp['use_max_score'];
+ $use_max_score[$row_lp['id']] = $row_lp['use_max_score'];
}
if ($debug) {
@@ -2129,6 +2129,7 @@ class Tracking
session_id = $session_id
GROUP BY lp_id, user_id";
if ($debug) echo $sql;
+
$rs_last_lp_view_id = Database::query($sql);
$global_result = 0;
@@ -2201,7 +2202,6 @@ class Tracking
(lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
WHERE lp_view_id = $lp_view_id ";
if ($debug) echo $sql.'
';
-
$res_max_score = Database::query($sql);
while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
@@ -2243,11 +2243,11 @@ class Tracking
if ($debug) echo '$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'
';
} else {
// Case of a TOOL_QUIZ element
- $item_id = $row_max_score['iid'];
- $item_path = $row_max_score['path'];
- $lp_item_view_id = $row_max_score['lp_item_view_id'];
+ $item_id = $row_max_score['iid'];
+ $item_path = $row_max_score['path'];
+ $lp_item_view_id = $row_max_score['lp_item_view_id'];
- // Get last attempt to this exercise through
+ // Get last attempt to this exercise through
// the current lp for the current user
$sql = "SELECT exe_id
FROM $tbl_stats_exercices
@@ -2258,7 +2258,8 @@ class Tracking
orig_lp_item_view_id = $lp_item_view_id AND
exe_cours_id = '$course_code' AND
session_id = $session_id
- ORDER BY exe_date DESC LIMIT 1";
+ ORDER BY exe_date DESC
+ LIMIT 1";
if ($debug) echo $sql .'
';
$result_last_attempt = Database::query($sql);
$num = Database :: num_rows($result_last_attempt);
diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index 92071b623a..3ef061e30d 100755
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -4,9 +4,7 @@
* Implements the tracking of students in the Reporting pages
* @package chamilo.reporting
*/
-/**
- * Code
- */
+
// name of the language file that needs to be included
$language_file = array(
'registration',
@@ -36,7 +34,10 @@ api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
// Check if the user is tutor of the course
- $user_course_status = CourseManager::get_tutor_in_course_status(api_get_user_id(), api_get_course_id());
+ $user_course_status = CourseManager::get_tutor_in_course_status(
+ api_get_user_id(),
+ api_get_course_id()
+ );
if ($user_course_status != 1) {
api_not_allowed(true);
}
@@ -85,11 +86,8 @@ if (isset($_GET['details'])) {
} else
if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
$course_info = CourseManager :: get_course_information($get_course_code);
- if (empty ($cidReq)) {
- //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']);
- }
$interbreadcrumb[] = array (
- "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . (empty ($_SESSION['id_session']) ? '' : $_SESSION['id_session']),
+ "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
"name" => get_lang("Tracking")
);
} else
@@ -173,8 +171,8 @@ if (isset($_GET['details'])) {
}
// Database Table Definitions
-$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
+$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
+$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
$user_id = intval($_GET['user_id']);
@@ -195,15 +193,27 @@ $check = Security::check_token('get');
if ($check) {
switch ($_GET['action']) {
case 'reset_lp' :
- $course = isset($_GET['course']) ? $_GET['course']:"";
- $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']):"";
-
- if (api_is_allowed_to_edit() && !empty($course) && !empty($lp_id) && !empty($student_id)) {
- $course_info = api_get_course_info($course);
- delete_student_lp_events($student_id, $lp_id, $course_info, $session_id);
+ $course = isset($_GET['course']) ? $_GET['course'] : "";
+ $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : "";
+
+ if (api_is_allowed_to_edit() &&
+ !empty($course) &&
+ !empty($lp_id) &&
+ !empty($student_id)
+ ) {
+ $course_info = api_get_course_info($course);
+ delete_student_lp_events(
+ $student_id,
+ $lp_id,
+ $course_info,
+ $session_id
+ );
//@todo delete the stats.track_e_exercices records. First implement this http://support.chamilo.org/issues/1334
- $message = Display::return_message(get_lang('LPWasReset'),'success');
+ $message = Display::return_message(
+ get_lang('LPWasReset'),
+ 'success'
+ );
}
break;
default:
@@ -251,8 +261,11 @@ if (!empty($sessions_coached_by_user)) {
}
}
-$sql = "SELECT course_code FROM $tbl_course_user
- WHERE relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND user_id = ".intval($user_info['user_id']);
+$sql = "SELECT course_code
+ FROM $tbl_course_user
+ WHERE
+ relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
+ user_id = ".intval($user_info['user_id']);
$rs = Database::query($sql);
while ($row = Database :: fetch_array($rs)) {
@@ -266,7 +279,8 @@ while ($row = Database :: fetch_array($rs)) {
}
// Get the list of sessions where the user is subscribed as student
-$sql = 'SELECT id_session, course_code FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
+$sql = 'SELECT id_session, course_code
+ FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
WHERE id_user=' . intval($user_info['user_id']);
$rs = Database::query($sql);
$tmp_sessions = array();
@@ -353,9 +367,21 @@ if (!empty($student_id)) {
if (!CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
unset($courses[$key]);
} else {
- $avg_student_progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, array(), $session_id);
+
+ $avg_student_progress = Tracking::get_avg_student_progress(
+ $user_info['user_id'],
+ $course_code,
+ array(),
+ $session_id
+ );
+
//the score inside the Reporting table
- $avg_student_score = Tracking::get_avg_student_score($user_info['user_id'], $course_code, array(), $session_id);
+ $avg_student_score = Tracking::get_avg_student_score(
+ $user_info['user_id'],
+ $course_code,
+ array(),
+ $session_id
+ );
//var_dump($avg_student_score);
}
@@ -363,7 +389,13 @@ if (!empty($student_id)) {
// time spent on the course
- $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id));
+ $time_spent_on_the_course = api_time_to_hms(
+ Tracking:: get_time_spent_on_the_course(
+ $user_info['user_id'],
+ $course_code,
+ $session_id
+ )
+ );
// get information about connections on the platform by student
$first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
@@ -377,7 +409,7 @@ if (!empty($student_id)) {
}
// cvs informations
- $csv_content[] = array (
+ $csv_content[] = array(
get_lang('Informations', '')
);
$csv_content[] = array (
@@ -385,26 +417,26 @@ if (!empty($student_id)) {
get_lang('Email', ''),
get_lang('Tel', '')
);
- $csv_content[] = array (
+ $csv_content[] = array(
$user_info['complete_name'],
$user_info['email'],
$user_info['phone']
);
- $csv_content[] = array ();
+ $csv_content[] = array();
// csv tracking
- $csv_content[] = array (
+ $csv_content[] = array(
get_lang('Tracking', '')
);
- $csv_content[] = array (
+ $csv_content[] = array(
get_lang('FirstLogin', ''),
get_lang('LatestLogin', ''),
get_lang('TimeSpentInTheCourse', ''),
get_lang('Progress', ''),
get_lang('Score', '')
);
- $csv_content[] = array (
+ $csv_content[] = array(
strip_tags($first_connection_date),
strip_tags($last_connection_date),
$time_spent_on_the_course,
@@ -412,7 +444,6 @@ if (!empty($student_id)) {
$avg_student_score
);
-
//Show title
$info_course = CourseManager :: get_course_information($course_code);
$coachs_name = '';
@@ -547,11 +578,18 @@ if (!empty($student_id)) {