From 18b5df9155fbb88d01f5555bc9ece0621d27fab0 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 20 Apr 2009 19:29:15 +0000 Subject: [PATCH] MDL-18910 normalised module intro and introformat --- mod/forum/db/upgrade.php | 8 ++++++++ mod/forum/version.php | 2 +- mod/quiz/accessrules.php | 2 +- mod/quiz/db/install.xml | 9 +++++---- mod/quiz/db/upgrade.php | 16 ++++++++++++++++ mod/quiz/version.php | 4 ++-- mod/quiz/view.php | 3 ++- 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index d95bc90a1ea..2ff19731d6d 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -233,6 +233,14 @@ function xmldb_forum_upgrade($oldversion) { upgrade_mod_savepoint($result, 2009042003, 'forum'); } + if ($result && $oldversion < 2009042004) { + /// set format to current + $DB->set_field('forum', 'introformat', FORMAT_MOODLE, array()); + + /// quiz savepoint reached + upgrade_mod_savepoint($result, 2009042004, 'forum'); + } + return $result; } diff --git a/mod/forum/version.php b/mod/forum/version.php index 4207a942707..11567b9981e 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2009042003; +$module->version = 2009042004; $module->requires = 2009041700; // Requires this Moodle version $module->cron = 60; diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index 0d41aa593db..7d74f41b816 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -623,7 +623,7 @@ class password_access_rule extends quiz_access_rule_base { if (trim(strip_tags($this->_quiz->intro))) { $formatoptions = new stdClass; $formatoptions->noclean = true; - $output .= print_box(format_text($this->_quiz->intro, FORMAT_MOODLE, $formatoptions), + $output .= print_box(format_text($this->_quiz->intro, $this->_quiz->introformat, $formatoptions), 'generalbox', 'intro', true); } $output .= print_box_start('generalbox', 'passwordbox', true); diff --git a/mod/quiz/db/install.xml b/mod/quiz/db/install.xml index 1f73ef8658f..c07a2c851c2 100755 --- a/mod/quiz/db/install.xml +++ b/mod/quiz/db/install.xml @@ -1,5 +1,5 @@ - @@ -9,8 +9,9 @@ - - + + + @@ -71,7 +72,7 @@ - + diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index a81a5ecc034..9b3444f4e11 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -276,6 +276,22 @@ function xmldb_quiz_upgrade($oldversion) { upgrade_mod_savepoint($result, 2009031001, 'quiz'); } + if ($result && $oldversion < 2009042000) { + + /// Define field introformat to be added to quiz + $table = new xmldb_table('quiz'); + $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro'); + + /// Launch add field introformat + $dbman->add_field($table, $field); + + /// set format to current + $DB->set_field('quiz', 'introformat', FORMAT_MOODLE, array()); + + /// quiz savepoint reached + upgrade_mod_savepoint($result, 2009042000, 'quiz'); + } + return $result; } diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 8b8359c7a40..f10172d34e2 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,8 +5,8 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2009031001; // The (date) version of this module -$module->requires = 2008072401; // Requires this Moodle version +$module->version = 2009042000; // The (date) version of this module +$module->requires = 2009041700; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? ?> diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 84f0e68afb4..1412aa99996 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -97,7 +97,8 @@ if (trim(strip_tags($quiz->intro))) { $formatoptions->noclean = true; $formatoptions->para = false; - print_box(format_text($quiz->intro, FORMAT_MOODLE, $formatoptions), 'generalbox', 'intro'); + $formatoptions->noclean = true; + print_box(format_text($quiz->intro, $quiz->introformat, $formatoptions), 'generalbox', 'intro'); } /// Display information about this quiz.