Adding the new grade tables

POSTGRES IS NOT DONE YET!!!!   DOES SOMEONE WANT TO TACKLE IT NOW?
This commit is contained in:
moodler 2005-03-28 18:16:39 +00:00
parent 0bb895a81b
commit 4eb25d43aa
5 changed files with 149 additions and 3 deletions

View File

@ -124,7 +124,7 @@ class block_admin extends block_list {
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/scales.gif" height="16" width="16" alt="" />';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/grades.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="log.php?id='.$this->instance->pageid.'">'.get_string('logs').'...</a>';
@ -146,7 +146,7 @@ class block_admin extends block_list {
} else if (!isguest()) { // Students menu
if ($course->showgrades) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/grade.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
}
if ($course->showreports) {

View File

@ -1253,6 +1253,65 @@ function main_upgrade($oldversion=0) {
) TYPE=MyISAM COMMENT='Rules for calculating local wall clock time for users';");
}
if ($oldversion < 2005032800) {
execute_sql("CREATE TABLE `{$CFG->prefix}grade_category` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) default NULL,
`courseid` int(10) unsigned NOT NULL default '0',
`drop_x_lowest` int(10) unsigned NOT NULL default '0',
`bonus_points` int(10) unsigned NOT NULL default '0',
`hidden` int(10) unsigned NOT NULL default '0',
`weight` decimal(4,2) default '0.00',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;");
execute_sql("CREATE TABLE `{$CFG->prefix}grade_exceptions` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`grade_itemid` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;");
execute_sql("CREATE TABLE `{$CFG->prefix}grade_item` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned default NULL,
`category` int(10) unsigned default NULL,
`modid` int(10) unsigned default NULL,
`cminstance` int(10) unsigned default NULL,
`scale_grade` float(11,10) default '1.0000000000',
`extra_credit` int(10) unsigned NOT NULL default '0',
`sort_order` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;");
execute_sql("CREATE TABLE `{$CFG->prefix}grade_letter` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`letter` varchar(8) NOT NULL default 'NA',
`grade_high` decimal(4,2) NOT NULL default '100.00',
`grade_low` decimal(4,2) NOT NULL default '0.00',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;");
execute_sql("CREATE TABLE `{$CFG->prefix}grade_preferences` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned default NULL,
`preference` int(10) NOT NULL default '0',
`value` int(10) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `courseidpreference` (`courseid`,`preference`)
) TYPE=MyISAM ;");
}
return $result;
}

View File

@ -220,6 +220,88 @@ CREATE TABLE `prefix_cache_text` (
# --------------------------------------------------------
#
# Table structure for table `grade_category`
#
CREATE TABLE `prefix_grade_category` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) default NULL,
`courseid` int(10) unsigned NOT NULL default '0',
`drop_x_lowest` int(10) unsigned NOT NULL default '0',
`bonus_points` int(10) unsigned NOT NULL default '0',
`hidden` int(10) unsigned NOT NULL default '0',
`weight` decimal(4,2) default '0.00',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;
# --------------------------------------------------------
#
# Table structure for table `grade_exceptions`
#
CREATE TABLE `prefix_grade_exceptions` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`grade_itemid` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;
# --------------------------------------------------------
#
# Table structure for table `grade_item`
#
CREATE TABLE `prefix_grade_item` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned default NULL,
`category` int(10) unsigned default NULL,
`modid` int(10) unsigned default NULL,
`cminstance` int(10) unsigned default NULL,
`scale_grade` float(11,10) default '1.0000000000',
`extra_credit` int(10) unsigned NOT NULL default '0',
`sort_order` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;
# --------------------------------------------------------
#
# Table structure for table `grade_letter`
#
CREATE TABLE `prefix_grade_letter` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`letter` varchar(8) NOT NULL default 'NA',
`grade_high` decimal(4,2) NOT NULL default '100.00',
`grade_low` decimal(4,2) NOT NULL default '0.00',
PRIMARY KEY (`id`),
KEY `courseid` (`courseid`)
) TYPE=MyISAM ;
# --------------------------------------------------------
#
# Table structure for table `grade_preferences`
#
CREATE TABLE `prefix_grade_preferences` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned default NULL,
`preference` int(10) NOT NULL default '0',
`value` int(10) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `courseidpreference` (`courseid`,`preference`)
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `group`

View File

@ -949,6 +949,7 @@ function main_upgrade($oldversion=0) {
execute_sql('UPDATE `'.$CFG->prefix.'user` SET timezonename = \'\'');
}
if ($oldversion < 2005032600) {
execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false);
modify_database('',"CREATE TABLE prefix_timezone (
@ -971,6 +972,10 @@ function main_upgrade($oldversion=0) {
);");
}
if ($oldversion < 2005032800) {
/// Need GRADE TABLES HERE!
}
return $result;
}

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 = 2005032600; // YYYYMMDD = date
$version = 2005032800; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name