function qformat_qti2::exportprocess_quiz in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/qti2/format.php \qformat_qti2::exportprocess_quiz()
This function is called to export a quiz (as opposed to exporting a category of questions)
@uses $USER
@todo use $result in the ouput
Parameters
object $quiz:
array $questions - an array of question objects:
object $result - if set, contains result of calling quiz_grade_responses():
1 call to qformat_qti2::exportprocess_quiz()
- qformat_qti2::export_quiz in includes/
moodle/ question/ format/ qti2/ format.php - exports a quiz (as opposed to exporting a category of questions)
File
- includes/
moodle/ question/ format/ qti2/ format.php, line 362
Class
Code
function exportprocess_quiz($quiz, $questions, $result, $submiturl, $course) {
global $USER;
global $CFG;
$gradingmethod = array(
1 => 'GRADEHIGHEST',
2 => 'GRADEAVERAGE',
3 => 'ATTEMPTFIRST',
4 => 'ATTEMPTLAST',
);
$questions = $this
->quiz_export_prepare_questions($questions, $quiz->id, $course->id, $quiz->shuffleanswers);
$smarty =& $this
->init_smarty();
$smarty
->assign('questions', $questions);
// quiz level smarty variables
$manifestid = str_replace(array(
':',
'/',
), array(
'-',
'_',
), "quiz{$quiz->id}-{$CFG->wwwroot}");
$smarty
->assign('manifestidentifier', $manifestid);
$smarty
->assign('submiturl', $submiturl);
$smarty
->assign('userid', $USER->id);
$smarty
->assign('username', htmlspecialchars($USER->username, ENT_COMPAT, 'UTF-8'));
$smarty
->assign('quiz_level_export', 1);
$smarty
->assign('quiztitle', format_string($quiz->name, true));
//assigned specifically so as not to cause problems with category-level export
$smarty
->assign('quiztimeopen', date('Y-m-d\\TH:i:s', $quiz->timeopen));
// ditto
$smarty
->assign('quiztimeclose', date('Y-m-d\\TH:i:s', $quiz->timeclose));
// ditto
$smarty
->assign('grademethod', $gradingmethod[$quiz->grademethod]);
$smarty
->assign('quiz', $quiz);
$smarty
->assign('course', $course);
$smarty
->assign('lang', $this->lang);
$expout = $smarty
->fetch('imsmanifest.tpl');
echo $expout;
return true;
}