]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9137 Removed hidden field from grade_categories and added deleted field to grade_...
authornicolasconnault <nicolasconnault>
Fri, 1 Jun 2007 04:46:24 +0000 (04:46 +0000)
committernicolasconnault <nicolasconnault>
Fri, 1 Jun 2007 04:46:24 +0000 (04:46 +0000)
lib/db/install.xml
lib/db/upgrade.php
lib/grade/grade_category.php
lib/grade/grade_grades_final.php
lib/grade/grade_item.php
pix/i/lock.gif [new file with mode: 0755]
pix/i/unlock.gif [new file with mode: 0755]
version.php

index 8a1fc97f57800db6b478ece8080119444b2569b4..34ae95012694ce1939f15aac8d3480d1304ea58b 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20070517" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20070601" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="plusfactor" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" COMMENT="Add this to all grades" PREVIOUS="multfactor" NEXT="sortorder"/>
         <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Sorting order of the columns" PREVIOUS="plusfactor" NEXT="hidden"/>
         <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until (prevents viewing)" PREVIOUS="sortorder" NEXT="locked"/>
-        <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)" PREVIOUS="hidden" NEXT="needsupdate"/>
-        <FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="If this flag is set, then the whole column will be recalculated" PREVIOUS="locked" NEXT="timecreated"/>
+        <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)" PREVIOUS="hidden" NEXT="deleted"/>
+        <FIELD NAME="deleted" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 means the associated module instance has been deleted" PREVIOUS="locked" NEXT="needsupdate"/>
+        <FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="If this flag is set, then the whole column will be recalculated" PREVIOUS="deleted" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The first time this grade_item was created" PREVIOUS="needsupdate" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The last time this grade_item was modified" PREVIOUS="timecreated"/>
       </FIELDS>
         <FIELD NAME="fullname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The name of this grade category" PREVIOUS="path" NEXT="aggregation"/>
         <FIELD NAME="aggregation" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="A constant pointing to one of the predefined aggregation strategies (none, mean,median,sum, etc)" PREVIOUS="fullname" NEXT="keephigh"/>
         <FIELD NAME="keephigh" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Keep only the X highest items" PREVIOUS="aggregation" NEXT="droplow"/>
-        <FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Drop the X lowest items" PREVIOUS="keephigh" NEXT="hidden"/>
-        <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until" PREVIOUS="droplow" NEXT="timecreated"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="hidden" NEXT="timemodified"/>
+        <FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Drop the X lowest items" PREVIOUS="keephigh" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="droplow" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated"/>
       </FIELDS>
       <KEYS>
index 412e03e0641ef4b35474836ef86fe8e9b7557f08..57c9d10634f438135dd0cac372871503f242ba1f 100644 (file)
@@ -1302,6 +1302,29 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && drop_field($table, $field);
     }
 
+    if ($result && $oldversion < 2007052300) {
+        require_once($CFG->dirroot . '/question/upgrade.php');
+        $result = $result && question_remove_rqp_qtype();
+    }
+
+    if ($result && $oldversion < 2007060100) {
+
+        /// Define field hidden to be dropped from grade_categories
+        $table = new XMLDBTable('grade_categories');
+        $field = new XMLDBField('hidden');
+        
+        // Launch drop field hidden
+        $result = $result && drop_field($table, $field);
+
+        // Define field deleted to be added to grade_items
+        $table = new XMLDBTable('grade_items');
+        $field = new XMLDBField('deleted');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'locked');
+
+        // Launch add field deleted
+        $result = $result && add_field($table, $field); 
+    }
+
     return $result; 
 }
 
index 431767812dcfda7621bb325f27ae1c013b4cf250..33c1e158a2e882e87f338f34876bfe300b9d4d78 100644 (file)
@@ -99,12 +99,6 @@ class grade_category extends grade_object {
      */
     var $droplow;
     
-    /**
-     * Date until which to hide this category. If null, 0 or false, category is not hidden.
-     * @var int $hidden
-     */
-    var $hidden;
-    
     /**
      * Array of grade_items or grade_categories nested exactly 1 level below this category
      * @var array $children
index 7547b1c3356bc5550bb4e99c4339010f9b59ff62..be25dc4ecee6deb0d852d2a29c038a4baa1f5f7e 100644 (file)
@@ -63,13 +63,13 @@ class grade_grades_final extends grade_object {
     var $gradevalue;
     
     /**
-     * Date until which to hide this grade_item. If null, 0 or false, grade_item is not hidden. Hiding prevents viewing.
+     * Date until which to hide this grade_final. If null, 0 or false, grade_item is not hidden. Hiding prevents viewing.
      * @var int $hidden
      */
     var $hidden;
     
     /**
-     * Date until which to lock this grade_item. If null, 0 or false, grade_item is not locked. Locking prevents updating.
+     * Date until which to lock this grade_final. If null, 0 or false, grade_item is not locked. Locking prevents updating.
      * @var int $locked
      */
     var $locked = false;
index 8b66d4e2b81668059aedf46dea72356116541ee2..048f191dd9116f6d97766ba1b1a0cfc2327d8990 100644 (file)
@@ -186,6 +186,12 @@ class grade_item extends grade_object {
      */
     var $locked = false;
     
+    /**
+     * Whether or not the module instance referred to by this grade_item has been deleted.
+     * @var int $deleted
+     */
+    var $deleted;
+
     /**
      * If set, the whole column will be recalculated, then this flag will be switched off.
      * @var boolean $needsupdate
diff --git a/pix/i/lock.gif b/pix/i/lock.gif
new file mode 100755 (executable)
index 0000000..6ad27be
Binary files /dev/null and b/pix/i/lock.gif differ
diff --git a/pix/i/unlock.gif b/pix/i/unlock.gif
new file mode 100755 (executable)
index 0000000..16d90a5
Binary files /dev/null and b/pix/i/unlock.gif differ
index 7658f294efde044da446dc093da33436852b51d3..12d276dd1e33a59c882d365c458d7f1807d8013f 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2007052800;  // YYYYMMDD = date
+   $version = 2007060100;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.9 dev';    // Human-friendly version name