2009-11-04 11:58:30 +00:00
|
|
|
<?php
|
2011-02-21 16:13:25 +00:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines the quiz module ettings form.
|
|
|
|
*
|
|
|
|
* @package mod
|
|
|
|
* @subpackage quiz
|
|
|
|
* @copyright 2006 Jamie Pratt
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
|
2011-02-03 18:06:10 +00:00
|
|
|
|
2011-02-23 15:03:35 +00:00
|
|
|
defined('MOODLE_INTERNAL') || die();
|
2010-05-13 02:02:05 +00:00
|
|
|
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
require_once($CFG->dirroot . '/course/moodleform_mod.php');
|
|
|
|
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
|
|
|
|
|
2011-02-03 18:06:10 +00:00
|
|
|
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
/**
|
|
|
|
* Settings form for the quiz module.
|
2009-04-22 06:48:15 +00:00
|
|
|
*
|
2011-02-21 16:13:25 +00:00
|
|
|
* @copyright 2006 Jamie Pratt
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
*/
|
2006-12-28 09:32:45 +00:00
|
|
|
class mod_quiz_mod_form extends moodleform_mod {
|
2011-02-03 18:06:10 +00:00
|
|
|
protected $_feedbacks;
|
|
|
|
protected static $reviewfields = array(); // Initialised in the constructor.
|
|
|
|
|
2011-02-04 15:47:52 +00:00
|
|
|
public function __construct($current, $section, $cm, $course) {
|
2011-02-03 18:06:10 +00:00
|
|
|
self::$reviewfields = array(
|
2012-04-02 16:13:29 +01:00
|
|
|
'attempt' => array('theattempt', 'quiz'),
|
|
|
|
'correctness' => array('whethercorrect', 'question'),
|
|
|
|
'marks' => array('marks', 'quiz'),
|
|
|
|
'specificfeedback' => array('specificfeedback', 'question'),
|
|
|
|
'generalfeedback' => array('generalfeedback', 'question'),
|
|
|
|
'rightanswer' => array('rightanswer', 'question'),
|
|
|
|
'overallfeedback' => array('reviewoverallfeedback', 'quiz'),
|
2011-02-03 18:06:10 +00:00
|
|
|
);
|
2011-02-04 15:47:52 +00:00
|
|
|
parent::__construct($current, $section, $cm, $course);
|
2011-02-03 18:06:10 +00:00
|
|
|
}
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-03-23 16:22:25 +00:00
|
|
|
protected function definition() {
|
2009-06-15 07:57:53 +00:00
|
|
|
global $COURSE, $CFG, $DB, $PAGE;
|
2008-08-26 01:05:01 +00:00
|
|
|
$quizconfig = get_config('quiz');
|
2011-02-03 18:06:10 +00:00
|
|
|
$mform = $this->_form;
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2006-12-19 07:03:08 +00:00
|
|
|
$mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Name.
|
2007-01-11 19:47:08 +00:00
|
|
|
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
|
2008-07-26 15:15:25 +00:00
|
|
|
if (!empty($CFG->formatstringstriptags)) {
|
|
|
|
$mform->setType('name', PARAM_TEXT);
|
|
|
|
} else {
|
2010-09-02 18:29:39 +00:00
|
|
|
$mform->setType('name', PARAM_CLEANHTML);
|
2008-07-26 15:15:25 +00:00
|
|
|
}
|
2007-08-03 10:33:29 +00:00
|
|
|
$mform->addRule('name', null, 'required', null, 'client');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Introduction.
|
2009-04-22 04:57:34 +00:00
|
|
|
$this->add_intro_editor(false, get_string('introduction', 'quiz'));
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2011-11-10 17:25:49 +00:00
|
|
|
$mform->addElement('header', 'timing', get_string('timing', 'quiz'));
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Open and close dates.
|
2011-02-03 18:06:10 +00:00
|
|
|
$mform->addElement('date_time_selector', 'timeopen', get_string('quizopen', 'quiz'),
|
|
|
|
array('optional' => true, 'step' => 1));
|
2011-02-04 15:47:52 +00:00
|
|
|
$mform->addHelpButton('timeopen', 'quizopenclose', 'quiz');
|
2011-02-03 18:06:10 +00:00
|
|
|
|
|
|
|
$mform->addElement('date_time_selector', 'timeclose', get_string('quizclose', 'quiz'),
|
|
|
|
array('optional' => true, 'step' => 1));
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Time limit.
|
|
|
|
$mform->addElement('duration', 'timelimit', get_string('timelimit', 'quiz'),
|
|
|
|
array('optional' => true));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('timelimit', 'timelimit', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('timelimit', $quizconfig->timelimit_adv);
|
2008-08-26 01:05:01 +00:00
|
|
|
$mform->setDefault('timelimit', $quizconfig->timelimit);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-11-10 18:27:31 +00:00
|
|
|
// What to do with overdue attempts.
|
|
|
|
$mform->addElement('select', 'overduehandling', get_string('overduehandling', 'quiz'),
|
|
|
|
quiz_get_overdue_handling_options());
|
2012-06-07 17:33:46 +01:00
|
|
|
$mform->addHelpButton('overduehandling', 'overduehandling', 'quiz');
|
2011-11-10 18:27:31 +00:00
|
|
|
$mform->setAdvanced('overduehandling', $quizconfig->overduehandling_adv);
|
|
|
|
$mform->setDefault('overduehandling', $quizconfig->overduehandling);
|
2012-04-30 10:24:02 +08:00
|
|
|
// TODO Formslib does OR logic on disableif, and we need AND logic here.
|
2011-11-10 18:27:31 +00:00
|
|
|
// $mform->disabledIf('overduehandling', 'timelimit', 'eq', 0);
|
|
|
|
// $mform->disabledIf('overduehandling', 'timeclose', 'eq', 0);
|
|
|
|
|
|
|
|
// Grace period time.
|
|
|
|
$mform->addElement('duration', 'graceperiod', get_string('graceperiod', 'quiz'),
|
|
|
|
array('optional' => true));
|
|
|
|
$mform->addHelpButton('graceperiod', 'graceperiod', 'quiz');
|
|
|
|
$mform->setAdvanced('graceperiod', $quizconfig->graceperiod_adv);
|
|
|
|
$mform->setDefault('graceperiod', $quizconfig->graceperiod);
|
|
|
|
$mform->disabledIf('graceperiod', 'overduehandling', 'neq', 'graceperiod');
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
|
|
|
// Grade settings.
|
2011-11-10 17:25:49 +00:00
|
|
|
$this->standard_grading_coursemodule_elements();
|
|
|
|
|
|
|
|
$mform->removeElement('grade');
|
|
|
|
$mform->addElement('hidden', 'grade', $quizconfig->maximumgrade);
|
2012-05-11 11:34:34 +08:00
|
|
|
$mform->setType('grade', PARAM_FLOAT);
|
2011-11-10 17:25:49 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Number of attempts.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$attemptoptions = array('0' => get_string('unlimited'));
|
|
|
|
for ($i = 1; $i <= QUIZ_MAX_ATTEMPT_OPTION; $i++) {
|
|
|
|
$attemptoptions[$i] = $i;
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('select', 'attempts', get_string('attemptsallowed', 'quiz'),
|
|
|
|
$attemptoptions);
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('attempts', $quizconfig->attempts_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('attempts', $quizconfig->attempts);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Grading method.
|
|
|
|
$mform->addElement('select', 'grademethod', get_string('grademethod', 'quiz'),
|
|
|
|
quiz_get_grading_options());
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('grademethod', 'grademethod', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('grademethod', $quizconfig->grademethod_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('grademethod', $quizconfig->grademethod);
|
|
|
|
$mform->disabledIf('grademethod', 'attempts', 'eq', 1);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('header', 'layouthdr', get_string('layout', 'quiz'));
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Shuffle questions.
|
|
|
|
$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'));
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('shufflequestions', $quizconfig->shufflequestions_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('shufflequestions', $quizconfig->shufflequestions);
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Questions per page.
|
2009-03-17 07:08:33 +00:00
|
|
|
$pageoptions = array();
|
|
|
|
$pageoptions[0] = get_string('neverallononepage', 'quiz');
|
|
|
|
$pageoptions[1] = get_string('everyquestion', 'quiz');
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
for ($i = 2; $i <= QUIZ_MAX_QPP_OPTION; ++$i) {
|
2009-03-17 07:08:33 +00:00
|
|
|
$pageoptions[$i] = get_string('everynquestions', 'quiz', $i);
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
2009-03-17 07:08:33 +00:00
|
|
|
|
|
|
|
$pagegroup = array();
|
2011-05-13 00:33:44 +01:00
|
|
|
$pagegroup[] = $mform->createElement('select', 'questionsperpage',
|
|
|
|
get_string('newpage', 'quiz'), $pageoptions, array('id' => 'id_questionsperpage'));
|
2008-08-26 01:05:01 +00:00
|
|
|
$mform->setDefault('questionsperpage', $quizconfig->questionsperpage);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2009-03-17 07:08:33 +00:00
|
|
|
if (!empty($this->_cm)) {
|
2011-05-13 00:33:44 +01:00
|
|
|
$pagegroup[] = $mform->createElement('checkbox', 'repaginatenow', '',
|
|
|
|
get_string('repaginatenow', 'quiz'), array('id' => 'id_repaginatenow'));
|
2009-03-17 07:08:33 +00:00
|
|
|
$mform->disabledIf('repaginatenow', 'shufflequestions', 'eq', 1);
|
2012-08-06 22:24:43 +02:00
|
|
|
|
|
|
|
$PAGE->requires->js('/question/qengine.js');
|
|
|
|
$module = array(
|
|
|
|
'name' => 'mod_quiz_edit',
|
|
|
|
'fullpath' => '/mod/quiz/edit.js',
|
|
|
|
'requires' => array('yui2-dom', 'yui2-event', 'yui2-container'),
|
|
|
|
'strings' => array(),
|
|
|
|
'async' => false,
|
|
|
|
);
|
|
|
|
$PAGE->requires->js_init_call('quiz_settings_init', null, false, $module);
|
2009-03-17 07:08:33 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addGroup($pagegroup, 'questionsperpagegrp',
|
|
|
|
get_string('newpage', 'quiz'), null, false);
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('questionsperpagegrp', 'newpage', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('questionsperpagegrp', $quizconfig->questionsperpage_adv);
|
2009-03-17 07:08:33 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// Navigation method.
|
2012-01-20 16:52:17 -08:00
|
|
|
$mform->addElement('select', 'navmethod', get_string('navmethod', 'quiz'),
|
|
|
|
quiz_get_navigation_options());
|
|
|
|
$mform->addHelpButton('navmethod', 'navmethod', 'quiz');
|
|
|
|
$mform->setAdvanced('navmethod', $quizconfig->navmethod_adv);
|
|
|
|
$mform->setDefault('navmethod', $quizconfig->navmethod);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('header', 'interactionhdr', get_string('questionbehaviour', 'quiz'));
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Shuffle within questions.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('selectyesno', 'shuffleanswers', get_string('shufflewithin', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('shuffleanswers', 'shufflewithin', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('shuffleanswers', $quizconfig->shuffleanswers_adv);
|
2008-08-26 01:05:01 +00:00
|
|
|
$mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// How questions behave (question behaviour).
|
2011-02-04 15:47:52 +00:00
|
|
|
if (!empty($this->current->preferredbehaviour)) {
|
|
|
|
$currentbehaviour = $this->current->preferredbehaviour;
|
2011-02-03 18:06:10 +00:00
|
|
|
} else {
|
|
|
|
$currentbehaviour = '';
|
|
|
|
}
|
|
|
|
$behaviours = question_engine::get_behaviour_options($currentbehaviour);
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('select', 'preferredbehaviour',
|
|
|
|
get_string('howquestionsbehave', 'question'), $behaviours);
|
2011-02-04 15:47:52 +00:00
|
|
|
$mform->addHelpButton('preferredbehaviour', 'howquestionsbehave', 'question');
|
2011-05-12 18:58:50 +01:00
|
|
|
$mform->setDefault('preferredbehaviour', $quizconfig->preferredbehaviour);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Each attempt builds on last.
|
|
|
|
$mform->addElement('selectyesno', 'attemptonlast',
|
|
|
|
get_string('eachattemptbuildsonthelast', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('attemptonlast', 'eachattemptbuildsonthelast', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('attemptonlast', $quizconfig->attemptonlast_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
|
|
|
|
$mform->disabledIf('attemptonlast', 'attempts', 'eq', 1);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('header', 'reviewoptionshdr',
|
|
|
|
get_string('reviewoptionsheading', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('reviewoptionshdr', 'reviewoptionsheading', 'quiz');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Review options.
|
|
|
|
$this->add_review_options_group($mform, $quizconfig, 'during',
|
2012-04-02 16:13:29 +01:00
|
|
|
mod_quiz_display_options::DURING, true);
|
2011-05-13 00:33:44 +01:00
|
|
|
$this->add_review_options_group($mform, $quizconfig, 'immediately',
|
|
|
|
mod_quiz_display_options::IMMEDIATELY_AFTER);
|
|
|
|
$this->add_review_options_group($mform, $quizconfig, 'open',
|
|
|
|
mod_quiz_display_options::LATER_WHILE_OPEN);
|
|
|
|
$this->add_review_options_group($mform, $quizconfig, 'closed',
|
|
|
|
mod_quiz_display_options::AFTER_CLOSE);
|
2011-02-03 18:06:10 +00:00
|
|
|
|
|
|
|
foreach ($behaviours as $behaviour => $notused) {
|
|
|
|
$unusedoptions = question_engine::get_behaviour_unused_display_options($behaviour);
|
|
|
|
foreach ($unusedoptions as $unusedoption) {
|
|
|
|
$mform->disabledIf($unusedoption . 'during', 'preferredbehaviour',
|
|
|
|
'eq', $behaviour);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$mform->disabledIf('attemptduring', 'preferredbehaviour',
|
|
|
|
'neq', 'wontmatch');
|
|
|
|
$mform->disabledIf('overallfeedbackduring', 'preferredbehaviour',
|
|
|
|
'neq', 'wontmatch');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('header', 'display', get_string('display', 'form'));
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Show user picture.
|
|
|
|
$mform->addElement('selectyesno', 'showuserpicture',
|
|
|
|
get_string('showuserpicture', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('showuserpicture', 'showuserpicture', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('showuserpicture', $quizconfig->showuserpicture_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('showuserpicture', $quizconfig->showuserpicture);
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Overall decimal points.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$options = array();
|
|
|
|
for ($i = 0; $i <= QUIZ_MAX_DECIMAL_OPTION; $i++) {
|
|
|
|
$options[$i] = $i;
|
|
|
|
}
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('select', 'decimalpoints', get_string('decimalplaces', 'quiz'),
|
|
|
|
$options);
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('decimalpoints', 'decimalplaces', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('decimalpoints', $quizconfig->decimalpoints_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('decimalpoints', $quizconfig->decimalpoints);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Question decimal points.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$options = array(-1 => get_string('sameasoverall', 'quiz'));
|
|
|
|
for ($i = 0; $i <= QUIZ_MAX_Q_DECIMAL_OPTION; $i++) {
|
|
|
|
$options[$i] = $i;
|
|
|
|
}
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('select', 'questiondecimalpoints',
|
|
|
|
get_string('decimalplacesquestion', 'quiz'), $options);
|
2011-05-12 00:30:25 +01:00
|
|
|
$mform->addHelpButton('questiondecimalpoints', 'decimalplacesquestion', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('questiondecimalpoints', $quizconfig->questiondecimalpoints_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('questiondecimalpoints', $quizconfig->questiondecimalpoints);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// Show blocks during quiz attempt.
|
2010-05-21 03:15:48 +00:00
|
|
|
$mform->addElement('selectyesno', 'showblocks', get_string('showblocks', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('showblocks', 'showblocks', 'quiz');
|
2010-05-21 03:15:48 +00:00
|
|
|
$mform->setAdvanced('showblocks', $quizconfig->showblocks_adv);
|
|
|
|
$mform->setDefault('showblocks', $quizconfig->showblocks);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('header', 'security', get_string('extraattemptrestrictions', 'quiz'));
|
|
|
|
|
2012-01-31 14:39:23 -05:00
|
|
|
// Require password to begin quiz attempt.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('passwordunmask', 'quizpassword', get_string('requirepassword', 'quiz'));
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->setType('quizpassword', PARAM_TEXT);
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('quizpassword', 'requirepassword', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('quizpassword', $quizconfig->password_adv);
|
2008-08-26 01:05:01 +00:00
|
|
|
$mform->setDefault('quizpassword', $quizconfig->password);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// IP address.
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->addElement('text', 'subnet', get_string('requiresubnet', 'quiz'));
|
2007-05-08 16:11:58 +00:00
|
|
|
$mform->setType('subnet', PARAM_TEXT);
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('subnet', 'requiresubnet', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('subnet', $quizconfig->subnet_adv);
|
2008-08-26 01:05:01 +00:00
|
|
|
$mform->setDefault('subnet', $quizconfig->subnet);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
// Enforced time delay between quiz attempts.
|
|
|
|
$mform->addElement('duration', 'delay1', get_string('delay1st2nd', 'quiz'),
|
|
|
|
array('optional' => true));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('delay1', 'delay1st2nd', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('delay1', $quizconfig->delay1_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('delay1', $quizconfig->delay1);
|
|
|
|
$mform->disabledIf('delay1', 'attempts', 'eq', 1);
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('duration', 'delay2', get_string('delaylater', 'quiz'),
|
|
|
|
array('optional' => true));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('delay2', 'delaylater', 'quiz');
|
2009-06-30 16:55:56 +00:00
|
|
|
$mform->setAdvanced('delay2', $quizconfig->delay2_adv);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
$mform->setDefault('delay2', $quizconfig->delay2);
|
|
|
|
$mform->disabledIf('delay2', 'attempts', 'eq', 1);
|
|
|
|
$mform->disabledIf('delay2', 'attempts', 'eq', 2);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// Browser security choices.
|
2011-10-06 20:15:01 +01:00
|
|
|
$mform->addElement('select', 'browsersecurity', get_string('browsersecurity', 'quiz'),
|
2011-10-06 18:58:33 +01:00
|
|
|
quiz_access_manager::get_browser_security_choices());
|
2011-10-06 20:15:01 +01:00
|
|
|
$mform->addHelpButton('browsersecurity', 'browsersecurity', 'quiz');
|
|
|
|
$mform->setAdvanced('browsersecurity', $quizconfig->browsersecurity_adv);
|
|
|
|
$mform->setDefault('browsersecurity', $quizconfig->browsersecurity);
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
|
2011-10-05 11:47:37 +01:00
|
|
|
// Any other rule plugins.
|
|
|
|
quiz_access_manager::add_settings_form_fields($this, $mform);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2007-01-08 13:58:42 +00:00
|
|
|
$mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'quiz'));
|
MDL-21695 quiz: deprecated setHelpButton() and old_help_icon() replaced with new calls
Some help icons dropped without replacement as suggested by Helen, the
Help Writer. Some strings moved to core_question.
AMOS BEGIN
HLP quiz/timelimit.html,[timelimit_help,mod_quiz]
HLP quiz/grademethod.html,[grademethod_help,mod_quiz]
HLP quiz/questionsperpage.html,[newpage_help,mod_quiz]
HLP quiz/shufflewithin.html,[shufflewithin_help,mod_quiz]
HLP quiz/penaltyscheme.html,[penaltyscheme_help,mod_quiz]
HLP quiz/repeatattempts.html,[eachattemptbuildsonthelast_help,mod_quiz]
HLP quiz/reviewoptions.html,[reviewoptionsheading_help,mod_quiz]
HLP quiz/showuserpicture.html,[showuserpicture_help,mod_quiz]
HLP quiz/decimalpoints.html,[decimalplaces_help,mod_quiz]
HLP quiz/decimalplacesquestion.html,[decimalplacesquestion_help,mod_quiz]
HLP quiz/requirepassword.html,[requirepassword_help,mod_quiz]
HLP quiz/requiresubnet.html,[requiresubnet_help,mod_quiz]
HLP quiz/timedelay1.html,[delay1st2nd_help,mod_quiz]
HLP quiz/timedelay2.html,[delaylater_help,mod_quiz]
HLP quiz/overallfeedback.html,[overallfeedback_help,mod_quiz]
HLP quiz_statistics/negcovar.html,[negcovar_help,quiz_statistics]
MOV [penaltyfactor,mod_quiz],[penaltyfactor,core_question]
MOV [penaltyfactor_help,mod_quiz],[penaltyfactor_help,core_question]
HLP quiz/penalty.html,[penaltyfactor_help,core_question]
AMOS END
2010-08-02 20:56:15 +00:00
|
|
|
$mform->addHelpButton('overallfeedbackhdr', 'overallfeedback', 'quiz');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-02-04 15:47:52 +00:00
|
|
|
if (isset($this->current->grade)) {
|
|
|
|
$needwarning = $this->current->grade === 0;
|
2009-03-18 07:33:56 +00:00
|
|
|
} else {
|
2011-02-04 15:47:52 +00:00
|
|
|
$needwarning = $quizconfig->maximumgrade == 0;
|
2009-03-18 07:33:56 +00:00
|
|
|
}
|
|
|
|
if ($needwarning) {
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('static', 'nogradewarning', '',
|
|
|
|
get_string('nogradewarning', 'quiz'));
|
2009-03-18 07:33:56 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addElement('static', 'gradeboundarystatic1',
|
|
|
|
get_string('gradeboundary', 'quiz'), '100%');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2009-03-18 07:33:56 +00:00
|
|
|
$repeatarray = array();
|
2011-04-11 14:40:04 +01:00
|
|
|
$repeatedoptions = array();
|
2012-03-18 18:39:37 +01:00
|
|
|
$repeatarray[] = $mform->createElement('editor', 'feedbacktext',
|
2013-02-18 18:13:51 +00:00
|
|
|
get_string('feedback', 'quiz'), array('rows' => 3), array('maxfiles' => EDITOR_UNLIMITED_FILES,
|
|
|
|
'noclean' => true, 'context' => $this->context, 'collapsed' => 1));
|
2012-03-18 18:39:37 +01:00
|
|
|
$repeatarray[] = $mform->createElement('text', 'feedbackboundaries',
|
2011-05-13 00:33:44 +01:00
|
|
|
get_string('gradeboundary', 'quiz'), array('size' => 10));
|
2011-04-11 14:40:04 +01:00
|
|
|
$repeatedoptions['feedbacktext']['type'] = PARAM_RAW;
|
|
|
|
$repeatedoptions['feedbackboundaries']['type'] = PARAM_RAW;
|
2006-12-19 07:03:08 +00:00
|
|
|
|
|
|
|
if (!empty($this->_instance)) {
|
2011-04-11 14:40:04 +01:00
|
|
|
$this->_feedbacks = $DB->get_records('quiz_feedback',
|
|
|
|
array('quizid' => $this->_instance), 'mingrade DESC');
|
2006-12-19 07:03:08 +00:00
|
|
|
} else {
|
|
|
|
$this->_feedbacks = array();
|
|
|
|
}
|
|
|
|
$numfeedbacks = max(count($this->_feedbacks) * 1.5, 5);
|
2006-12-28 16:44:47 +00:00
|
|
|
|
2011-04-11 14:40:04 +01:00
|
|
|
$nextel = $this->repeat_elements($repeatarray, $numfeedbacks - 1,
|
|
|
|
$repeatedoptions, 'boundary_repeats', 'boundary_add_fields', 3,
|
2007-10-09 15:44:06 +00:00
|
|
|
get_string('addmoreoverallfeedbacks', 'quiz'), true);
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// Put some extra elements in before the button.
|
2012-03-18 18:39:37 +01:00
|
|
|
$mform->insertElementBefore($mform->createElement('editor',
|
2013-02-18 18:13:51 +00:00
|
|
|
"feedbacktext[$nextel]", get_string('feedback', 'quiz'), array('rows' => 3),
|
2011-04-11 14:40:04 +01:00
|
|
|
array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true,
|
2013-02-18 18:13:51 +00:00
|
|
|
'context' => $this->context, 'collapsed' => 1)),
|
2011-04-11 14:40:04 +01:00
|
|
|
'boundary_add_fields');
|
2012-03-18 18:39:37 +01:00
|
|
|
$mform->insertElementBefore($mform->createElement('static',
|
2011-04-11 14:40:04 +01:00
|
|
|
'gradeboundarystatic2', get_string('gradeboundary', 'quiz'), '0%'),
|
|
|
|
'boundary_add_fields');
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2009-03-18 07:33:56 +00:00
|
|
|
// Add the disabledif rules. We cannot do this using the $repeatoptions parameter to
|
2011-07-06 14:19:25 +01:00
|
|
|
// repeat_elements because we don't want to dissable the first feedbacktext.
|
2009-03-18 07:33:56 +00:00
|
|
|
for ($i = 0; $i < $nextel; $i++) {
|
|
|
|
$mform->disabledIf('feedbackboundaries[' . $i . ']', 'grade', 'eq', 0);
|
|
|
|
$mform->disabledIf('feedbacktext[' . ($i + 1) . ']', 'grade', 'eq', 0);
|
|
|
|
}
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2009-04-21 08:57:20 +00:00
|
|
|
$this->standard_coursemodule_elements();
|
quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.
* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.
* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3
* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.
* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.
* Improve some field labels.
* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
|
|
|
|
2012-10-16 10:33:03 +01:00
|
|
|
// Check and act on whether setting outcomes is considered an advanced setting.
|
|
|
|
$mform->setAdvanced('modoutcomes', !empty($quizconfig->outcomes_adv));
|
|
|
|
|
2013-03-05 22:58:51 +00:00
|
|
|
// The standard_coursemodule_elements method sets this to 100, but the
|
|
|
|
// quiz has its own setting, so use that.
|
|
|
|
$mform->setDefault('grade', $quizconfig->maximumgrade);
|
|
|
|
|
2012-05-04 12:40:21 +01:00
|
|
|
// -------------------------------------------------------------------------------
|
2006-12-19 07:03:08 +00:00
|
|
|
$this->add_action_buttons();
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2012-04-02 16:13:29 +01:00
|
|
|
protected function add_review_options_group($mform, $quizconfig, $whenname,
|
|
|
|
$when, $withhelp = false) {
|
|
|
|
global $OUTPUT;
|
|
|
|
|
2011-02-03 18:06:10 +00:00
|
|
|
$group = array();
|
2012-04-02 16:13:29 +01:00
|
|
|
foreach (self::$reviewfields as $field => $string) {
|
|
|
|
list($identifier, $component) = $string;
|
|
|
|
|
|
|
|
$label = get_string($identifier, $component);
|
|
|
|
if ($withhelp) {
|
|
|
|
$label .= ' ' . $OUTPUT->help_icon($identifier, $component);
|
|
|
|
}
|
|
|
|
|
2011-02-03 18:06:10 +00:00
|
|
|
$group[] = $mform->createElement('checkbox', $field . $whenname, '', $label);
|
|
|
|
}
|
2011-05-13 00:33:44 +01:00
|
|
|
$mform->addGroup($group, $whenname . 'optionsgrp',
|
|
|
|
get_string('review' . $whenname, 'quiz'), null, false);
|
2011-02-03 18:06:10 +00:00
|
|
|
|
|
|
|
foreach (self::$reviewfields as $field => $notused) {
|
2011-02-10 18:32:04 +00:00
|
|
|
$cfgfield = 'review' . $field;
|
|
|
|
if ($quizconfig->$cfgfield & $when) {
|
2011-02-03 18:06:10 +00:00
|
|
|
$mform->setDefault($field . $whenname, 1);
|
|
|
|
} else {
|
|
|
|
$mform->setDefault($field . $whenname, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->disabledIf('correctness' . $whenname, 'attempt' . $whenname);
|
|
|
|
$mform->disabledIf('specificfeedback' . $whenname, 'attempt' . $whenname);
|
|
|
|
$mform->disabledIf('generalfeedback' . $whenname, 'attempt' . $whenname);
|
|
|
|
$mform->disabledIf('rightanswer' . $whenname, 'attempt' . $whenname);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function preprocessing_review_settings(&$toform, $whenname, $when) {
|
|
|
|
foreach (self::$reviewfields as $field => $notused) {
|
|
|
|
$fieldname = 'review' . $field;
|
|
|
|
if (array_key_exists($fieldname, $toform)) {
|
|
|
|
$toform[$field . $whenname] = $toform[$fieldname] & $when;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-28 11:40:15 +01:00
|
|
|
public function data_preprocessing(&$toform) {
|
2011-02-03 18:06:10 +00:00
|
|
|
if (isset($toform['grade'])) {
|
2011-05-13 00:33:44 +01:00
|
|
|
// Convert to a real number, so we don't get 0.0000.
|
|
|
|
$toform['grade'] = $toform['grade'] + 0;
|
2009-03-18 07:33:56 +00:00
|
|
|
}
|
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
if (count($this->_feedbacks)) {
|
|
|
|
$key = 0;
|
2011-05-13 00:33:44 +01:00
|
|
|
foreach ($this->_feedbacks as $feedback) {
|
2010-08-10 09:56:48 +00:00
|
|
|
$draftid = file_get_submitted_draft_itemid('feedbacktext['.$key.']');
|
2011-02-03 18:06:10 +00:00
|
|
|
$toform['feedbacktext['.$key.']']['text'] = file_prepare_draft_area(
|
2012-05-04 12:40:21 +01:00
|
|
|
$draftid, // Draftid.
|
|
|
|
$this->context->id, // Context.
|
|
|
|
'mod_quiz', // Component.
|
|
|
|
'feedback', // Filarea.
|
|
|
|
!empty($feedback->id) ? (int) $feedback->id : null, // Itemid.
|
2010-08-10 09:56:48 +00:00
|
|
|
null,
|
2012-05-04 12:40:21 +01:00
|
|
|
$feedback->feedbacktext // Text.
|
2010-08-10 09:56:48 +00:00
|
|
|
);
|
2011-02-03 18:06:10 +00:00
|
|
|
$toform['feedbacktext['.$key.']']['format'] = $feedback->feedbacktextformat;
|
|
|
|
$toform['feedbacktext['.$key.']']['itemid'] = $draftid;
|
2010-08-10 09:56:48 +00:00
|
|
|
|
2011-03-04 17:48:13 +00:00
|
|
|
if ($toform['grade'] == 0) {
|
|
|
|
// When a quiz is un-graded, there can only be one lot of
|
|
|
|
// feedback. If the quiz previously had a maximum grade and
|
|
|
|
// several lots of feedback, we must now avoid putting text
|
|
|
|
// into input boxes that are disabled, but which the
|
|
|
|
// validation will insist are blank.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
if ($feedback->mingrade > 0) {
|
2011-05-13 00:33:44 +01:00
|
|
|
$toform['feedbackboundaries['.$key.']'] =
|
|
|
|
(100.0 * $feedback->mingrade / $toform['grade']) . '%';
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
$key++;
|
|
|
|
}
|
|
|
|
}
|
2008-08-13 03:17:49 +00:00
|
|
|
|
2011-02-03 18:06:10 +00:00
|
|
|
if (isset($toform['timelimit'])) {
|
|
|
|
$toform['timelimitenable'] = $toform['timelimit'] > 0;
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 00:33:44 +01:00
|
|
|
$this->preprocessing_review_settings($toform, 'during',
|
|
|
|
mod_quiz_display_options::DURING);
|
|
|
|
$this->preprocessing_review_settings($toform, 'immediately',
|
|
|
|
mod_quiz_display_options::IMMEDIATELY_AFTER);
|
|
|
|
$this->preprocessing_review_settings($toform, 'open',
|
|
|
|
mod_quiz_display_options::LATER_WHILE_OPEN);
|
|
|
|
$this->preprocessing_review_settings($toform, 'closed',
|
|
|
|
mod_quiz_display_options::AFTER_CLOSE);
|
2011-02-03 18:06:10 +00:00
|
|
|
$toform['attemptduring'] = true;
|
|
|
|
$toform['overallfeedbackduring'] = false;
|
|
|
|
|
|
|
|
// Password field - different in form to stop browsers that remember
|
|
|
|
// passwords from getting confused.
|
|
|
|
if (isset($toform['password'])) {
|
|
|
|
$toform['quizpassword'] = $toform['password'];
|
|
|
|
unset($toform['password']);
|
2007-04-27 08:33:11 +00:00
|
|
|
}
|
2011-10-05 12:55:22 +01:00
|
|
|
|
|
|
|
// Load any settings belonging to the access rules.
|
|
|
|
if (!empty($toform['instance'])) {
|
|
|
|
$accesssettings = quiz_access_manager::load_settings($toform['instance']);
|
|
|
|
foreach ($accesssettings as $name => $value) {
|
|
|
|
$toform[$name] = $value;
|
|
|
|
}
|
|
|
|
}
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-12-19 07:03:08 +00:00
|
|
|
|
2011-03-23 16:22:25 +00:00
|
|
|
public function validation($data, $files) {
|
2007-11-23 22:15:07 +00:00
|
|
|
$errors = parent::validation($data, $files);
|
2007-08-02 10:38:18 +00:00
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
// Check open and close times are consistent.
|
2011-05-13 00:33:44 +01:00
|
|
|
if ($data['timeopen'] != 0 && $data['timeclose'] != 0 &&
|
|
|
|
$data['timeclose'] < $data['timeopen']) {
|
2006-12-19 07:03:08 +00:00
|
|
|
$errors['timeclose'] = get_string('closebeforeopen', 'quiz');
|
|
|
|
}
|
|
|
|
|
2012-06-07 19:17:07 +01:00
|
|
|
// Check that the grace period is not too short.
|
|
|
|
if ($data['overduehandling'] == 'graceperiod') {
|
|
|
|
$graceperiodmin = get_config('quiz', 'graceperiodmin');
|
|
|
|
if ($data['graceperiod'] <= $graceperiodmin) {
|
|
|
|
$errors['graceperiod'] = get_string('graceperiodtoosmall', 'quiz', format_time($graceperiodmin));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
// Check the boundary value is a number or a percentage, and in range.
|
|
|
|
$i = 0;
|
|
|
|
while (!empty($data['feedbackboundaries'][$i] )) {
|
|
|
|
$boundary = trim($data['feedbackboundaries'][$i]);
|
2012-12-11 17:59:31 +00:00
|
|
|
if (strlen($boundary) > 0) {
|
|
|
|
if ($boundary[strlen($boundary) - 1] == '%') {
|
|
|
|
$boundary = trim(substr($boundary, 0, -1));
|
|
|
|
if (is_numeric($boundary)) {
|
|
|
|
$boundary = $boundary * $data['grade'] / 100.0;
|
|
|
|
} else {
|
|
|
|
$errors["feedbackboundaries[$i]"] =
|
|
|
|
get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
|
|
|
|
}
|
|
|
|
} else if (!is_numeric($boundary)) {
|
2011-05-13 00:33:44 +01:00
|
|
|
$errors["feedbackboundaries[$i]"] =
|
|
|
|
get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (is_numeric($boundary) && $boundary <= 0 || $boundary >= $data['grade'] ) {
|
2011-05-13 00:33:44 +01:00
|
|
|
$errors["feedbackboundaries[$i]"] =
|
|
|
|
get_string('feedbackerrorboundaryoutofrange', 'quiz', $i + 1);
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
2011-05-13 00:33:44 +01:00
|
|
|
if (is_numeric($boundary) && $i > 0 &&
|
|
|
|
$boundary >= $data['feedbackboundaries'][$i - 1]) {
|
|
|
|
$errors["feedbackboundaries[$i]"] =
|
|
|
|
get_string('feedbackerrororder', 'quiz', $i + 1);
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
$data['feedbackboundaries'][$i] = $boundary;
|
|
|
|
$i += 1;
|
|
|
|
}
|
|
|
|
$numboundaries = $i;
|
|
|
|
|
|
|
|
// Check there is nothing in the remaining unused fields.
|
2009-03-18 07:33:56 +00:00
|
|
|
if (!empty($data['feedbackboundaries'])) {
|
|
|
|
for ($i = $numboundaries; $i < count($data['feedbackboundaries']); $i += 1) {
|
2011-05-13 00:33:44 +01:00
|
|
|
if (!empty($data['feedbackboundaries'][$i] ) &&
|
|
|
|
trim($data['feedbackboundaries'][$i] ) != '') {
|
|
|
|
$errors["feedbackboundaries[$i]"] =
|
|
|
|
get_string('feedbackerrorjunkinboundary', 'quiz', $i + 1);
|
2009-03-18 07:33:56 +00:00
|
|
|
}
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-18 07:33:56 +00:00
|
|
|
for ($i = $numboundaries + 1; $i < count($data['feedbacktext']); $i += 1) {
|
2011-05-13 00:33:44 +01:00
|
|
|
if (!empty($data['feedbacktext'][$i]['text']) &&
|
|
|
|
trim($data['feedbacktext'][$i]['text'] ) != '') {
|
|
|
|
$errors["feedbacktext[$i]"] =
|
|
|
|
get_string('feedbackerrorjunkinfeedback', 'quiz', $i + 1);
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-02 10:38:18 +00:00
|
|
|
|
2013-04-17 14:24:38 +01:00
|
|
|
// Any other rule plugins.
|
|
|
|
$errors = quiz_access_manager::validate_settings_form_fields($errors, $data, $files, $this);
|
|
|
|
|
2008-06-01 17:53:25 +00:00
|
|
|
return $errors;
|
2007-05-08 16:11:58 +00:00
|
|
|
}
|
2006-12-19 07:03:08 +00:00
|
|
|
}
|