Bug 6239 - Allow questions to have some teacher-supplied commentary.
While implementing this, I removed the ~100 lines of very similar code from the top of each question type's editquestion.html template, and moved this to a the function print_question_form_start() in the base class, which uses the template question/type/editquestionstart.html. This is described in more detail here: http://moodle.org/mod/forum/discuss.php?d=51590, and is why this patch makes the codebase 523 lines smaller.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<p align="center"><b>Question commentary</b></p>
|
||||
|
||||
<p>Question commentary is some text that gets shown to the
|
||||
student after they have attempted the question. Unlike feedback,
|
||||
which depends on the question type and what response the student gave,
|
||||
the same commentary text is shown to all students.</p>
|
||||
|
||||
<p>You can control when commentary is shown to students using
|
||||
the "Students may review:" check-boxes on the quiz editing form.</p>
|
||||
|
||||
<p>You can use the commentary to give students some background
|
||||
to what knownledge the question was testing. Or to give them a
|
||||
link to more information they can use if they did not understand the
|
||||
questions.</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<p align="center"><b>Question text</b></p>
|
||||
|
||||
<p>Different question types all display differently,
|
||||
but they all start with some text which is entered here.
|
||||
Depending on the question type, there may be more
|
||||
settings to control the rest of the question display
|
||||
lower down this form.</p>
|
||||
@@ -83,6 +83,7 @@ $string['close'] = 'Close window';
|
||||
$string['closepreview'] = 'Close preview';
|
||||
$string['closereview'] = 'Close review';
|
||||
$string['comment'] = 'Comment';
|
||||
$string['commentary'] = 'Commentary';
|
||||
$string['commentorgrade'] = 'Make comment or override grade';
|
||||
$string['completedon'] = 'Completed on';
|
||||
$string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.';
|
||||
@@ -257,6 +258,7 @@ $string['markall'] = 'Submit page';
|
||||
$string['marks'] = 'Marks';
|
||||
$string['match'] = 'Matching';
|
||||
$string['matchanswer'] = 'Matching answer';
|
||||
$string['matchanswerno'] = 'Matching answer $a';
|
||||
$string['matcherror'] = 'Grades do not match grade options - question skipped';
|
||||
$string['matchgrades'] = 'Match grades';
|
||||
$string['matchgradeserror'] = 'Error if grade not listed';
|
||||
@@ -345,9 +347,11 @@ $string['questiondeleted'] = 'This question has been deleted. Please contact you
|
||||
$string['questioninuse'] = 'The question \'$a->questionname\' is currently being used in: <br />$a->quiznames<br />The question will not be deleted from these quizzes but only from the category list.';
|
||||
$string['questionname'] = 'Question name';
|
||||
$string['questionnametoolong'] = 'Question name too long at line $a (255 char. max). It has been truncated.';
|
||||
$string['questionno'] = 'Question $a';
|
||||
$string['questions'] = 'Questions';
|
||||
$string['questionsinuse'] = '(* Questions marked by an asterisk are already in use in some quizzes. These question will not be deleted from these quizzes but only from the category list.)';
|
||||
$string['questionsperpage'] = 'Questions per page';
|
||||
$string['questiontext'] = 'Question text';
|
||||
$string['questiontype'] = 'Question type $a';
|
||||
$string['questiontypesetupoptions'] = 'Setup options for question types:';
|
||||
$string['quizavailable'] = 'The quiz is available until: $a';
|
||||
|
||||
+5
-1
@@ -59,6 +59,10 @@ define("ESSAY", "essay");
|
||||
*/
|
||||
define("QUESTION_NUMANS", "10");
|
||||
|
||||
/**
|
||||
* The options used when popping up a question preview window in Javascript.
|
||||
*/
|
||||
define('QUESTION_PREVIEW_POPUP_OPTIONS', "'scrollbars=yes,resizable=yes,width=700,height=540'");
|
||||
|
||||
/**#@+
|
||||
* Option flags for ->optionflags
|
||||
@@ -1560,4 +1564,4 @@ function default_export_filename($course,$category) {
|
||||
return $export_name;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+16
-1
@@ -5,6 +5,8 @@ function quiz_upgrade($oldversion) {
|
||||
// older versions to match current functionality
|
||||
|
||||
global $CFG, $QTYPES, $db;
|
||||
$success = true;
|
||||
|
||||
require_once("$CFG->dirroot/mod/quiz/locallib.php");
|
||||
|
||||
if ($oldversion < 2002101800) {
|
||||
@@ -1097,8 +1099,21 @@ function quiz_upgrade($oldversion) {
|
||||
execute_sql('DROP TABLE '.$CFG->prefix.'quiz_attemptonlast_datasets', false);
|
||||
}
|
||||
|
||||
if ($oldversion < 2006081000) {
|
||||
// Add a column to the the question table to store the question commentary.
|
||||
$success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image');
|
||||
|
||||
return true;
|
||||
// Adjust the quiz review options so that commentary is displayed whenever feedback is.
|
||||
$success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' .
|
||||
'(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits.
|
||||
'((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones.
|
||||
|
||||
// Same adjustment to the defaults for new quizzes.
|
||||
$success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) |
|
||||
(($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3));
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -250,6 +250,7 @@ CREATE TABLE prefix_question (
|
||||
questiontext text NOT NULL,
|
||||
questiontextformat tinyint(2) NOT NULL default '0',
|
||||
image varchar(255) NOT NULL default '',
|
||||
commentarytext text NOT NULL,
|
||||
defaultgrade int(10) unsigned NOT NULL default '1',
|
||||
penalty float NOT NULL default '0.1',
|
||||
qtype varchar(20) NOT NULL default '',
|
||||
|
||||
@@ -5,6 +5,8 @@ function quiz_upgrade($oldversion) {
|
||||
// older versions to match current functionality
|
||||
|
||||
global $CFG, $db;
|
||||
$success = true;
|
||||
|
||||
include_once("$CFG->dirroot/mod/quiz/locallib.php");
|
||||
|
||||
if ($oldversion < 2003010100) {
|
||||
@@ -1419,8 +1421,22 @@ function quiz_upgrade($oldversion) {
|
||||
|
||||
}
|
||||
|
||||
if ($oldversion < 2006081000) {
|
||||
// Add a column to the the question table to store the question commentary.
|
||||
$success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image');
|
||||
|
||||
return true;
|
||||
// Adjust the quiz review options so that commentary is displayed whenever feedback is.
|
||||
$success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' .
|
||||
'(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits.
|
||||
'((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones.
|
||||
|
||||
// Same adjustment to the defaults for new quizzes.
|
||||
$success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) |
|
||||
(($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3));
|
||||
}
|
||||
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -244,6 +244,7 @@ CREATE TABLE prefix_question (
|
||||
questiontext text NOT NULL default '',
|
||||
questiontextformat integer NOT NULL default '0',
|
||||
image varchar(255) NOT NULL default '',
|
||||
commentarytext text NOT NULL default '',
|
||||
defaultgrade integer NOT NULL default '1',
|
||||
penalty real NOT NULL default '0.1',
|
||||
qtype varchar(20) NOT NULL default '0',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// It defines default values for any important configuration variables
|
||||
|
||||
$defaults = array (
|
||||
'quiz_review' => hexdec('ffffff'),
|
||||
'quiz_review' => 0xffffff,
|
||||
'quiz_attemptonlast' => 0,
|
||||
'quiz_attempts' => 0,
|
||||
'quiz_grademethod' => '',
|
||||
|
||||
@@ -267,15 +267,16 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true, $r
|
||||
|
||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\">
|
||||
<img src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
||||
<img src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
|
||||
if ($canedit) {
|
||||
echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$qnum$context\">
|
||||
<img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
|
||||
<img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
|
||||
}
|
||||
if ($allowdelete) {
|
||||
echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&quizid=$quiz->id&sesskey=$USER->sesskey\">
|
||||
<img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
|
||||
<img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
|
||||
}
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
+22
-9
@@ -22,25 +22,25 @@ require_once($CFG->libdir.'/questionlib.php');
|
||||
/**
|
||||
* The first 6 bits refer to the time immediately after the attempt
|
||||
*/
|
||||
define('QUIZ_REVIEW_IMMEDIATELY', 64-1);
|
||||
define('QUIZ_REVIEW_IMMEDIATELY', 0x3f);
|
||||
/**
|
||||
* the next 6 bits refer to the time after the attempt but while the quiz is open
|
||||
*/
|
||||
define('QUIZ_REVIEW_OPEN', 4096-64);
|
||||
define('QUIZ_REVIEW_OPEN', 0xfc0);
|
||||
/**
|
||||
* the final 6 bits refer to the time after the quiz closes
|
||||
*/
|
||||
define('QUIZ_REVIEW_CLOSED', 262144-4096);
|
||||
define('QUIZ_REVIEW_CLOSED', 0x3f000);
|
||||
|
||||
// within each group of 6 bits we determine what should be shown
|
||||
define('QUIZ_REVIEW_RESPONSES', 1+64+4096); // Show responses
|
||||
define('QUIZ_REVIEW_SCORES', 2*4161); // Show scores
|
||||
define('QUIZ_REVIEW_FEEDBACK', 4*4161); // Show feedback
|
||||
define('QUIZ_REVIEW_ANSWERS', 8*4161); // Show correct answers
|
||||
define('QUIZ_REVIEW_RESPONSES', 1*0x1041); // Show responses
|
||||
define('QUIZ_REVIEW_SCORES', 2*0x1041); // Show scores
|
||||
define('QUIZ_REVIEW_FEEDBACK', 4*0x1041); // Show feedback
|
||||
define('QUIZ_REVIEW_ANSWERS', 8*0x1041); // Show correct answers
|
||||
// Some handling of worked solutions is already in the code but not yet fully supported
|
||||
// and not switched on in the user interface.
|
||||
define('QUIZ_REVIEW_SOLUTIONS', 16*4161); // Show solutions
|
||||
// the 6th bit is as yet unused
|
||||
define('QUIZ_REVIEW_SOLUTIONS', 16*0x1041); // Show solutions
|
||||
define('QUIZ_REVIEW_COMMENTARY', 32*0x1041); // Show commentary
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
@@ -671,6 +671,19 @@ function quiz_process_options(&$form) {
|
||||
unset($form->solutionsclosed);
|
||||
}
|
||||
|
||||
if (isset($form->commentaryimmediately)) {
|
||||
$review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY);
|
||||
unset($form->solutionsimmediately);
|
||||
}
|
||||
if (isset($form->commentaryopen)) {
|
||||
$review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN);
|
||||
unset($form->solutionsopen);
|
||||
}
|
||||
if (isset($form->commentaryclosed)) {
|
||||
$review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED);
|
||||
unset($form->solutionsclosed);
|
||||
}
|
||||
|
||||
$form->review = $review;
|
||||
$form->optionflags = $optionflags;
|
||||
|
||||
|
||||
+27
-22
@@ -459,6 +459,7 @@ function quiz_upgrade_states($attempt) {
|
||||
$questionlist = quiz_questions_in_quiz($attempt->layout);
|
||||
if ($questionlist and $states = get_records_select('question_states', "attempt = '$attempt->uniqueid' AND question IN ($questionlist)")) {
|
||||
foreach ($states as $state) {
|
||||
$session = new stdClass;
|
||||
$session->newgraded = $state->id;
|
||||
$session->newest = $state->id;
|
||||
$session->questionid = $state->question;
|
||||
@@ -474,8 +475,9 @@ function quiz_get_question_review($quiz, $question) {
|
||||
$strpreview = get_string('previewquestion', 'quiz');
|
||||
$context = $quiz->id ? '&contextquiz='.$quiz->id : '';
|
||||
$quiz_id = $quiz->id ? '&quizid=' . $quiz->id : '';
|
||||
return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\">
|
||||
<img src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
|
||||
return "<a title=\"$strpreview\" href=\"javascript:void(0)\" onClick=\"openpopup('/question/preview.php?id=$qnum$quiz_id','questionpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\">
|
||||
<img src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>";
|
||||
}
|
||||
|
||||
|
||||
@@ -486,6 +488,8 @@ function quiz_get_question_review($quiz, $question) {
|
||||
* @param object $state
|
||||
*/
|
||||
function quiz_get_renderoptions($reviewoptions, $state) {
|
||||
$options = new stdClass;
|
||||
|
||||
// Show the question in readonly (review) mode if the question is in
|
||||
// the closed state
|
||||
$options->readonly = question_state_is_closed($state);
|
||||
@@ -499,6 +503,9 @@ function quiz_get_renderoptions($reviewoptions, $state) {
|
||||
// Show correct responses in readonly mode if the quiz allows it
|
||||
$options->correct_responses = $options->readonly && ($reviewoptions & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
|
||||
|
||||
// Show commentary if the question has been graded and the quiz allows it.
|
||||
$options->commentary = question_state_is_graded($state) && ($reviewoptions & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY);
|
||||
|
||||
// Always show responses and scores
|
||||
$options->responses = true;
|
||||
$options->scores = true;
|
||||
@@ -511,6 +518,8 @@ function quiz_get_renderoptions($reviewoptions, $state) {
|
||||
* Determine review options
|
||||
*/
|
||||
function quiz_get_reviewoptions($quiz, $attempt, $isteacher=false) {
|
||||
|
||||
$options = new stdClass;
|
||||
$options->readonly = true;
|
||||
// Provide the links to the question review and comment script
|
||||
$options->questionreviewlink = '/mod/quiz/reviewquestion.php';
|
||||
@@ -523,32 +532,28 @@ function quiz_get_reviewoptions($quiz, $attempt, $isteacher=false) {
|
||||
$options->feedback = true;
|
||||
$options->correct_responses = true;
|
||||
$options->solutions = false;
|
||||
$options->commentary = true;
|
||||
|
||||
// Show a link to the comment box only for closed attempts
|
||||
if ($attempt->timefinish) {
|
||||
$options->questioncommentlink = '/mod/quiz/comment.php';
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) {
|
||||
$options->responses = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
|
||||
$options->scores = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_SCORES) ? 1 : 0;
|
||||
$options->feedback = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
$options->correct_responses = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
|
||||
$options->solutions = ($quiz->review & QUIZ_REVIEW_IMMEDIATELY & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
|
||||
} else if (!$quiz->timeclose or time() < $quiz->timeclose) {
|
||||
$options->responses = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
|
||||
$options->scores = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_SCORES) ? 1 : 0;
|
||||
$options->feedback = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
$options->correct_responses = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
|
||||
$options->solutions = ($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
|
||||
} else {
|
||||
$options->responses = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
|
||||
$options->scores = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_SCORES) ? 1 : 0;
|
||||
$options->feedback = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
$options->correct_responses = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
|
||||
$options->solutions = ($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
|
||||
if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) {
|
||||
$quiz_state_mask = QUIZ_REVIEW_IMMEDIATELY;
|
||||
} else if (!$quiz->timeclose or time() < $quiz->timeclose) {
|
||||
$quiz_state_mask = QUIZ_REVIEW_OPEN;
|
||||
} else {
|
||||
$quiz_state_mask = QUIZ_REVIEW_CLOSED;
|
||||
}
|
||||
$options->responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_RESPONSES) ? 1 : 0;
|
||||
$options->scores = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SCORES) ? 1 : 0;
|
||||
$options->feedback = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_FEEDBACK) ? 1 : 0;
|
||||
$options->correct_responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_ANSWERS) ? 1 : 0;
|
||||
$options->solutions = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0;
|
||||
$options->commentary = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_COMMENTARY) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<td align="center"><?php print_string('feedback', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('answers', 'quiz') ?></td>
|
||||
<!-- <td align="center"><?php print_string('solutions', 'quiz') ?></td>-->
|
||||
<td align="center"><?php print_string('commentary', 'quiz') ?></td>
|
||||
<td>
|
||||
<?php helpbutton("review2", get_string("allowreview","quiz"), "quiz"); ?>
|
||||
</td>
|
||||
@@ -38,6 +39,9 @@
|
||||
<input type="checkbox" name="solutionsimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
-->
|
||||
<td align="center">
|
||||
<input type="checkbox" name="commentaryimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
@@ -57,6 +61,9 @@
|
||||
<input type="checkbox" name="solutionsopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
-->
|
||||
<td align="center">
|
||||
<input type="checkbox" name="commentaryopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
@@ -76,6 +83,9 @@
|
||||
<input type="checkbox" name="solutionsclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SOLUTIONS & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
-->
|
||||
<td align="center">
|
||||
<input type="checkbox" name="commentaryclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2006080900; // The (date) version of this module
|
||||
$module->version = 2006081000; // The (date) version of this module
|
||||
$module->requires = 2006080900; // Requires this Moodle version
|
||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
fwrite ($bf,full_tag("QUESTIONTEXT",6,false,$question->questiontext));
|
||||
fwrite ($bf,full_tag("QUESTIONTEXTFORMAT",6,false,$question->questiontextformat));
|
||||
fwrite ($bf,full_tag("IMAGE",6,false,$question->image));
|
||||
fwrite ($bf,full_tag("COMMENTARYTEXT",6,false,$question->commentarytext));
|
||||
fwrite ($bf,full_tag("DEFAULTGRADE",6,false,$question->defaultgrade));
|
||||
fwrite ($bf,full_tag("PENALTY",6,false,$question->penalty));
|
||||
fwrite ($bf,full_tag("QTYPE",6,false,$question->qtype));
|
||||
|
||||
@@ -339,18 +339,19 @@ function question_list($course, $categoryid, $quizid=0,
|
||||
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&quizid=$quizid&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a> ";
|
||||
}
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img
|
||||
src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a> ";
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview', " .
|
||||
QUESTION_PREVIEW_POPUP_OPTIONS . ", false)\"><img
|
||||
src=\"$CFG->pixpath/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a> ";
|
||||
if ($canedit) {
|
||||
echo "<a title=\"$stredit\" href=\"$CFG->wwwroot/question/question.php?id=$question->id\"><img
|
||||
src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a> ";
|
||||
src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a> ";
|
||||
// hide-feature
|
||||
if($question->hidden) {
|
||||
echo "<a title=\"$strrestore\" href=\"edit.php?courseid=$course->id&unhide=$question->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"$CFG->pixpath/t/restore.gif\" border=\"0\" alt=\"$strrestore\" /></a>";
|
||||
src=\"$CFG->pixpath/t/restore.gif\" border=\"0\" alt=\"$strrestore\" /></a>";
|
||||
} else {
|
||||
echo "<a title=\"$strdelete\" href=\"edit.php?courseid=$course->id&deleteselected=$question->id&q$question->id=1\"><img
|
||||
src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strdelete\" /></a>";
|
||||
src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strdelete\" /></a>";
|
||||
}
|
||||
}
|
||||
echo " <input title=\"$strselect\" type=\"checkbox\" name=\"q$question->id\" value=\"1\" />";
|
||||
|
||||
@@ -82,6 +82,11 @@ class qformat_xml extends qformat_default {
|
||||
$image_base64 = stripslashes( trim( $question['#']['image_base64'][0]['#'] ) );
|
||||
$image = $this->importimagefile( $image, $image_base64 );
|
||||
}
|
||||
if (array_key_exists('commentarytext', $question['#'])) {
|
||||
$commentarytext = $this->import_text( $question['#']['commentarytext'][0]['#']['text'] );
|
||||
} else {
|
||||
$commentarytext = '';
|
||||
}
|
||||
$penalty = $question['#']['penalty'][0]['#'];
|
||||
|
||||
$qo = $this->defaultquestion();
|
||||
@@ -89,6 +94,7 @@ class qformat_xml extends qformat_default {
|
||||
$qo->questiontext = $qtext;
|
||||
$qo->questiontextformat = $this->trans_format( $qformat );
|
||||
$qo->image = ((!empty($image)) ? $image : '');
|
||||
$qo->commentarytext = $commentarytext;
|
||||
$qo->penalty = $penalty;
|
||||
|
||||
return $qo;
|
||||
@@ -603,6 +609,7 @@ class qformat_xml extends qformat_default {
|
||||
$name_text = $this->writetext( $question->name );
|
||||
$qtformat = $this->get_format($question->questiontextformat);
|
||||
$question_text = $this->writetext( $question->questiontext );
|
||||
$commentary_text = $this->writetext( $question->commentarytext );
|
||||
$expout .= " <question type=\"$question_type\">\n";
|
||||
$expout .= " <name>$name_text</name>\n";
|
||||
$expout .= " <questiontext format=\"$qtformat\">\n";
|
||||
@@ -610,6 +617,9 @@ class qformat_xml extends qformat_default {
|
||||
$expout .= " </questiontext>\n";
|
||||
$expout .= " <image>{$question->image}</image>\n";
|
||||
$expout .= $this->writeimage($question->image);
|
||||
$expout .= " <commentarytext>\n";
|
||||
$expout .= $commentary_text;
|
||||
$expout .= " </commentarytext>\n";
|
||||
$expout .= " <penalty>{$question->penalty}</penalty>\n";
|
||||
$expout .= " <hidden>{$question->hidden}</hidden>\n";
|
||||
}
|
||||
|
||||
@@ -261,14 +261,6 @@
|
||||
}
|
||||
|
||||
|
||||
make_upload_directory("$course->id"); // Just in case
|
||||
$coursefiles = get_directory_list("$CFG->dataroot/$course->id", $CFG->moddata);
|
||||
foreach ($coursefiles as $filename) {
|
||||
if (mimeinfo("icon", $filename) == "image.gif") {
|
||||
$images["$filename"] = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
// Print the question editing form
|
||||
|
||||
if (empty($question->id)) {
|
||||
@@ -289,6 +281,9 @@
|
||||
if (!isset($question->defaultgrade)) {
|
||||
$question->defaultgrade = 1;
|
||||
}
|
||||
if (empty($question->commentarytext)) {
|
||||
$question->commentarytext = "";
|
||||
}
|
||||
|
||||
// Set up some Richtext editing if necessary
|
||||
if ($usehtmleditor = can_use_richtext_editor()) {
|
||||
|
||||
@@ -189,6 +189,11 @@
|
||||
$question->questiontext = backup_todb($que_info['#']['QUESTIONTEXT']['0']['#']);
|
||||
$question->questiontextformat = backup_todb($que_info['#']['QUESTIONTEXTFORMAT']['0']['#']);
|
||||
$question->image = backup_todb($que_info['#']['IMAGE']['0']['#']);
|
||||
if (array_key_exists('COMMENTARYTEXT', $que_info['#'])) {
|
||||
$question->commentarytext = backup_todb($que_info['#']['COMMENTARYTEXT']['0']['#']);
|
||||
} else {
|
||||
$question->commentarytext = '';
|
||||
}
|
||||
$question->defaultgrade = backup_todb($que_info['#']['DEFAULTGRADE']['0']['#']);
|
||||
$question->penalty = backup_todb($que_info['#']['PENALTY']['0']['#']);
|
||||
$question->qtype = backup_todb($que_info['#']['QTYPE']['0']['#']);
|
||||
|
||||
@@ -1,85 +1,6 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<span class="editorhelptext">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
print_textarea($usehtmleditor, 20, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
|
||||
if ($usehtmleditor) { /// Trying this out for a while
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo '<div align="right">';
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("correctanswerformula", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
@@ -157,15 +78,12 @@ for ($i=1; $i<count($units); $i++) {
|
||||
</tr>
|
||||
<?php
|
||||
} /// END for
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question,
|
||||
'onclick="return determineMinAndMax();"',
|
||||
'<input type="hidden" name="wizardpage" value="question" />');
|
||||
?>
|
||||
</table>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
|
||||
<input type="hidden" name="wizardpage" value="question" />
|
||||
<input type="submit" onclick="return determineMinAndMax();" value="<?php print_string("savechanges") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
<script language="javascript" type="text/javascript">
|
||||
function determineMinAndMax() {
|
||||
// This client-side script will determine the values for min and max
|
||||
|
||||
@@ -1,72 +1,5 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
|
||||
<input type="hidden" name="defaultgrade" value="0" />
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
|
||||
array('defaultgrade', 'penalty'));
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<tr valign="top">
|
||||
<td colspan="2" align="center">
|
||||
<input type="submit" <?php echo $submitscript ?> value="<?php print_string('savechanges') ?>" />
|
||||
<?php
|
||||
if ($question->id) {
|
||||
?>
|
||||
<input type="submit" name="makecopy" <?php echo $submitscript ?> value="<?php print_string("makecopy", "quiz") ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>" />
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
|
||||
<?php
|
||||
echo $hiddenfields;
|
||||
|
||||
// The following hidden field indicates that the versioning code should be turned on, i.e.,
|
||||
// that old versions should be kept if necessary
|
||||
?>
|
||||
<input type="hidden" name="versioning" value="on" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
@@ -0,0 +1,122 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br /><br /><br />
|
||||
<?php
|
||||
helpbutton("questiontext", get_string("questiontext", "quiz"), "quiz", true, true);
|
||||
echo '<br />';
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if (!in_array('image', $hidefields)) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!in_array('defaultgrade', $hidefields)) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!in_array('penalty', $hidefields)) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("commentary", "quiz") ?>:</b>
|
||||
<br /><br /><br />
|
||||
<?php
|
||||
helpbutton("commentary", get_string("commentary", "quiz"), "quiz", true, true);
|
||||
?>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (isset($err["commentarytext"])) {
|
||||
formerr($err["commentarytext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea(false, 10, 60, 630, 200, "commentarytext", $question->commentarytext);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
@@ -1,86 +1,6 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?php print_string("category", "quiz") ?>:</b>
|
||||
</td>
|
||||
<td>
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?php print_string("questionname", "quiz") ?>:</b>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?php print_string("imagedisplay", "quiz") ?>:</b>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?php print_string("feedback", "quiz") ?>:</b>
|
||||
@@ -89,15 +9,9 @@
|
||||
<textarea name="feedback" rows="2" cols="50" wrap="virtual"><?php p($options->answer->feedback) ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="fraction" value="0" /> <?php // dont think there would ever be a different value other than 1... ?>
|
||||
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question, '',
|
||||
'<input type="hidden" name="fraction" value="0" />'); // dont think there would ever be a different value other than 1...
|
||||
?>
|
||||
|
||||
</center>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
@@ -1,116 +1,46 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("choices", "quiz") ?></b>:</td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
<div style="width: 30em">
|
||||
<?php print_string("filloutthreequestions", "quiz") ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("choices", "quiz") ?></b>:</td>
|
||||
<td align="left"><?php print_string("filloutthreequestions", "quiz") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("shuffle", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "shuffleanswers", "$options->shuffleanswers", "");
|
||||
helpbutton("matchshuffle", get_string("shuffle","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=1; $i <= count($subquestions); $i++) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php echo get_string("question", "quiz")." $i"; ?> :</b></td>
|
||||
<td align="left">
|
||||
<textarea name="subquestions[]" rows="5" cols="50"><?php p($subquestions[$i-1]) ?></textarea>
|
||||
<br />
|
||||
<?php echo get_string("matchanswer", "quiz")." $i"; ?>
|
||||
<input type="text" name="subanswers[]" size="50" value="<?php p($subanswers[$i-1]) ?>" alt="<?php echo get_string("matchanswer", "quiz")." $i"; ?>" />
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "shuffleanswers", "$options->shuffleanswers", "");
|
||||
helpbutton("matchshuffle", get_string("shuffle","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
for ($i=1; $i <= count($subquestions); $i++) {
|
||||
?>
|
||||
</table>
|
||||
<tr valign="top">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
</center>
|
||||
</form>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionno", "quiz", $i) ?>:</b></td>
|
||||
<td align="left">
|
||||
<textarea name="subquestions[]" rows="3" cols="50"><?php p($subquestions[$i-1]) ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("matchanswerno", "quiz", $i) ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="subanswers[]" size="50" value="<?php p($subanswers[$i-1]) ?>" alt="<?php print_string("matchanswerno", "quiz", $i) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
|
||||
@@ -239,10 +239,6 @@ class question_match_qtype extends default_questiontype {
|
||||
$answerids = array();
|
||||
$responses = &$state->responses;
|
||||
|
||||
$formatoptions = new stdClass;
|
||||
$formatoptions->noclean = true;
|
||||
$formatoptions->para = false;
|
||||
|
||||
// Prepare a list of answers, removing duplicates.
|
||||
foreach ($subquestions as $subquestion) {
|
||||
foreach ($subquestion->options->answers as $ans) {
|
||||
@@ -268,9 +264,8 @@ class question_match_qtype extends default_questiontype {
|
||||
$answers = draw_rand_array($answers, count($answers));
|
||||
|
||||
// Print formulation
|
||||
$questiontext = format_text($question->questiontext,
|
||||
$question->questiontextformat,
|
||||
$formatoptions, $cmoptions->course);
|
||||
$questiontext = $this->format_text($question->questiontext,
|
||||
$question->questiontextformat, $cmoptions);
|
||||
$image = get_question_image($question, $cmoptions->course);
|
||||
|
||||
///// Print the input controls //////
|
||||
@@ -278,8 +273,8 @@ class question_match_qtype extends default_questiontype {
|
||||
if ($subquestion->questiontext) {
|
||||
/// Subquestion text:
|
||||
$a = new stdClass;
|
||||
$a->text = format_text($subquestion->questiontext,
|
||||
$question->questiontextformat, $formatoptions, $cmoptions->course);
|
||||
$a->text = $this->format_text($subquestion->questiontext,
|
||||
$question->questiontextformat, $cmoptions);
|
||||
|
||||
/// Drop-down list:
|
||||
$menuname = $nameprefix.$subquestion->id;
|
||||
|
||||
@@ -1,94 +1,12 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br /><br /><br /><font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
if (!isset($answers[$i-1]->fraction)) {
|
||||
$answers[$i-1]->answer = '';
|
||||
$answers[$i-1]->fraction = 0;
|
||||
$answers[$i-1]->feedback = '';
|
||||
}
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
if (!isset($answers[$i-1]->fraction)) {
|
||||
$answers[$i-1]->answer = '';
|
||||
$answers[$i-1]->fraction = 0;
|
||||
$answers[$i-1]->feedback = '';
|
||||
}
|
||||
?>
|
||||
|
||||
<tr valign="top">
|
||||
@@ -116,12 +34,8 @@
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
} /// End of loop, printing answers
|
||||
$QTYPES['missingtype']->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES['missingtype']->print_question_form_end($question);
|
||||
} /// End of loop, printing answers
|
||||
|
||||
$QTYPES['missingtype']->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES['missingtype']->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -1,61 +1,7 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle");
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
|
||||
array('defaultgrade'));
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question, '',
|
||||
'<input type="hidden" name="defaultgrade" value="' . s($question->defaultgrade) . '" />');
|
||||
?>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="defaultgrade" value="<?php p($question->defaultgrade) ?>" />
|
||||
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -1,86 +1,6 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br /><br /><br /><font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("answerhowmany", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
@@ -107,12 +27,12 @@
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
if (!isset($answers[$i-1]->fraction)) {
|
||||
$answers[$i-1]->answer = '';
|
||||
$answers[$i-1]->fraction = 0;
|
||||
$answers[$i-1]->feedback = '';
|
||||
}
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
if (!isset($answers[$i-1]->fraction)) {
|
||||
$answers[$i-1]->answer = '';
|
||||
$answers[$i-1]->fraction = 0;
|
||||
$answers[$i-1]->feedback = '';
|
||||
}
|
||||
?>
|
||||
|
||||
<tr valign="top">
|
||||
@@ -140,12 +60,8 @@
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
} /// End of loop, printing answers
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
} /// End of loop, printing answers
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -1,88 +1,7 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Answers. -->
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
|
||||
// Answers.
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
$answer = $answers[$i-1];
|
||||
?>
|
||||
@@ -121,8 +40,8 @@
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
// Units.
|
||||
?>
|
||||
<!-- Units. -->
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("unit", "quiz") ?>:</b></td>
|
||||
<td align="left"><?php
|
||||
@@ -166,9 +85,6 @@ for ($i = 1; $i < 6; $i++) {
|
||||
<?php
|
||||
} /// END for
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -29,7 +29,12 @@
|
||||
?>
|
||||
</div>
|
||||
<?php }
|
||||
echo $commentlink;
|
||||
echo $commentlink;
|
||||
if ($commentary) { ?>
|
||||
<div class="commentary">
|
||||
<?php echo $commentary ?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($history) { ?>
|
||||
<div class="history">
|
||||
<?php
|
||||
|
||||
@@ -59,6 +59,12 @@ class default_questiontype {
|
||||
$question->image = $form->image;
|
||||
}
|
||||
|
||||
if (empty($form->commentarytext)) {
|
||||
$question->commentarytext = '';
|
||||
} else {
|
||||
$question->commentarytext = trim($form->commentarytext);
|
||||
}
|
||||
|
||||
if (empty($question->name)) {
|
||||
$question->name = substr(strip_tags($question->questiontext), 0, 15);
|
||||
if (empty($question->name)) {
|
||||
@@ -458,7 +464,9 @@ class default_questiontype {
|
||||
/* The default implementation should work for most question types
|
||||
provided the member functions it calls are overridden where required.
|
||||
The layout is determined by the template question.html */
|
||||
|
||||
global $CFG;
|
||||
$isgraded = question_state_is_graded($state->last_graded);
|
||||
|
||||
// For editing teachers print a link to an editing popup window
|
||||
$editlink = '';
|
||||
@@ -468,10 +476,16 @@ class default_questiontype {
|
||||
$editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
|
||||
}
|
||||
|
||||
$commentary = '';
|
||||
if ($isgraded && $options->commentary) {
|
||||
$commentary = $this->format_text($question->commentarytext,
|
||||
$question->questiontextformat, $cmoptions);
|
||||
}
|
||||
|
||||
$grade = '';
|
||||
if ($question->maxgrade and $options->scores) {
|
||||
if ($cmoptions->optionflags & QUESTION_ADAPTIVE) {
|
||||
$grade = (!question_state_is_graded($state->last_graded)) ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/';
|
||||
$grade = !$isgraded ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/';
|
||||
}
|
||||
$grade .= $question->maxgrade;
|
||||
}
|
||||
@@ -506,7 +520,7 @@ class default_questiontype {
|
||||
}
|
||||
if (count($states) > 1) {
|
||||
$strreviewquestion = get_string('reviewresponse', 'quiz');
|
||||
unset($table);
|
||||
$table = new stdClass;
|
||||
$table->width = '100%';
|
||||
if ($options->scores) {
|
||||
$table->head = array (
|
||||
@@ -599,6 +613,7 @@ class default_questiontype {
|
||||
if (!empty($question->maxgrade) && $options->scores) {
|
||||
if (question_state_is_graded($state->last_graded)) {
|
||||
// Display the grading details from the last graded state
|
||||
$grade = new stdClass;
|
||||
$grade->cur = round($state->last_graded->grade, $cmoptions->decimalpoints);
|
||||
$grade->max = $question->maxgrade;
|
||||
$grade->raw = round($state->last_graded->raw_grade, $cmoptions->decimalpoints);
|
||||
@@ -987,24 +1002,71 @@ class default_questiontype {
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
function print_question_form_end($question, $submitscript='') {
|
||||
// This function is used at the end of the question edit forms in all question types
|
||||
// It prints the submit, copy, and cancel buttons and the standard hidden form fields
|
||||
global $USER;
|
||||
echo '<tr valign="top">
|
||||
<td colspan="2" align="center">
|
||||
<input type="submit" '.$submitscript.' value="'.get_string('savechanges').'" /> ';
|
||||
if ($question->id) {
|
||||
echo '<input type="submit" name="makecopy" '.$submitscript.' value="'.get_string("makecopy", "quiz").'" /> ';
|
||||
/**
|
||||
* Print the start of the question editing form, including the question category,
|
||||
* questionname, questiontext, image, defaultgrade, penalty and commentary fields.
|
||||
*
|
||||
* Three of the fields, image, defaultgrade, penalty, are optional, and
|
||||
* can be removed from the from using the $hidefields argument.
|
||||
*
|
||||
* @param object $question The question object that the form we are printing is for.
|
||||
* @param array $err Array of optional error messages to display by each field.
|
||||
* Used when the form is being redisplayed after validation failed.
|
||||
* @param object $course The course object for the course this question belongs to.
|
||||
* @param boolean $usehtmleditor Whether the html editor should be used.
|
||||
* @param array $hidefields An array which may contain the strings,
|
||||
* 'image', 'defaultgrade' or 'penalty' to remove the corresponding field.
|
||||
*/
|
||||
function print_question_form_start($question, $err, $course, $usehtmleditor, $hidefields = array()) {
|
||||
global $CFG;
|
||||
|
||||
// If you edit this function, you also need to edit random/editquestion.html.
|
||||
|
||||
if (!in_array('image', $hidefields)) {
|
||||
make_upload_directory("$course->id"); // Just in case
|
||||
$coursefiles = get_directory_list("$CFG->dataroot/$course->id", $CFG->moddata);
|
||||
foreach ($coursefiles as $filename) {
|
||||
if (mimeinfo("icon", $filename) == "image.gif") {
|
||||
$images["$filename"] = $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<input type="submit" name="cancel" value="'.get_string("cancel").'" />
|
||||
<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />
|
||||
<input type="hidden" name="id" value="'.$question->id.'" />
|
||||
<input type="hidden" name="qtype" value="'.$question->qtype.'" />';
|
||||
// The following hidden field indicates that the versioning code should be turned on, i.e.,
|
||||
// that old versions should be kept if necessary
|
||||
echo '<input type="hidden" name="versioning" value="on" />
|
||||
</td></tr>';
|
||||
|
||||
include('editquestionstart.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the end of the question editing form, including the submit, copy,
|
||||
* and cancel button, and the standard hidden fields like the sesskey and
|
||||
* the question type.
|
||||
*
|
||||
* @param object $question The question object that the form we are printing is for.
|
||||
* @param string $submitscript Extra attributes, for example 'onsubmit="myfunction"',
|
||||
* that is added to the HTML of the submit button.
|
||||
* @param string $hiddenfields Extra hidden fields (actually any HTML)
|
||||
* to be added at the end of the form.
|
||||
*/
|
||||
function print_question_form_end($question, $submitscript = '', $hiddenfields = '') {
|
||||
global $USER;
|
||||
|
||||
// If you edit this function, you also need to edit random/editquestion.html.
|
||||
|
||||
include('editquestionend.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* Call format_text from weblib.php with the options appropriate to question types.
|
||||
*
|
||||
* @param string $text the text to format.
|
||||
* @param integer $text the type of text. Normally $question->questiontextformat.
|
||||
* @param object $cmoptions the context the string is being displayed in. Only $cmoptions->course is used.
|
||||
* @return string the formatted text.
|
||||
*/
|
||||
function format_text($text, $textformat, $cmoptions) {
|
||||
$formatoptions = new stdClass;
|
||||
$formatoptions->noclean = true;
|
||||
$formatoptions->para = false;
|
||||
return format_text($text, $textformat, $formatoptions, $cmoptions->course);
|
||||
}
|
||||
|
||||
/// BACKUP FUNCTIONS ////////////////////////////
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<center>
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($question->name)) {
|
||||
$question->name = get_string("random", "quiz");
|
||||
} ?>
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("recurse", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
@@ -33,5 +33,5 @@
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
</form>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php // $Id$
|
||||
|
||||
if (empty($question->name)) {
|
||||
$question->name = get_string("random", "quiz");
|
||||
}
|
||||
|
||||
print_heading_with_help(get_string("editingrandom", "quiz"), "random", "quiz");
|
||||
require("$CFG->dirroot/question/type/random/editquestion.html");
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,79 +1,7 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php echo $categories[$question->category]; ?>
|
||||
<input type="hidden" name="category" value="<?php echo "$question->category"; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if (empty($question->name)) {
|
||||
$question->name = get_string("randomsamatch", "quiz");
|
||||
}
|
||||
?>
|
||||
<input type="text" name="name" size="40" value="<?php p($question->name) ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("introduction", "quiz") ?>:</b>
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
if (empty($question->questiontext)) {
|
||||
$question->questiontext = get_string("randomsamatchintro", "quiz");
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo '<div align="right">';
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (empty($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor,
|
||||
array('image'));
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("randomsamatchnumber", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
@@ -95,9 +23,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
$numberavailable = count($saquestions);
|
||||
unset($saquestions);
|
||||
|
||||
if (empty($question->name)) {
|
||||
$question->name = get_string("randomsamatch", "quiz");
|
||||
}
|
||||
|
||||
if (empty($question->questiontext)) {
|
||||
$question->questiontext = get_string("randomsamatchintro", "quiz");
|
||||
}
|
||||
|
||||
$yesnooptions = array();
|
||||
$yesnooptions[0] = get_string("no");
|
||||
$yesnooptions[1] = get_string("yes");
|
||||
|
||||
@@ -1,69 +1,8 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>" />
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("casesensitive", "quiz") ?>:</b></td>
|
||||
<td align="right"><b><?php print_string("casesensitive", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
unset($menu);
|
||||
@@ -74,32 +13,18 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="right"><b><?php print_string("correctanswers", "quiz") ?></b>:</td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("correctanswers", "quiz") ?></b>:</td>
|
||||
<td align="left">
|
||||
<?php print_string("filloutoneanswer", "quiz") ?>
|
||||
<div style="width: 35em">
|
||||
<?php print_string("filloutoneanswer", "quiz") ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=1; $i<=count($answers); $i++) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php echo get_string("answer", "quiz")." $i"; ?>:</b></td>
|
||||
<td align="right"><b><?php echo get_string("answer", "quiz")." $i"; ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
if ($answers[$i-1]->answer === '') {
|
||||
@@ -120,7 +45,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("feedback", "quiz") ?>:</b></td>
|
||||
<td align="right"><b><?php print_string("feedback", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<textarea name="feedback[]" rows="2" cols="50"><?php p($feedbacktext) ?></textarea>
|
||||
</td>
|
||||
@@ -130,11 +55,7 @@
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -1,83 +1,6 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php question_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" size="50" value="<?php p($question->name) ?>" alt="<?php print_string("questionname", "quiz") ?>"/>
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<font size="1">
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
</td>
|
||||
<td align="left">
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);
|
||||
if ($usehtmleditor) {
|
||||
echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
|
||||
} else {
|
||||
echo "<div align=\"right\">";
|
||||
print_string("formattexttype");
|
||||
echo ": ";
|
||||
if (!isset($question->questiontextformat)) {
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
}
|
||||
choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
|
||||
helpbutton("textformat", get_string("helpformatting"));
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php if (empty($images)) {
|
||||
print_string("noimagesyet");
|
||||
} else {
|
||||
choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />
|
||||
|
||||
<?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyfactor", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penaltyfactor", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_question_form_start($question, array(), $course, $usehtmleditor);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("correctanswer", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
@@ -100,10 +23,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
$QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
|
||||
$QTYPES[$question->qtype]->print_question_form_end($question);
|
||||
?>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
</form>
|
||||
|
||||
@@ -1239,6 +1239,7 @@ body#message-messages {
|
||||
.que .grading,
|
||||
.que .comment,
|
||||
.que .commentlink,
|
||||
.que .commentary,
|
||||
.que .history {
|
||||
float: right;
|
||||
margin: 5px;
|
||||
|
||||
Reference in New Issue
Block a user