]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18910 normalised module intro and introformat
authorskodak <skodak>
Mon, 20 Apr 2009 19:29:15 +0000 (19:29 +0000)
committerskodak <skodak>
Mon, 20 Apr 2009 19:29:15 +0000 (19:29 +0000)
mod/forum/db/upgrade.php
mod/forum/version.php
mod/quiz/accessrules.php
mod/quiz/db/install.xml
mod/quiz/db/upgrade.php
mod/quiz/version.php
mod/quiz/view.php

index d95bc90a1ea601994b3c337fc9a50cea7afa7dbe..2ff19731d6d7d0a0c427159a5ade9f1b3d548e3c 100644 (file)
@@ -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;
 }
 
index 4207a9427076f8a5c1db1e87bd7b6eb54bce20cb..11567b9981e2dc313ac1bea7638d72c393a26db2 100644 (file)
@@ -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;
 
index 0d41aa593db3353ebf2217a6e13165a9eed50f17..7d74f41b81655df22e9de4c38ead97e2fe67996f 100644 (file)
@@ -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);
index 1f73ef8658f2912906fd9e4692c48a0d8918bb4a..c07a2c851c2fd06f4da21e80fe0a1faa1d021bcb 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/quiz/db" VERSION="20090107" COMMENT="XMLDB file for Moodle mod/quiz"
+<XMLDB PATH="mod/quiz/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/quiz"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
 >
@@ -9,8 +9,9 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references course.id." PREVIOUS="id" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The name of this quiz." PREVIOUS="course" NEXT="intro"/>
-        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The introductory text desplayed on the view.php page." PREVIOUS="name" NEXT="timeopen"/>
-        <FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Time at which students may start attempting this quiz." PREVIOUS="intro" NEXT="timeclose"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The introductory text desplayed on the view.php page." PREVIOUS="name" NEXT="introformat"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="timeopen"/>
+        <FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Time at which students may start attempting this quiz." PREVIOUS="introformat" NEXT="timeclose"/>
         <FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Time by which students must have completed their attempt." PREVIOUS="timeopen" NEXT="optionflags"/>
         <FIELD NAME="optionflags" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="This stores the adaptive mode setting for this quiz." PREVIOUS="timeclose" NEXT="penaltyscheme"/>
         <FIELD NAME="penaltyscheme" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Stores the apply penaties setting." PREVIOUS="optionflags" NEXT="attempts"/>
@@ -71,7 +72,7 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="quiz"/>
         <FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references quiz.id." PREVIOUS="id" NEXT="userid"/>
         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references user.id." PREVIOUS="quiz" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="The overall grade from the quiz. Not affected by overrides in the gradebook." DECIMALS="5" PREVIOUS="userid" NEXT="timemodified"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" COMMENT="The overall grade from the quiz. Not affected by overrides in the gradebook." PREVIOUS="userid" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="The last time this grade changed." PREVIOUS="grade"/>
       </FIELDS>
       <KEYS>
index a81a5ecc03441519b51e85a485dd33ac8411b869..9b3444f4e11db28a9afaf0a69fbb79f464b21494 100644 (file)
@@ -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;
 }
 
index 8b8359c7a402cf0a1a6d33d317eca2a65dbff890..f10172d34e2300cac4591c6c02617dd651472b3f 100644 (file)
@@ -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)?
 
 ?>
index 84f0e68afb4e046daa8cbb71a700985b75422ad0..1412aa99996fba690d0261abc15f41034ff1ca12 100644 (file)
@@ -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.