From a565d2a935aef6b60ee97f8980b62f2953436a98 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 17 Mar 2020 13:54:58 +0100 Subject: [PATCH] Add course code in report BT#16865 --- main/exercise/exercise_report.php | 20 +---------------- main/exercise/exercise_result.class.php | 29 +++++++++++++++---------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/main/exercise/exercise_report.php b/main/exercise/exercise_report.php index 0084a48cc51..3d9f2ba0a99 100755 --- a/main/exercise/exercise_report.php +++ b/main/exercise/exercise_report.php @@ -1,11 +1,10 @@ jqgrid integration * Modified by hubert.borderiou (question category) * @@ -304,23 +303,6 @@ WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id; Database::query($sql); - /*if (empty($origin)) { - header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?exerciseId='.$exercise_id.'&'.api_get_cidreq()); - exit; - } - - if ($origin === 'tracking_course') { - //Redirect to the course detail in lp - header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?course='.Security::remove_XSS($_GET['course'])); - exit; - } else { - // Redirect to the reporting - header( - 'Location: '.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?origin='.$origin.'&student='.$student_id.'&details=true&course='.api_get_course_id( - ).'&session_id='.$session_id - ); - exit; - }*/ header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise_show.php?id='.$id.'&student='.$student_id.'&'.api_get_cidreq()); exit; } diff --git a/main/exercise/exercise_result.class.php b/main/exercise/exercise_result.class.php index adf3364fd99..df7a0ff17f9 100755 --- a/main/exercise/exercise_result.class.php +++ b/main/exercise/exercise_result.class.php @@ -56,10 +56,10 @@ public function getExercisesReporting( $cid = api_get_course_id(); $course_id = api_get_course_int_id(); - $user_id = intval($user_id); + $user_id = (int) $user_id; $sessionId = api_get_session_id(); $session_id_and = ' AND te.session_id = '.$sessionId.' '; - $exercise_id = intval($exercise_id); + $exercise_id = (int) $exercise_id; if (!empty($exercise_id)) { $session_id_and .= " AND exe_exo_id = $exercise_id "; @@ -84,11 +84,11 @@ public function getExercisesReporting( user.username, te.status as exstatus FROM $TBL_EXERCISES AS ce - INNER JOIN $TBL_TRACK_EXERCISES AS te + INNER JOIN $TBL_TRACK_EXERCISES AS te ON (te.exe_exo_id = ce.id) - INNER JOIN $TBL_USER AS user + INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id) - LEFT JOIN $TBL_TABLE_LP_MAIN AS tlm + LEFT JOIN $TBL_TABLE_LP_MAIN AS tlm ON (tlm.id = te.orig_lp_id AND tlm.c_id = ce.c_id) WHERE ce.c_id = $course_id AND @@ -115,11 +115,11 @@ public function getExercisesReporting( user.username, te.status as exstatus FROM $TBL_EXERCISES AS ce - INNER JOIN $TBL_TRACK_EXERCISES AS te + INNER JOIN $TBL_TRACK_EXERCISES AS te ON (te.exe_exo_id = ce.id) - INNER JOIN $TBL_USER AS user + INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id) - LEFT JOIN $TBL_TABLE_LP_MAIN AS tlm + LEFT JOIN $TBL_TABLE_LP_MAIN AS tlm ON (tlm.id = te.orig_lp_id AND tlm.c_id = ce.c_id) WHERE ce.c_id = $course_id AND @@ -185,10 +185,10 @@ public function getExercisesReporting( $revised = -1; } else { //revised or not - $sql_exe = "SELECT exe_id + $sql_exe = "SELECT exe_id FROM $TBL_TRACK_ATTEMPT_RECORDING - WHERE - author != '' AND + WHERE + author != '' AND exe_id = ".intval($result['exid'])." LIMIT 1"; $query = Database::query($sql_exe); @@ -371,6 +371,7 @@ public function exportCompleteReportCSV( $data .= get_lang('Status').';'; $data .= get_lang('ToolLearnpath').';'; $data .= get_lang('UserIsCurrentlySubscribed').';'; + $data .= get_lang('CourseCode').';'; $data .= "\n"; //results @@ -419,6 +420,8 @@ public function exportCompleteReportCSV( $data .= str_replace("\r\n", ' ', $row['status']).';'; $data .= str_replace("\r\n", ' ', $row['lp_name']).';'; $data .= str_replace("\r\n", ' ', $row['is_user_subscribed']).';'; + $data .= str_replace("\r\n", ' ', api_get_course_id()).';'; + $data .= "\n"; } @@ -564,6 +567,8 @@ public function exportCompleteReportXLS( $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ToolLearnpath')); $column++; $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('UserIsCurrentlySubscribed')); + $column++; + $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('CourseCode')); $line++; foreach ($this->results as $row) { @@ -713,6 +718,8 @@ public function exportCompleteReportXLS( $worksheet->setCellValueByColumnAndRow($column, $line, $row['lp_name']); $column++; $worksheet->setCellValueByColumnAndRow($column, $line, $row['is_user_subscribed']); + $column++; + $worksheet->setCellValueByColumnAndRow($column, $line, api_get_course_id()); $line++; }