]> git.mjollnir.org Git - moodle.git/commitdiff
adding grade_outcomes description;
authorskodak <skodak>
Tue, 31 Jul 2007 21:10:20 +0000 (21:10 +0000)
committerskodak <skodak>
Tue, 31 Jul 2007 21:10:20 +0000 (21:10 +0000)
fixing field lengths in outcome and scale forms

grade/edit/outcome/edit_form.php
grade/edit/scale/edit_form.php
lib/db/install.xml
lib/db/upgrade.php
lib/grade/grade_outcome.php
version.php

index 6cb718e56af9f75102b4d919116e3e0f8ae225d9..b7827c77698bcb3f9928334707dfe2d68b5d5df9 100644 (file)
@@ -10,11 +10,11 @@ class edit_outcome_form extends moodleform {
         // visible elements
         $mform->addElement('header', 'general', get_string('outcomes', 'grades'));
 
-        $mform->addElement('text', 'fullname', get_string('fullname'));
+        $mform->addElement('text', 'fullname', get_string('fullname'), 'size="40"');
         $mform->addRule('fullname', get_string('required'), 'required');
         $mform->setType('fullname', PARAM_TEXT);
 
-        $mform->addElement('text', 'shortname', get_string('shortname'));
+        $mform->addElement('text', 'shortname', get_string('shortname'), 'size="20"');
         $mform->addRule('shortname', get_string('required'), 'required');
         $mform->setType('shortname', PARAM_NOTAGS);
 
@@ -25,6 +25,8 @@ class edit_outcome_form extends moodleform {
         $mform->addElement('select', 'scaleid', get_string('scale'), $options);
         $mform->addRule('scaleid', get_string('required'), 'required');
 
+        $mform->addElement('htmleditor', 'description', get_string('description'), array('cols'=>80, 'rows'=>20));
+
 
         // hidden params
         $mform->addElement('hidden', 'id', 0);
index 771efe1edacb207648437b3684f5e28b13c0f2eb..7539410f373ecee58044fc1eb728af57e685199d 100644 (file)
@@ -10,7 +10,7 @@ class edit_scale_form extends moodleform {
         // visible elements
         $mform->addElement('header', 'general', get_string('scale'));
 
-        $mform->addElement('text', 'name', get_string('name'));
+        $mform->addElement('text', 'name', get_string('name'), 'size="40"');
         $mform->addRule('name', get_string('required'), 'required', null, 'client');
         $mform->setType('name', PARAM_TEXT);
 
index 8e877dbac67a7b797b533fc38c5d5bd7437452d0..1ed0ce1b59628414007c2eb7604bf86971fc9867 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20070731" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20070801" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Mostly these are defined site wide ie NULL" PREVIOUS="id" NEXT="shortname"/>
         <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The short name or code for this outcome statement" PREVIOUS="courseid" NEXT="fullname"/>
         <FIELD NAME="fullname" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The full description of the outcome (usually 1 sentence)" PREVIOUS="shortname" NEXT="scaleid"/>
-        <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The recommended scale for this outcome." PREVIOUS="fullname" NEXT="timecreated"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="the time this outcome was first created" PREVIOUS="scaleid" NEXT="timemodified"/>
+        <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The recommended scale for this outcome." PREVIOUS="fullname" NEXT="description"/>
+        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="outcome description" PREVIOUS="scaleid" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="the time this outcome was first created" PREVIOUS="description" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="the time this outcome was last updated" PREVIOUS="timecreated" NEXT="usermodified"/>
         <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="the userid of the person who last modified this outcome" PREVIOUS="timemodified"/>
       </FIELDS>
         <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Mostly these are defined site wide ie NULL" PREVIOUS="loggeduser" NEXT="shortname"/>
         <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The short name or code for this outcome statement" PREVIOUS="courseid" NEXT="fullname"/>
         <FIELD NAME="fullname" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The full description of the outcome (usually 1 sentence)" PREVIOUS="shortname" NEXT="scaleid"/>
-        <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The recommended scale for this outcome." PREVIOUS="fullname"/>
+        <FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The recommended scale for this outcome." PREVIOUS="fullname" NEXT="description"/>
+        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Outcome description" PREVIOUS="scaleid"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me" NEXT="oldid"/>
       </SENTENCES>
     </STATEMENT>
   </STATEMENTS>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index 57cacfc7a5ebe0e1b8a8c1c6d298708376c80bfa..e47a55ea1915365fd7dd05ecbc468e98160fe8ba 100644 (file)
@@ -1045,6 +1045,7 @@ function xmldb_main_upgrade($oldversion=0) {
         $table->addFieldInfo('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
         $table->addFieldInfo('fullname', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
         $table->addFieldInfo('scaleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
+        $table->addFieldInfo('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null);
         $table->addFieldInfo('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
         $table->addFieldInfo('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
         $table->addFieldInfo('usermodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
@@ -1197,6 +1198,7 @@ function xmldb_main_upgrade($oldversion=0) {
         $table->addFieldInfo('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
         $table->addFieldInfo('fullname', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
         $table->addFieldInfo('scaleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
+        $table->addFieldInfo('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null);
 
     /// Adding keys to table grade_outcomes_history
         $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
@@ -1531,6 +1533,26 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && add_field($table, $field);
     }
 
+    if ($result && $oldversion < 2007073105) {
+
+    /// Define field description to be added to grade_outcomes
+        $table = new XMLDBTable('grade_outcomes');
+        $field = new XMLDBField('description');
+        if (!field_exists($table, $field)) {
+            $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'scaleid');
+        /// Launch add field description
+            $result = $result && add_field($table, $field);
+        }
+
+        $table = new XMLDBTable('grade_outcomes_history');
+        $field = new XMLDBField('description');
+        if (!field_exists($table, $field)) {
+            $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'scaleid');
+        /// Launch add field description
+            $result = $result && add_field($table, $field);
+        }
+
+    }
 
 
 /*
index 819677ed22178697c2398fc45929f030e29b6985..077fd62915739b92ac8a572d285a4696221e0c87 100644 (file)
@@ -72,6 +72,12 @@ class grade_outcome extends grade_object {
      */
     var $scaleid;
 
+    /**
+     * The description of this outcome - FORMAT_MOODLE.
+     * @var string $description
+     */
+    var $description;
+
     /**
      * The userid of the person who last modified this outcome.
      * @var int $usermodified
@@ -223,11 +229,11 @@ class grade_outcome extends grade_object {
     }
 
     /**
-     * Returns outcome short name.
+     * Returns unique outcome short name.
      * @return string name
      */
     function get_shortname() {
-        return format_string($this->shortname);
+        return $this->shortname;
     }
 
     /**
index baa4822ec31e9ff695fa7e3e9422acb3a8b3cc66..cfd1c685fc970377ec411ece7d98cf492861eeaf 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 = 2007073104;  // YYYYMMDD = date
+    $version = 2007073105;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '1.9 dev';   // Human-friendly version name