Skip to content

Commit

Permalink
Add course code in report BT#16865
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Mar 17, 2020
1 parent cdfedd9 commit a565d2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
20 changes: 1 addition & 19 deletions main/exercise/exercise_report.php
@@ -1,11 +1,10 @@
<?php

/* For licensing terms, see /license.txt */

/**
* Exercise list: This script shows the list of exercises for administrators and students.
*
* @package chamilo.exercise
*
* @author Julio Montoya <gugli100@gmail.com> jqgrid integration
* Modified by hubert.borderiou (question category)
*
Expand Down Expand Up @@ -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;
}
Expand Down
29 changes: 18 additions & 11 deletions main/exercise/exercise_result.class.php
Expand Up @@ -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 ";
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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++;
}

Expand Down

0 comments on commit a565d2a

Please sign in to comment.