From 4c2275d557757ed854c65d6a80176de9bde5fafc Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Thu, 23 Nov 2006 07:52:54 +0000 Subject: [PATCH] fix for MDL-7395, adding capaiblity mod/quiz:ignoretimelimits for quiz takers with disability. --- lang/en_utf8/quiz.php | 1 + lib/db/upgrade.php | 2 +- mod/quiz/attempt.php | 4 +++- mod/quiz/db/access.php | 6 ++++++ mod/quiz/version.php | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index b7336bb63d..818a962e5f 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -379,6 +379,7 @@ $string['questiontypesetupoptions'] = 'Setup options for question types:'; $string['quiz:attempt'] = 'Attempt quizzes'; $string['quiz:deleteattempts'] = 'Delete quiz attempts'; $string['quiz:grade'] = 'Grade quizzes manually'; +$string['quiz:ignoretimelimits'] = 'Ignores time limit on quizs'; $string['quiz:manage'] = 'Manage quizzes'; $string['quiz:preview'] = 'Preview quizzes'; $string['quiz:view'] = 'View quiz information'; diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index c0e34de977..53062bcb3b 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -25,7 +25,7 @@ function xmldb_main_upgrade($oldversion=0) { if ($oldversion < 2006100401) { /// Only for those tracking Moodle 1.7 dev, others will have these dropped in moodle_install_roles() - if (!empty($CFG->rolesactive)) { + if (!empty($CFG->rolesactive)) { drop_table(new XMLDBTable('user_students')); drop_table(new XMLDBTable('user_teachers')); drop_table(new XMLDBTable('user_coursecreators')); diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 64ca659e55..5ce5199659 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -556,7 +556,9 @@ $secondsleft = 999999999999; } // If time limit is set include floating timer. - if ($quiz->timelimit > 0) { + // MDL-7495, no timer for users with disability + + if ($quiz->timelimit > 0 && !has_capability('mod/quiz:ignoretimelimits', $context)) { $timesincestart = time() - $attempt->timestart; $timerstartvalue = min($quiz->timelimit*60 - $timesincestart, $secondsleft); diff --git a/mod/quiz/db/access.php b/mod/quiz/db/access.php index b3abe03ebd..cba0de1c2f 100644 --- a/mod/quiz/db/access.php +++ b/mod/quiz/db/access.php @@ -93,6 +93,12 @@ $mod_quiz_capabilities = array( 'coursecreator' => CAP_ALLOW, 'admin' => CAP_ALLOW ) + ), + + 'mod/quiz:ignoretimelimits' => array( + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array() ) ); diff --git a/mod/quiz/version.php b/mod/quiz/version.php index d1f9bad56c..836145a874 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 = 2006091901; // The (date) version of this module +$module->version = 2006112300; // The (date) version of this module $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? -- 2.39.5