Skip to content
Permalink
Browse files

There can now be an arbitrary number of rqp servers of each type.

The remote question types do show up on the editing drop-down like any other question type.
I have disabled rqp on php < 5 for the time being.
  • Loading branch information...
gustav_delius
gustav_delius committed May 14, 2005
1 parent 7aaffc3 commit 815bb0cf3220a425f9365fad3a2c9a2847044300
@@ -640,6 +640,29 @@ function quiz_upgrade($oldversion) {
table_column('quiz_newest_states', 'new', 'newest', 'integer', '10', 'unsigned', '0', 'not null');
}
if ($oldversion < 2005051400) {
modify_database('', 'ALTER TABLE prefix_quiz_rqp_type RENAME prefix_quiz_rqp_types;');
modify_database('', "CREATE TABLE `prefix_quiz_rqp_servers` (
id int(10) unsigned NOT NULL auto_increment,
typeid int(10) unsigned NOT NULL default '0',
url varchar(255) NOT NULL default '',
can_render tinyint(2) unsigned NOT NULL default '0',
can_author tinyint(2) unsigned NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM COMMENT='Information about RQP servers';");
if ($types = get_records('quiz_rqp_types')) {
foreach($types as $type) {
$server->typeid = $type->id;
$server->url = $type->rendering_server;
$server->can_render = 1;
insert_record('quiz_rqp_servers', $server);
}
}
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP rendering_server');
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP cloning_server');
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP flags');
}
return true;
}
@@ -12,6 +12,32 @@
require_once("locallib.php");
/**
* Array of question types names translated to the user's language
*
* The $QUIZ_QUESTION_TYPE array holds the names of all the question types that the user should
* be able to create directly. Some internal question types like random questions are excluded.
* The complete list of question types can be found in {@link $QUIZ_QTYPES}.
*/
$QUIZ_QUESTION_TYPE = array ( MULTICHOICE => get_string("multichoice", "quiz"),
TRUEFALSE => get_string("truefalse", "quiz"),
SHORTANSWER => get_string("shortanswer", "quiz"),
NUMERICAL => get_string("numerical", "quiz"),
CALCULATED => get_string("calculated", "quiz"),
MATCH => get_string("match", "quiz"),
DESCRIPTION => get_string("description", "quiz"),
RANDOMSAMATCH => get_string("randomsamatch", "quiz"),
MULTIANSWER => get_string("multianswer", "quiz")
);
// add remote question types
if ($rqp_types = get_records('quiz_rqp_types')) {
foreach($rqp_types as $type) {
$QUIZ_QUESTION_TYPE[100+$type->id] = $type->name;
}
}
/**
* Delete a question from a quiz
*
@@ -21,14 +21,15 @@
$string['closereview'] = 'Close review';
$string['completedon'] = 'Completed on';
$string['confirmattemptclose'] = 'You still have an unfinished attempt. Do you want to close this and start a new attempt now?';
$string['confirmserverdelete'] = 'Are you sure you want to remove the server <b>$a</b> from the list?';
$string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.';
$string['continueattemptfail'] = 'Error: Could not load the last attempt';
$string['continueattemptquiz'] = 'Continue the last attempt';
$string['correct'] = 'Correct';
$string['deleteitemtypecheck'] = 'Are you absolutely sure you want to delete \'$a\'?';
$string['duplicateresponse'] = 'This submission has been ignored because you gave an equivalent answer earlier.';
$string['editingitemtype'] = 'Editing an Item Type';
$string['editingrqp'] = 'Editing a Remote Question (RQP)';
$string['editingrqp'] = '$a: editing a question';
$string['editquiz'] = 'Edit Quiz';
$string['event1'] = 'Autosave';
$string['event2'] = 'Save';
@@ -43,7 +44,7 @@
$string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a. ';
$string['incorrect'] = 'Incorrect';
$string['info'] = 'Info';
$string['invalidsource'] = 'The source is not accepted as valid by the server $a->rendering_server.';
$string['invalidsource'] = 'The source is not accepted as valid.';
$string['invalidsourcetype'] = 'Invalid source type.';
$string['itemsource'] = 'Item Source';
$string['itemsourceformat'] = 'Item Source Format';
@@ -61,6 +62,7 @@
$string['missingrenderingserver'] = 'Missing rendering server URL';
$string['newattemptfail'] = 'Error: Could not start a new attempt at the quiz';
$string['noattemptstoshow'] = 'There are no attempts to show';
$string['noconnection'] = 'There is currently no connection to a web service that can process this question. Please contact your administrator';
$string['noquestionsfound'] = 'No questions found';
$string['notavailable'] = 'Sorry, this quiz is not available';
$string['notavailabletostudents'] = 'Note: This quiz is not currently available to your students';
@@ -97,6 +99,11 @@
$string['rqps'] = 'Remote Questions';
$string['savenosubmit'] = 'Save without submitting';
$string['scores'] = 'Scores';
$string['serveradded'] = 'Server added';
$string['serveridentifier'] = 'Identifier';
$string['serverinfo'] = 'Server information';
$string['serverinuse'] = 'The server that you are about to delete is the last $a server and there are already questions which will not work any more if you delete this server.';
$string['serverurl'] = 'Server URL';
$string['servers'] = 'Servers';
$string['showall'] = 'Show all questions on one page';
$string['showbreaks'] = 'Show page breaks';
@@ -105,6 +112,7 @@
$string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.';
$string['timestr'] = '%%H:%%M:%%S on %%d/%%m/%%y';
$string['unfinished'] = 'open';
$string['url'] = 'URL';
$string['validate'] = 'Validate';
$string['withselected'] = 'With selected';
$string['wronguse'] = 'You can not use this page like that';
@@ -64,27 +64,6 @@
define("RQP", "11");
/**#@-*/
/**
* Array of question types names translated to the user's language
*
* The $QUIZ_QUESTION_TYPE array holds the names of all the question types that the user should
* be able to create directly. Some internal question types like random questions are excluded.
* The complete list of question types can be found in {@link $QUIZ_QTYPES}.
*/
// Note: Commented-out questiontypes are disabled, because they have not been
// upgraded to the new code yet.
$QUIZ_QUESTION_TYPE = array ( MULTICHOICE => get_string("multichoice", "quiz"),
TRUEFALSE => get_string("truefalse", "quiz"),
SHORTANSWER => get_string("shortanswer", "quiz"),
NUMERICAL => get_string("numerical", "quiz"),
CALCULATED => get_string("calculated", "quiz"),
MATCH => get_string("match", "quiz"),
DESCRIPTION => get_string("description", "quiz"),
RANDOMSAMATCH => get_string("randomsamatch", "quiz"),
MULTIANSWER => get_string("multianswer", "quiz"),
RQP => get_string("rqp", "quiz")
);
define("QUIZ_PICTURE_MAX_HEIGHT", "600"); // Not currently implemented
define("QUIZ_PICTURE_MAX_WIDTH", "600"); // Not currently implemented
@@ -27,6 +27,12 @@
$qtype = optional_param('qtype');
$category = optional_param('category');
// a qtype > 99 means a remote question
if ($qtype > 99) {
$typeid = $qtype - 100;
$qtype = RQP;
}
$contextquiz = optional_param('contextquiz'); // the quiz from which this question is being edited
if (isset($_REQUEST['cancel'])) {
@@ -2,19 +2,23 @@
require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php');
$types = quiz_rqp_get_types();
print_heading_with_help(get_string('editingrqp', 'quiz'), 'rqp', 'quiz');
if (empty($question->id)) {
$question->options->type = '';
if (!isset($typeid)) {
error('No remote question type specified');
}
$question->options->type = $typeid;
$question->options->source = '';
$question->options->format = '';
}
else if (!$QUIZ_QTYPES[$question->qtype]->get_question_options($question)) {
$question->options->type = '';
$question->options->source = '';
$question->options->format = '';
echo "<p align=\"center\">Error! Could not load the options for this question!</p>\n";
error("Could not load the options for this question");
}
if (!$type = get_record('quiz_rqp_types', 'id', $question->options->type = $typeid)) {
error("Invalid remote question type");
}
print_heading_with_help(get_string('editingrqp', 'quiz', $type->name), 'rqp', 'quiz');
require('rqp.html');
?>

This file was deleted.

0 comments on commit 815bb0c

Please sign in to comment.
You can’t perform that action at this time.