adding grade_outcomes description;

fixing field lengths in outcome and scale forms
This commit is contained in:
skodak 2007-07-31 21:10:20 +00:00
parent 24881e5dd0
commit 678a79caa5
6 changed files with 43 additions and 11 deletions

View 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);

View 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);

View 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"
>
@ -1280,8 +1280,9 @@
<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>
@ -1420,7 +1421,8 @@
<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"/>
@ -1670,4 +1672,4 @@
</SENTENCES>
</STATEMENT>
</STATEMENTS>
</XMLDB>
</XMLDB>

View 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);
}
}
/*

View 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;
}
/**

View 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