Minor - format code.

1.10.x
Julio Montoya 9 years ago
parent f53d157dda
commit 4f69b6f854
  1. 24
      main/tracking/exams.php

@ -5,7 +5,6 @@
* @package chamilo.tracking * @package chamilo.tracking
*/ */
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
//require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
$toolTable = Database::get_course_table(TABLE_TOOL_LIST); $toolTable = Database::get_course_table(TABLE_TOOL_LIST);
$quizTable = Database::get_course_table(TABLE_QUIZ_TEST); $quizTable = Database::get_course_table(TABLE_QUIZ_TEST);
@ -189,7 +188,7 @@ if (!empty($courseList) && is_array($courseList)) {
if ($global) { if ($global) {
$sql = "SELECT count(id) as count $sql = "SELECT count(id) as count
FROM $quizTable AS quiz FROM $quizTable AS quiz
WHERE active='1' AND c_id = $courseId AND session_id = 0"; WHERE active='1' AND c_id = $courseId AND (session_id = 0 OR session_id IS NULL)";
$result = Database::query($sql); $result = Database::query($sql);
$countExercises = Database::store_result($result); $countExercises = Database::store_result($result);
$exerciseCount = $countExercises[0]['count']; $exerciseCount = $countExercises[0]['count'];
@ -201,7 +200,7 @@ if (!empty($courseList) && is_array($courseList)) {
$countExercises = Database::store_result($result); $countExercises = Database::store_result($result);
$exerciseSessionCount = $countExercises[0]['count']; $exerciseSessionCount = $countExercises[0]['count'];
$exerciseCount = $exerciseCount + $exerciseCount *count($newSessionList) + $exerciseSessionCount; $exerciseCount = $exerciseCount + $exerciseCount * count($newSessionList) + $exerciseSessionCount;
// Add course and session list. // Add course and session list.
if ($exerciseCount == 0) { if ($exerciseCount == 0) {
@ -238,7 +237,6 @@ if (!empty($courseList) && is_array($courseList)) {
ORDER BY session_id, quiz.title ASC"; ORDER BY session_id, quiz.title ASC";
} else { } else {
$sql = "SELECT quiz.title, id, session_id $sql = "SELECT quiz.title, id, session_id
FROM $quizTable AS quiz FROM $quizTable AS quiz
WHERE WHERE
@ -254,7 +252,8 @@ if (!empty($courseList) && is_array($courseList)) {
if (Database::num_rows($resultExercises) > 0) { if (Database::num_rows($resultExercises) > 0) {
$export_array_global = array(); $export_array_global = array();
while ($exercise = Database::fetch_array($resultExercises)) { while ($exercise = Database::fetch_array($resultExercises, 'ASSOC')) {
$exerciseSessionId = $exercise['session_id']; $exerciseSessionId = $exercise['session_id'];
if (empty($exerciseSessionId)) { if (empty($exerciseSessionId)) {
@ -387,8 +386,10 @@ function sort_user($a, $b) {
if ($a['score'] < $b['score']) { if ($a['score'] < $b['score']) {
return 1; return 1;
} }
return 0; return 0;
} }
return 1; return 1;
} }
@ -482,6 +483,15 @@ function export_complete_report_xls($filename, $array)
exit; exit;
} }
/**
* @param $filter_score
* @param $global
* @param $exercise
* @param $courseInfo
* @param $sessionId
* @param $newSessionList
* @return array
*/
function processStudentList($filter_score, $global, $exercise, $courseInfo, $sessionId, $newSessionList) function processStudentList($filter_score, $global, $exercise, $courseInfo, $sessionId, $newSessionList)
{ {
$exerciseStatsTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $exerciseStatsTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
@ -547,7 +557,7 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
WHERE WHERE
ex.c_id = $courseId AND ex.c_id = $courseId AND
ex.exe_exo_id = ".$exercise['id']." AND ex.exe_exo_id = ".$exercise['id']." AND
exe_user_id='".$studentId."' AND exe_user_id= $studentId AND
session_id = $sessionId session_id = $sessionId
"; ";
$result = Database::query($sql); $result = Database::query($sql);
@ -556,7 +566,7 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
$sql = "SELECT exe_id, exe_result, exe_weighting $sql = "SELECT exe_id, exe_result, exe_weighting
FROM $exerciseStatsTable FROM $exerciseStatsTable
WHERE WHERE
exe_user_id = ".$studentId." AND exe_user_id = $studentId AND
c_id = $courseId AND c_id = $courseId AND
exe_exo_id = ".$exercise['id']." AND exe_exo_id = ".$exercise['id']." AND
session_id = $sessionId session_id = $sessionId

Loading…
Cancel
Save