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

index d5feeb00297e97613e907ca9a317df17972f49d9..bee107fd75231ebeea0050b3266c855113b019b9 100644 (file)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/survey/db" VERSION="20060812" COMMENT="XMLDB file for Moodle mod/survey">
+<XMLDB PATH="mod/survey/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/survey"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
   <TABLES>
     <TABLE NAME="survey" COMMENT="Each record is one SURVEY module with its configuration" NEXT="survey_questions">
       <FIELDS>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="days" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="intro"/>
-        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="questions"/>
-        <FIELD NAME="questions" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="intro"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="intro text field format" PREVIOUS="intro" NEXT="questions"/>
+        <FIELD NAME="questions" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="introformat"/>
       </FIELDS>
       <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" />
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
       <INDEXES>
         <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
@@ -31,7 +35,7 @@
         <FIELD NAME="options" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="type"/>
       </FIELDS>
       <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" />
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
     </TABLE>
     <TABLE NAME="survey_answers" COMMENT="the answers to each questions filled by the users" PREVIOUS="survey_questions" NEXT="survey_analysis">
@@ -69,4 +73,4 @@
       </INDEXES>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index 18dde0c6365c267ed027314336b626e9c71d0ce9..d85ae54c4f5bacb7bce8bd9d15fa2e93c841d5c1 100644 (file)
@@ -28,6 +28,19 @@ function xmldb_survey_upgrade($oldversion) {
 
 //===== 1.9.0 upgrade line ======//
 
+    if ($result && $oldversion < 2009042002) {
+
+    /// Define field introformat to be added to survey
+        $table = new xmldb_table('survey');
+        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+    /// Conditionally launch add field introformat
+        $dbman->add_field($table, $field);
+
+    /// survey savepoint reached
+        upgrade_mod_savepoint($result, 2009042002, 'survey');
+    }
+
     return $result;
 }
 
index 51a67c370cc3cbb22b3f61edbc50a5c57d2df3bb..662eadcac810a9cb038af53cffd59a922ede5915 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2007101509;
-$module->requires = 2007101509;  // Requires this Moodle version
+$module->version  = 2009042002;
+$module->requires = 2009041700;  // Requires this Moodle version
 $module->cron     = 0;
 
 ?>
index 4fa6b05eee470025cc7d6193514456801e9abbff..e0f4558588b82627c924140d47d43252d274fa44 100644 (file)
@@ -80,7 +80,8 @@
 
         } else {
 
-            print_box(format_text($survey->intro), 'generalbox', 'intro');
+            $options = (object)array('noclean'=>true);
+            print_box(format_text($survey->intro, $survey->introformat, $options), 'generalbox', 'intro');
             print_spacer(30);
 
             $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));