Moving exercise result to a new page exercise_report.php instead of exercice.php?show=result

skala
Julio Montoya 14 years ago
parent d7e06f96ce
commit e6365cc081
  1. 2
      main/exercice/admin.php
  2. 505
      main/exercice/exercice.php
  3. 396
      main/exercice/exercice_report.php
  4. 2
      main/exercice/exercise.class.php
  5. 98
      main/exercice/exercise.lib.php
  6. 6
      main/exercice/exercise_history.php
  7. 123
      main/exercice/exercise_result.class.php
  8. 5
      main/exercice/exercise_show.php
  9. 2
      main/exercice/overview.php
  10. 8
      main/exercice/stats.php
  11. 2
      main/exercice/upload_exercise.php

@ -461,7 +461,7 @@ if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GE
}
echo '<a href="overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.Display::return_icon('preview_view.png', get_lang('Preview'),'','32').'</a>';
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'),'','32'), 'exercice.php?'.api_get_cidReq().'&show=result&exerciseId='.$objExercise->id);
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'),'','32'), 'exercice_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id);
if ($show_quiz_edition) {
echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display::return_icon('settings.png', get_lang('ModifyExercise'),'','32').'</a>';

@ -27,8 +27,6 @@ $htmlHeadXtra[] = api_get_jquery_ui_js();
// Access control
api_protect_course_script(true);
$show = (isset ($_GET['show']) && $_GET['show'] == 'result') ? 'result' : 'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
@ -77,12 +75,7 @@ $exfile = strtolower($exfile[sizeof($exfile) - 1]);
$exercicePath = substr($exercicePath, 0, strpos($exercicePath, $exfile));
$exercicePath = $exercicePath . "exercice.php";
if ($show == 'result') {
if (empty($_GET['exerciseId']) && empty($_GET['path']) ) {
//header('Location: exercice.php?' . api_get_cidreq());
}
}
// Clear the exercise session
if (isset ($_SESSION['objExercise'])) {
api_session_unregister('objExercise');
@ -116,20 +109,7 @@ if (empty ($exerciseId)) {
if (empty ($file)) {
$file = Database :: escape_string($_REQUEST['file']);
}
//
// filter display by student group
// if $_GET['filterByGroup'] = -1 => do not filter
// else, filter by group_id (0 for no group)
//
$filterByGroup = -1;
if (isset($_GET['filterByGroup']) && is_numeric($_GET['filterByGroup'])) {
$filterByGroup = Security::remove_XSS($_GET['filterByGroup']);
api_session_register('filterByGroup');
}
else if (isset($_SESSION['filterByGroup'])) {
$filterByGroup = $_SESSION['filterByGroup'];
}
// -------------------------------
$learnpath_id = intval($_REQUEST['learnpath_id']);
$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
$page = intval($_REQUEST['page']);
@ -140,9 +120,6 @@ if ($page < 0) {
$page = 1;
}
if ($origin == 'learnpath') {
$show = 'result';
}
//Deleting an attempt
if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !empty ($_GET['did']) && $_GET['did'] == strval(intval($_GET['did']))) {
@ -153,120 +130,6 @@ if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !emp
exit;
}
$course_id = api_get_course_int_id();
//Send student email @todo move this code in a class, library
if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_GET['exeid']== strval(intval($_GET['exeid']))) {
$id = intval($_GET['exeid']); //filtered by post-condition
$track_exercise_info = get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}
$test = $track_exercise_info['title'];
$student_id = $track_exercise_info['exe_user_id'];
// $course_id = $track_exercise_info['exe_cours_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
// Teacher data
$teacher_info = api_get_user_info(api_get_user_id());
$user_info = api_get_user_info($student_id);
$student_email = $user_info['mail'];
$from = $teacher_info['mail'];
$from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$url = api_get_path(WEB_CODE_PATH) . 'exercice/exercice.php?' . api_get_cidreq() . '&id_session='.$session_id.'&show=result&exerciseId='.$exerciseId;
$my_post_info = array();
$post_content_id = array();
$comments_exist = false;
foreach ($_POST as $key_index=>$key_value) {
$my_post_info = explode('_',$key_index);
$post_content_id[]=$my_post_info[1];
if ($my_post_info[0]=='comments') {
$comments_exist=true;
}
}
$loop_in_track=($comments_exist===true) ? (count($_POST)/2) : count($_POST);
$array_content_id_exe=array();
if ($comments_exist===true) {
$array_content_id_exe = array_slice($post_content_id,$loop_in_track);
} else {
$array_content_id_exe = $post_content_id;
}
for ($i=0;$i<$loop_in_track;$i++) {
$my_marks = Database::escape_string($_POST['marks_'.$array_content_id_exe[$i]]);
$contain_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
if (isset($contain_comments)) {
$my_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
} else {
$my_comments = '';
}
$my_questionid=$array_content_id_exe[$i];
$sql = "SELECT question from $TBL_QUESTIONS WHERE id = '$my_questionid'";
$result =Database::query($sql);
$ques_name = Database::result($result,0,"question");
$query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks',teacher_comment = '$my_comments' WHERE question_id = ".$my_questionid." AND exe_id=".$id;
Database::query($query);
//Saving results in the track recording table
$recording_changes = 'INSERT INTO '.$TBL_TRACK_ATTEMPT_RECORDING.' (exe_id, question_id, marks, insert_date, author, teacher_comment) VALUES ('."'$id','".$my_questionid."','$my_marks','".api_get_utc_datetime()."','".api_get_user_id()."'".',"'.$my_comments.'")';
Database::query($recording_changes);
}
$qry = 'SELECT DISTINCT question_id, marks FROM ' . $TBL_TRACK_ATTEMPT . ' WHERE exe_id = '.$id .' GROUP BY question_id';
$res = Database::query($qry);
$tot = 0;
while ($row = Database :: fetch_array($res, 'ASSOC')) {
$tot += $row['marks'];
}
$totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".floatval($tot)."' WHERE exe_id = ".$id;
Database::query($totquery);
//@todo move this somewhere else
$subject = get_lang('ExamSheetVCC');
$message = '<p>'.get_lang('DearStudentEmailIntroduction') . '</p><p>'.get_lang('AttemptVCC');
$message .= '<h3>'.get_lang('CourseName'). '</h3><p>'.Security::remove_XSS($course_info['name']).'';
$message .= '<h3>'.get_lang('Exercise') . '</h3><p>'.Security::remove_XSS($test);
//Only for exercises not in a LP
if ($lp_id == 0) {
$message .= '<p>'.get_lang('ClickLinkToViewComment') . ' <a href="#url#">#url#</a><br />';
}
$message .= '<p>'.get_lang('Regards') . ' </p>';
$message .= $from_name;
$message = str_replace("#test#", Security::remove_XSS($test), $message);
$message = str_replace("#url#", $url, $message);
@api_mail_html($student_email, $student_email, $subject, $message, $from_name, $from, array('charset'=>api_get_system_encoding()));
//Updating LP score here
if (in_array($origin, array ('tracking_course','user_course','correct_exercise_in_lp'))) {
$sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = '" . floatval($tot) . "' WHERE id = " .$lp_item_view_id;
Database::query($sql_update_score);
if ($origin == 'tracking_course') {
//Redirect to the course detail in lp
header('location: exercice.php?course=' . Security :: remove_XSS($_GET['course']));
exit;
} else {
//Redirect to the reporting
header('location: ../mySpace/myStudents.php?origin=' . $origin . '&student=' . $student_id . '&details=true&course=' . $course_id.'&session_id='.$session_id);
exit;
}
}
}
if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) {
$_SESSION['gradebook']=Security::remove_XSS($_GET['gradebook']);
$gradebook= $_SESSION['gradebook'];
@ -322,42 +185,7 @@ if ($is_allowedToEdit && !empty ($choice) && $choice == 'exportqti2') {
rmdir($temp_zip_dir);
exit; //otherwise following clicks may become buggy
}
if (!empty ($_GET['extra_data'])) {
switch ($_GET['extra_data']) {
case 'on' :
$_SESSION['export_user_fields'] = true;
break;
default :
$_SESSION['export_user_fields'] = false;
break;
}
}
if (!empty($_GET['export_report']) && $_GET['export_report'] == '1') {
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$user_id = null;
if (empty($_SESSION['export_user_fields']))
$_SESSION['export_user_fields'] = false;
if (!$is_allowedToEdit and !$is_tutor) {
$user_id = api_get_user_id();
}
require_once 'exercise_result.class.php';
switch ($_GET['export_format']) {
case 'xls' :
$export = new ExerciseResult();
$export->exportCompleteReportXLS($documentPath, $user_id, $_SESSION['export_user_fields'], $_GET['export_filter'], $_GET['exerciseId'], $_GET['hotpotato_name']);
exit;
break;
case 'csv' :
default :
$export = new ExerciseResult();
$export->exportCompleteReportCSV($documentPath, $user_id, $_SESSION['export_user_fields'], $_GET['export_filter'], $_GET['exerciseId'], $_GET['hotpotato_name']);
exit;
break;
}
} else {
api_not_allowed(true);
}
}
if ($origin != 'learnpath') {
//so we are not in learnpath tool
@ -482,8 +310,6 @@ if ($is_allowedToEdit) {
// Actions div bar
if ($is_allowedToEdit) {
echo '<div class="actions">';
} elseif ($show == 'result') {
echo '<div class="actions">';
}
@ -499,184 +325,71 @@ HotPotGCt($documentPath, 1, api_get_user_id());
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id,true,true);
if ($show == 'test') {
// Only for administrators
if ($is_allowedToEdit) {
$total_sql = "SELECT count(id) as count FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ";
$sql = "SELECT * FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ORDER BY title LIMIT ".$from."," .$limit;
} else {
// Only for students
$total_sql = "SELECT count(id) as count FROM $TBL_EXERCICES WHERE active = '1' $condition_session ";
$sql = "SELECT id, title, type, description, results_disabled, session_id, start_time, end_time, max_attempt FROM $TBL_EXERCICES
WHERE active='1' $condition_session
ORDER BY title LIMIT ".$from."," .$limit;
}
$result = Database::query($sql);
$exercises_count = Database :: num_rows($result);
$result_total = Database::query($total_sql);
$total_exercises = 0;
if (Database :: num_rows($result_total)) {
$result_total = Database::fetch_array($result_total);
$total_exercises = $result_total['count'];
}
//get HotPotatoes files (active and inactive)
if ($is_allowedToEdit) {
$sql = "SELECT * FROM $TBL_DOCUMENT WHERE path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'";
$res = Database::query($sql);
$hp_count = Database :: num_rows($res);
} else {
$res = Database::query("SELECT * FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "'
AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'
AND ip.visibility='1' AND d.c_id=".api_get_course_int_id()." AND ip.c_id=".api_get_course_int_id());
$hp_count = Database :: num_rows($res);
}
$total = $total_exercises + $hp_count;
// Only for administrators
if ($is_allowedToEdit) {
$total_sql = "SELECT count(id) as count FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ";
$sql = "SELECT * FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ORDER BY title LIMIT ".$from."," .$limit;
} else {
// Only for students
$total_sql = "SELECT count(id) as count FROM $TBL_EXERCICES WHERE active = '1' $condition_session ";
$sql = "SELECT id, title, type, description, results_disabled, session_id, start_time, end_time, max_attempt FROM $TBL_EXERCICES
WHERE active='1' $condition_session
ORDER BY title LIMIT ".$from."," .$limit;
}
$result = Database::query($sql);
$exercises_count = Database :: num_rows($result);
if ($is_allowedToEdit && $origin != 'learnpath') {
if ($show != 'result') {
echo '<a href="exercise_admin.php?' . api_get_cidreq() . '">' . Display :: return_icon('new_exercice.png', get_lang('NewEx'),'','32').'</a>';
echo '<a href="question_create.php?' . api_get_cidreq() . '">' . Display :: return_icon('new_question.png', get_lang('AddQ'),'','32').'</a>';
// Question category
echo '<a href="tests_category.php">';
echo Display::return_icon('question_category_show.gif', get_lang('QuestionCategory'));
echo '</a>';
echo '<a href="question_pool.php">';
echo Display::return_icon('database.png', get_lang('langQuestionPool'), array('style'=>'width:32px'));
echo '</a>';
// end question category
echo '<a href="hotpotatoes.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'),'','32').'</a>';
// link to import qti2 ...
echo '<a href="qti2.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'),'','32') .'</a>';
echo '<a href="upload_exercise.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'),'','32') .'</a>';
}
$result_total = Database::query($total_sql);
$total_exercises = 0;
// the actions for the statistics
if ($show == 'result') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
if ($_SESSION['export_user_fields']) {
$alt = get_lang('ExportWithUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="export_user_fields">';
} else {
$alt = get_lang('ExportWithoutUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="do_not_export_user_fields">';
}
echo '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
echo '<script type="text/javascript">
$(document).ready(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
autoOpen: false,
show: "blind",
resizable: false,
height:250,
modal: true
});
$("#export_opener").click(function() {
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
width:350,
height:220,
buttons: {
"'.addslashes(get_lang('Download')).'": function() {
var export_format = $("input[name=export_format]:checked").val();
var extra_data = $("input[name=load_extra_data]:checked").val();
location.href = targetUrl+"&export_format="+export_format+"&extra_data="+extra_data;
$( this ).dialog( "close" );
},
}
});
$( "#dialog-confirm" ).dialog("open");
return false;
});
});
</script>';
echo '<div id="dialog-confirm" title="'.get_lang("ConfirmYourChoice").'">';
echo Display::tag('p', Display::input('radio', 'export_format', 'csv', array('checked'=>'1', 'id'=>'export_format_csv_label')). Display::tag('label', get_lang('ExportAsCSV'), array('for'=>'export_format_csv_label')));
echo Display::tag('p', Display::input('radio', 'export_format', 'xls', array('id'=>'export_format_xls_label')). Display::tag('label', get_lang('ExportAsXLS'), array('for'=>'export_format_xls_label')));
echo Display::tag('p', Display::input('checkbox', 'load_extra_data', '0',array('id'=>'load_extra_data_id')). Display::tag('label', get_lang('LoadExtraData'), array('for'=>'load_extra_data_id')));
echo '</div>';
if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
$filter = 1;
} else {
$filter = 2;
}
echo '<a id="export_opener" href="'.api_get_self().'?export_report=1&show=result&export_filter='.$filter.'&hotpotato_name='.Security::remove_XSS($_GET['path']).'&exerciseId='.intval($_GET['exerciseId']).'" >'.
Display::return_icon('save.png', get_lang('Export'),'',32).'</a>';
}
}
if (Database :: num_rows($result_total)) {
$result_total = Database::fetch_array($result_total);
$total_exercises = $result_total['count'];
}
//get HotPotatoes files (active and inactive)
if ($is_allowedToEdit) {
$sql = "SELECT * FROM $TBL_DOCUMENT WHERE path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'";
$res = Database::query($sql);
$hp_count = Database :: num_rows($res);
} else {
//Student view
if ($show == 'result') {
echo '<a href="' . api_add_url_param($_SERVER['REQUEST_URI'], 'show=test') . '">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
}
$res = Database::query("SELECT * FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "'
AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'
AND ip.visibility='1' AND d.c_id=".api_get_course_int_id()." AND ip.c_id=".api_get_course_int_id());
$hp_count = Database :: num_rows($res);
}
$total = $total_exercises + $hp_count;
if ($show == 'result') {
if (api_is_allowed_to_edit(null,true)) {
if (!$_GET['filter']) {
$filter_by_not_revised = true;
$filter = 1;
} else {
$filter=Security::remove_XSS($_GET['filter']);
}
$filter = (int)$_GET['filter'];
switch ($filter) {
case 1 :
$filter_by_not_revised = true;
break;
case 2 :
$filter_by_revised = true;
break;
default :
null;
}
if (!empty($_GET['exerciseId']) && empty($_GET['filter_by_user'])) {
if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
$view_result = '<a href="' . api_get_self() . '?cidReq=' . api_get_course_id() . '&show=result&filter=2&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_check.png', get_lang('ShowCorrectedOnly'),'','32').'</a>';
} else {
$view_result = '<a href="' .api_get_self() . '?cidReq=' . api_get_course_id() . '&show=result&filter=1&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_uncheck.png', get_lang('ShowUnCorrectedOnly'),'','32').'</a>';
}
echo $view_result;
//
// filter by student group menu
//
$exercice_id = intval($_GET['exerciseId']);
echo "<script type='text/javascript'>";
echo " function doFilterByGroup() {";
echo " var IdGroup = document.getElementById('groupFilter').value;";
echo " var goToUrl = \"".api_get_self()."?".api_get_cidreq()."&show=result&filter=$filter&gradebook=$gradebook&exerciseId=$exercice_id;$quiz_results_per_page&filterByGroup=\"+IdGroup;";
echo " self.location.href=goToUrl;";
echo " }";
echo " </script>";
echo "&nbsp;&nbsp;";
echo Display::return_icon('group.gif', get_lang("FilterByGroup"));
echo displayGroupMenu("groupFilter", $filterByGroup, "doFilterByGroup()")."&nbsp;";
}
}
}
if ($is_allowedToEdit && $origin != 'learnpath') {
echo '<a href="exercise_admin.php?' . api_get_cidreq() . '">' . Display :: return_icon('new_exercice.png', get_lang('NewEx'),'','32').'</a>';
echo '<a href="question_create.php?' . api_get_cidreq() . '">' . Display :: return_icon('new_question.png', get_lang('AddQ'),'','32').'</a>';
// Question category
echo '<a href="tests_category.php">';
echo Display::return_icon('question_category_show.gif', get_lang('QuestionCategory'));
echo '</a>';
echo '<a href="question_pool.php">';
echo Display::return_icon('database.png', get_lang('langQuestionPool'), array('style'=>'width:32px'));
echo '</a>';
// end question category
echo '<a href="hotpotatoes.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'),'','32').'</a>';
// link to import qti2 ...
echo '<a href="qti2.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'),'','32') .'</a>';
echo '<a href="upload_exercise.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'),'','32') .'</a>';
}
if ($is_allowedToEdit) {
echo '</div>'; // closing the actions div
} elseif ($show == 'result') {
echo '</div>'; // closing the actions div
}
if ($show == 'test') {
if ($total > $limit) {
echo '<div style="float:right;height:20px;">';
//show pages navigation link for previous page
@ -694,9 +407,7 @@ if ($show == 'test') {
}
echo '</div>';
}
}
if ($show == 'test') {
$i =1;
$lis = '';
$exercise_list = array();
@ -834,7 +545,7 @@ if ($show == 'test') {
//Settings
//$actions = Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']);
$actions = Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']);
$actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$actions .='<a href="exercice_report.php?' . api_get_cidreq() . '&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
//Export
$actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
//Clean exercise
@ -849,7 +560,7 @@ if ($show == 'test') {
$actions .= Display::url(Display::return_icon('export_qti2.png','IMS/QTI','','22'), 'exercice.php?choice=exportqti2&exerciseId='.$row['id']);
} else { // not session resource
$actions = Display::return_icon('edit_na.png', get_lang('ExerciseEditionNotAvailableInSession'));
$actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$actions .='<a href="exercice_report.php?' . api_get_cidreq() . '&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
}
@ -992,7 +703,7 @@ if ($show == 'test') {
$item .= Display::tag('td', $attempt_text);
//See results
$actions =' '.$num.' <a href="exercice.php?' . api_get_cidreq() . '&show=result&exerciseId='.$row['id'].'"> '.Display::return_icon('test_results.png', get_lang('Results'),'',22).' </a>';
$actions =' '.$num.' <a href="exercice_report.php?' . api_get_cidreq() . '&exerciseId='.$row['id'].'"> '.Display::return_icon('test_results.png', get_lang('Results'),'',22).' </a>';
}
$class = 'row_even';
if ($count % 2) {
@ -1009,8 +720,7 @@ if ($show == 'test') {
//Hotpotatoes results
//Hotpotatoes results
if ($is_allowedToEdit) {
@ -1067,7 +777,7 @@ if ($show == 'test') {
$item .= Display::tag('td','-');
$actions = Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path);
$actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$actions .='<a href="exercice_report.php?' . api_get_cidreq() . '&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
// if active
if ($active) {
@ -1085,9 +795,8 @@ if ($show == 'test') {
if ($active == 1) {
$nbrActiveTests = $nbrActiveTests +1;
$item .= Display::tag('td', '<a href="showinframes.php?'.api_get_cidreq().'&file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'">'.$title.'</a>');
$item .= Display::tag('td', '');
//$item .= Display::tag('td', '');
$actions ='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$item .= Display::tag('td', '');
$actions ='<a href="exercice_report.php?' . api_get_cidreq() . '&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
$item .= Display::tag('td', $actions);
echo Display::tag('tr',$item, array('class'=>$class));
}
@ -1098,96 +807,8 @@ if ($show == 'test') {
echo '</table>';
Display :: display_footer();
exit;
}
/* Exercise Results (uses tracking tool) */
// if tracking is enabled
if ($show == 'result') {
$parameters = array('cidReq'=>Security::remove_XSS($_GET['cidReq']),'show'=>Security::remove_XSS($_GET['show']),'filter' => Security::remove_XSS($_GET['filter']),'gradebook' =>Security::remove_XSS($_GET['gradebook']));
$exercise_id = intval($_GET['exerciseId']);
if (!empty($exercise_id))
$parameters['exerciseId'] = $exercise_id;
if (!empty($_GET['path'])) {
$parameters['path'] = Security::remove_XSS($_GET['path']);
}
$table = new SortableTable('quiz_results', 'get_count_exam_results', 'get_exam_results_data', 1, 10);
$table->set_additional_parameters($parameters);
if ($is_allowedToEdit || $is_tutor) {
if (api_is_western_name_order()) {
$table->set_header(0, get_lang('FirstName'));
$table->set_header(1, get_lang('LastName'));
} else {
$table->set_header(0, get_lang('LastName'));
$table->set_header(1, get_lang('FirstName'));
}
$table->set_header(2, get_lang('LoginName'));
$table->set_header(3, get_lang('Group'),false);
$table->set_header(4, get_lang('Exercice'),false);
$table->set_header(5, get_lang('Duration'),false);
$table->set_header(6, get_lang('Date'));
$table->set_header(7, get_lang('Score'),false);
$table->set_header(8, get_lang('CorrectTest'), false);
} else {
$table->set_header(0, get_lang('Exercice'));
$table->set_header(1, get_lang('Duration'),false);
$table->set_header(2, get_lang('Date'));
$table->set_header(3, get_lang('Score'),false);
$table->set_header(4, get_lang('Result'), false);
}
$table->display();
}
if ($origin != 'learnpath') { //so we are not in learnpath tool
Display :: display_footer();
}
// ===========================================================================
// some functions
// ===========================================================================
// ---------------------------------------------------------
// return the HTML code for a menu with students group
// @input : $in_name : is the name and the id of the <select>
// $in_default : default value for option
// @return : the html code of the <select>
// ---------------------------------------------------------
function displayGroupMenu($in_name, $in_default, $in_onchange="") {
// check the default value of option
$tabSelected = array($in_default => " selected='selected' ");
$res = "";
$res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
$res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang('AllGroups')." --</option>";
$res .= "<option value='0'".$tabSelected["0"].">- ".get_lang('NotInAGroup')." -</option>";
$tabGroups = GroupManager::get_group_list();
$currentCatId = 0;
for ($i=0; $i < count($tabGroups); $i++) {
$tabCategory = GroupManager::get_category_from_group($tabGroups[$i]["id"]);
if ($tabCategory["id"] != $currentCatId) {
$res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
$currentCatId = $tabCategory["id"];
}
$res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
}
$res .= "</select>";
return $res;
}
// ------------------------------------------------------
// return a list of group for user with user_id=in_userid
// separated with in_separator
// --------------------------------------------------
function displayGroupsForUser($in_separator, $in_userid) {
$res = implode($in_separator, GroupManager::get_user_group_name($in_userid));
if ($res == "") {
$res = "<div style='text-align:center'>-</div>";
}
return $res;
}

@ -0,0 +1,396 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Exercise list: This script shows the list of exercises for administrators and students.
* @package chamilo.exercise
* @author Olivier Brouckaert, original author
* @author Denes Nagy, HotPotatoes integration
* @author Wolfgang Schneider, code/html cleanup
* @author Julio Montoya <gugli100@gmail.com>, lots of cleanup + several improvements
* Modified by hubert.borderiou (question category)
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file = array('exercice','tracking');
// including the global library
require_once '../inc/global.inc.php';
require_once '../gradebook/lib/be.inc.php';
// Setting the tabs
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_jquery_ui_js();
// Access control
api_protect_course_script(true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
require_once 'hotpotatoes.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH)."groupmanager.lib.php"; // for group filtering
// document path
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . "/document";
/* Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null,true);
$is_tutor = api_is_allowed_to_edit(true);
$is_tutor_course = api_is_course_tutor();
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_ATTEMPT_RECORDING= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM);
$course_id = api_get_course_int_id();
//
// filter display by student group
// if $_GET['filterByGroup'] = -1 => do not filter
// else, filter by group_id (0 for no group)
//
$filterByGroup = -1;
if (isset($_GET['filterByGroup']) && is_numeric($_GET['filterByGroup'])) {
$filterByGroup = Security::remove_XSS($_GET['filterByGroup']);
api_session_register('filterByGroup');
} else if (isset($_SESSION['filterByGroup'])) {
$filterByGroup = $_SESSION['filterByGroup'];
}
if (!empty ($_GET['extra_data'])) {
switch ($_GET['extra_data']) {
case 'on' :
$_SESSION['export_user_fields'] = true;
break;
default :
$_SESSION['export_user_fields'] = false;
break;
}
}
if (!empty($_GET['export_report']) && $_GET['export_report'] == '1') {
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$user_id = null;
if (empty($_SESSION['export_user_fields']))
$_SESSION['export_user_fields'] = false;
if (!$is_allowedToEdit and !$is_tutor) {
$user_id = api_get_user_id();
}
require_once 'exercise_result.class.php';
switch ($_GET['export_format']) {
case 'xls' :
$export = new ExerciseResult();
$export->exportCompleteReportXLS($documentPath, $user_id, $_SESSION['export_user_fields'], $_GET['export_filter'], $_GET['exerciseId'], $_GET['hotpotato_name']);
exit;
break;
case 'csv' :
default :
$export = new ExerciseResult();
$export->exportCompleteReportCSV($documentPath, $user_id, $_SESSION['export_user_fields'], $_GET['export_filter'], $_GET['exerciseId'], $_GET['hotpotato_name']);
exit;
break;
}
} else {
api_not_allowed(true);
}
}
//Send student email @todo move this code in a class, library
if ($_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_GET['exeid']== strval(intval($_GET['exeid']))) {
$id = intval($_GET['exeid']); //filtered by post-condition
$track_exercise_info = get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}
$test = $track_exercise_info['title'];
$student_id = $track_exercise_info['exe_user_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
// Teacher data
$teacher_info = api_get_user_info(api_get_user_id());
$user_info = api_get_user_info($student_id);
$student_email = $user_info['mail'];
$from = $teacher_info['mail'];
$from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$url = api_get_path(WEB_CODE_PATH) . 'exercice/exercice_report.php?' . api_get_cidreq() . '&id_session='.$session_id.'&exerciseId='.$exerciseId;
$my_post_info = array();
$post_content_id = array();
$comments_exist = false;
foreach ($_POST as $key_index=>$key_value) {
$my_post_info = explode('_',$key_index);
$post_content_id[]=$my_post_info[1];
if ($my_post_info[0]=='comments') {
$comments_exist=true;
}
}
$loop_in_track=($comments_exist===true) ? (count($_POST)/2) : count($_POST);
$array_content_id_exe=array();
if ($comments_exist===true) {
$array_content_id_exe = array_slice($post_content_id,$loop_in_track);
} else {
$array_content_id_exe = $post_content_id;
}
for ($i=0;$i<$loop_in_track;$i++) {
$my_marks = Database::escape_string($_POST['marks_'.$array_content_id_exe[$i]]);
$contain_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
if (isset($contain_comments)) {
$my_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
} else {
$my_comments = '';
}
$my_questionid=$array_content_id_exe[$i];
$sql = "SELECT question from $TBL_QUESTIONS WHERE id = '$my_questionid'";
$result =Database::query($sql);
$ques_name = Database::result($result,0,"question");
$query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks',teacher_comment = '$my_comments' WHERE question_id = ".$my_questionid." AND exe_id=".$id;
Database::query($query);
//Saving results in the track recording table
$recording_changes = 'INSERT INTO '.$TBL_TRACK_ATTEMPT_RECORDING.' (exe_id, question_id, marks, insert_date, author, teacher_comment) VALUES ('."'$id','".$my_questionid."','$my_marks','".api_get_utc_datetime()."','".api_get_user_id()."'".',"'.$my_comments.'")';
Database::query($recording_changes);
}
$qry = 'SELECT DISTINCT question_id, marks FROM ' . $TBL_TRACK_ATTEMPT . ' WHERE exe_id = '.$id .' GROUP BY question_id';
$res = Database::query($qry);
$tot = 0;
while ($row = Database :: fetch_array($res, 'ASSOC')) {
$tot += $row['marks'];
}
$totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".floatval($tot)."' WHERE exe_id = ".$id;
Database::query($totquery);
//@todo move this somewhere else
$subject = get_lang('ExamSheetVCC');
$message = '<p>'.get_lang('DearStudentEmailIntroduction') . '</p><p>'.get_lang('AttemptVCC');
$message .= '<h3>'.get_lang('CourseName'). '</h3><p>'.Security::remove_XSS($course_info['name']).'';
$message .= '<h3>'.get_lang('Exercise') . '</h3><p>'.Security::remove_XSS($test);
//Only for exercises not in a LP
if ($lp_id == 0) {
$message .= '<p>'.get_lang('ClickLinkToViewComment') . ' <a href="#url#">#url#</a><br />';
}
$message .= '<p>'.get_lang('Regards') . ' </p>';
$message .= $from_name;
$message = str_replace("#test#", Security::remove_XSS($test), $message);
$message = str_replace("#url#", $url, $message);
@api_mail_html($student_email, $student_email, $subject, $message, $from_name, $from, array('charset'=>api_get_system_encoding()));
//Updating LP score here
if (in_array($origin, array ('tracking_course','user_course','correct_exercise_in_lp'))) {
$sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = '" . floatval($tot) . "' WHERE id = " .$lp_item_view_id;
Database::query($sql_update_score);
if ($origin == 'tracking_course') {
//Redirect to the course detail in lp
header('location: exercice.php?course=' . Security :: remove_XSS($_GET['course']));
exit;
} else {
//Redirect to the reporting
header('location: ../mySpace/myStudents.php?origin=' . $origin . '&student=' . $student_id . '&details=true&course=' . $course_id.'&session_id='.$session_id);
exit;
}
}
}
if ($is_allowedToEdit && $origin != 'learnpath') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
if ($_SESSION['export_user_fields']) {
$alt = get_lang('ExportWithUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="export_user_fields">';
} else {
$alt = get_lang('ExportWithoutUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="do_not_export_user_fields">';
}
$actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
$filter = 1;
} else {
$filter = 2;
}
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&export_filter='.$filter.'&hotpotato_name='.Security::remove_XSS($_GET['path']).'&exerciseId='.intval($_GET['exerciseId']).'" >'.
Display::return_icon('save.png', get_lang('Export'),'',32).'</a>';
}
} else {
$actions .= '<a href="' . api_add_url_param($_SERVER['REQUEST_URI'], 'show=test') . '">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
}
if (api_is_allowed_to_edit(null,true)) {
if (!$_GET['filter']) {
$filter_by_not_revised = true;
$filter = 1;
} else {
$filter=Security::remove_XSS($_GET['filter']);
}
$filter = (int)$_GET['filter'];
switch ($filter) {
case 1 :
$filter_by_not_revised = true;
break;
case 2 :
$filter_by_revised = true;
break;
default :
null;
}
if (!empty($_GET['exerciseId']) && empty($_GET['filter_by_user'])) {
if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
$view_result = '<a href="' . api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=2&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_check.png', get_lang('ShowCorrectedOnly'),'','32').'</a>';
} else {
$view_result = '<a href="' .api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=1&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_uncheck.png', get_lang('ShowUnCorrectedOnly'),'','32').'</a>';
}
$actions .= $view_result;
//
// filter by student group menu
//
$exercice_id = intval($_GET['exerciseId']);
$actions .= "<script type='text/javascript'>";
$actions .= " function doFilterByGroup() {";
$actions .= " var IdGroup = document.getElementById('groupFilter').value;";
$actions .= " var goToUrl = \"".api_get_self()."?".api_get_cidreq()."&filter=$filter&gradebook=$gradebook&exerciseId=$exercice_id;$quiz_results_per_page&filterByGroup=\"+IdGroup;";
$actions .= " self.location.href=goToUrl;";
$actions .= " }";
$actions .= " </script>";
$actions .= "&nbsp;&nbsp;";
$actions .= Display::return_icon('group.gif', get_lang("FilterByGroup"));
$actions .= displayGroupMenu("groupFilter", $filterByGroup, "doFilterByGroup()")."&nbsp;";
}
}
$table = new SortableTable('quiz_results', 'get_count_exam_results', 'get_exam_results_data', 1, 10);
$table->set_additional_parameters($parameters);
if ($is_allowedToEdit || $is_tutor) {
if (api_is_western_name_order()) {
$table->set_header(0, get_lang('FirstName'));
$table->set_header(1, get_lang('LastName'));
} else {
$table->set_header(0, get_lang('LastName'));
$table->set_header(1, get_lang('FirstName'));
}
$table->set_header(2, get_lang('LoginName'));
$table->set_header(3, get_lang('Group'),false);
$table->set_header(4, get_lang('Exercice'),false);
$table->set_header(5, get_lang('Duration'),false);
$table->set_header(6, get_lang('Date'));
$table->set_header(7, get_lang('Score'),false);
$table->set_header(8, get_lang('CorrectTest'), false);
} else {
$table->set_header(0, get_lang('Exercice'));
$table->set_header(1, get_lang('Duration'),false);
$table->set_header(2, get_lang('Date'));
$table->set_header(3, get_lang('Score'),false);
$table->set_header(4, get_lang('Result'), false);
}
$content = $table->return_table();
if (empty ($exerciseId)) {
$exerciseId = intval($_REQUEST['exerciseId']);
}
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
$interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$objExerciseTmp = new Exercise();
if ($objExerciseTmp->read($exerciseId)) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exerciseId, "name" => $objExerciseTmp->name);
}
} else {
$nameTools = get_lang('YourScore');
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
}
Display :: display_header($nameTools);
$actions = Display::div($actions, array('class'=> 'actions'));
$extra = '<script type="text/javascript">
$(document).ready(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
autoOpen: false,
show: "blind",
resizable: false,
height:250,
modal: true
});
$("#export_opener").click(function() {
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
width:350,
height:220,
buttons: {
"'.addslashes(get_lang('Download')).'": function() {
var export_format = $("input[name=export_format]:checked").val();
var extra_data = $("input[name=load_extra_data]:checked").val();
location.href = targetUrl+"&export_format="+export_format+"&extra_data="+extra_data;
$( this ).dialog( "close" );
},
}
});
$( "#dialog-confirm" ).dialog("open");
return false;
});
});
</script>';
$extra .= '<div id="dialog-confirm" title="'.get_lang("ConfirmYourChoice").'">';
$extra .= Display::tag('p', Display::input('radio', 'export_format', 'csv', array('checked'=>'1', 'id'=>'export_format_csv_label')). Display::tag('label', get_lang('ExportAsCSV'), array('for'=>'export_format_csv_label')));
$extra .= Display::tag('p', Display::input('radio', 'export_format', 'xls', array('id'=>'export_format_xls_label')). Display::tag('label', get_lang('ExportAsXLS'), array('for'=>'export_format_xls_label')));
$extra .= Display::tag('p', Display::input('checkbox', 'load_extra_data', '0',array('id'=>'load_extra_data_id')). Display::tag('label', get_lang('LoadExtraData'), array('for'=>'load_extra_data_id')));
$extra .= '</div>';
if ($is_allowedToEdit)
echo $extra;
echo $actions;
echo $content;
/*
$tpl = new Template($nameTools);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
*/
Display :: display_footer();

@ -3068,7 +3068,7 @@ class Exercise {
//this is a problem (it means that there is no admin for this course)
}
$url_email = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&show=result&exerciseId='.$this->id;
$url_email = api_get_path(WEB_CODE_PATH).'exercice/exercice_report.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$this->id;
$user_info = UserManager::get_user_info_by_id(api_get_user_id());
$mycharset = api_get_system_encoding();

@ -767,10 +767,27 @@ function get_count_exam_results() {
*/
function get_exam_results_data($from, $number_of_items, $column, $direction) {
//@todo replace all this globals
global $is_allowedToEdit, $is_tutor,$TBL_USER, $TBL_EXERCICES,$TBL_TRACK_HOTPOTATOES,
$TBL_TRACK_EXERCICES, $TBL_TRACK_ATTEMPT_RECORDING,
$filter_by_not_revised, $filter_by_revised, $documentPath, $filter,
$filterByGroup, $TBL_GROUP_REL_USER;
global $is_allowedToEdit, $is_tutor, $filter_by_not_revised, $filter_by_revised, $documentPath, $filter, $filterByGroup;
$is_tutor = api_is_allowed_to_edit(true);
$is_tutor_course = api_is_course_tutor();
$tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$TBL_USER = Database :: get_main_table(TABLE_MAIN_USER);
$TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCICE_ANSWER = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$TBL_EXERCICE_QUESTION = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_ATTEMPT_RECORDING= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM);
$TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW);
$TBL_GROUP_REL_USER = Database :: get_course_table(TABLE_GROUP_USER);
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
@ -791,15 +808,15 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
$user_id_and = '';
if (!empty ($_REQUEST['filter_by_user'])) {
if ($_REQUEST['filter_by_user'] == 'all') {
$user_id_and = " AND user_id like '%'";
$user_id_and = " AND user_id LIKE '%'";
} else {
$user_id_and = " AND user_id = '" . intval($_REQUEST['filter_by_user']) . "' ";
}
}
}
if ($_GET['gradebook'] == 'view') {
$exercise_where_query = ' te.exe_exo_id =ce.id AND ';
$exercise_where_query = ' te.exe_exo_id = ce.id AND ';
}
$sqlFromOption = "";
@ -851,7 +868,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
break;
default : // user in group $filterByGroup
$sql_inner_join_tbl_user = "
(SELECT u.user_id, firstname, lastname, email , username
(SELECT u.user_id, firstname, lastname, email, username
FROM $TBL_USER u
INNER JOIN $TBL_GROUP_REL_USER gru ON (
gru.user_id=u.user_id
@ -867,8 +884,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
//
// sql for chamilo-type tests for teacher / tutor view
//
$sql="
SELECT
$sql = "SELECT
user_id,
$first_and_last_name,
ce.title as col3,
@ -896,11 +912,9 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
AND ce.c_id=".api_get_course_int_id()."
$exercise_where ";
//
// sql for hotpotatoes tests for teacher / tutor view
//
$hpsql="
SELECT
// sql for hotpotatoes tests for teacher / tutor view
$hpsql="SELECT
$first_and_last_name ,
tth.exe_name,
tth.exe_result ,
@ -918,8 +932,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
ORDER BY
tth.exe_cours_id ASC,
tth.exe_date DESC";
}
else {
} else {
// get only this user's results
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
@ -983,7 +996,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
$sql .= " LIMIT $from, $number_of_items";
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx,'ASSOC')) {
$results[] = $rowx;
@ -1044,6 +1057,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
$res = $results[$i]['exresult'];
$duration = intval($results[$i]['exduration']);
// we filter the results if we have the permission to
if (isset ($results[$i]['exdisabled']))
$result_disabled = intval($results[$i]['exdisabled']);
@ -1054,17 +1068,19 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
$add_start_date = $lang_nostartdate;
if ($is_allowedToEdit || $is_tutor) {
//var_dump($results[$i]);
$user = $results[$i]['col0'] . $results[$i]['col1'];
$start_date = $results[$i]['col4'];
$start_date = $results[$i]['col6'];
} else {
$start_date = $results[$i]['col2'];
}
if ($start_date != "0000-00-00 00:00:00") {
$start_date_timestamp = api_strtotime($start_date);
$exe_date_timestamp = api_strtotime($results[$i]['exdate']);
$exe_date_timestamp = api_strtotime($results[$i]['exdate']);
$my_duration = ceil((($exe_date_timestamp - $start_date_timestamp) / 60));
//var_dump($start_date .' - '.$results[$i]['exdate'].' - '.$my_duration);
if ($my_duration == 1 ) {
$duration_list = $my_duration . ' ' . get_lang('MinMinute');
} else {
@ -1119,7 +1135,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
}
if (api_is_platform_admin() || $is_tutor) {
$html_link.=' <a href="exercice.php?'.api_get_cidreq().'&show=result&filter_by_user='.intval($_GET['filter_by_user']).'&filter=' . $filter . '&exerciseId='.$exercise_id.'&delete=delete&did=' . $id . '" onclick="javascript:if(!confirm(\'' . sprintf(get_lang('DeleteAttempt'), $user, $dt) . '\')) return false;">'.Display :: return_icon('delete.png', get_lang('Delete')).'</a>';
$html_link.=' <a href="exercice_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter=' . $filter . '&exerciseId='.$exercise_id.'&delete=delete&did=' . $id . '" onclick="javascript:if(!confirm(\'' . sprintf(get_lang('DeleteAttempt'), $user, $dt) . '\')) return false;">'.Display :: return_icon('delete.png', get_lang('Delete')).'</a>';
$html_link.='&nbsp;';
}
@ -1617,3 +1633,43 @@ function get_student_stats_by_question($question_id, $exercise_id, $course_code
// ---------------------------------------------------------
// return the HTML code for a menu with students group
// @input : $in_name : is the name and the id of the <select>
// $in_default : default value for option
// @return : the html code of the <select>
// ---------------------------------------------------------
function displayGroupMenu($in_name, $in_default, $in_onchange="") {
// check the default value of option
$tabSelected = array($in_default => " selected='selected' ");
$res = "";
$res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
$res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang('AllGroups')." --</option>";
$res .= "<option value='0'".$tabSelected["0"].">- ".get_lang('NotInAGroup')." -</option>";
$tabGroups = GroupManager::get_group_list();
$currentCatId = 0;
for ($i=0; $i < count($tabGroups); $i++) {
$tabCategory = GroupManager::get_category_from_group($tabGroups[$i]["id"]);
if ($tabCategory["id"] != $currentCatId) {
$res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
$currentCatId = $tabCategory["id"];
}
$res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
}
$res .= "</select>";
return $res;
}
// ------------------------------------------------------
// return a list of group for user with user_id=in_userid
// separated with in_separator
// --------------------------------------------------
function displayGroupsForUser($in_separator, $in_userid) {
$res = implode($in_separator, GroupManager::get_user_group_name($in_userid));
if ($res == "") {
$res = "<div style='text-align:center'>-</div>";
}
return $res;
}

@ -37,8 +37,8 @@ if(!$is_allowedToEdit){
exit;
}
$interbreadcrumb[]= array ('url' => 'exercice.php'.'?show=result','name' => get_lang('Exercices'));
$interbreadcrumb[]= array ('url' => 'exercice.php'.'?show=result&amp;filter=2','name' => get_lang('StudentScore'));
$interbreadcrumb[]= array ('url' => 'exercice_report.php','name' => get_lang('Exercices'));
$interbreadcrumb[]= array ('url' => 'exercice_report.php'.'?filter=2','name' => get_lang('StudentScore'));
$interbreadcrumb[]= array ('url' => 'exercise_history.php'.'?exe_id='.intval($_GET['exe_id']), 'name' => get_lang('Details'));
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
@ -56,7 +56,7 @@ if (isset($_GET['message'])) {
}
echo '<div class="actions">';
echo '<a href="exercice.php?' . api_get_cidreq() . '&show=result&filter=2">' . Display :: return_icon('back.png', get_lang('BackToResultList'),'','32').'</a>';
echo '<a href="exercice_report.php?' . api_get_cidreq() . '&filter=2">' . Display :: return_icon('back.png', get_lang('BackToResultList'),'','32').'</a>';
echo '</div>';
?>

@ -106,10 +106,13 @@ class ExerciseResult
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_ATTEMPT_RECORDING= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_COURSE_REL_USER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = intval($user_id);
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
$exercise_id = intval($exercise_id);
@ -122,12 +125,20 @@ class ExerciseResult
if (empty($user_id)) {
$sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", ce.title as extitle, te.exe_result as exresult , te.exe_weighting as exweight,
te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as exstart, steps_counter as exstep, exe_user_id as excruid, te.exe_duration as exduration
FROM $TBL_EXERCISES AS ce INNER JOIN $TBL_TRACK_EXERCISES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0";
FROM $TBL_EXERCISES AS ce INNER JOIN $TBL_TRACK_EXERCISES AS te ON (te.exe_exo_id = ce.id) INNER JOIN
$TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE ce.c_id = $course_id AND
te.status != 'incomplete' AND
te.exe_cours_id='" . Database :: escape_string($cid) . "' $user_id_and $session_id_and AND
ce.active <>-1 AND
orig_lp_id = 0 AND
orig_lp_item_id = 0";
$hpsql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", email, tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($cid) . "' AND tth.exe_name = '$hotpotato_name'
WHERE tu.user_id=tth.exe_user_id AND
tth.exe_cours_id = '" . Database :: escape_string($cid) . "' AND
tth.exe_name = '$hotpotato_name'
ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
} else {
@ -137,16 +148,24 @@ class ExerciseResult
"te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
"te.start_date as exstart, steps_counter as exstep, exe_user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
FROM $TBL_EXERCISES AS ce INNER JOIN $TBL_TRACK_EXERCISES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
" orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY userpart2, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";
WHERE ce.c_id = $course_id AND
te.status != 'incomplete' AND
te.exe_cours_id='" . Database :: escape_string($cid) . "' $user_id_and $session_id_and AND
ce.active <>-1 AND
orig_lp_id = 0 AND
orig_lp_item_id = 0
ORDER BY userpart2, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";
$hpsql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $user_id . "' AND exe_cours_id = '" . Database :: escape_string($cid) . "' AND tth.exe_name = '$hotpotato_name'
WHERE exe_user_id = '" . $user_id . "' AND
exe_cours_id = '" . Database :: escape_string($cid) . "' AND
tth.exe_name = '$hotpotato_name'
ORDER BY exe_cours_id ASC, exe_date DESC";
}
$results = array();
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx,'ASSOC')) {
$results[] = $rowx;
@ -173,11 +192,12 @@ class ExerciseResult
//Print the results of tests
if (is_array($results) && empty($hotpotato_name)) {
for($i = 0; $i < sizeof($results); $i++) {
for ($i = 0; $i < sizeof($results); $i++) {
$revised = false;
$sql_exe = 'SELECT exe_id FROM ' . Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING) . '
WHERE author != ' . "''" . ' AND exe_id = ' . "'" . Database :: escape_string($results[$i]['exid']) . "'" . ' LIMIT 1';
//revised or not
$sql_exe = "SELECT exe_id FROM $TBL_TRACK_ATTEMPT_RECORDING
WHERE author != '' AND exe_id = ".Database :: escape_string($results[$i]['exid'])." LIMIT 1";
$query = Database::query($sql_exe);
if (Database :: num_rows($query) > 0)
@ -187,11 +207,10 @@ class ExerciseResult
if ($filter_by_revised && !$revised) continue;
$return[$i] = array();
//$id = $results[$i]['exid'];
if (empty($user_id)) {
$return[$i]['last_name'] = $results[$i]['userpart1'];
$return[$i]['first_name'] = $results[$i]['userpart2'];
$return[$i]['first_name'] = $results[$i]['userpart1'];
$return[$i]['last_name'] = $results[$i]['userpart2'];
$return[$i]['user_id'] = $results[$i]['excruid'];
$return[$i]['email'] = $results[$i]['exemail'];
}
@ -201,7 +220,6 @@ class ExerciseResult
$return[$i]['max'] = $results[$i]['exweight'];
}
}
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
@ -213,8 +231,8 @@ class ExerciseResult
}
if(empty($user_id)) {
$return[$i]['email'] = $hpresults[$i]['email'];
$return[$i]['first_name'] = $hpresults[$i]['userpart2'];
$return[$i]['last_name'] = $hpresults[$i]['userpart1'];
$return[$i]['first_name'] = $hpresults[$i]['userpart1'];
$return[$i]['last_name'] = $hpresults[$i]['userpart2'];
//$return[$i]['user_id'] = $results[$i]['userid'];
}
$return[$i]['title'] = $title;
@ -241,15 +259,23 @@ class ExerciseResult
$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
}
$data = '';
$data .= get_lang('Email').';';
if(!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
if(!empty($this->results[0]['first_name'])) {
$data .= get_lang('FirstName').';';
}
if (api_is_western_name_order()) {
if(!empty($this->results[0]['first_name'])) {
$data .= get_lang('FirstName').';';
}
if(!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
} else {
if(!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
if(!empty($this->results[0]['first_name'])) {
$data .= get_lang('FirstName').';';
}
}
$data .= get_lang('Email').';';
if ($export_user_fields) {
//show user fields section with a big th colspan that spans over all fields
@ -268,16 +294,24 @@ class ExerciseResult
//results
foreach($this->results as $row) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
if(!empty($row['last_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
}
if (api_is_western_name_order()) {
if(!empty($row['first_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
}
if(!empty($row['last_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
}
} else {
if(!empty($row['last_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
}
if(!empty($row['first_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
}
}
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
if(!empty($row['first_name'])) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
}
if($export_user_fields) {
if ($export_user_fields) {
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
foreach($user_fields_values as $value) {
@ -290,6 +324,7 @@ class ExerciseResult
$data .= str_replace("\r\n",' ',$row['max']).';';
$data .= "\n";
}
//output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
@ -310,6 +345,7 @@ class ExerciseResult
echo $data;
return true;
}
/**
* Exports the complete report as an XLS file
* @return boolean False on error
@ -346,10 +382,21 @@ class ExerciseResult
$worksheet->write($line,$column,get_lang('Email'));
$column++;
$worksheet->write($line,$column,get_lang('LastName'));
$column++;
$worksheet->write($line,$column,get_lang('FirstName'));
$column++;
if (api_is_western_name_order()) {
$worksheet->write($line,$column,get_lang('FirstName'));
$column++;
$worksheet->write($line,$column,get_lang('LastName'));
$column++;
} else {
$worksheet->write($line,$column,get_lang('LastName'));
$column++;
$worksheet->write($line,$column,get_lang('FirstName'));
$column++;
}
}
if ($export_user_fields) {

@ -24,7 +24,6 @@ require_once 'answer.class.php';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
if (empty($origin) ) {
@ -608,7 +607,7 @@ if (is_array($arrid) && is_array($arrmarks)) {
if ($is_allowedToEdit) {
if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
echo ' <form name="myform" id="myform" action="exercice.php?show=result&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
echo ' <form name="myform" id="myform" action="exercice_report.php?exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
//echo ' <input type = "hidden" name="totalWeighting" value="'.$totalWeighting.'">';
echo '<input type = "hidden" name="lp_item_id" value="'.$lp_id.'">';
echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">';
@ -616,7 +615,7 @@ if ($is_allowedToEdit) {
echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> ';
echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> ';
} else {
echo ' <form name="myform" id="myform" action="exercice.php?show=result&action=qualify&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
echo ' <form name="myform" id="myform" action="exercice_report.php?exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
}
if ($origin!='learnpath' && $origin!='student_progress') {
?>

@ -91,7 +91,7 @@ $html .= $message;
$exercise_url_button = Display::url($label, $exercise_url, array('class'=>'a_button blue bigger round'));
if (!$objExercise->is_visible($learnpath_id, $learnpath_item_id)) {
$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq().'&show=result&exerciseId='.$objExercise->id;
$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercice_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id;
//$exercise_url_button = Display::url(get_lang('SeeResults'), $exercise_url, array('class'=>'a_button white bigger round no_link'));
if ($origin == 'learnpath') {
$exercise_url_button = Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $objExercise->title, $objExercise->selectAttempts()), 'warning');

@ -1,14 +1,11 @@
<?php
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php';
require_once 'answer.class.php';
$language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;
$exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0;
@ -80,9 +77,6 @@ $headers = array(
get_lang('HighestScore'),
get_lang('MaximumScore')
);
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
$interbreadcrumb[] = array ("url" => "admin.php?exerciseId=$exercise_id","name" => $objExercise->name);

@ -80,7 +80,7 @@ function lp_upload_quiz_actions() {
function lp_upload_quiz_secondary_actions() {
$lp_id = Security::remove_XSS($_GET['lp_id']);
$return.= '';
$return.='<a href="exercice.php?show=result&' . api_get_cidreq() . '">' . Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>';
$return.='<a href="exercice_report.php?' . api_get_cidreq() . '">' . Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>';
return $return;
}

Loading…
Cancel
Save