mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merged from STABLE.
Examview 'SA' type questions now supported.
This commit is contained in:
parent
5772f71f1c
commit
85474b2615
1 changed files with 25 additions and 24 deletions
|
@ -4,31 +4,22 @@
|
||||||
|
|
||||||
require_once("$CFG->libdir/xmlize.php");
|
require_once("$CFG->libdir/xmlize.php");
|
||||||
|
|
||||||
/*
|
|
||||||
define("SHORTANSWER", "1");
|
|
||||||
define("TRUEFALSE", "2");
|
|
||||||
define("MULTICHOICE", "3");
|
|
||||||
define("MATCH", "5");
|
|
||||||
define("DESCRIPTION", "7");
|
|
||||||
define("NUMERICAL", "8");
|
|
||||||
define("MULTIANSWER", "9");
|
|
||||||
define("CALCULATED", "10");
|
|
||||||
*/
|
|
||||||
|
|
||||||
class qformat_examview extends qformat_default {
|
class qformat_examview extends qformat_default {
|
||||||
|
|
||||||
var $qtypes = array('tf' => TRUEFALSE,
|
var $qtypes = array(
|
||||||
'mc' => MULTICHOICE,
|
'tf' => TRUEFALSE,
|
||||||
'yn' => TRUEFALSE,
|
'mc' => MULTICHOICE,
|
||||||
'co' => SHORTANSWER,
|
'yn' => TRUEFALSE,
|
||||||
'ma' => MATCH,
|
'co' => SHORTANSWER,
|
||||||
'mtf' => 99,
|
'ma' => MATCH,
|
||||||
'nr' => NUMERICAL,
|
'mtf' => 99,
|
||||||
'pr' => 99,
|
'nr' => NUMERICAL,
|
||||||
'es' => 99,
|
'pr' => 99,
|
||||||
'ca' => 99,
|
'es' => 99,
|
||||||
'ot' => 99
|
'ca' => 99,
|
||||||
);
|
'ot' => 99,
|
||||||
|
'sa' => ESSAY
|
||||||
|
);
|
||||||
|
|
||||||
var $matching_questions = array();
|
var $matching_questions = array();
|
||||||
|
|
||||||
|
@ -170,7 +161,7 @@ class qformat_examview extends qformat_default {
|
||||||
// Only one answer is allowed
|
// Only one answer is allowed
|
||||||
$htmltext = $this->unxmlise($qrec['#']['text'][0]['#']);
|
$htmltext = $this->unxmlise($qrec['#']['text'][0]['#']);
|
||||||
$question->questiontext = $htmltext;
|
$question->questiontext = $htmltext;
|
||||||
$question->name = $question->questiontext;
|
$question->name = shorten_text( $question->questiontext, 250 );
|
||||||
|
|
||||||
switch ($question->qtype) {
|
switch ($question->qtype) {
|
||||||
case MULTICHOICE:
|
case MULTICHOICE:
|
||||||
|
@ -186,6 +177,9 @@ class qformat_examview extends qformat_default {
|
||||||
case SHORTANSWER:
|
case SHORTANSWER:
|
||||||
$question = $this->parse_co($qrec['#'], $question);
|
$question = $this->parse_co($qrec['#'], $question);
|
||||||
break;
|
break;
|
||||||
|
case ESSAY:
|
||||||
|
$question = $this->parse_sa($qrec['#'], $question);
|
||||||
|
break;
|
||||||
case NUMERICAL:
|
case NUMERICAL:
|
||||||
$question = $this->parse_nr($qrec['#'], $question);
|
$question = $this->parse_nr($qrec['#'], $question);
|
||||||
break;
|
break;
|
||||||
|
@ -254,6 +248,13 @@ class qformat_examview extends qformat_default {
|
||||||
return $question;
|
return $question;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_sa($qrec, $question) {
|
||||||
|
$feedback = trim($this->unxmlise($qrec['answer'][0]['#']));
|
||||||
|
$question->feedback = $feedback;
|
||||||
|
$question->fraction = 0;
|
||||||
|
return $question;
|
||||||
|
}
|
||||||
|
|
||||||
function parse_nr($qrec, $question)
|
function parse_nr($qrec, $question)
|
||||||
{
|
{
|
||||||
$answer = trim($this->unxmlise($qrec['answer'][0]['#']));
|
$answer = trim($this->unxmlise($qrec['answer'][0]['#']));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue