MDL-19668 improvements of _with_advanced admin setting classes finished, quiz settings updated too

This commit is contained in:
skodak 2009-06-30 16:55:56 +00:00
parent c304d58106
commit adf8f3f9ad
6 changed files with 198 additions and 107 deletions

View File

@ -3572,31 +3572,36 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
}
/**
* Text field with an advanced checkbox, that controls a additional "fix_$name" setting.
* Text field with an advanced checkbox, that controls a additional $name.'_adv' setting.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_configtext_with_advanced extends admin_setting_configtext {
/**
* Calls parent::__construct with specific arguments
* Constructor
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised
* @param string $description long localised info
* @param array $defaultsetting ('value'=>string, '__construct'=>bool)
* @param mixed $paramtype int means PARAM_XXX type, string is a allowed format in regex
* @param int $size default field size
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype) {
parent::__construct($name, $visiblename, $description,
$defaultsetting, $paramtype);
public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype=PARAM_RAW, $size=null) {
parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype, $size);
}
/**
* Loads the current setting and returns array
*
* @return array Returns array value=>xx, fix=>xx
* @return array Returns array value=>xx, __construct=>xx
*/
public function get_setting() {
$value = parent::get_setting();
$fix = $this->config_read('fix_' . $this->name);
if (is_null($value) or is_null($fix)) {
$adv = $this->config_read($this->name.'_adv');
if (is_null($value) or is_null($adv)) {
return NULL;
}
return array('value' => $value, 'fix' => $fix);
return array('value' => $value, 'adv' => $adv);
}
/**
@ -3609,14 +3614,8 @@ class admin_setting_configtext_with_advanced extends admin_setting_configtext {
public 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');
}
$value = empty($data['adv']) ? 0 : 1;
$this->config_write($this->name.'_adv', $value);
}
return $error;
}
@ -3638,19 +3637,19 @@ class admin_setting_configtext_with_advanced extends admin_setting_configtext {
$defaultinfo[] = $default['value'];
}
}
if (!empty($default['fix'])) {
if (!empty($default['adv'])) {
$defaultinfo[] = get_string('advanced');
}
$defaultinfo = implode(', ', $defaultinfo);
$fix = !empty($data['fix']);
$adv = !empty($data['adv']);
$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">' .
$this->get_id() . '_adv" name="' . $this->get_full_name() .
'[adv]" value="1" ' . ($adv ? 'checked="checked"' : '') . ' />' .
' <label for="' . $this->get_id() . '_adv">' .
get_string('advanced') . '</label></div>';
return format_admin_setting($this, $this->visiblename, $return,
@ -3659,7 +3658,111 @@ class admin_setting_configtext_with_advanced extends admin_setting_configtext {
}
/**
* Dropdown menu with an advanced checkbox, that controls a additional "fix_$name" setting.
* Checkbox with an advanced checkbox that controls an additional $name.'_adv' config setting.
*
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_configcheckbox_with_advanced extends admin_setting_configcheckbox {
/**
* Constructor
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised
* @param string $description long localised info
* @param array $defaultsetting ('value'=>string, 'adv'=>bool)
* @param string $yes value used when checked
* @param string $no value used when not checked
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $yes='1', $no='0') {
parent::__construct($name, $visiblename, $description, $defaultsetting, $yes, $no);
}
/**
* Loads the current setting and returns array
*
* @return array Returns array value=>xx, adv=>xx
*/
public function get_setting() {
$value = parent::get_setting();
$adv = $this->config_read($this->name.'_adv');
if (is_null($value) or is_null($adv)) {
return NULL;
}
return array('value' => $value, 'adv' => $adv);
}
/**
* Sets the value for the setting
*
* Sets the value for the setting to either the yes or no values
* of the object by comparing $data to yes
*
* @param mixed $data Gets converted to str for comparison against yes value
* @return string empty string or error
*/
public function write_setting($data) {
$error = parent::write_setting($data['value']);
if (!$error) {
$value = empty($data['adv']) ? 0 : 1;
$this->config_write($this->name.'_adv', $value);
}
return $error;
}
/**
* Returns an XHTML checkbox field and with extra advanced cehckbox
*
* @param string $data If $data matches yes then checkbox is checked
* @param string $query
* @return string XHTML field
*/
public function output_html($data, $query='') {
$defaults = $this->get_defaultsetting();
$defaultinfo = array();
if (!is_null($defaults)) {
if ((string)$defaults['value'] === $this->yes) {
$defaultinfo[] = get_string('checkboxyes', 'admin');
} else {
$defaultinfo[] = get_string('checkboxno', 'admin');
}
if (!empty($defaults['adv'])) {
$defaultinfo[] = get_string('advanced');
}
}
$defaultinfo = implode(', ', $defaultinfo);
if ((string)$data['value'] === $this->yes) { // convert to strings before comparison
$checked = 'checked="checked"';
} else {
$checked = '';
}
if (!empty($data['adv'])) {
$advanced = 'checked="checked"';
} else {
$advanced = '';
}
$fullname = $this->get_full_name();
$novalue = s($this->no);
$yesvalue = s($this->yes);
$id = $this->get_id();
$stradvanced = get_string('advanced');
$return = <<<EOT
<div class="form-checkbox defaultsnext" >
<input type="hidden" name="{$fullname}[value]" value="$novalue" />
<input type="checkbox" id="$id" name="{$fullname}[value]" value="$yesvalue" $checked />
<input type="checkbox" class="form-checkbox" id="{$id}_adv" name="{$fullname}[adv]" value="1" $advanced />
<label for="{$id}_adv">$stradvanced</label>
</div>
EOT;
return format_admin_setting($this, $this->visiblename, $return, $this->description,
true, '', $defaultinfo, $query);
}
}
/**
* Dropdown menu with an advanced checkbox, that controls a additional $name.'_adv' setting.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -3674,15 +3777,15 @@ class admin_setting_configselect_with_advanced extends admin_setting_configselec
/**
* Loads the current setting and returns array
*
* @return array Returns array value=>xx, fix=>xx
* @return array Returns array value=>xx, adv=>xx
*/
public function get_setting() {
$value = parent::get_setting();
$fix = $this->config_read('fix_' . $this->name);
if (is_null($value) or is_null($fix)) {
$adv = $this->config_read($this->name.'_adv');
if (is_null($value) or is_null($adv)) {
return NULL;
}
return array('value' => $value, 'fix' => $fix);
return array('value' => $value, 'adv' => $adv);
}
/**
@ -3695,14 +3798,8 @@ class admin_setting_configselect_with_advanced extends admin_setting_configselec
public 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');
}
$value = empty($data['adv']) ? 0 : 1;
$this->config_write($this->name.'_adv', $value);
}
return $error;
}
@ -3729,7 +3826,7 @@ class admin_setting_configselect_with_advanced extends admin_setting_configselec
if (isset($this->choices[$default['value']])) {
$defaultinfo[] = $this->choices[$default['value']];
}
if (!empty($default['fix'])) {
if (!empty($default['adv'])) {
$defaultinfo[] = get_string('advanced');
}
$defaultinfo = implode(', ', $defaultinfo);
@ -3737,33 +3834,18 @@ class admin_setting_configselect_with_advanced extends admin_setting_configselec
$defaultinfo = '';
}
$fix = !empty($data['fix']);
$adv = !empty($data['adv']);
$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">' .
$this->get_id() . '_adv" name="' . $this->get_full_name() .
'[adv]" value="1" ' . ($adv ? 'checked="checked"' : '') . ' />' .
' <label for="' . $this->get_id() . '_adv">' .
get_string('advanced') . '</label></div>';
return format_admin_setting($this, $this->visiblename, $return, $this->description, true, $warning, $defaultinfo, $query);
}
}
/**
* Specialisation of admin_setting_configselect_with_advanced for easy yes/no choices.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_yesno_with_advanced extends admin_setting_configselect_with_advanced {
/**
* Calls parent::__construct with specific arguments
*/
public function __construct($name, $visiblename, $description, $defaultsetting) {
parent::__construct($name, $visiblename, $description,
$defaultsetting, array(get_string('no'), get_string('yes')));
}
}
/**
* Graded roles in gradebook
*

View File

@ -2251,6 +2251,21 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
upgrade_main_savepoint($result, 2009061706);
}
if ($result && $oldversion < 2009063000) {
// upgrade format of _with_advanced settings - quiz only
// note: this can be removed later, not needed for upgrades from 1.9.x
$quiz = get_config('quiz');
foreach ($quiz as $name=>$value) {
if (strpos($name, 'fix_') !== 0) {
continue;
}
$newname = substr($name,4).'_adv';
set_config($newname, $value, 'quiz');
unset_config($name, 'quiz');
}
upgrade_main_savepoint($result, 2009063000);
}
return $result;
}

View File

@ -66,7 +66,7 @@ class mod_quiz_mod_form extends moodleform_mod {
/// Time limit.
$mform->addElement('duration', 'timelimit', get_string('timelimit', 'quiz'), array('optional' => true));
$mform->setHelpButton('timelimit', array('timelimit', get_string('quiztimer','quiz'), 'quiz'));
$mform->setAdvanced('timelimit', $quizconfig->fix_timelimit);
$mform->setAdvanced('timelimit', $quizconfig->timelimit_adv);
$mform->setDefault('timelimit', $quizconfig->timelimit);
/// Number of attempts.
@ -76,13 +76,13 @@ 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', $quizconfig->fix_attempts);
$mform->setAdvanced('attempts', $quizconfig->attempts_adv);
$mform->setDefault('attempts', $quizconfig->attempts);
/// Grading method.
$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', $quizconfig->fix_grademethod);
$mform->setAdvanced('grademethod', $quizconfig->grademethod_adv);
$mform->setDefault('grademethod', $quizconfig->grademethod);
$mform->disabledIf('grademethod', 'attempts', 'eq', 1);
@ -93,7 +93,7 @@ class mod_quiz_mod_form extends moodleform_mod {
$shuffleoptions = array(0 => get_string('asshownoneditscreen', 'quiz'), 1 => get_string('shuffledrandomly', 'quiz'));
$mform->addElement('select', 'shufflequestions', get_string('questionorder', 'quiz'), $shuffleoptions, array('id' => 'id_shufflequestions'));
$mform->setHelpButton('shufflequestions', array('shufflequestions', get_string('shufflequestions','quiz'), 'quiz'));
$mform->setAdvanced('shufflequestions', $quizconfig->fix_shufflequestions);
$mform->setAdvanced('shufflequestions', $quizconfig->shufflequestions_adv);
$mform->setDefault('shufflequestions', $quizconfig->shufflequestions);
/// Questions per page.
@ -117,7 +117,7 @@ class mod_quiz_mod_form extends moodleform_mod {
$mform->addGroup($pagegroup, 'questionsperpagegrp', get_string('newpage', 'quiz'), null, false);
$mform->setHelpButton('questionsperpagegrp', array('questionsperpage', get_string('newpageevery', 'quiz'), 'quiz'));
$mform->setAdvanced('questionsperpagegrp', $quizconfig->fix_questionsperpage);
$mform->setAdvanced('questionsperpagegrp', $quizconfig->questionsperpage_adv);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'interactionhdr', get_string('questionbehaviour', 'quiz'));
@ -125,33 +125,33 @@ class mod_quiz_mod_form extends moodleform_mod {
/// Shuffle within questions.
$mform->addElement('selectyesno', 'shuffleanswers', get_string('shufflewithin', 'quiz'));
$mform->setHelpButton('shuffleanswers', array('shufflewithin', get_string('shufflewithin','quiz'), 'quiz'));
$mform->setAdvanced('shuffleanswers', $quizconfig->fix_shuffleanswers);
$mform->setAdvanced('shuffleanswers', $quizconfig->shuffleanswers_adv);
$mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);
/// Adaptive mode.
$mform->addElement('selectyesno', 'adaptive', get_string('adaptive', 'quiz'));
$mform->setHelpButton('adaptive', array('adaptive', get_string('adaptive','quiz'), 'quiz'));
$mform->setAdvanced('adaptive', $quizconfig->fix_optionflags);
$mform->setAdvanced('adaptive', $quizconfig->optionflags_adv);
$mform->setDefault('adaptive', $quizconfig->optionflags & QUESTION_ADAPTIVE);
/// Apply penalties.
$mform->addElement('selectyesno', 'penaltyscheme', get_string('penaltyscheme', 'quiz'));
$mform->setHelpButton('penaltyscheme', array('penaltyscheme', get_string('penaltyscheme','quiz'), 'quiz'));
$mform->setAdvanced('penaltyscheme', $quizconfig->fix_penaltyscheme);
$mform->setAdvanced('penaltyscheme', $quizconfig->penaltyscheme_adv);
$mform->setDefault('penaltyscheme', $quizconfig->penaltyscheme);
$mform->disabledIf('penaltyscheme', 'adaptive', 'neq', 1);
/// Each attempt builds on last.
$mform->addElement('selectyesno', 'attemptonlast', get_string('eachattemptbuildsonthelast', 'quiz'));
$mform->setHelpButton('attemptonlast', array('repeatattempts', get_string('eachattemptbuildsonthelast', 'quiz'), 'quiz'));
$mform->setAdvanced('attemptonlast', $quizconfig->fix_attemptonlast);
$mform->setAdvanced('attemptonlast', $quizconfig->attemptonlast_adv);
$mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
$mform->disabledIf('attemptonlast', 'attempts', 'eq', 1);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'reviewoptionshdr', get_string('reviewoptionsheading', 'quiz'));
$mform->setHelpButton('reviewoptionshdr', array('reviewoptions', get_string('reviewoptionsheading','quiz'), 'quiz'));
$mform->setAdvanced('reviewoptionshdr', $quizconfig->fix_review);
$mform->setAdvanced('reviewoptionshdr', $quizconfig->review_adv);
/// Review options.
$immediatelyoptionsgrp=array();
@ -206,7 +206,7 @@ class mod_quiz_mod_form extends moodleform_mod {
/// Show user picture.
$mform->addElement('selectyesno', 'showuserpicture', get_string('showuserpicture', 'quiz'));
$mform->setHelpButton('showuserpicture', array('showuserpicture', get_string('showuserpicture', 'quiz'), 'quiz'));
$mform->setAdvanced('showuserpicture', $quizconfig->fix_showuserpicture);
$mform->setAdvanced('showuserpicture', $quizconfig->showuserpicture_adv);
$mform->setDefault('showuserpicture', $quizconfig->showuserpicture);
/// Overall decimal points.
@ -216,7 +216,7 @@ class mod_quiz_mod_form extends moodleform_mod {
}
$mform->addElement('select', 'decimalpoints', get_string('decimalplaces', 'quiz'), $options);
$mform->setHelpButton('decimalpoints', array('decimalpoints', get_string('decimalplaces','quiz'), 'quiz'));
$mform->setAdvanced('decimalpoints', $quizconfig->fix_decimalpoints);
$mform->setAdvanced('decimalpoints', $quizconfig->decimalpoints_adv);
$mform->setDefault('decimalpoints', $quizconfig->decimalpoints);
/// Question decimal points.
@ -226,7 +226,7 @@ class mod_quiz_mod_form extends moodleform_mod {
}
$mform->addElement('select', 'questiondecimalpoints', get_string('decimalplacesquestion', 'quiz'), $options);
$mform->setHelpButton('questiondecimalpoints', array('decimalplacesquestion', get_string('decimalplacesquestion','quiz'), 'quiz'));
$mform->setAdvanced('questiondecimalpoints', $quizconfig->fix_questiondecimalpoints);
$mform->setAdvanced('questiondecimalpoints', $quizconfig->questiondecimalpoints_adv);
$mform->setDefault('questiondecimalpoints', $quizconfig->questiondecimalpoints);
//-------------------------------------------------------------------------------
@ -236,26 +236,26 @@ class mod_quiz_mod_form extends moodleform_mod {
$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', $quizconfig->fix_password);
$mform->setAdvanced('quizpassword', $quizconfig->password_adv);
$mform->setDefault('quizpassword', $quizconfig->password);
/// IP address.
$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', $quizconfig->fix_subnet);
$mform->setAdvanced('subnet', $quizconfig->subnet_adv);
$mform->setDefault('subnet', $quizconfig->subnet);
/// Enforced time delay between quiz attempts.
$mform->addElement('duration', 'delay1', get_string('delay1st2nd', 'quiz'), array('optional' => true));
$mform->setHelpButton('delay1', array('timedelay1', get_string('delay1st2nd', 'quiz'), 'quiz'));
$mform->setAdvanced('delay1', $quizconfig->fix_delay1);
$mform->setAdvanced('delay1', $quizconfig->delay1_adv);
$mform->setDefault('delay1', $quizconfig->delay1);
$mform->disabledIf('delay1', 'attempts', 'eq', 1);
$mform->addElement('duration', 'delay2', get_string('delaylater', 'quiz'), array('optional' => true));
$mform->setHelpButton('delay2', array('timedelay2', get_string('delaylater', 'quiz'), 'quiz'));
$mform->setAdvanced('delay2', $quizconfig->fix_delay2);
$mform->setAdvanced('delay2', $quizconfig->delay2_adv);
$mform->setDefault('delay2', $quizconfig->delay2);
$mform->disabledIf('delay2', 'attempts', 'eq', 1);
$mform->disabledIf('delay2', 'attempts', 'eq', 2);
@ -263,7 +263,7 @@ class mod_quiz_mod_form extends moodleform_mod {
/// 'Secure' window.
$mform->addElement('selectyesno', 'popup', get_string('showinsecurepopup', 'quiz'));
$mform->setHelpButton('popup', array('popup', get_string('showinsecurepopup', 'quiz'), 'quiz'));
$mform->setAdvanced('popup', $quizconfig->fix_popup);
$mform->setAdvanced('popup', $quizconfig->popup_adv);
$mform->setDefault('popup', $quizconfig->popup);
//-------------------------------------------------------------------------------

View File

@ -4,7 +4,9 @@ if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page.
}
// Quiz specific admin settings class.
/**
* Quiz specific admin settings class.
*/
class admin_setting_quiz_reviewoptions extends admin_setting {
private static $times = array(
QUIZ_REVIEW_IMMEDIATELY => 'reviewimmediately',
@ -37,28 +39,20 @@ class admin_setting_quiz_reviewoptions extends admin_setting {
public function get_setting() {
$value = $this->config_read($this->name);
$fix = $this->config_read('fix_' . $this->name);
if (is_null($value) or is_null($fix)) {
$adv = $this->config_read($this->name.'_adv');
if (is_null($value) or is_null($adv)) {
return NULL;
}
return array('value' => $value, 'fix' => $fix);
return array('value' => $value, 'adv' => $adv);
}
public 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');
}
$this->config_write($this->name, $data['value']);
$value = empty($data['adv']) ? 0 : 1;
$this->config_write($this->name.'_adv', $value);
return '';
}
@ -87,11 +81,11 @@ class admin_setting_quiz_reviewoptions extends admin_setting {
}
$return .= "</div>\n";
$fix = !empty($data['fix']);
$adv = !empty($data['adv']);
$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">' .
$this->get_id() . '_adv" name="' . $this->get_full_name() .
'[adv]" value="1" ' . ($adv ? 'checked="checked"' : '') . ' />' .
' <label for="' . $this->get_id() . '_adv">' .
get_string('advanced') . '</label> ';
return format_admin_setting($this, $this->visiblename, $return,

View File

@ -63,9 +63,9 @@ $quizsettings->add(new admin_setting_configtext('quiz/maximumgrade',
get_string('maximumgrade'), get_string('configmaximumgrade', 'quiz'), 10, PARAM_INT));
// Shuffle questions
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/shufflequestions',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/shufflequestions',
get_string('shufflequestions', 'quiz'), get_string('configshufflequestions', 'quiz'),
array('value' => 0, 'fix' => false)));
array('value' => 0, 'adv' => false)));
// Questions per page
$perpage = array();
@ -79,24 +79,24 @@ $quizsettings->add(new admin_setting_configselect_with_advanced('quiz/questionsp
array('value' => 1, 'fix' => false), $perpage));
// Shuffle within questions
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/shuffleanswers',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/shuffleanswers',
get_string('shufflewithin', 'quiz'), get_string('configshufflewithin', 'quiz'),
array('value' => 1, 'fix' => false)));
array('value' => 1, 'adv' => false)));
// Adaptive mode.
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/optionflags',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/optionflags',
get_string('adaptive', 'quiz'), get_string('configadaptive', 'quiz'),
array('value' => 1, 'fix' => false)));
array('value' => 1, 'adv' => false)));
// Apply penalties.
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/penaltyscheme',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/penaltyscheme',
get_string('penaltyscheme', 'quiz'), get_string('configpenaltyscheme', 'quiz'),
array('value' => 1, 'fix' => true)));
array('value' => 1, 'adv' => true)));
// Each attempt builds on last.
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/attemptonlast',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/attemptonlast',
get_string('eachattemptbuildsonthelast', 'quiz'), get_string('configeachattemptbuildsonthelast', 'quiz'),
array('value' => 0, 'fix' => true)));
array('value' => 0, 'adv' => true)));
// Review options.
$quizsettings->add(new admin_setting_quiz_reviewoptions('quiz/review',
@ -104,9 +104,9 @@ $quizsettings->add(new admin_setting_quiz_reviewoptions('quiz/review',
array('value' => QUIZ_REVIEW_IMMEDIATELY | QUIZ_REVIEW_OPEN | QUIZ_REVIEW_CLOSED, 'fix' => false)));
// Show the user's picture
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/showuserpicture',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/showuserpicture',
get_string('showuserpicture', 'quiz'), get_string('configshowuserpicture', 'quiz'),
array('value' => 0, 'fix' => false)));
array('value' => 0, 'adv' => false)));
// Decimal places for overall grades.
$options = array();
@ -145,9 +145,9 @@ $quizsettings->add(new admin_setting_configtext_with_advanced('quiz/delay2',
array('value' => 0, 'fix' => true), PARAM_INTEGER));
// 'Secure' window.
$quizsettings->add(new admin_setting_yesno_with_advanced('quiz/popup',
$quizsettings->add(new admin_setting_configcheckbox_with_advanced('quiz/popup',
get_string('showinsecurepopup', 'quiz'), get_string('configpopup', 'quiz'),
array('value' => 0, 'fix' => true)));
array('value' => 0, 'adv' => true)));
/// Now, depending on whether any reports have their own settings page, add
/// the quiz setting page to the appropriate place in the tree.

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2009061706; // YYYYMMDD = date of the last version bump
$version = 2009063000; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20090630)'; // Human-friendly version name