mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-7010 Convert mod\quiz\config.html to mod/quiz/settingstree.php using the new admin tree system.
This commit is contained in:
parent
5261baf11e
commit
e2249afe2b
@ -29,10 +29,6 @@ if ($hassiteconfig) {
|
||||
include($CFG->dirroot.'/mod/'.$modulename.'/settings.php');
|
||||
}
|
||||
$ADMIN->add('modsettings', $settings);
|
||||
} else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/config.html')) {
|
||||
//TODO this branch should be deleted as soon as quiz/config.html has been
|
||||
//migrated to settings.php
|
||||
$ADMIN->add('modsettings', new admin_externalpage('modsetting'.$modulename, $strmodulename, "$CFG->wwwroot/$CFG->admin/module.php?module=$modulename", 'moodle/site:config', !$module->visible));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,24 @@ $string['comment'] = 'Comment';
|
||||
$string['commentorgrade'] = 'Make comment or override grade';
|
||||
$string['comments'] = 'Comments';
|
||||
$string['completedon'] = 'Completed on';
|
||||
$string['configintro'] = 'The values you set here define the default values that are used in the settings form when you create a new quiz. You can also configure which quiz settings are considered advanced.';
|
||||
$string['configadaptive'] = 'If you choose Yes for this option then the student will be allowed multiple responses to a question even within the same attempt at the quiz.';
|
||||
$string['configattemptsallowed'] = 'Restriction on the number of attempts students are allowed at the quiz.';
|
||||
$string['configdecimaldigits'] = 'Number of digits that should be shown after the decimal point when displaying grades.';
|
||||
$string['configdelay1'] = 'If you set a time delay, then a student has to wait for that time before they can attempt a quiz after the first attempt.';
|
||||
$string['configdelay2'] = 'If you set a time delay here, then a student has to wait for that time before they can attempt their third or later attempts.';
|
||||
$string['configeachattemptbuildsonthelast'] = 'If multiple attempts are allowed then each new attempt contains the results of the previous attempt.';
|
||||
$string['configgrademethod'] = 'When multiple attempts are allowed, which method should be used to calculate the student\'s final grade for the quiz.';
|
||||
$string['configmaximumgrade'] = 'The default grade that the quiz grade is scaled to be out of.';
|
||||
$string['confignewpageevery'] = 'When adding questions to the quiz page breaks will automatically be inserted according to the setting you choose here.';
|
||||
$string['configpenaltyscheme'] = 'Penalty subtracted for each wrong response in adaptive mode.';
|
||||
$string['configpopup'] = 'Use JavaScript tricks to try to restrict copy and paste, etc. during quiz attempts.';
|
||||
$string['configrequirepassword'] = 'Students must enter this password before they can attempt the quiz.';
|
||||
$string['configrequiresubnet'] = 'Students can only attempt the quiz from these computers.';
|
||||
$string['configreviewoptions'] = 'These options control what information users can see when they review a quiz attempt or look at the quiz reports.';
|
||||
$string['configshufflequestions'] = 'If you enable this option, then the order of questions in the quiz will be randomly shuffled each time a student attempts the quiz.';
|
||||
$string['configshufflewithin'] = 'If you enable this option, then the parts making up the individual questions will be randomly shuffled each time a student starts an attempt at this quiz, provided the option is also enabled in the question settings.';
|
||||
$string['configtimelimit'] = 'Default time limit for quizzes in minutes. 0 mean no time limit.';
|
||||
$string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.';
|
||||
$string['confirmserverdelete'] = 'Are you sure you want to remove the server <b>$a</b> from the list?';
|
||||
$string['confirmstartattemptlimit'] = 'This quiz is limited to $a attempt(s). You are about to start a new attempt. Do you wish to proceed?';
|
||||
@ -232,6 +250,7 @@ $string['event6'] = 'Close&Grade';
|
||||
$string['event7'] = 'Submit';
|
||||
$string['event8'] = 'Close';
|
||||
$string['event9'] = 'Manual Grade';
|
||||
$string['everythingon'] = 'Everything on';
|
||||
$string['examview'] = 'Examview';
|
||||
$string['export'] = 'Export';
|
||||
$string['exporterror'] = 'An error occurred during export processing';
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
$string['analysis'] = 'Item analysis';
|
||||
$string['analysisreport'] = 'Item analysis report';
|
||||
$string['analysisdownload'] = 'Analysis download';
|
||||
$string['analysisoptions'] = 'Analysis options';
|
||||
$string['analysistitle'] = 'Item Analysis Table';
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
$string['essayonly'] = 'The following questions need to be graded manually';
|
||||
$string['grading'] = 'Manual grading';
|
||||
$string['gradingreport'] = 'Manual grading report';
|
||||
$string['gradeall'] = 'Grade all $a attempts';
|
||||
$string['graded'] = '(graded)';
|
||||
$string['gradeungraded'] = 'Grade all $a ungraded attempts';
|
||||
|
@ -25,6 +25,7 @@ $string['optnoattemptsonly'] = '$a who have not attempted the quiz';
|
||||
$string['optonlygradedattempts'] = 'that are graded for each user ($a)';
|
||||
$string['optonlyregradedattempts'] = 'that have been regraded / are marked as needing regrading';
|
||||
$string['overview'] = 'Grades';
|
||||
$string['overviewreport'] = 'Grades report';
|
||||
$string['overviewdownload'] = 'Overview download';
|
||||
$string['overviewdownload'] = 'Overview download';
|
||||
$string['overviewreportgraph'] = 'Overall Number of Students Achieving Grade Ranges';
|
||||
|
@ -5,5 +5,6 @@ $string['responsestitle'] = 'Detailed responses';
|
||||
$string['pagesize'] = 'Page Size';
|
||||
$string['reportresponses'] = 'Responses';
|
||||
$string['responses'] = 'Responses';
|
||||
$string['responses report'] = 'Responses report';
|
||||
$string['responsesdownload'] = 'Responses download';
|
||||
?>
|
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
$string['statistics'] = 'Statistics';
|
||||
$string['statisticsreport'] = 'Statistics report';
|
||||
$string['calculatefrom'] = 'Calculate statistics from';
|
||||
|
||||
|
||||
|
298
lib/adminlib.php
298
lib/adminlib.php
@ -2557,11 +2557,50 @@ class admin_setting_configselect extends admin_setting {
|
||||
return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
|
||||
}
|
||||
|
||||
function output_html($data, $query='') {
|
||||
/**
|
||||
* Ensure the options are loaded, and generate the HTML for the select
|
||||
* element and any warning message. Separating this out from output_html
|
||||
* makes it easier to subclass this class.
|
||||
*
|
||||
* @param string $data the option to show as selected.
|
||||
* @param string $current the currently selected option in the database, null if none.
|
||||
* @param string $default the default selected option.
|
||||
* @return array the HTML for the select element, and a warning message.
|
||||
*/
|
||||
function output_select_html($data, $current, $default, $extraname = '') {
|
||||
if (!$this->load_choices() or empty($this->choices)) {
|
||||
return array('', '');
|
||||
}
|
||||
|
||||
$warning = '';
|
||||
if (is_null($current)) {
|
||||
// first run
|
||||
} else if (empty($current) and (array_key_exists('', $this->choices) or array_key_exists(0, $this->choices))) {
|
||||
// no warning
|
||||
} else if (!array_key_exists($current, $this->choices)) {
|
||||
$warning = get_string('warningcurrentsetting', 'admin', s($current));
|
||||
if (!is_null($default) and $data == $current) {
|
||||
$data = $default; // use default instead of first value when showing the form
|
||||
}
|
||||
}
|
||||
|
||||
$selecthtml = '<select id="'.$this->get_id().'" name="'.$this->get_full_name().$extraname.'">';
|
||||
foreach ($this->choices as $key => $value) {
|
||||
// the string cast is needed because key may be integer - 0 is equal to most strings!
|
||||
$selecthtml .= '<option value="'.$key.'"'.((string)$key==$data ? ' selected="selected"' : '').'>'.$value.'</option>';
|
||||
}
|
||||
$selecthtml .= '</select>';
|
||||
return array($selecthtml, $warning);
|
||||
}
|
||||
|
||||
function output_html($data, $query='') {
|
||||
$default = $this->get_defaultsetting();
|
||||
$current = $this->get_setting();
|
||||
|
||||
list($selecthtml, $warning) = $this->output_select_html($data, $current, $default);
|
||||
if (!$selecthtml) {
|
||||
return '';
|
||||
}
|
||||
$default = $this->get_defaultsetting();
|
||||
|
||||
if (!is_null($default) and array_key_exists($default, $this->choices)) {
|
||||
$defaultinfo = $this->choices[$default];
|
||||
@ -2569,29 +2608,10 @@ class admin_setting_configselect extends admin_setting {
|
||||
$defaultinfo = NULL;
|
||||
}
|
||||
|
||||
$current = $this->get_setting();
|
||||
$warning = '';
|
||||
if (is_null($current)) {
|
||||
//first run
|
||||
} else if (empty($current) and (array_key_exists('', $this->choices) or array_key_exists(0, $this->choices))) {
|
||||
// no warning
|
||||
} else if (!array_key_exists($current, $this->choices)) {
|
||||
$warning = get_string('warningcurrentsetting', 'admin', s($current));
|
||||
if (!is_null($default) and $data==$current) {
|
||||
$data = $default; // use default instead of first value when showing the form
|
||||
}
|
||||
}
|
||||
|
||||
$return = '<div class="form-select defaultsnext"><select id="'.$this->get_id().'" name="'.$this->get_full_name().'">';
|
||||
foreach ($this->choices as $key => $value) {
|
||||
// the string cast is needed because key may be integer - 0 is equal to most strings!
|
||||
$return .= '<option value="'.$key.'"'.((string)$key==$data ? ' selected="selected"' : '').'>'.$value.'</option>';
|
||||
}
|
||||
$return .= '</select></div>';
|
||||
$return = '<div class="form-select defaultsnext">' . $selecthtml . '</div>';
|
||||
|
||||
return format_admin_setting($this, $this->visiblename, $return, $this->description, true, $warning, $defaultinfo, $query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3629,6 +3649,240 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Text field linked to config_plugins for the quiz, with an advanced checkbox.
|
||||
*/
|
||||
class admin_setting_quiz_text extends admin_setting_configtext {
|
||||
function __construct($name, $visiblename, $description, $defaultsetting, $paramtype) {
|
||||
$this->plugin = 'quiz';
|
||||
parent::admin_setting_configtext($name, $visiblename, $description,
|
||||
$defaultsetting, $paramtype);
|
||||
}
|
||||
|
||||
function get_setting() {
|
||||
$value = parent::get_setting();
|
||||
$fix = $this->config_read('fix_' . $this->name);
|
||||
if (is_null($value) or is_null($fix)) {
|
||||
return NULL;
|
||||
}
|
||||
return array('value' => $value, 'fix' => $fix);
|
||||
}
|
||||
|
||||
function write_setting($data) {
|
||||
$error = parent::write_setting($data['value']);
|
||||
if (!$error) {
|
||||
if (empty($data['fix'])) {
|
||||
$ok = $this->config_write('fix_' . $this->name, 0);
|
||||
} else {
|
||||
$ok = $this->config_write('fix_' . $this->name, 1);
|
||||
}
|
||||
if (!$ok) {
|
||||
$error = get_string('errorsetting', 'admin');
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
function output_html($data, $query='') {
|
||||
$default = $this->get_defaultsetting();
|
||||
$defaultinfo = array();
|
||||
if (isset($this->choices[$default['value']])) {
|
||||
$defaultinfo[] = $default['value'];
|
||||
}
|
||||
if (!empty($default['fix'])) {
|
||||
$defaultinfo[] = get_string('advanced');
|
||||
}
|
||||
$defaultinfo = implode(', ', $defaultinfo);
|
||||
|
||||
$fix = !empty($data['fix']);
|
||||
$return = '<div class="form-text defaultsnext">' .
|
||||
'<input type="text" size="' . $this->size . '" id="' . $this->get_id() .
|
||||
'" name="' . $this->get_full_name() . '[value]" value="' . s($data['value']) . '" />' .
|
||||
' <input type="checkbox" class="form-checkbox" id="' .
|
||||
$this->get_id() . '_fix" name="' . $this->get_full_name() .
|
||||
'[fix]" value="1" ' . ($fix ? 'checked="checked"' : '') . ' />' .
|
||||
' <label for="' . $this->get_id() . '_fix">' .
|
||||
get_string('advanced') . '</label></div>';
|
||||
|
||||
return format_admin_setting($this, $this->visiblename, $return,
|
||||
$this->description, true, '', $defaultinfo, $query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dropdown menu linked to config_plugins for the quiz, with an advanced checkbox.
|
||||
*/
|
||||
class admin_setting_quiz_combo extends admin_setting_configselect {
|
||||
function __construct($name, $visiblename, $description, $defaultsetting, $choices) {
|
||||
$this->plugin = 'quiz';
|
||||
parent::admin_setting_configselect($name, $visiblename, $description,
|
||||
$defaultsetting, $choices);
|
||||
}
|
||||
|
||||
function get_setting() {
|
||||
$value = parent::get_setting();
|
||||
$fix = $this->config_read('fix_' . $this->name);
|
||||
if (is_null($value) or is_null($fix)) {
|
||||
return NULL;
|
||||
}
|
||||
return array('value' => $value, 'fix' => $fix);
|
||||
}
|
||||
|
||||
function write_setting($data) {
|
||||
$error = parent::write_setting($data['value']);
|
||||
if (!$error) {
|
||||
if (empty($data['fix'])) {
|
||||
$ok = $this->config_write('fix_' . $this->name, 0);
|
||||
} else {
|
||||
$ok = $this->config_write('fix_' . $this->name, 1);
|
||||
}
|
||||
if (!$ok) {
|
||||
$error = get_string('errorsetting', 'admin');
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
function output_html($data, $query='') {
|
||||
$default = $this->get_defaultsetting();
|
||||
$current = $this->get_setting();
|
||||
|
||||
list($selecthtml, $warning) = $this->output_select_html($data['value'],
|
||||
$current['value'], $default['value'], '[value]');
|
||||
if (!$selecthtml) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!is_null($default) and array_key_exists($default['value'], $this->choices)) {
|
||||
$defaultinfo = array();
|
||||
if (isset($this->choices[$default['value']])) {
|
||||
$defaultinfo[] = $this->choices[$default['value']];
|
||||
}
|
||||
if (!empty($default['fix'])) {
|
||||
$defaultinfo[] = get_string('advanced');
|
||||
}
|
||||
$defaultinfo = implode(', ', $defaultinfo);
|
||||
} else {
|
||||
$defaultinfo = '';
|
||||
}
|
||||
|
||||
$fix = !empty($data['fix']);
|
||||
$return = '<div class="form-select defaultsnext">' . $selecthtml .
|
||||
' <input type="checkbox" class="form-checkbox" id="' .
|
||||
$this->get_id() . '_fix" name="' . $this->get_full_name() .
|
||||
'[fix]" value="1" ' . ($fix ? 'checked="checked"' : '') . ' />' .
|
||||
' <label for="' . $this->get_id() . '_fix">' .
|
||||
get_string('advanced') . '</label></div>';
|
||||
|
||||
return format_admin_setting($this, $this->visiblename, $return, $this->description, true, $warning, $defaultinfo, $query);
|
||||
}
|
||||
}
|
||||
|
||||
class admin_setting_quiz_reviewoptions extends admin_setting {
|
||||
private static $times = array(
|
||||
QUIZ_REVIEW_IMMEDIATELY => 'reviewimmediately',
|
||||
QUIZ_REVIEW_OPEN => 'reviewopen',
|
||||
QUIZ_REVIEW_CLOSED => 'reviewclosed');
|
||||
private static $things = array(
|
||||
QUIZ_REVIEW_RESPONSES => 'responses',
|
||||
QUIZ_REVIEW_ANSWERS => 'answers',
|
||||
QUIZ_REVIEW_FEEDBACK => 'feedback',
|
||||
QUIZ_REVIEW_GENERALFEEDBACK => 'generalfeedback',
|
||||
QUIZ_REVIEW_SCORES => 'scores',
|
||||
QUIZ_REVIEW_OVERALLFEEDBACK => 'overallfeedback');
|
||||
|
||||
function __construct($name, $visiblename, $description, $defaultsetting) {
|
||||
$this->plugin = 'quiz';
|
||||
parent::admin_setting($name, $visiblename, $description, $defaultsetting);
|
||||
}
|
||||
|
||||
private function normalise_data($data) {
|
||||
$value = 0;
|
||||
foreach (admin_setting_quiz_reviewoptions::$times as $timemask => $timestring) {
|
||||
foreach (admin_setting_quiz_reviewoptions::$things as $thingmask => $thingstring) {
|
||||
if (!empty($data[$timemask][$thingmask])) {
|
||||
$value += $timemask & $thingmask;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
function get_setting() {
|
||||
$value = $this->config_read($this->name);
|
||||
$fix = $this->config_read('fix_' . $this->name);
|
||||
if (is_null($value) or is_null($fix)) {
|
||||
return NULL;
|
||||
}
|
||||
return array('value' => $value, 'fix' => $fix);
|
||||
}
|
||||
|
||||
function write_setting($data) {
|
||||
if (!isset($data['value'])) {
|
||||
$data['value'] = $this->normalise_data($data);
|
||||
}
|
||||
$ok = $this->config_write($this->name, $data['value']);
|
||||
if ($ok) {
|
||||
if (empty($data['fix'])) {
|
||||
$ok = $this->config_write('fix_' . $this->name, 0);
|
||||
} else {
|
||||
$ok = $this->config_write('fix_' . $this->name, 1);
|
||||
}
|
||||
}
|
||||
if (!$ok) {
|
||||
return get_string('errorsetting', 'admin');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function output_html($data, $query='') {
|
||||
if (!isset($data['value'])) {
|
||||
$data['value'] = $this->normalise_data($data);
|
||||
}
|
||||
|
||||
$return = '<div id="adminquizreviewoptions" class="clearfix">' . "\n";
|
||||
foreach (admin_setting_quiz_reviewoptions::$times as $timemask => $timestring) {
|
||||
$return .= '<div class="group"><div class="fitemtitle">' . get_string($timestring, 'quiz') . "</div>\n";
|
||||
$nameprefix = $this->get_full_name() . '[' . $timemask . ']';
|
||||
$idprefix = $this->get_id(). '_' . $timemask . '_';
|
||||
foreach (admin_setting_quiz_reviewoptions::$things as $thingmask => $thingstring) {
|
||||
$id = $idprefix . $thingmask;
|
||||
$state = '';
|
||||
if ($data['value'] & $timemask & $thingmask) {
|
||||
$state = 'checked="checked" ';
|
||||
}
|
||||
$return .= '<span><input type="checkbox" name="' .
|
||||
$nameprefix . '[' . $thingmask . ']" value="1" id="' . $id .
|
||||
'" ' . $state . '/> <label for="' . $id . '">' .
|
||||
get_string($thingstring, 'quiz') . "</label></span>\n";
|
||||
}
|
||||
$return .= "</div>\n";
|
||||
}
|
||||
$return .= "</div>\n";
|
||||
|
||||
$fix = !empty($data['fix']);
|
||||
$return .= '<input type="checkbox" class="form-checkbox" id="' .
|
||||
$this->get_id() . '_fix" name="' . $this->get_full_name() .
|
||||
'[fix]" value="1" ' . ($fix ? 'checked="checked"' : '') . ' />' .
|
||||
' <label for="' . $this->get_id() . '_fix">' .
|
||||
get_string('advanced') . '</label> ';
|
||||
|
||||
return format_admin_setting($this, $this->visiblename, $return,
|
||||
$this->description, true, '', get_string('everythingon', 'quiz'), $query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialisation of admin_setting_quiz_combo for easy yes/no choices.
|
||||
*/
|
||||
class admin_setting_quiz_yesno extends admin_setting_quiz_combo {
|
||||
function __construct($name, $visiblename, $description, $defaultsetting) {
|
||||
$this->plugin = 'quiz';
|
||||
parent::__construct($name, $visiblename, $description,
|
||||
$defaultsetting, array(get_string('no'), get_string('yes')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Graded roles in gradebook
|
||||
*/
|
||||
|
@ -1,391 +0,0 @@
|
||||
<?php // $Id$
|
||||
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
|
||||
|
||||
if (!isset($form->timeopen)) {
|
||||
$form->timeopen = "";
|
||||
}
|
||||
if (!isset($form->timeclose)) {
|
||||
$form->timeclose = "";
|
||||
}
|
||||
if (!isset($form->attempts)) {
|
||||
$form->attempts = $CFG->quiz_attempts;
|
||||
}
|
||||
if (!isset($form->attemptonlast)) {
|
||||
$form->attemptonlast = $CFG->quiz_attemptonlast;
|
||||
}
|
||||
if (!isset($form->grademethod)) {
|
||||
$form->grademethod = $CFG->quiz_grademethod;
|
||||
}
|
||||
if (!isset($form->decimalpoints)) {
|
||||
$form->decimalpoints = $CFG->quiz_decimalpoints;
|
||||
}
|
||||
if (!isset($form->review)) {
|
||||
$form->review = $CFG->quiz_review;
|
||||
}
|
||||
if (!isset($form->questionsperpage)) {
|
||||
$form->questionsperpage = $CFG->quiz_questionsperpage;
|
||||
}
|
||||
if (!isset($form->shufflequestions)) {
|
||||
$form->shufflequestions = $CFG->quiz_shufflequestions;
|
||||
}
|
||||
if (!isset($form->shuffleanswers)) {
|
||||
$form->shuffleanswers = $CFG->quiz_shuffleanswers;
|
||||
}
|
||||
if (!isset($form->grade)) {
|
||||
$form->grade = $CFG->quiz_maximumgrade;
|
||||
}
|
||||
if (!isset($form->questions)) {
|
||||
$form->questions = "";
|
||||
}
|
||||
if (!isset($form->password)) {
|
||||
$form->quizpassword = $CFG->quiz_password;
|
||||
}
|
||||
if (!isset($form->subnet)) {
|
||||
$form->subnet = $CFG->quiz_subnet;
|
||||
}
|
||||
if (!isset($form->timelimit)) {
|
||||
$form->timelimit = $CFG->quiz_timelimit;
|
||||
}
|
||||
if (!isset($form->popup)) {
|
||||
$form->popup = $CFG->quiz_popup;
|
||||
}
|
||||
if (!isset($form->optionflags)) {
|
||||
$form->optionflags = $CFG->quiz_optionflags;
|
||||
}
|
||||
if (!isset($form->penaltyscheme)) {
|
||||
$form->penaltyscheme = $CFG->quiz_penaltyscheme;
|
||||
}
|
||||
if (!isset($form->maximumgrade)) {
|
||||
$form->maximumgrade = $CFG->quiz_maximumgrade;
|
||||
}
|
||||
//enforced delay attempt between quiz
|
||||
if (!isset($form->delay1)) {
|
||||
$form->delay1 = $CFG->quiz_delay1;
|
||||
}
|
||||
if (!isset($form->delay2)) {
|
||||
$form->delay2 = $CFG->quiz_delay2;
|
||||
}
|
||||
//enforced time delay between quiz attempts add-on
|
||||
$timedelayoptions = array();
|
||||
$timedelayoptions[0] = get_string('none');
|
||||
$timedelayoptions[1800] = get_string('numminutes', '', 30);
|
||||
$timedelayoptions[3600] = get_string('numminutes', '', 60);
|
||||
for($i=2; $i<=23; $i++) {
|
||||
$seconds = $i*3600;
|
||||
$timedelayoptions[$seconds] = get_string('numhours', '', $i);
|
||||
}
|
||||
$timedelayoptions[86400] = get_string('numhours', '', 24);
|
||||
for($i=2; $i<=7; $i++) {
|
||||
$seconds = $i*86400;
|
||||
$timedelayoptions[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var timelimititems = ['timelimit'];
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<form method="post" action="module.php" id="form">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
|
||||
<!-- Table of default values -->
|
||||
|
||||
<?php
|
||||
// the following are used for drop-down menus
|
||||
|
||||
$yesnooptions = array();
|
||||
$yesnooptions[0] = get_string("no");
|
||||
$yesnooptions[1] = get_string("yes");
|
||||
|
||||
$attemptoptions = array();
|
||||
$attemptoptions[0] = get_string("attemptsunlimited", "quiz");
|
||||
$attemptoptions[1] = "1 ".moodle_strtolower(get_string("attempt", "quiz"));
|
||||
for ($i=2;$i<=6;$i++) {
|
||||
$attemptoptions[$i] = "$i ".moodle_strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table cellpadding="9" cellspacing="0">
|
||||
|
||||
<tr valign="top">
|
||||
<th align="right" scope="col"> </th>
|
||||
<th align="left" scope="col">
|
||||
<?php print_string('sitedefault'); ?>
|
||||
</th>
|
||||
<th align="center" scope="col">
|
||||
<?php print_string('advancedsettings'); helpbutton('advancedsettings', get_string('advancedsettings')); ?>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("timelimit", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input name="timelimitenable" type="checkbox" value="1" alt="<?php print_string('timelimit', 'quiz') ?>" onclick="return lockoptions('form', 'timelimitenable', timelimititems)" <?php if ($form->timelimit) echo 'checked="checked"' ?> />
|
||||
<input type="text" name="timelimit" size="3" value="<?php p($form->timelimit ? $form->timelimit : '') ?>" />
|
||||
<?php
|
||||
print_string('minutes');
|
||||
helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz");
|
||||
?>
|
||||
<input type="hidden" name="htimelimit" value="0" />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_timelimit" value="0" />
|
||||
<input type="checkbox" name="fix_timelimit" value="1" <?php echo $CFG->quiz_fix_timelimit ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string('newpageevery', 'quiz') ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
$perpage = array();
|
||||
$perpage[0] = get_string('never');
|
||||
$perpage[1] = get_string('aftereachquestion', 'quiz');
|
||||
for ($i = 2; $i <= 50; ++$i) {
|
||||
$perpage[$i] = get_string('afternquestions', 'quiz', $i);
|
||||
}
|
||||
|
||||
choose_from_menu($perpage, 'questionsperpage', $form->questionsperpage, '');
|
||||
helpbutton('questionsperpage', get_string('newpageevery', 'quiz'), 'quiz');
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_questionsperpage" value="0" />
|
||||
<input type="checkbox" name="fix_questionsperpage" value="1" <?php echo $CFG->quiz_fix_questionsperpage ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("shufflequestions", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu ($yesnooptions, "shufflequestions", $form->shufflequestions, "", "", "");
|
||||
helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_shufflequestions" value="0" />
|
||||
<input type="checkbox" name="fix_shufflequestions" value="1" <?php echo $CFG->quiz_fix_shufflequestions ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("shufflewithin", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu ($yesnooptions, "shuffleanswers", $form->shuffleanswers, "", "", "");
|
||||
helpbutton("shufflewithin", get_string("shufflewithin","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_shuffleanswers" value="0" />
|
||||
<input type="checkbox" name="fix_shuffleanswers" value="1" <?php echo $CFG->quiz_fix_shuffleanswers ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("attemptsallowed", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("attemptsunlimited", "quiz");
|
||||
$options[1] = "1 ".strtolower(get_string("attempt", "quiz"));
|
||||
for ($i=2;$i<=6;$i++) {
|
||||
$options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
choose_from_menu ($options, "attempts", $form->attempts, "", "", "");
|
||||
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_attempts" value="0" />
|
||||
<input type="checkbox" name="fix_attempts" value="1" <?php echo $CFG->quiz_fix_attempts ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("eachattemptbuildsonthelast", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu ($yesnooptions, "attemptonlast", $form->attemptonlast, "", "", "");
|
||||
helpbutton("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_attemptonlast" value="0" />
|
||||
<input type="checkbox" name="fix_attemptonlast" value="1" <?php echo $CFG->quiz_fix_attemptonlast ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("grademethod", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu (quiz_get_grading_options(), "grademethod", $form->grademethod, "", "", "");
|
||||
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_grademethod" value="0" />
|
||||
<input type="checkbox" name="fix_grademethod" value="1" <?php echo $CFG->quiz_fix_grademethod ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("adaptive", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "adaptive", ($CFG->quiz_optionflags & QUESTION_ADAPTIVE) ? 1 : 0, "");
|
||||
helpbutton("adaptive", get_string("adaptive","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_adaptive" value="0" />
|
||||
<input type="checkbox" name="fix_adaptive" value="1" <?php echo $CFG->quiz_fix_adaptive ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_penaltyscheme" value="0" />
|
||||
<input type="checkbox" name="fix_penaltyscheme" value="1" <?php echo $CFG->quiz_fix_penaltyscheme ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("decimaldigits", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = '0';
|
||||
$options[1] = '1';
|
||||
$options[2] = '2';
|
||||
$options[3] = '3';
|
||||
choose_from_menu ($options, "decimalpoints", $form->decimalpoints, "", "", "");
|
||||
helpbutton("decimalpoints", get_string("decimaldigits","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_decimalpoints" value="0" />
|
||||
<input type="checkbox" name="fix_decimalpoints" value="1" <?php echo $CFG->quiz_fix_decimalpoints ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<?php include($CFG->dirroot . '/mod/quiz/reviewoptions.html'); ?>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_review" value="0" />
|
||||
<input type="checkbox" name="fix_review" value="1" <?php echo $CFG->quiz_fix_review ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("popup", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu ($yesnooptions, "popup", $form->popup, "", "", "");
|
||||
helpbutton("popup", get_string("popup","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_popup" value="0" />
|
||||
<input type="checkbox" name="fix_popup" value="1" <?php echo $CFG->quiz_fix_popup ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string('delay1', 'quiz') ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
choose_from_menu($timedelayoptions, 'delay1', $form->delay1, "", "", "" );
|
||||
helpbutton('timedelay1', get_string('delay1','quiz'), 'quiz');
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_delay1" value="0" />
|
||||
<input type="checkbox" name="fix_delay1" value="1" <?php echo $CFG->quiz_fix_delay1 ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string('delay2', 'quiz') ?>:</b></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
choose_from_menu($timedelayoptions, 'delay2', $form->delay2, "", "", "");
|
||||
helpbutton('timedelay2', get_string('delay2','quiz'), 'quiz');
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_delay2" value="0" />
|
||||
<input type="checkbox" name="fix_delay2" value="1" <?php echo $CFG->quiz_fix_delay2 ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("requirepassword", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="quizpassword" size="20" value="<?php p($form->quizpassword) ?>" />
|
||||
<?php helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_password" value="0" />
|
||||
<input type="checkbox" name="fix_password" value="1" <?php echo $CFG->quiz_fix_password ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("requiresubnet", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="subnet" size="20" value="<?php p($form->subnet) ?>" />
|
||||
<?php helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="hidden" name="fix_subnet" value="0" />
|
||||
<input type="checkbox" name="fix_subnet" value="1" <?php echo $CFG->quiz_fix_subnet ? 'checked="checked"' : ''; ?> />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
unset($grades);
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
$grades[0] = get_string("nograde");
|
||||
choose_from_menu ($grades, "maximumgrade", $form->maximumgrade, "", "", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input type="hidden" name="module" value="quiz" />
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if (!$form->timelimit) echo "lockoptions('form','timelimitenable', timelimititems);";
|
||||
?>
|
||||
</script>
|
@ -170,6 +170,22 @@ function xmldb_quiz_upgrade($oldversion) {
|
||||
upgrade_mod_savepoint($result, 2008081507, 'quiz');
|
||||
}
|
||||
|
||||
/// Move all of the quiz config settings from $CFG to the config_plugins table.
|
||||
if ($result && $oldversion < 2008082200) {
|
||||
foreach (get_object_vars($CFG) as $name => $value) {
|
||||
if (strpos($name, 'quiz_') === 0) {
|
||||
$shortname = substr($name, 5);
|
||||
if ($shortname == 'fix_adaptive') {
|
||||
// Special case - remove old inconsistency.
|
||||
$shortname == 'fix_optionflags';
|
||||
}
|
||||
$result = $result && set_config($shortname, $value, 'quiz');
|
||||
$result = $result && unset_config($name);
|
||||
}
|
||||
}
|
||||
upgrade_mod_savepoint($result, 2008082200, 'quiz');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -3,42 +3,42 @@
|
||||
// This file is generally only included from upgrade_activity_modules()
|
||||
// It defines default values for any important configuration variables
|
||||
|
||||
$defaults = array (
|
||||
'quiz_review' => 0xffffff,
|
||||
'quiz_attemptonlast' => 0,
|
||||
'quiz_attempts' => 0,
|
||||
'quiz_grademethod' => '',
|
||||
'quiz_decimalpoints' => 2,
|
||||
'quiz_maximumgrade' => 10,
|
||||
'quiz_password' => '',
|
||||
'quiz_popup' => 0,
|
||||
'quiz_questionsperpage' => 0,
|
||||
'quiz_shuffleanswers' => 1,
|
||||
'quiz_shufflequestions' => 0,
|
||||
'quiz_subnet' => '',
|
||||
'quiz_timelimit' => 0,
|
||||
'quiz_optionflags' => 1,
|
||||
'quiz_penaltyscheme' => 1,
|
||||
'quiz_delay1' => 0,
|
||||
'quiz_delay2' => 0,
|
||||
$defaults = array (
|
||||
'_use_config_plugins' => true,
|
||||
|
||||
'quiz_fix_review' => 0,
|
||||
'quiz_fix_attemptonlast' => 0,
|
||||
'quiz_fix_attempts' => 0,
|
||||
'quiz_fix_grademethod' => 0,
|
||||
'quiz_fix_decimalpoints' => 0,
|
||||
'quiz_fix_password' => 0,
|
||||
'quiz_fix_popup' => 0,
|
||||
'quiz_fix_questionsperpage' => 0,
|
||||
'quiz_fix_shuffleanswers' => 0,
|
||||
'quiz_fix_shufflequestions' => 0,
|
||||
'quiz_fix_subnet' => 0,
|
||||
'quiz_fix_timelimit' => 0,
|
||||
'quiz_fix_adaptive' => 0,
|
||||
'quiz_fix_penaltyscheme' => 0,
|
||||
'quiz_fix_delay1' => 0,
|
||||
'quiz_fix_delay2' => 0,
|
||||
'review' => 0x3fffffff,
|
||||
'attemptonlast' => 0,
|
||||
'attempts' => 0,
|
||||
'grademethod' => QUIZ_GRADEHIGHEST,
|
||||
'decimalpoints' => 2,
|
||||
'maximumgrade' => 10,
|
||||
'password' => '',
|
||||
'popup' => 0,
|
||||
'questionsperpage' => 0,
|
||||
'shuffleanswers' => 1,
|
||||
'shufflequestions' => 0,
|
||||
'subnet' => '',
|
||||
'timelimit' => 0,
|
||||
'optionflags' => 1,
|
||||
'penaltyscheme' => 1,
|
||||
'delay1' => 0,
|
||||
'delay2' => 0,
|
||||
|
||||
'fix_review' => 0,
|
||||
'fix_attemptonlast' => 0,
|
||||
'fix_attempts' => 0,
|
||||
'fix_grademethod' => 0,
|
||||
'fix_decimalpoints' => 0,
|
||||
'fix_password' => 0,
|
||||
'fix_popup' => 0,
|
||||
'fix_questionsperpage' => 0,
|
||||
'fix_shuffleanswers' => 0,
|
||||
'fix_shufflequestions' => 0,
|
||||
'fix_subnet' => 0,
|
||||
'fix_timelimit' => 0,
|
||||
'fix_optionflags' => 0,
|
||||
'fix_penaltyscheme' => 0,
|
||||
'fix_delay1' => 0,
|
||||
'fix_delay2' => 0,
|
||||
);
|
||||
|
||||
?>
|
||||
|
@ -94,7 +94,7 @@
|
||||
if ($quiz_showbreaks > -1) {
|
||||
$thispageurl->param('showbreaks', $quiz_showbreaks);
|
||||
} else {
|
||||
$quiz_showbreaks = ($CFG->quiz_questionsperpage < 2) ? 0 : 1;
|
||||
$quiz_showbreaks = get_config('quiz', 'questionsperpage') > 1;
|
||||
}
|
||||
if ($quiz_reordertool != 0) {
|
||||
$thispageurl->param('reordertool', $quiz_reordertool);
|
||||
|
@ -15,6 +15,16 @@ require_once($CFG->libdir.'/eventslib.php');
|
||||
|
||||
/// CONSTANTS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
/**#@+
|
||||
* Options determining how the grades from individual attempts are combined to give
|
||||
* the overall grade for a user
|
||||
*/
|
||||
define("QUIZ_GRADEHIGHEST", "1");
|
||||
define("QUIZ_GRADEAVERAGE", "2");
|
||||
define("QUIZ_ATTEMPTFIRST", "3");
|
||||
define("QUIZ_ATTEMPTLAST", "4");
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* The different review options are stored in the bits of $quiz->review
|
||||
* These constants help to extract the options
|
||||
@ -459,6 +469,16 @@ function quiz_grade_item_delete($quiz) {
|
||||
return grade_update('mod/quiz', $quiz->course, 'mod', 'quiz', $quiz->id, 0, NULL, array('deleted'=>1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the options for calculating the quiz grade from the individual attempt grades.
|
||||
*/
|
||||
function quiz_get_grading_options() {
|
||||
return array (
|
||||
QUIZ_GRADEHIGHEST => get_string('gradehighest', 'quiz'),
|
||||
QUIZ_GRADEAVERAGE => get_string('gradeaverage', 'quiz'),
|
||||
QUIZ_ATTEMPTFIRST => get_string('attemptfirst', 'quiz'),
|
||||
QUIZ_ATTEMPTLAST => get_string('attemptlast', 'quiz'));
|
||||
}
|
||||
|
||||
function quiz_get_participants($quizid) {
|
||||
/// Returns an array of users who have data in a given quiz
|
||||
|
@ -31,16 +31,6 @@ require_once($CFG->libdir . '/eventslib.php');
|
||||
|
||||
/// Constants ///////////////////////////////////////////////////////////////////
|
||||
|
||||
/**#@+
|
||||
* Options determining how the grades from individual attempts are combined to give
|
||||
* the overall grade for a user
|
||||
*/
|
||||
define("QUIZ_GRADEHIGHEST", "1");
|
||||
define("QUIZ_GRADEAVERAGE", "2");
|
||||
define("QUIZ_ATTEMPTFIRST", "3");
|
||||
define("QUIZ_ATTEMPTLAST", "4");
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* Constants to describe the various states a quiz attempt can be in.
|
||||
*/
|
||||
@ -649,17 +639,6 @@ function quiz_calculate_best_attempt($quiz, $attempts) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the options for calculating the quiz grade from the individual attempt grades.
|
||||
*/
|
||||
function quiz_get_grading_options() {
|
||||
return array (
|
||||
QUIZ_GRADEHIGHEST => get_string('gradehighest', 'quiz'),
|
||||
QUIZ_GRADEAVERAGE => get_string('gradeaverage', 'quiz'),
|
||||
QUIZ_ATTEMPTFIRST => get_string('attemptfirst', 'quiz'),
|
||||
QUIZ_ATTEMPTLAST => get_string('attemptlast', 'quiz'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $option one of the values QUIZ_GRADEHIGHEST, QUIZ_GRADEAVERAGE, QUIZ_ATTEMPTFIRST or QUIZ_ATTEMPTLAST.
|
||||
* @return the lang string for that option.
|
||||
|
@ -9,6 +9,7 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
function definition() {
|
||||
|
||||
global $COURSE, $CFG, $DB;
|
||||
$quizconfig = get_config('quiz');
|
||||
$mform =& $this->_form;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@ -44,10 +45,10 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
$timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client');
|
||||
$mform->addGroupRule('timelimitgrp', $timelimitgrprules);
|
||||
$mform->disabledIf('timelimitgrp', 'timelimitenable');
|
||||
$mform->setAdvanced('timelimitgrp', $CFG->quiz_fix_timelimit);
|
||||
$mform->setAdvanced('timelimitgrp', $quizconfig->fix_timelimit);
|
||||
$mform->setHelpButton('timelimitgrp', array("timelimit", get_string("quiztimer","quiz"), "quiz"));
|
||||
$mform->setDefault('timelimit', $CFG->quiz_timelimit);
|
||||
$mform->setDefault('timelimitenable', !empty($CFG->quiz_timelimit));
|
||||
$mform->setDefault('timelimit', $quizconfig->timelimit);
|
||||
$mform->setDefault('timelimitenable', !empty($quizconfig->timelimit));
|
||||
|
||||
|
||||
//enforced time delay between quiz attempts add-on
|
||||
@ -66,13 +67,13 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'delay1', get_string("delay1", "quiz"), $timedelayoptions);
|
||||
$mform->setHelpButton('delay1', array("timedelay1", get_string("delay1", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('delay1', $CFG->quiz_fix_delay1);
|
||||
$mform->setDefault('delay1', $CFG->quiz_delay1);
|
||||
$mform->setAdvanced('delay1', $quizconfig->fix_delay1);
|
||||
$mform->setDefault('delay1', $quizconfig->delay1);
|
||||
|
||||
$mform->addElement('select', 'delay2', get_string("delay2", "quiz"), $timedelayoptions);
|
||||
$mform->setHelpButton('delay2', array("timedelay2", get_string("delay2", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('delay2', $CFG->quiz_fix_delay2);
|
||||
$mform->setDefault('delay2', $CFG->quiz_delay2);
|
||||
$mform->setAdvanced('delay2', $quizconfig->fix_delay2);
|
||||
$mform->setDefault('delay2', $quizconfig->delay2);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'displayhdr', get_string('display', 'form'));
|
||||
@ -84,18 +85,18 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'questionsperpage', get_string('newpageevery', 'quiz'), $perpage);
|
||||
$mform->setHelpButton('questionsperpage', array('questionsperpage', get_string('newpageevery', 'quiz'), 'quiz'));
|
||||
$mform->setAdvanced('questionsperpage', $CFG->quiz_fix_questionsperpage);
|
||||
$mform->setDefault('questionsperpage', $CFG->quiz_questionsperpage);
|
||||
$mform->setAdvanced('questionsperpage', $quizconfig->fix_questionsperpage);
|
||||
$mform->setDefault('questionsperpage', $quizconfig->questionsperpage);
|
||||
|
||||
$mform->addElement('selectyesno', 'shufflequestions', get_string("shufflequestions", "quiz"));
|
||||
$mform->setHelpButton('shufflequestions', array("shufflequestions", get_string("shufflequestions","quiz"), "quiz"));
|
||||
$mform->setAdvanced('shufflequestions', $CFG->quiz_fix_shufflequestions);
|
||||
$mform->setDefault('shufflequestions', $CFG->quiz_shufflequestions);
|
||||
$mform->setAdvanced('shufflequestions', $quizconfig->fix_shufflequestions);
|
||||
$mform->setDefault('shufflequestions', $quizconfig->shufflequestions);
|
||||
|
||||
$mform->addElement('selectyesno', 'shuffleanswers', get_string("shufflewithin", "quiz"));
|
||||
$mform->setHelpButton('shuffleanswers', array("shufflewithin", get_string("shufflewithin","quiz"), "quiz"));
|
||||
$mform->setAdvanced('shuffleanswers', $CFG->quiz_fix_shuffleanswers);
|
||||
$mform->setDefault('shuffleanswers', $CFG->quiz_shuffleanswers);
|
||||
$mform->setAdvanced('shuffleanswers', $quizconfig->fix_shuffleanswers);
|
||||
$mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'attemptshdr', get_string('attempts', 'quiz'));
|
||||
@ -107,31 +108,31 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'attempts', get_string("attemptsallowed", "quiz"), $attemptoptions);
|
||||
$mform->setHelpButton('attempts', array("attempts", get_string("attemptsallowed","quiz"), "quiz"));
|
||||
$mform->setAdvanced('attempts', $CFG->quiz_fix_attempts);
|
||||
$mform->setDefault('attempts', $CFG->quiz_attempts);
|
||||
$mform->setAdvanced('attempts', $quizconfig->fix_attempts);
|
||||
$mform->setDefault('attempts', $quizconfig->attempts);
|
||||
|
||||
$mform->addElement('selectyesno', 'attemptonlast', get_string("eachattemptbuildsonthelast", "quiz"));
|
||||
$mform->setHelpButton('attemptonlast', array("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('attemptonlast', $CFG->quiz_fix_attemptonlast);
|
||||
$mform->setDefault('attemptonlast', $CFG->quiz_attemptonlast);
|
||||
$mform->setAdvanced('attemptonlast', $quizconfig->fix_attemptonlast);
|
||||
$mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
|
||||
|
||||
$mform->addElement('selectyesno', 'adaptive', get_string("adaptive", "quiz"));
|
||||
$mform->setHelpButton('adaptive', array("adaptive", get_string("adaptive","quiz"), "quiz"));
|
||||
$mform->setAdvanced('adaptive', $CFG->quiz_fix_adaptive);
|
||||
$mform->setDefault('adaptive', $CFG->quiz_optionflags & QUESTION_ADAPTIVE);
|
||||
$mform->setAdvanced('adaptive', $quizconfig->fix_optionflags);
|
||||
$mform->setDefault('adaptive', $quizconfig->optionflags & QUESTION_ADAPTIVE);
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'gradeshdr', get_string('grades', 'grades'));
|
||||
$mform->addElement('select', 'grademethod', get_string("grademethod", "quiz"), quiz_get_grading_options());
|
||||
$mform->setHelpButton('grademethod', array("grademethod", get_string("grademethod","quiz"), "quiz"));
|
||||
$mform->setAdvanced('grademethod', $CFG->quiz_fix_grademethod);
|
||||
$mform->setDefault('grademethod', $CFG->quiz_grademethod);
|
||||
$mform->setAdvanced('grademethod', $quizconfig->fix_grademethod);
|
||||
$mform->setDefault('grademethod', $quizconfig->grademethod);
|
||||
|
||||
$mform->addElement('selectyesno', 'penaltyscheme', get_string("penaltyscheme", "quiz"));
|
||||
$mform->setHelpButton('penaltyscheme', array("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"));
|
||||
$mform->setAdvanced('penaltyscheme', $CFG->quiz_fix_penaltyscheme);
|
||||
$mform->setDefault('penaltyscheme', $CFG->quiz_penaltyscheme);
|
||||
$mform->setAdvanced('penaltyscheme', $quizconfig->fix_penaltyscheme);
|
||||
$mform->setDefault('penaltyscheme', $quizconfig->penaltyscheme);
|
||||
|
||||
$options = array(
|
||||
0 => '0',
|
||||
@ -140,15 +141,15 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
3 => '3');
|
||||
$mform->addElement('select', 'decimalpoints', get_string("decimaldigits", "quiz"), $options);
|
||||
$mform->setHelpButton('decimalpoints', array("decimalpoints", get_string("decimaldigits","quiz"), "quiz"));
|
||||
$mform->setAdvanced('decimalpoints', $CFG->quiz_fix_decimalpoints);
|
||||
$mform->setDefault('decimalpoints', $CFG->quiz_decimalpoints);
|
||||
$mform->setAdvanced('decimalpoints', $quizconfig->fix_decimalpoints);
|
||||
$mform->setDefault('decimalpoints', $quizconfig->decimalpoints);
|
||||
|
||||
$mform->addElement('hidden', 'grade', $CFG->quiz_maximumgrade);
|
||||
$mform->addElement('hidden', 'grade', $quizconfig->maximumgrade);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'reviewoptionshdr', get_string('reviewoptionsheading', 'quiz'));
|
||||
$mform->setHelpButton('reviewoptionshdr', array('reviewoptions', get_string('reviewoptionsheading','quiz'), 'quiz'));
|
||||
$mform->setAdvanced('reviewoptionshdr', $CFG->quiz_fix_review);
|
||||
$mform->setAdvanced('reviewoptionshdr', $quizconfig->fix_review);
|
||||
|
||||
$immediatelyoptionsgrp=array();
|
||||
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'responsesimmediately', '', get_string('responses', 'quiz'));
|
||||
@ -158,12 +159,12 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'scoreimmediately', '', get_string('scores', 'quiz'));
|
||||
$immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'overallfeedbackimmediately', '', get_string('overallfeedback', 'quiz'));
|
||||
$mform->addGroup($immediatelyoptionsgrp, 'immediatelyoptionsgrp', get_string("reviewimmediately", "quiz"), null, false);
|
||||
$mform->setDefault('responsesimmediately', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('answersimmediately', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('feedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('generalfeedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('scoreimmediately', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('overallfeedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('responsesimmediately', $quizconfig->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('answersimmediately', $quizconfig->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('feedbackimmediately', $quizconfig->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('generalfeedbackimmediately', $quizconfig->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('scoreimmediately', $quizconfig->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_IMMEDIATELY);
|
||||
$mform->setDefault('overallfeedbackimmediately', $quizconfig->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
|
||||
|
||||
$openoptionsgrp=array();
|
||||
$openoptionsgrp[] = &$mform->createElement('checkbox', 'responsesopen', '', get_string('responses', 'quiz'));
|
||||
@ -173,12 +174,12 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
$openoptionsgrp[] = &$mform->createElement('checkbox', 'scoreopen', '', get_string('scores', 'quiz'));
|
||||
$openoptionsgrp[] = &$mform->createElement('checkbox', 'overallfeedbackopen', '', get_string('overallfeedback', 'quiz'));
|
||||
$mform->addGroup($openoptionsgrp, 'openoptionsgrp', get_string("reviewopen", "quiz"), array(' '), false);
|
||||
$mform->setDefault('responsesopen', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('answersopen', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('feedbackopen', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('generalfeedbackopen', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('scoreopen', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('overallfeedbackopen', $CFG->quiz_review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('responsesopen', $quizconfig->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('answersopen', $quizconfig->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('feedbackopen', $quizconfig->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('generalfeedbackopen', $quizconfig->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('scoreopen', $quizconfig->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN);
|
||||
$mform->setDefault('overallfeedbackopen', $quizconfig->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_OPEN);
|
||||
|
||||
|
||||
$closedoptionsgrp=array();
|
||||
@ -189,32 +190,32 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
$closedoptionsgrp[] = &$mform->createElement('checkbox', 'scoreclosed', '', get_string('scores', 'quiz'));
|
||||
$closedoptionsgrp[] = &$mform->createElement('checkbox', 'overallfeedbackclosed', '', get_string('overallfeedback', 'quiz'));
|
||||
$mform->addGroup($closedoptionsgrp, 'closedoptionsgrp', get_string("reviewclosed", "quiz"), array(' '), false);
|
||||
$mform->setDefault('responsesclosed', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('answersclosed', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('feedbackclosed', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('generalfeedbackclosed', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('scoreclosed', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('overallfeedbackclosed', $CFG->quiz_review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('responsesclosed', $quizconfig->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('answersclosed', $quizconfig->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('feedbackclosed', $quizconfig->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('generalfeedbackclosed', $quizconfig->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('scoreclosed', $quizconfig->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED);
|
||||
$mform->setDefault('overallfeedbackclosed', $quizconfig->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_CLOSED);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'security', get_string('security', 'form'));
|
||||
|
||||
$mform->addElement('selectyesno', 'popup', get_string("popup", "quiz"));
|
||||
$mform->setHelpButton('popup', array("popup", get_string("popup", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('popup', $CFG->quiz_fix_popup);
|
||||
$mform->setDefault('popup', $CFG->quiz_popup);
|
||||
$mform->setAdvanced('popup', $quizconfig->fix_popup);
|
||||
$mform->setDefault('popup', $quizconfig->popup);
|
||||
|
||||
$mform->addElement('passwordunmask', 'quizpassword', get_string("requirepassword", "quiz"));
|
||||
$mform->setType('quizpassword', PARAM_TEXT);
|
||||
$mform->setHelpButton('quizpassword', array("requirepassword", get_string("requirepassword", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('quizpassword', $CFG->quiz_fix_password);
|
||||
$mform->setDefault('quizpassword', $CFG->quiz_password);
|
||||
$mform->setAdvanced('quizpassword', $quizconfig->fix_password);
|
||||
$mform->setDefault('quizpassword', $quizconfig->password);
|
||||
|
||||
$mform->addElement('text', 'subnet', get_string("requiresubnet", "quiz"));
|
||||
$mform->setType('subnet', PARAM_TEXT);
|
||||
$mform->setHelpButton('subnet', array("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"));
|
||||
$mform->setAdvanced('subnet', $CFG->quiz_fix_subnet);
|
||||
$mform->setDefault('subnet', $CFG->quiz_subnet);
|
||||
$mform->setAdvanced('subnet', $quizconfig->fix_subnet);
|
||||
$mform->setDefault('subnet', $quizconfig->subnet);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$features = new stdClass;
|
||||
|
@ -1,88 +0,0 @@
|
||||
<!-- This form fragment is used to set the review options -->
|
||||
|
||||
<td align="right">
|
||||
<table>
|
||||
<tr><td align="right"><b><?php print_string("reviewoptions", "quiz") ?>:</b></td></tr>
|
||||
<tr><td align="right"><?php print_string("reviewimmediately", "quiz") ?>:</td></tr>
|
||||
<tr><td align="right"><?php print_string("reviewopen", "quiz") ?>:</td></tr>
|
||||
<tr><td align="right"><?php print_string("reviewclosed", "quiz") ?>:</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td align="left">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center"><?php print_string('responses', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('answers', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('feedback', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('generalfeedback', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('scores', 'quiz') ?></td>
|
||||
<td align="center"><?php print_string('overallfeedback', 'quiz') ?></td>
|
||||
<td>
|
||||
<?php helpbutton("review2", get_string("allowreview","quiz"), "quiz"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="responsesimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="answersimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="feedbackimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="generalfeedbackimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="scoreimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="overallfeedbackimmediately" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="responsesopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="answersopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="feedbackopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="generalfeedbackopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="scoreopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="overallfeedbackopen" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="responsesclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="answersclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="feedbackclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="generalfeedbackclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="scoreclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="overallfeedbackclosed" value="Yes" <?php echo ($form->review & QUIZ_REVIEW_OVERALLFEEDBACK & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
|
||||
|
170
mod/quiz/settingstree.php
Normal file
170
mod/quiz/settingstree.php
Normal file
@ -0,0 +1,170 @@
|
||||
<?php // $Id$
|
||||
/**
|
||||
* settingstree.php - Tells the admin menu that there are sub menu pages to
|
||||
* include for this activity.
|
||||
*
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package quiz
|
||||
*/
|
||||
|
||||
require_once($CFG->dirroot . '/mod/quiz/lib.php');
|
||||
|
||||
// First get a list of quiz reports with there own settings pages. If there none,
|
||||
// we use a simpler overall menu structure.
|
||||
$reportsbyname = array();
|
||||
if ($reports = get_list_of_plugins('mod/quiz/report')) {
|
||||
foreach ($reports as $report) {
|
||||
if (file_exists($CFG->dirroot . "/mod/quiz/report/$report/settings.php")) {
|
||||
$strreportname = get_string($report . 'report', 'quiz_'.$report);
|
||||
// Deal with reports which are lacking the language string
|
||||
if ($strreportname[0] == '[') {
|
||||
$textlib = textlib_get_instance();
|
||||
$strreportname = $textlib->strtotitle($report . ' report');
|
||||
}
|
||||
$reportsbyname[$strreportname] = $report;
|
||||
}
|
||||
}
|
||||
ksort($reportsbyname);
|
||||
}
|
||||
|
||||
// Create the quiz settings page.
|
||||
if (empty($reportsbyname)) {
|
||||
$pagetitle = get_string('modulename', 'quiz');
|
||||
} else {
|
||||
$pagetitle = get_string('generalsettings', 'admin');
|
||||
}
|
||||
$quizsettings = new admin_settingpage('modsettingquiz', $pagetitle, 'moodle/site:config');
|
||||
|
||||
// Introductory explanation that all the settings are defaults for the add quiz form.
|
||||
$quizsettings->add(new admin_setting_heading('quizintro', '', get_string('configintro', 'quiz')));
|
||||
|
||||
// timelimit
|
||||
$quizsettings->add(new admin_setting_quiz_text('timelimit',
|
||||
get_string('timelimit', 'quiz'), get_string('configtimelimit', 'quiz'),
|
||||
array('value' => '0', 'fix' => false), PARAM_INT));
|
||||
|
||||
// delay1 and delay2
|
||||
$timedelayoptions = array();
|
||||
$timedelayoptions[0] = get_string('none');
|
||||
$timedelayoptions[1800] = get_string('numminutes', '', 30);
|
||||
$timedelayoptions[3600] = get_string('numminutes', '', 60);
|
||||
for($i=2; $i<=23; $i++) {
|
||||
$seconds = $i*3600;
|
||||
$timedelayoptions[$seconds] = get_string('numhours', '', $i);
|
||||
}
|
||||
$timedelayoptions[86400] = get_string('numhours', '', 24);
|
||||
for($i=2; $i<=7; $i++) {
|
||||
$seconds = $i*86400;
|
||||
$timedelayoptions[$seconds] = get_string('numdays', '', $i);
|
||||
}
|
||||
$quizsettings->add(new admin_setting_quiz_combo('delay1',
|
||||
get_string('delay1', 'quiz'), get_string('configdelay1', 'quiz'),
|
||||
array('value' => 0, 'fix' => false), $timedelayoptions));
|
||||
$quizsettings->add(new admin_setting_quiz_combo('delay2',
|
||||
get_string('delay2', 'quiz'), get_string('configdelay2', 'quiz'),
|
||||
array('value' => 0, 'fix' => false), $timedelayoptions));
|
||||
|
||||
// questionsperpage
|
||||
$perpage = array();
|
||||
$perpage[0] = get_string('never');
|
||||
$perpage[1] = get_string('aftereachquestion', 'quiz');
|
||||
for ($i = 2; $i <= 50; ++$i) {
|
||||
$perpage[$i] = get_string('afternquestions', 'quiz', $i);
|
||||
}
|
||||
$quizsettings->add(new admin_setting_quiz_combo('questionsperpage',
|
||||
get_string('newpageevery', 'quiz'), get_string('confignewpageevery', 'quiz'),
|
||||
array('value' => 1, 'fix' => false), $perpage));
|
||||
|
||||
// shufflequestions
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('shufflequestions',
|
||||
get_string('shufflequestions', 'quiz'), get_string('configshufflequestions', 'quiz'),
|
||||
array('value' => 0, 'fix' => false)));
|
||||
|
||||
// shuffleanswers
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('shuffleanswers',
|
||||
get_string('shufflewithin', 'quiz'), get_string('configshufflewithin', 'quiz'),
|
||||
array('value' => 1, 'fix' => false)));
|
||||
|
||||
// attempts
|
||||
$options = array(get_string('unlimited'));
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$quizsettings->add(new admin_setting_quiz_combo('attempts',
|
||||
get_string('attemptsallowed', 'quiz'), get_string('configattemptsallowed', 'quiz'),
|
||||
array('value' => 0, 'fix' => false), $options));
|
||||
|
||||
// attemptonlast
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('attemptonlast',
|
||||
get_string('eachattemptbuildsonthelast', 'quiz'), get_string('configeachattemptbuildsonthelast', 'quiz'),
|
||||
array('value' => 0, 'fix' => false)));
|
||||
|
||||
// optionflags
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('optionflags',
|
||||
get_string('adaptive', 'quiz'), get_string('configadaptive', 'quiz'),
|
||||
array('value' => 1, 'fix' => false)));
|
||||
|
||||
// maximumgrade
|
||||
$maxgradesetting = new admin_setting_configtext('maximumgrade',
|
||||
get_string('maximumgrade'), get_string('configmaximumgrade', 'quiz'), 10, PARAM_INT);
|
||||
$maxgradesetting->plugin = 'quiz';
|
||||
$quizsettings->add($maxgradesetting);
|
||||
|
||||
// grademethod
|
||||
$quizsettings->add(new admin_setting_quiz_combo('grademethod',
|
||||
get_string('grademethod', 'quiz'), get_string('configgrademethod', 'quiz'),
|
||||
array('value' => QUIZ_GRADEHIGHEST, 'fix' => false), quiz_get_grading_options()));
|
||||
|
||||
// penaltyscheme
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('penaltyscheme',
|
||||
get_string('penaltyscheme', 'quiz'), get_string('configpenaltyscheme', 'quiz'),
|
||||
array('value' => 1, 'fix' => false)));
|
||||
|
||||
// decimalpoints
|
||||
$options = array();
|
||||
for ($i = 0; $i <= 5; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$quizsettings->add(new admin_setting_quiz_combo('decimalpoints',
|
||||
get_string('decimaldigits', 'quiz'), get_string('configdecimaldigits', 'quiz'),
|
||||
array('value' => 2, 'fix' => false), $options));
|
||||
|
||||
// review
|
||||
$quizsettings->add(new admin_setting_quiz_reviewoptions('review',
|
||||
get_string('reviewoptions', 'quiz'), get_string('configreviewoptions', 'quiz'),
|
||||
array('value' => 0x3fffffff, 'fix' => false)));
|
||||
|
||||
// popup
|
||||
$quizsettings->add(new admin_setting_quiz_yesno('popup',
|
||||
get_string('popup', 'quiz'), get_string('configpopup', 'quiz'),
|
||||
array('value' => 0, 'fix' => false)));
|
||||
|
||||
// quizpassword
|
||||
$quizsettings->add(new admin_setting_quiz_text('password',
|
||||
get_string('requirepassword', 'quiz'), get_string('configrequirepassword', 'quiz'),
|
||||
array('value' => '', 'fix' => false), PARAM_TEXT));
|
||||
|
||||
// subnet
|
||||
$quizsettings->add(new admin_setting_quiz_text('subnet',
|
||||
get_string('requiresubnet', 'quiz'), get_string('configrequiresubnet', 'quiz'),
|
||||
array('value' => '', 'fix' => false), PARAM_TEXT));
|
||||
|
||||
/// Now, depending on whether any reports have their own settings page, add
|
||||
/// the quiz setting page to the appropriate place in the tree.
|
||||
if (empty($reportsbyname)) {
|
||||
$ADMIN->add('modsettings', $quizsettings);
|
||||
} else {
|
||||
$ADMIN->add('modsettings', new admin_category('modsettingsquizcat', get_string('modulename', 'quiz'), !$module->visible));
|
||||
$ADMIN->add('modsettingsquizcat', $quizsettings);
|
||||
|
||||
/// Add the report pages for the settings.php files in sub directories of mod/quiz/report
|
||||
foreach ($reportsbyname as $strreportname => $report) {
|
||||
$reportname = $report;
|
||||
$settings = new admin_settingpage('modsettingsquizcat'.$reportname, $strreportname, 'moodle/site:config', !$module->visible);
|
||||
if ($ADMIN->fulltree) {
|
||||
include($CFG->dirroot."/mod/quiz/report/$reportname/settings.php");
|
||||
}
|
||||
$ADMIN->add('modsettingsquizcat', $settings);
|
||||
}
|
||||
}
|
||||
?>
|
@ -5,7 +5,7 @@
|
||||
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2008081507; // The (date) version of this module
|
||||
$module->version = 2008082200; // The (date) version of this module
|
||||
$module->requires = 2008072401; // Requires this Moodle version
|
||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||
|
||||
|
@ -3954,28 +3954,37 @@ table.quizreviewsummary td.cell {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#mod-quiz-mod #reviewoptionshdr .fitem {
|
||||
#mod-quiz-mod #reviewoptionshdr .fitem,
|
||||
#adminquizreviewoptions .group {
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin-left: 10px;
|
||||
width: 33%;
|
||||
clear: none;
|
||||
}
|
||||
#mod-quiz-mod #reviewoptionshdr .fitemtitle {
|
||||
#mod-quiz-mod #reviewoptionshdr .fitem {
|
||||
width: 30%;
|
||||
margin-left: 10px;
|
||||
}
|
||||
#mod-quiz-mod #reviewoptionshdr .fitemtitle,
|
||||
#adminquizreviewoptions .fitemtitle {
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
height: 2.5em;
|
||||
margin-left: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
#mod-quiz-mod #reviewoptionshdr fieldset.fgroup {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin-left: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
#mod-quiz-mod #reviewoptionshdr fieldset.fgroup span {
|
||||
#mod-quiz-mod #reviewoptionshdr fieldset.fgroup span,
|
||||
#adminquizreviewoptions span {
|
||||
float: left;
|
||||
clear: left;
|
||||
}
|
||||
#adminquizreviewoptions {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
#mod-quiz-edit #page .controls,
|
||||
#mod-quiz-edit #page .quizattemptcounts
|
||||
|
Loading…
x
Reference in New Issue
Block a user