mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-20538 get rid of badly name-spaced constants from lib/questionlib.php.
Unfortunately, they are used all over the import/export code, so I cannot eliminate them completely. However, I was able to move them out of the core library.
This commit is contained in:
parent
6911fa130b
commit
55190d7e2c
@ -41,22 +41,6 @@ require_once($CFG->dirroot . '/question/type/questiontypebase.php');
|
||||
|
||||
/// CONSTANTS ///////////////////////////////////
|
||||
|
||||
/**#@+
|
||||
* The core question types.
|
||||
*/
|
||||
define("SHORTANSWER", "shortanswer");
|
||||
define("TRUEFALSE", "truefalse");
|
||||
define("MULTICHOICE", "multichoice");
|
||||
define("RANDOM", "random");
|
||||
define("MATCH", "match");
|
||||
define("RANDOMSAMATCH", "randomsamatch");
|
||||
define("DESCRIPTION", "description");
|
||||
define("NUMERICAL", "numerical");
|
||||
define("MULTIANSWER", "multianswer");
|
||||
define("CALCULATED", "calculated");
|
||||
define("ESSAY", "essay");
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Constant determines the number of answer boxes supplied in the editing
|
||||
* form for multiple choice and similar question types.
|
||||
|
@ -29,6 +29,27 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**#@+
|
||||
* The core question types.
|
||||
*
|
||||
* These used to be in lib/questionlib.php, but are being deprecated. Copying them
|
||||
* here to keep this code working for now.
|
||||
*/
|
||||
if (!defined('SHORTANSWER')) {
|
||||
define("SHORTANSWER", "shortanswer");
|
||||
define("TRUEFALSE", "truefalse");
|
||||
define("MULTICHOICE", "multichoice");
|
||||
define("RANDOM", "random");
|
||||
define("MATCH", "match");
|
||||
define("RANDOMSAMATCH", "randomsamatch");
|
||||
define("DESCRIPTION", "description");
|
||||
define("NUMERICAL", "numerical");
|
||||
define("MULTIANSWER", "multianswer");
|
||||
define("CALCULATED", "calculated");
|
||||
define("ESSAY", "essay");
|
||||
}
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Given some question info and some data about the the answers
|
||||
* this function parses, organises and saves the question
|
||||
|
@ -49,7 +49,7 @@ function quiz_upgrade_very_old_question_sessions($attempt) {
|
||||
// newgraded pointing to this state.
|
||||
// Actually we only do this for states whose question is actually listed in $attempt->layout.
|
||||
// We do not do it for states associated to wrapped questions like for example the questions
|
||||
// used by a RANDOM question
|
||||
// used by a random question
|
||||
$session = new stdClass();
|
||||
$session->attemptid = $attempt->uniqueid;
|
||||
$session->sumpenalty = 0;
|
||||
|
@ -27,6 +27,29 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**#@+
|
||||
* The core question types.
|
||||
*
|
||||
* These used to be in lib/questionlib.php, but are being deprecated. Copying
|
||||
* them here to keep the import/export code working for now (there are 135
|
||||
* references to these constants which I don't want to try to fix at the moment.)
|
||||
*/
|
||||
if (!defined('SHORTANSWER')) {
|
||||
define("SHORTANSWER", "shortanswer");
|
||||
define("TRUEFALSE", "truefalse");
|
||||
define("MULTICHOICE", "multichoice");
|
||||
define("RANDOM", "random");
|
||||
define("MATCH", "match");
|
||||
define("RANDOMSAMATCH", "randomsamatch");
|
||||
define("DESCRIPTION", "description");
|
||||
define("NUMERICAL", "numerical");
|
||||
define("MULTIANSWER", "multianswer");
|
||||
define("CALCULATED", "calculated");
|
||||
define("ESSAY", "essay");
|
||||
}
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* Base class for question import and export formats.
|
||||
*
|
||||
@ -697,7 +720,7 @@ class qformat_default {
|
||||
}
|
||||
|
||||
// do not export random questions
|
||||
if ($question->qtype==RANDOM) {
|
||||
if ($question->qtype == 'random') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class qtype_randomsamatch extends question_type {
|
||||
available for this question, therefore it is not available in this
|
||||
quiz. Please inform your teacher.";
|
||||
// Treat this as a description from this point on
|
||||
$question->qtype = DESCRIPTION;
|
||||
$question->qtype = 'description';
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ class qtype_randomsamatch extends question_type {
|
||||
available for this question, therefore it is not available in this
|
||||
quiz. Please inform your teacher.";
|
||||
// Treat this as a description from this point on
|
||||
$question->qtype = DESCRIPTION;
|
||||
$question->qtype = 'description';
|
||||
} else {
|
||||
$responses = explode(',', $state->responses['']);
|
||||
$responses = array_map(create_function('$val',
|
||||
|
Loading…
x
Reference in New Issue
Block a user