From bb4598fcf7156b999a1c83eceae1887cbca7f01a Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 2 Jul 2007 06:48:50 +0000 Subject: [PATCH] Quiz time limit field: Store it in the DB as an int(10), like the other time-related columns. Also, include the unit (minutes) in the forum label. --- lang/en_utf8/quiz.php | 1 + mod/quiz/db/install.xml | 2 +- mod/quiz/db/upgrade.php | 11 +++++++++++ mod/quiz/mod_form.php | 2 +- mod/quiz/version.php | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index 1de91fe568..8cf4ff1591 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -528,6 +528,7 @@ $string['timecompleted'] = 'Completed'; $string['timedelay'] = 'You are not allowed to do the quiz since you have not passed the time delay before attempting another quiz'; $string['timeleft'] = 'Time Remaining'; $string['timelimit'] = 'Time limit'; +$string['timelimitmin'] = 'Time limit (minutes)'; $string['timelimitexeeded'] = 'Sorry! Quiz time limit exceeded!'; $string['timestr'] = '%%H:%%M:%%S on %%d/%%m/%%y'; $string['timesup'] = 'Time is up!'; diff --git a/mod/quiz/db/install.xml b/mod/quiz/db/install.xml index f3e37aa0d8..84fdd25731 100755 --- a/mod/quiz/db/install.xml +++ b/mod/quiz/db/install.xml @@ -191,7 +191,7 @@ - + diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 5e2f04e2f8..5a4eabf730 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -55,6 +55,17 @@ function xmldb_quiz_upgrade($oldversion=0) { $db->debug = true; } + if ($result && $oldversion < 2007070200) { + + /// Changing precision of field timelimit on table quiz to (10) + $table = new XMLDBTable('quiz'); + $field = new XMLDBField('timelimit'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timemodified'); + + /// Launch change of precision for field timelimit + $result = $result && change_field_precision($table, $field); + } + return $result; } diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 4cb412b966..6b80a36aec 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -33,7 +33,7 @@ class mod_quiz_mod_form extends moodleform_mod { $timelimitgrp=array(); $timelimitgrp[] = &$mform->createElement('text', 'timelimit'); $timelimitgrp[] = &$mform->createElement('checkbox', 'timelimitenable', '', get_string('enable')); - $mform->addGroup($timelimitgrp, 'timelimitgrp', get_string("timelimit", "quiz"), array(' '), false); + $mform->addGroup($timelimitgrp, 'timelimitgrp', get_string('timelimitmin', 'quiz'), array(' '), false); $mform->setType('timelimit', PARAM_TEXT); $timelimitgrprules = array(); $timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client'); diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 40b6d1f6b3..d0f0a9c131 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,7 +5,7 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2007062600; // The (date) version of this module +$module->version = 2007070200; // The (date) version of this module $module->requires = 2007062401; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? -- 2.39.5