|
|
|
@ -13,6 +13,7 @@ require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
|
|
$id = isset($_REQUEST['id']) ? (int) $_GET['id'] : 0; // exe id |
|
|
|
$id = isset($_REQUEST['id']) ? (int) $_GET['id'] : 0; // exe id |
|
|
|
$show_headers = isset($_REQUEST['show_headers']) ? (int) $_REQUEST['show_headers'] : null; |
|
|
|
$show_headers = isset($_REQUEST['show_headers']) ? (int) $_REQUEST['show_headers'] : null; |
|
|
|
|
|
|
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
|
|
|
$origin = api_get_origin(); |
|
|
|
$origin = api_get_origin(); |
|
|
|
|
|
|
|
|
|
|
|
if (in_array($origin, ['learnpath', 'embeddable', 'mobileapp'])) { |
|
|
|
if (in_array($origin, ['learnpath', 'embeddable', 'mobileapp'])) { |
|
|
|
@ -105,17 +106,59 @@ if ($show_headers) { |
|
|
|
$message = Session::read('attempt_remaining'); |
|
|
|
$message = Session::read('attempt_remaining'); |
|
|
|
Session::erase('attempt_remaining'); |
|
|
|
Session::erase('attempt_remaining'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$allowExportPdf = api_get_configuration_value('quiz_results_answers_report'); |
|
|
|
|
|
|
|
|
|
|
|
ob_start(); |
|
|
|
ob_start(); |
|
|
|
ExerciseLib::displayQuestionListByAttempt( |
|
|
|
$stats = ExerciseLib::displayQuestionListByAttempt( |
|
|
|
$objExercise, |
|
|
|
$objExercise, |
|
|
|
$id, |
|
|
|
$id, |
|
|
|
false, |
|
|
|
false, |
|
|
|
$message, |
|
|
|
$message, |
|
|
|
$allowSignature |
|
|
|
$allowSignature, |
|
|
|
|
|
|
|
$allowExportPdf |
|
|
|
); |
|
|
|
); |
|
|
|
$pageContent = ob_get_contents(); |
|
|
|
$pageContent = ob_get_contents(); |
|
|
|
ob_end_clean(); |
|
|
|
ob_end_clean(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
|
|
|
|
case 'export': |
|
|
|
|
|
|
|
if ($allowExportPdf) { |
|
|
|
|
|
|
|
$allAnswers = $stats['all_answers_html']; |
|
|
|
|
|
|
|
@$pdf = new PDF(); |
|
|
|
|
|
|
|
$cssFile = api_get_path(SYS_CSS_PATH).'themes/chamilo/default.css'; |
|
|
|
|
|
|
|
$title = get_lang('ResponseReport'); |
|
|
|
|
|
|
|
$exerciseTitle = $objExercise->get_formated_title(); |
|
|
|
|
|
|
|
$studentInfo = api_get_user_info($student_id); |
|
|
|
|
|
|
|
$userHeader = $objExercise->showExerciseResultHeader( |
|
|
|
|
|
|
|
$studentInfo, |
|
|
|
|
|
|
|
$track_exercise_info, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$filename = get_lang('Exercise').'_'.$exerciseTitle; |
|
|
|
|
|
|
|
$pdf->content_to_pdf(" |
|
|
|
|
|
|
|
<html><body> |
|
|
|
|
|
|
|
<h2 style='text-align: center'>$title</h2> |
|
|
|
|
|
|
|
$userHeader |
|
|
|
|
|
|
|
$allAnswers |
|
|
|
|
|
|
|
</body></html>", |
|
|
|
|
|
|
|
file_get_contents($cssFile), |
|
|
|
|
|
|
|
$filename, |
|
|
|
|
|
|
|
api_get_course_id(), |
|
|
|
|
|
|
|
'D', |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
true |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
api_not_allowed(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$template = new Template('', $show_headers, $show_headers); |
|
|
|
$template = new Template('', $show_headers, $show_headers); |
|
|
|
$template->assign('page_content', $pageContent); |
|
|
|
$template->assign('page_content', $pageContent); |
|
|
|
$template->assign('allow_signature', $allowSignature); |
|
|
|
$template->assign('allow_signature', $allowSignature); |
|
|
|
|