$string['questionnametoolong'] = 'Question name too long at line $a (255 char. max). It has been truncated.';
$string['questions'] = 'Questions';
$string['questionsperpage'] = 'Max number of questions per page';
+$string['questiontypesetupoptions'] = 'Setup options for question types:';
$string['quizavailable'] = 'The quiz is available until: $a';
$string['quizclose'] = 'Close the quiz';
$string['quizclosed'] = 'This quiz closed on $a';
+<?php
+ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
+?>
<form method="post" action="module.php" name="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
-<table cellpadding="9" cellspacing="0" >
+
+<!-- Table of config options -->
+<?php
+ $table_created = false; // used to make sure that table is only created when needed
+ $submitbutton = false;
+ // Include the options from each question type
+ foreach ($QUIZ_QTYPES as $type) {
+ $options = $type->get_config_options();
+ if ($options) {
+ // Temporary code
+ if (!$table_created) {
+ echo "<table cellpadding=\"9\" cellspacing=\"0\" align=\"center\">\n";
+ echo '<tr><th colspan="3">';
+ print_heading(get_string('questiontypesetupoptions', 'quiz'));
+ echo "</th></tr>\n";
+ $table_created = true;
+ }
+ $typename = $type->name();
+ $strtype = get_string($typename, 'quiz');
+ echo "<tr valign=\"top\">\n";
+ echo '<td colspan="3" align="center"><b>' . $strtype . "</b></td>\n";
+ echo "</tr>\n";
+ foreach ($options as $option) {
+ if (!isset($option->name)) {
+ continue;
+ }
+ echo "<tr valign=\"top\">\n";
+ if (!empty($option->link)) {
+ echo '<td colspan="3" align="center"><a href="' . s($CFG->wwwroot) . '/mod/quiz/questiontypes/' . s($typename) . '/' . s($option->link) . '?sesskey=' . s(rawurlencode($USER->sesskey)) . '">' . get_string($option->name, 'quiz') . "</a></td>\n";
+ }
+ else {
+ if (!isset($option->code)) {
+ $option->code = '';
+ }
+ echo '<td align="right"><b>';
+ print_string($option->name, 'quiz');
+ echo ":</b></td>\n";
+ echo '<td>' . $option->code . "</td>\n";
+ if (empty($option->help)) {
+ echo "<td></td>\n";
+ }
+ else {
+ echo '<td align="left">' . get_string($option->help, 'quiz') . "</td>\n";
+ }
+ $submitbutton = 'true';
+ }
+ echo "</tr>\n";
+ }
+ }
+ }
+ if ($submitbutton) {
+?>
+<tr>
+ <td colspan="3" align="center">
+ <input type="submit" value="<?php print_string("savechanges") ?>" />
+ </td>
+</tr>
+</table>
+<?php
+ }
+ if ($table_created) {
+ echo '</table>';
+ print_simple_box_end();
+ echo '<br />';
+ print_simple_box_start("center", "", "$THEME->cellheading");
+ }
+?>
+
+
+<!-- Table of default values -->
+
+<table cellpadding="9" cellspacing="0" align="center">
<tr valign="top">
<th align="right"> </th>
error('grade_response has not been implemented for question type '
.$this->name());
}
+
+ function get_config_options() {
+ // Returns an array of objects describing the options for the question type
+ // to be included on the quiz module admin page
+ //
+ // Configuration options can be included by setting the following fields in
+ // the object:
+ // ->name (The name of the option within this question type
+ // - the full option name will be constructed as
+ // "quiz_{$this->name()}_$name", the human readable name
+ // will be displayed with get_string($name, 'quiz'))
+ // ->code (The code to display the form element, help button, etc.
+ // i.e. the content for the central table cell. Be sure
+ // to name the element "quiz_{$this->name()}_$name" and
+ // set the value to $CFG->{"quiz_{$this->name()}_$name"})
+ // ->help (Name of the string from the quiz module language file
+ // to be used for the help message in the third column of
+ // the table. An empty string (or the field not set)
+ // means to leave the box empty)
+ //
+ // Links to custom settings pages can be included by setting the following
+ // fields in the object:
+ // ->name (The name of the link text string -
+ // get_string($name, 'quiz') will be called)
+ // ->link (The filename part of the URL for the link
+ // - the full URL is contructed as
+ // "$CFG->wwwroot/mod/quiz/questiontypes/{$this->name()}/$link?sesskey=$sesskey"
+ // [but with the relavant calls to the s and rawurlencode
+ // functions] where $sesskey is the sesskey for the user)
+
+ // No options by default
+ return false;
+ }
}
quiz_load_questiontypes();