]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18910 normalised module intro and introformat
authorskodak <skodak>
Mon, 20 Apr 2009 18:51:37 +0000 (18:51 +0000)
committerskodak <skodak>
Mon, 20 Apr 2009 18:51:37 +0000 (18:51 +0000)
15 files changed:
mod/assignment/db/upgrade.php
mod/choice/db/upgrade.php
mod/data/db/install.xml
mod/data/db/upgrade.php
mod/data/index.php
mod/data/version.php
mod/data/view.php
mod/feedback/backuplib.php
mod/feedback/db/install.xml
mod/feedback/db/upgrade.php
mod/feedback/lib.php
mod/feedback/mod_form.php
mod/feedback/restorelib.php
mod/feedback/version.php
mod/feedback/view.php

index 6d01ab6ac04121d02710d6c0fe570574595dc18d..a1c145a42f22da0b81d1dc1693331244831676cb 100644 (file)
@@ -149,7 +149,7 @@ function xmldb_assignment_upgrade($oldversion) {
 
     /// Rename field format on table assignment to introformat
         $table = new xmldb_table('assignment');
-        $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'description');
+        $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
 
     /// Launch rename field format
         $dbman->rename_field($table, $field, 'introformat');
index de45eccfcc8835c1473336a643dd6f1600995db6..2c7eb5f1ab5eadc80e9c9e26334f0c7ce59b78c1 100644 (file)
@@ -45,7 +45,7 @@ function xmldb_choice_upgrade($oldversion) {
 
     /// Rename field format on table choice to NEWNAMEGOESHERE
         $table = new xmldb_table('choice');
-        $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'text');
+        $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
 
     /// Launch rename field format
         $dbman->rename_field($table, $field, 'introformat');
index 079518a9ce7704f93bf6d7ed4e2c73b60a8c55cd..7920a2f46947a75f67815b20800a6f8cc739a72a 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/data/db" VERSION="20080226" COMMENT="XMLDB file for Moodle mod/data"
+<XMLDB PATH="mod/data/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/data"
     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" PREVIOUS="id" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="intro"/>
-        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="comments"/>
-        <FIELD NAME="comments" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="timeavailablefrom"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="comments"/>
+        <FIELD NAME="comments" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="timeavailablefrom"/>
         <FIELD NAME="timeavailablefrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="comments" NEXT="timeavailableto"/>
         <FIELD NAME="timeavailableto" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timeavailablefrom" NEXT="timeviewfrom"/>
         <FIELD NAME="timeviewfrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timeavailableto" NEXT="timeviewto"/>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index eccbde4de79bba3e4af24bebab2db127ad51dbb9..0847570abfd0e65eecb77857585a5999126801f3 100644 (file)
@@ -167,6 +167,19 @@ function xmldb_data_upgrade($oldversion) {
         upgrade_mod_savepoint($result, 2008112700, 'data');
     }
 
+    if ($result && $oldversion < 2009042000) {
+
+    /// Define field introformat to be added to data
+        $table = new xmldb_table('data');
+        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+    /// Launch add field introformat
+        $dbman->add_field($table, $field);
+
+    /// data savepoint reached
+        upgrade_mod_savepoint($result, 2009042000, 'data');
+    }
+
     return $result;
 }
 
index f4e325bc3a9cc29d9f31dfc164a0eab7e65b8507..93e9c2a145d1c87d202f3d95a4d199254db29713 100755 (executable)
                 }
                 $currentsection = $data->section;
             }
-            $row = array ($printsection, $link, format_text($data->intro, FORMAT_MOODLE, $options), $numrecords, $numunapprovedrecords);
+            $row = array ($printsection, $link, format_text($data->intro, $data->introformat, $options), $numrecords, $numunapprovedrecords);
 
         } else {
-            $row = array ($link, format_text($data->intro, FORMAT_MOODLE, $options), $numrecords, $numunapprovedrecords);
+            $row = array ($link, format_text($data->intro, $data->introformat, $options), $numrecords, $numunapprovedrecords);
         }
 
         if ($rss) {
index 7c61de22e8aa1e545b56965d9b91e0e8972f3b42..b40155e72f493cc81d2ccdd5e1fd0f1dc450358b 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2008112700;
-$module->requires = 2008080701;  // Requires this Moodle version
+$module->version  = 2009042000;
+$module->requires = 2009041700;  // Requires this Moodle version
 $module->cron     = 60;
 
 ?>
index 93b11b506d6be396a9c9f3f0808c1591bf444c0c..9a6792730ad5b7f1c9f0922b2ca43552d31f8002 100755 (executable)
     if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
         $options = new object();
         $options->noclean = true;
-        print_box(format_text($data->intro, FORMAT_MOODLE, $options), 'generalbox', 'intro');
+        print_box(format_text($data->intro, $data->introformat, $options), 'generalbox', 'intro');
     }
 
 /// Delete any requested records
index 2b56b9ec9958096fa8152aa6d0acd42021cd510c..caa1ef1b27110d31c01e269a0cde5f982b4c9ba6 100644 (file)
@@ -58,7 +58,7 @@
       fwrite ($bf,full_tag("MODTYPE",4,false,"feedback"));
       fwrite ($bf,full_tag("VERSION",4,false,1)); //version 1 steht fuer die neue Version
       fwrite ($bf,full_tag("NAME",4,false,$feedback->name));
-      fwrite ($bf,full_tag("SUMMARY",4,false,$feedback->summary));
+      fwrite ($bf,full_tag("SUMMARY",4,false,$feedback->intro));
       fwrite ($bf,full_tag("ANONYMOUS",4,false,$feedback->anonymous));
       fwrite ($bf,full_tag("EMAILNOTIFICATION",4,false,$feedback->email_notification));
       fwrite ($bf,full_tag("MULTIPLESUBMIT",4,false,$feedback->multiple_submit));
index 89e276eb0147e591b159cbbee07ce8f55afb08a1..ae6a4e5b7e5622692e660a5a678e346bfa59a8ac 100644 (file)
@@ -1,13 +1,17 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/feedback/db" VERSION="20070101" COMMENT="XMLDB file for Moodle mod/feedback">
+<XMLDB PATH="mod/feedback/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/feedback"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
   <TABLES>
     <TABLE NAME="feedback" COMMENT="all feedbacks" NEXT="feedback_template">
       <FIELDS>
         <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" PREVIOUS="id" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="summary"/>
-        <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="anonymous"/>
-        <FIELD NAME="anonymous" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="email_notification"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="intro"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="anonymous"/>
+        <FIELD NAME="anonymous" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="email_notification"/>
         <FIELD NAME="email_notification" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="anonymous" NEXT="multiple_submit"/>
         <FIELD NAME="multiple_submit" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="email_notification" NEXT="autonumbering"/>
         <FIELD NAME="autonumbering" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="multiple_submit" NEXT="site_after_submit"/>
       </INDEXES>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index 3aa24f3048d4ba8cc2980a949e968a399886451e..ba7e0e84defe03f4520cd97426d855057ef57645 100644 (file)
@@ -250,7 +250,33 @@ function xmldb_feedback_upgrade($oldversion) {
 
         upgrade_mod_savepoint($result, 2009031301, 'feedback');
     }
-    
+
+    if ($result && $oldversion < 2009042000) {
+
+    /// Rename field summary on table feedback to intro
+        $table = new xmldb_table('feedback');
+        $field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
+
+    /// Launch rename field summary
+        $dbman->rename_field($table, $field, 'intro');
+
+    /// feedback savepoint reached
+        upgrade_mod_savepoint($result, 2009042000, 'feedback');
+    }
+
+    if ($result && $oldversion < 2009042001) {
+
+    /// Define field introformat to be added to feedback
+        $table = new xmldb_table('feedback');
+        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+    /// Launch add field introformat
+        $dbman->add_field($table, $field);
+
+    /// feedback savepoint reached
+        upgrade_mod_savepoint($result, 2009042001, 'feedback');
+    }
+
     return $result;
 }
 
index ce42b1149ac8486017de77e43d6a133ee441b08f..871585429b6230eac0932879415006587d7c8e36 100644 (file)
@@ -454,7 +454,7 @@ function feedback_set_events($feedback) {
     if($feedback->timeopen > 0) {
         $event = NULL;
         $event->name          = get_string('start', 'feedback').' '.$feedback->name;
-        $event->description = $feedback->summary;
+        $event->description = $feedback->intro;
         $event->courseid     = $feedback->course;
         $event->groupid      = 0;
         $event->userid        = 0;
@@ -476,7 +476,7 @@ function feedback_set_events($feedback) {
     if($feedback->timeclose > 0) {
         $event = NULL;
         $event->name          = get_string('stop', 'feedback').' '.$feedback->name;
-        $event->description = $feedback->summary;
+        $event->description = $feedback->intro;
         $event->courseid     = $feedback->course;
         $event->groupid      = 0;
         $event->userid        = 0;
index a96dc11d65cdefe16644d21e087749091f079460..1365def081d341273ba5565cde4107fc3e5f82a1 100644 (file)
@@ -24,9 +24,9 @@ class mod_feedback_mod_form extends moodleform_mod {
         $mform->setType('name', PARAM_TEXT);
         $mform->addRule('name', null, 'required', null, 'client');
 
-        $mform->addElement('htmleditor', 'summary', get_string("description", "feedback"), array('rows' => 20));
-        $mform->setType('summary', PARAM_RAW);
-        $mform->addRule('summary', null, 'required', null, 'client');
+        $mform->addElement('htmleditor', 'intro', get_string("description", "feedback"), array('rows' => 20));
+        $mform->setType('intro', PARAM_RAW);
+        $mform->addRule('intro', null, 'required', null, 'client');
 
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
index 279aa1dee460135d8ab8ab59802128600bdf7b89..7a6f8853c5240e20b29519bedcb290857798d2fa 100644 (file)
@@ -49,7 +49,7 @@
             //Now, build the feedback record structure
             $feedback->course = $restore->course_id;
             $feedback->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
-            $feedback->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
+            $feedback->intro = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
             $feedback->anonymous = backup_todb($info['MOD']['#']['ANONYMOUS']['0']['#']);
             $feedback->email_notification = backup_todb($info['MOD']['#']['EMAILNOTIFICATION']['0']['#']);
             $feedback->multiple_submit = backup_todb($info['MOD']['#']['MULTIPLESUBMIT']['0']['#']);
@@ -69,7 +69,7 @@
             if($feedback->timeopen > 0) {
                 $event = NULL;
                 $event->name          = get_string('start', 'feedback').' '.$feedback->name;
-                $event->description = $feedback->summary;
+                $event->description = $feedback->intro;
                 $event->courseid     = $feedback->course;
                 $event->groupid      = 0;
                 $event->userid        = 0;
@@ -91,7 +91,7 @@
             if($feedback->timeclose > 0) {
                 $event = NULL;
                 $event->name          = get_string('stop', 'feedback').' '.$feedback->name;
-                $event->description = $feedback->summary;
+                $event->description = $feedback->intro;
                 $event->courseid     = $feedback->course;
                 $event->groupid      = 0;
                 $event->userid        = 0;
index 1320f8aee70187003245d2e6959f9600560c2369..b1bb96e8ee6fcccc2cee66c467d5833e8e10a720 100644 (file)
@@ -10,8 +10,8 @@
 */
 
    
-    $module->version = 2009031301; // The current module version (Date: YYYYMMDDXX)
-    $module->requires = 2008072401;  // Requires this Moodle version
+    $module->version = 2009042001; // The current module version (Date: YYYYMMDDXX)
+    $module->requires = 2009041700;  // Requires this Moodle version
     $feedback_version_intern = 1; //this version is used for restore older backups
     $module->cron = 0; // Period for cron to check this module (secs)
 
index abb656f199f462a3f3a614ee077a3490f10de8ad..c34a1849726d591c9c82a272ee8983f4798d18ed 100644 (file)
 
     // print_simple_box_start('center', '80%');
     print_box_start('generalbox boxaligncenter boxwidthwide');
-    echo format_text($feedback->summary);
+    $options = (object)array('noclean'=>true);
+    echo format_text($feedback->intro, $feedback->introformat, $options);
     // print_simple_box_end();
     print_box_end();