Bye. Now all those tabs are out
This commit is contained in:
+107
-107
@@ -18,133 +18,133 @@ function lesson_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2004022200) {
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxattempts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxanswers");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `nextpagedefault` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxpages` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER nextpagedefault");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `qtype` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER lessonid");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `qoption` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER qtype");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_answers` ADD `grade` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER jumpto");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxattempts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxanswers");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `nextpagedefault` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxpages` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER nextpagedefault");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `qtype` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER lessonid");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `qoption` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER qtype");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_answers` ADD `grade` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER jumpto");
|
||||
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032000) { // Upgrade some old beta lessons
|
||||
execute_sql(" UPDATE `{$CFG->prefix}lesson_pages` SET qtype = 3 WHERE qtype = 0");
|
||||
execute_sql(" UPDATE `{$CFG->prefix}lesson_pages` SET qtype = 3 WHERE qtype = 0");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032400) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `usemaxgrade` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `minquestions` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER nextpagedefault");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `usemaxgrade` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `minquestions` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER nextpagedefault");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032700) {
|
||||
table_column("lesson_answers", "", "flags", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
table_column("lesson_answers", "", "flags", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
}
|
||||
|
||||
// CDC-FLAG
|
||||
if ($oldversion < 2004072100) {
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_high_scores
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
gradeid int(10) unsigned not null,
|
||||
nickname varchar(5) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
// CDC-FLAG
|
||||
if ($oldversion < 2004072100) {
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_high_scores
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
gradeid int(10) unsigned not null,
|
||||
nickname varchar(5) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_branch
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
pageid int(10) unsigned not null,
|
||||
retry int(10) unsigned not null,
|
||||
flag tinyint(3) unsigned not null,
|
||||
timeseen int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_branch
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
pageid int(10) unsigned not null,
|
||||
retry int(10) unsigned not null,
|
||||
flag tinyint(3) unsigned not null,
|
||||
timeseen int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_timer
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
starttime int(10) unsigned not null,
|
||||
lessontime int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_timer
|
||||
( id int(10) unsigned not null auto_increment,
|
||||
lessonid int(10) unsigned not null,
|
||||
userid int(10) unsigned not null,
|
||||
starttime int(10) unsigned not null,
|
||||
lessontime int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER qoption");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER layout");
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER qoption");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER layout");
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_answers` ADD `score` INT(10) NOT NULL DEFAULT '0' AFTER grade");
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `usepassword` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `password` VARCHAR(32) NOT NULL DEFAULT '' AFTER usepassword");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `custom` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `ongoing` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER custom");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `timed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxpages");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER timed");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER retake");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER tree");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `width` INT(10) UNSIGNED NOT NULL DEFAULT '640' AFTER slideshow");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `height` INT(10) UNSIGNED NOT NULL DEFAULT '480' AFTER width");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF' AFTER height");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER bgcolor");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER displayleft");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER highscores");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_answers` ADD `score` INT(10) NOT NULL DEFAULT '0' AFTER grade");
|
||||
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `usepassword` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `password` VARCHAR(32) NOT NULL DEFAULT '' AFTER usepassword");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `custom` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `ongoing` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER custom");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `timed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxpages");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER timed");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER retake");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER tree");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `width` INT(10) UNSIGNED NOT NULL DEFAULT '640' AFTER slideshow");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `height` INT(10) UNSIGNED NOT NULL DEFAULT '480' AFTER width");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF' AFTER height");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER bgcolor");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER displayleft");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER highscores");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081100) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `practice` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `review` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081700) {
|
||||
execute_sql("CREATE TABLE `{$CFG->prefix}lesson_default`
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`practice` tinyint(3) unsigned NOT NULL default '0',
|
||||
`password` varchar(32) NOT NULL default '',
|
||||
`usepassword` int(3) unsigned NOT NULL default '0',
|
||||
`grade` tinyint(3) NOT NULL default '0',
|
||||
`custom` int(3) unsigned NOT NULL default '0',
|
||||
`ongoing` int(3) unsigned NOT NULL default '0',
|
||||
`usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxanswers` int(3) unsigned NOT NULL default '4',
|
||||
`maxattempts` int(3) unsigned NOT NULL default '5',
|
||||
`review` tinyint(3) unsigned NOT NULL default '0',
|
||||
`nextpagedefault` int(3) unsigned NOT NULL default '0',
|
||||
`minquestions` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxpages` int(3) unsigned NOT NULL default '0',
|
||||
`timed` int(3) unsigned NOT NULL default '0',
|
||||
`maxtime` int(10) unsigned NOT NULL default '0',
|
||||
`retake` int(3) unsigned NOT NULL default '1',
|
||||
`tree` int(3) unsigned NOT NULL default '0',
|
||||
`slideshow` int(3) unsigned NOT NULL default '0',
|
||||
`width` int(10) unsigned NOT NULL default '640',
|
||||
`height` int(10) unsigned NOT NULL default '480',
|
||||
`bgcolor` varchar(7) default '#FFFFFF',
|
||||
`displayleft` int(3) unsigned NOT NULL default '0',
|
||||
`highscores` int(3) unsigned NOT NULL default '0',
|
||||
`maxhighscores` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT = 'Defines lesson_default'");
|
||||
}
|
||||
if ($oldversion < 2004081100) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `practice` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `review` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081700) {
|
||||
execute_sql("CREATE TABLE `{$CFG->prefix}lesson_default`
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`practice` tinyint(3) unsigned NOT NULL default '0',
|
||||
`password` varchar(32) NOT NULL default '',
|
||||
`usepassword` int(3) unsigned NOT NULL default '0',
|
||||
`grade` tinyint(3) NOT NULL default '0',
|
||||
`custom` int(3) unsigned NOT NULL default '0',
|
||||
`ongoing` int(3) unsigned NOT NULL default '0',
|
||||
`usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxanswers` int(3) unsigned NOT NULL default '4',
|
||||
`maxattempts` int(3) unsigned NOT NULL default '5',
|
||||
`review` tinyint(3) unsigned NOT NULL default '0',
|
||||
`nextpagedefault` int(3) unsigned NOT NULL default '0',
|
||||
`minquestions` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxpages` int(3) unsigned NOT NULL default '0',
|
||||
`timed` int(3) unsigned NOT NULL default '0',
|
||||
`maxtime` int(10) unsigned NOT NULL default '0',
|
||||
`retake` int(3) unsigned NOT NULL default '1',
|
||||
`tree` int(3) unsigned NOT NULL default '0',
|
||||
`slideshow` int(3) unsigned NOT NULL default '0',
|
||||
`width` int(10) unsigned NOT NULL default '640',
|
||||
`height` int(10) unsigned NOT NULL default '480',
|
||||
`bgcolor` varchar(7) default '#FFFFFF',
|
||||
`displayleft` int(3) unsigned NOT NULL default '0',
|
||||
`highscores` int(3) unsigned NOT NULL default '0',
|
||||
`maxhighscores` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT = 'Defines lesson_default'");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004100400) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_attempts` ADD `useranswer` text NOT NULL AFTER correct");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004100700) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
}
|
||||
if ($oldversion < 2004100400) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_attempts` ADD `useranswer` text NOT NULL AFTER correct");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004100700) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004102600) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_default` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
}
|
||||
if ($oldversion < 2004102600) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_default` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
}
|
||||
|
||||
// CDC-FLAG end
|
||||
// CDC-FLAG end
|
||||
|
||||
if ($oldversion < 2004111200) {
|
||||
execute_sql("ALTER TABLE {$CFG->prefix}lesson DROP INDEX course;",false);
|
||||
@@ -165,7 +165,7 @@ function lesson_upgrade($oldversion) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+52
-52
@@ -108,67 +108,67 @@ CREATE TABLE `prefix_lesson_grades` (
|
||||
# --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `prefix_lesson_default`
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`practice` tinyint(3) unsigned NOT NULL default '0',
|
||||
`modattempts` tinyint(3) unsigned NOT NULL default '0',
|
||||
`password` varchar(32) NOT NULL default '',
|
||||
`usepassword` int(3) unsigned NOT NULL default '0',
|
||||
`grade` tinyint(3) NOT NULL default '0',
|
||||
`custom` int(3) unsigned NOT NULL default '0',
|
||||
`ongoing` int(3) unsigned NOT NULL default '0',
|
||||
`usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxanswers` int(3) unsigned NOT NULL default '4',
|
||||
`maxattempts` int(3) unsigned NOT NULL default '5',
|
||||
`review` tinyint(3) unsigned NOT NULL default '0',
|
||||
`nextpagedefault` int(3) unsigned NOT NULL default '0',
|
||||
`minquestions` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxpages` int(3) unsigned NOT NULL default '0',
|
||||
`timed` int(3) unsigned NOT NULL default '0',
|
||||
`maxtime` int(10) unsigned NOT NULL default '0',
|
||||
`retake` int(3) unsigned NOT NULL default '1',
|
||||
`tree` int(3) unsigned NOT NULL default '0',
|
||||
`slideshow` int(3) unsigned NOT NULL default '0',
|
||||
`width` int(10) unsigned NOT NULL default '640',
|
||||
`height` int(10) unsigned NOT NULL default '480',
|
||||
`bgcolor` varchar(7) default '#FFFFFF',
|
||||
`displayleft` int(3) unsigned NOT NULL default '0',
|
||||
`highscores` int(3) unsigned NOT NULL default '0',
|
||||
`maxhighscores` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT = 'Defines lesson_default';
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`practice` tinyint(3) unsigned NOT NULL default '0',
|
||||
`modattempts` tinyint(3) unsigned NOT NULL default '0',
|
||||
`password` varchar(32) NOT NULL default '',
|
||||
`usepassword` int(3) unsigned NOT NULL default '0',
|
||||
`grade` tinyint(3) NOT NULL default '0',
|
||||
`custom` int(3) unsigned NOT NULL default '0',
|
||||
`ongoing` int(3) unsigned NOT NULL default '0',
|
||||
`usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxanswers` int(3) unsigned NOT NULL default '4',
|
||||
`maxattempts` int(3) unsigned NOT NULL default '5',
|
||||
`review` tinyint(3) unsigned NOT NULL default '0',
|
||||
`nextpagedefault` int(3) unsigned NOT NULL default '0',
|
||||
`minquestions` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxpages` int(3) unsigned NOT NULL default '0',
|
||||
`timed` int(3) unsigned NOT NULL default '0',
|
||||
`maxtime` int(10) unsigned NOT NULL default '0',
|
||||
`retake` int(3) unsigned NOT NULL default '1',
|
||||
`tree` int(3) unsigned NOT NULL default '0',
|
||||
`slideshow` int(3) unsigned NOT NULL default '0',
|
||||
`width` int(10) unsigned NOT NULL default '640',
|
||||
`height` int(10) unsigned NOT NULL default '480',
|
||||
`bgcolor` varchar(7) default '#FFFFFF',
|
||||
`displayleft` int(3) unsigned NOT NULL default '0',
|
||||
`highscores` int(3) unsigned NOT NULL default '0',
|
||||
`maxhighscores` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT = 'Defines lesson_default';
|
||||
# --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `prefix_lesson_timer`
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`starttime` int(10) unsigned not null,
|
||||
`lessontime` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
( `id` int(10) unsigned NOT NULL auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`starttime` int(10) unsigned not null,
|
||||
`lessontime` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `prefix_lesson_branch`
|
||||
( `id` int(10) unsigned not null auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`pageid` int(10) unsigned not null,
|
||||
`retry` int(10) unsigned not null,
|
||||
`flag` tinyint(3) unsigned not null,
|
||||
`timeseen` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
( `id` int(10) unsigned not null auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`pageid` int(10) unsigned not null,
|
||||
`retry` int(10) unsigned not null,
|
||||
`flag` tinyint(3) unsigned not null,
|
||||
`timeseen` int(10) unsigned not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `prefix_lesson_high_scores`
|
||||
( `id` int(10) unsigned not null auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`gradeid` int(10) unsigned not null,
|
||||
`nickname` varchar(5) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
( `id` int(10) unsigned not null auto_increment,
|
||||
`lessonid` int(10) unsigned not null,
|
||||
`userid` int(10) unsigned not null,
|
||||
`gradeid` int(10) unsigned not null,
|
||||
`nickname` varchar(5) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
+113
-113
@@ -18,177 +18,177 @@ function lesson_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2004022200) {
|
||||
|
||||
table_column("lesson", "", "maxattempts", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "maxanswers");
|
||||
table_column("lesson", "", "nextpagedefault", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "maxattempts");
|
||||
table_column("lesson", "", "maxpages", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "nextpagedefault");
|
||||
table_column("lesson_pages", "", "qtype", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "lessonid");
|
||||
table_column("lesson_pages", "", "qoption", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "qtype");
|
||||
table_column("lesson_answers", "", "grade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "jumpto");
|
||||
table_column("lesson", "", "maxattempts", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "maxanswers");
|
||||
table_column("lesson", "", "nextpagedefault", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "maxattempts");
|
||||
table_column("lesson", "", "maxpages", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "nextpagedefault");
|
||||
table_column("lesson_pages", "", "qtype", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "lessonid");
|
||||
table_column("lesson_pages", "", "qoption", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "qtype");
|
||||
table_column("lesson_answers", "", "grade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "jumpto");
|
||||
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032000) { // Upgrade some old beta lessons
|
||||
execute_sql(" UPDATE \"{$CFG->prefix}lesson_pages\" SET qtype = 3 WHERE qtype = 0");
|
||||
execute_sql(" UPDATE \"{$CFG->prefix}lesson_pages\" SET qtype = 3 WHERE qtype = 0");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032400) {
|
||||
table_column("lesson", "", "usemaxgrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
table_column("lesson", "", "minquestions", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "nextpagedefault");
|
||||
table_column("lesson", "", "usemaxgrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
table_column("lesson", "", "minquestions", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "nextpagedefault");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004032700) {
|
||||
table_column("lesson_answers", "", "flags", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
table_column("lesson_answers", "", "flags", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
}
|
||||
// CDC-FLAG
|
||||
if ($oldversion < 2004072100) {
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_high_scores
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
gradeid int8 not null,
|
||||
nickname varchar(5) not null
|
||||
)");
|
||||
if ($oldversion < 2004072100) {
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_high_scores
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
gradeid int8 not null,
|
||||
nickname varchar(5) not null
|
||||
)");
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_essay
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
pageid int8 not null,
|
||||
answerid int8 not null,
|
||||
try int8 not null,
|
||||
answer text not null,
|
||||
graded int4 not null default 0,
|
||||
score int8 not null default 0,
|
||||
response text not null,
|
||||
sent int4 not null default 0,
|
||||
timesubmitted int8 not null
|
||||
)");
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_essay
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
pageid int8 not null,
|
||||
answerid int8 not null,
|
||||
try int8 not null,
|
||||
answer text not null,
|
||||
graded int4 not null default 0,
|
||||
score int8 not null default 0,
|
||||
response text not null,
|
||||
sent int4 not null default 0,
|
||||
timesubmitted int8 not null
|
||||
)");
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_branch
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
pageid int8 not null,
|
||||
retry int8 not null,
|
||||
flag int4 not null,
|
||||
timeseen int8 not null
|
||||
)");
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_branch
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
pageid int8 not null,
|
||||
retry int8 not null,
|
||||
flag int4 not null,
|
||||
timeseen int8 not null
|
||||
)");
|
||||
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_timer
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
starttime int8 not null,
|
||||
lessontime int8 not null
|
||||
)");
|
||||
|
||||
execute_sql(" create table ".$CFG->prefix."lesson_timer
|
||||
( id serial8 primary key,
|
||||
lessonid int8 not null,
|
||||
userid int8 not null,
|
||||
starttime int8 not null,
|
||||
lessontime int8 not null
|
||||
)");
|
||||
|
||||
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_pages ADD layout TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER qoption");
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_pages ADD layout TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER qoption");
|
||||
table_column('lesson_pages','','layout','int','3','unsigned', '1', 'not null', 'qoption');
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_pages ADD display TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER layout");
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_pages ADD display TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER layout");
|
||||
table_column('lesson_pages','','display','int','3','unsigned', '1', 'not null', 'layout');
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_answers ADD score INT(10) NOT NULL DEFAULT '0' AFTER grade");
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson_answers ADD score INT(10) NOT NULL DEFAULT '0' AFTER grade");
|
||||
table_column('lesson_answers','','score','int','10','unsigned', '1', 'not null', 'grade');
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD usepassword TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD usepassword TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
table_column('lesson','','usepassword','int','3','unsigned', '0', 'not null', 'name');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD password VARCHAR(32) NOT NULL DEFAULT '' AFTER usepassword");
|
||||
table_column('lesson','','password','varchar','32','', '', 'not null', 'usepassword');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD custom TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
|
||||
table_column('lesson','','custom','int','3','unsigned', '0', 'not null', 'grade');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD ongoing TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER custom");
|
||||
table_column('lesson','','ongoing','int','3','unsigned', '0', 'not null', 'custom');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD timed TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxpages");
|
||||
table_column('lesson','','timed','int','3','unsigned', '0', 'not null', 'maxpages');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD maxtime INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER timed");
|
||||
table_column('lesson','','maxtime','int','10','unsigned', '0', 'not null', 'timed');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD tree TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER retake");
|
||||
table_column('lesson','','tree','int','3','unsigned', '0', 'not null', 'retake');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD slideshow TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER tree");
|
||||
table_column('lesson','','slideshow','int','3','unsigned', '0', 'not null', 'tree');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD width INT(10) UNSIGNED NOT NULL DEFAULT '640' AFTER slideshow");
|
||||
table_column('lesson','','width','int','10','unsigned', '640', 'not null', 'slideshow');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD height INT(10) UNSIGNED NOT NULL DEFAULT '480' AFTER width");
|
||||
table_column('lesson','','height','int','10','unsigned', '480', 'not null', 'width');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD bgcolor CHAR(7) NOT NULL DEFAULT '#FFFFFF' AFTER height");
|
||||
table_column('lesson','','bgcolor','varchar','7','unsigned', '#FFFFFF', 'not null', 'height');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD displayleft TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER bgcolor");
|
||||
table_column('lesson','','displayleft','int','3','unsigned', '0', 'not null', 'bgcolor');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD highscores TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER displayleft");
|
||||
table_column('lesson','','highscores','int','3','unsigned', '0', 'not null', 'displayleft');
|
||||
|
||||
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD maxhighscores INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER highscores");
|
||||
table_column('lesson','','maxhighscores','int','10','unsigned', '0', 'not null', 'highscores');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081100) {
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD practice TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
if ($oldversion < 2004081100) {
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD practice TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
|
||||
table_column('lesson','','practice','int','3','unsigned', '0', 'not null', 'name');
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD review TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
//execute_sql(" ALTER TABLE {$CFG->prefix}lesson ADD review TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
|
||||
table_column('lesson','','review','int','3','unsigned', '0', 'not null', 'maxattempts');
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081700) {
|
||||
execute_sql("CREATE TABLE {$CFG->prefix}lesson_default
|
||||
( id serial8 primary key,
|
||||
course int8 NOT NULL default '0',
|
||||
practice int4 NOT NULL default '0',
|
||||
password varchar(32) NOT NULL default '',
|
||||
usepassword int4 NOT NULL default '0',
|
||||
grade int4 NOT NULL default '0',
|
||||
custom int4 NOT NULL default '0',
|
||||
ongoing int4 NOT NULL default '0',
|
||||
usemaxgrade int4 NOT NULL default '0',
|
||||
maxanswers int4 NOT NULL default '4',
|
||||
maxattempts int4 NOT NULL default '5',
|
||||
review int4 NOT NULL default '0',
|
||||
nextpagedefault int4 NOT NULL default '0',
|
||||
minquestions int4 NOT NULL default '0',
|
||||
maxpages int4 NOT NULL default '0',
|
||||
timed int4 NOT NULL default '0',
|
||||
maxtime int8 NOT NULL default '0',
|
||||
retake int4 NOT NULL default '1',
|
||||
tree int4 NOT NULL default '0',
|
||||
slideshow int4 NOT NULL default '0',
|
||||
width int8 NOT NULL default '640',
|
||||
height int8 NOT NULL default '480',
|
||||
bgcolor varchar(7) default '#FFFFFF',
|
||||
displayleft int4 NOT NULL default '0',
|
||||
highscores int4 NOT NULL default '0',
|
||||
maxhighscores int8 NOT NULL default '0'
|
||||
)");
|
||||
}
|
||||
// CDC-FLAG end
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081700) {
|
||||
execute_sql("CREATE TABLE {$CFG->prefix}lesson_default
|
||||
( id serial8 primary key,
|
||||
course int8 NOT NULL default '0',
|
||||
practice int4 NOT NULL default '0',
|
||||
password varchar(32) NOT NULL default '',
|
||||
usepassword int4 NOT NULL default '0',
|
||||
grade int4 NOT NULL default '0',
|
||||
custom int4 NOT NULL default '0',
|
||||
ongoing int4 NOT NULL default '0',
|
||||
usemaxgrade int4 NOT NULL default '0',
|
||||
maxanswers int4 NOT NULL default '4',
|
||||
maxattempts int4 NOT NULL default '5',
|
||||
review int4 NOT NULL default '0',
|
||||
nextpagedefault int4 NOT NULL default '0',
|
||||
minquestions int4 NOT NULL default '0',
|
||||
maxpages int4 NOT NULL default '0',
|
||||
timed int4 NOT NULL default '0',
|
||||
maxtime int8 NOT NULL default '0',
|
||||
retake int4 NOT NULL default '1',
|
||||
tree int4 NOT NULL default '0',
|
||||
slideshow int4 NOT NULL default '0',
|
||||
width int8 NOT NULL default '640',
|
||||
height int8 NOT NULL default '480',
|
||||
bgcolor varchar(7) default '#FFFFFF',
|
||||
displayleft int4 NOT NULL default '0',
|
||||
highscores int4 NOT NULL default '0',
|
||||
maxhighscores int8 NOT NULL default '0'
|
||||
)");
|
||||
}
|
||||
// CDC-FLAG end
|
||||
if ($oldversion < 2004100400) {
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_attempts` ADD `useranswer` text NOT NULL AFTER correct");
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_attempts` ADD `useranswer` text NOT NULL AFTER correct");
|
||||
table_column('lesson_attempts', '', 'useranswer', 'text', '', '', '', 'NOT NULL', 'correct');
|
||||
}
|
||||
|
||||
if ($oldversion < 2004100700) {
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004100700) {
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
table_column('lesson', '', 'modattempts', 'INT', '4', 'unsigned', '0', 'NOT NULL', 'practice');
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004102600) {
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_default` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
if ($oldversion < 2004102600) {
|
||||
//execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_default` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice");
|
||||
table_column('lesson_default', '', 'modattempts', 'INT', '4', 'unsigned', '0', 'NOT NULL', 'practice');
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004111200) {
|
||||
execute_sql("DROP INDEX {$CFG->prefix}lesson_course_idx;",false);
|
||||
|
||||
+61
-61
@@ -96,75 +96,75 @@ CREATE INDEX prefix_lesson_grades_lessonid_idx ON prefix_lesson_grades (lessonid
|
||||
CREATE INDEX prefix_lesson_grades_userid_idx ON prefix_lesson_grades (userid);
|
||||
|
||||
CREATE TABLE prefix_lesson_default
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
course INT8 NOT NULL default '0',
|
||||
practice INT NOT NULL default '0',
|
||||
modattempts INT4 NOT NULL default '0',
|
||||
password varchar(32) NOT NULL default '',
|
||||
usepassword INT NOT NULL default '0',
|
||||
grade INT NOT NULL default '0',
|
||||
custom INT NOT NULL default '0',
|
||||
ongoing INT NOT NULL default '0',
|
||||
usemaxgrade INT NOT NULL default '0',
|
||||
maxanswers INT NOT NULL default '4',
|
||||
maxattempts INT NOT NULL default '5',
|
||||
review INT NOT NULL default '0',
|
||||
nextpagedefault INT NOT NULL default '0',
|
||||
minquestions INT NOT NULL default '0',
|
||||
maxpages INT NOT NULL default '0',
|
||||
timed INT NOT NULL default '0',
|
||||
maxtime INT8 NOT NULL default '0',
|
||||
retake INT NOT NULL default '1',
|
||||
tree INT NOT NULL default '0',
|
||||
slideshow INT NOT NULL default '0',
|
||||
width INT8 NOT NULL default '640',
|
||||
height INT8 NOT NULL default '480',
|
||||
bgcolor varchar(7) default '#FFFFFF',
|
||||
displayleft INT NOT NULL default '0',
|
||||
highscores INT NOT NULL default '0',
|
||||
maxhighscores INT8 NOT NULL default '0'
|
||||
) ;
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
course INT8 NOT NULL default '0',
|
||||
practice INT NOT NULL default '0',
|
||||
modattempts INT4 NOT NULL default '0',
|
||||
password varchar(32) NOT NULL default '',
|
||||
usepassword INT NOT NULL default '0',
|
||||
grade INT NOT NULL default '0',
|
||||
custom INT NOT NULL default '0',
|
||||
ongoing INT NOT NULL default '0',
|
||||
usemaxgrade INT NOT NULL default '0',
|
||||
maxanswers INT NOT NULL default '4',
|
||||
maxattempts INT NOT NULL default '5',
|
||||
review INT NOT NULL default '0',
|
||||
nextpagedefault INT NOT NULL default '0',
|
||||
minquestions INT NOT NULL default '0',
|
||||
maxpages INT NOT NULL default '0',
|
||||
timed INT NOT NULL default '0',
|
||||
maxtime INT8 NOT NULL default '0',
|
||||
retake INT NOT NULL default '1',
|
||||
tree INT NOT NULL default '0',
|
||||
slideshow INT NOT NULL default '0',
|
||||
width INT8 NOT NULL default '640',
|
||||
height INT8 NOT NULL default '480',
|
||||
bgcolor varchar(7) default '#FFFFFF',
|
||||
displayleft INT NOT NULL default '0',
|
||||
highscores INT NOT NULL default '0',
|
||||
maxhighscores INT8 NOT NULL default '0'
|
||||
) ;
|
||||
|
||||
CREATE TABLE prefix_lesson_timer
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
starttime INT8 not null,
|
||||
lessontime INT8 not null
|
||||
);
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
starttime INT8 not null,
|
||||
lessontime INT8 not null
|
||||
);
|
||||
|
||||
CREATE TABLE prefix_lesson_branch
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
pageid INT8 not null,
|
||||
retry INT8 not null,
|
||||
flag INT not null,
|
||||
timeseen INT8 not null
|
||||
);
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
pageid INT8 not null,
|
||||
retry INT8 not null,
|
||||
flag INT not null,
|
||||
timeseen INT8 not null
|
||||
);
|
||||
|
||||
CREATE TABLE prefix_lesson_essay
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
pageid INT8 not null,
|
||||
answerid INT8 not null,
|
||||
try INT8 not null,
|
||||
answer text not null,
|
||||
graded INT not null default 0,
|
||||
score INT8 not null default 0,
|
||||
response text not null,
|
||||
sent INT not null default 0,
|
||||
timesubmitted INT8 not null
|
||||
);
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
pageid INT8 not null,
|
||||
answerid INT8 not null,
|
||||
try INT8 not null,
|
||||
answer text not null,
|
||||
graded INT not null default 0,
|
||||
score INT8 not null default 0,
|
||||
response text not null,
|
||||
sent INT not null default 0,
|
||||
timesubmitted INT8 not null
|
||||
);
|
||||
|
||||
CREATE TABLE prefix_lesson_high_scores
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
gradeid INT8 not null,
|
||||
nickname varchar(5) not null
|
||||
);
|
||||
( id SERIAL8 PRIMARY KEY,
|
||||
lessonid INT8 not null,
|
||||
userid INT8 not null,
|
||||
gradeid INT8 not null,
|
||||
nickname varchar(5) not null
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name');
|
||||
|
||||
+12
-12
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
// bad words < 5 characters long
|
||||
$filterwords = array (
|
||||
"shit",
|
||||
"fuck",
|
||||
"dick",
|
||||
"cunt",
|
||||
"pussy",
|
||||
"hore",
|
||||
"whore",
|
||||
"damn"
|
||||
);
|
||||
?>
|
||||
// bad words < 5 characters long
|
||||
$filterwords = array (
|
||||
"shit",
|
||||
"fuck",
|
||||
"dick",
|
||||
"cunt",
|
||||
"pussy",
|
||||
"hore",
|
||||
"whore",
|
||||
"damn"
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// This page lists all the instances of lesson in a particular course
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("locallib.php");
|
||||
require_once("locallib.php");
|
||||
|
||||
require_variable($id); // course
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
$strdeadline = get_string("deadline", "lesson");
|
||||
$strweek = get_string("week");
|
||||
$strtopic = get_string("topic");
|
||||
$table = new stdClass;
|
||||
$table = new stdClass;
|
||||
|
||||
if ($course->format == "weeks") {
|
||||
$table->head = array ($strweek, $strname, $strgrade, $strdeadline);
|
||||
|
||||
+1348
-1348
File diff suppressed because it is too large
Load Diff
+134
-134
@@ -1,8 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
// modified by mnielsen @ CDC
|
||||
/// Update: The lib.php now contains only the functions that are
|
||||
/// used outside of the lesson module. All functions (I hope) that are only local
|
||||
/// are now in locallib.php. All the constants moved there as well.
|
||||
// modified by mnielsen @ CDC
|
||||
/// Update: The lib.php now contains only the functions that are
|
||||
/// used outside of the lesson module. All functions (I hope) that are only local
|
||||
/// are now in locallib.php. All the constants moved there as well.
|
||||
|
||||
/// Library of functions and constants for module lesson
|
||||
/// (replace lesson with the name of your module and delete this line)
|
||||
@@ -13,42 +13,42 @@ function lesson_add_instance($lesson) {
|
||||
/// (defined by the form in mod.html) this function
|
||||
/// will create a new instance and return the id number
|
||||
/// of the new instance.
|
||||
global $SESSION;
|
||||
global $SESSION;
|
||||
|
||||
$lesson->timemodified = time();
|
||||
|
||||
$lesson->available = make_timestamp($lesson->availableyear,
|
||||
$lesson->availablemonth, $lesson->availableday, $lesson->availablehour,
|
||||
$lesson->availableminute);
|
||||
$lesson->availablemonth, $lesson->availableday, $lesson->availablehour,
|
||||
$lesson->availableminute);
|
||||
|
||||
$lesson->deadline = make_timestamp($lesson->deadlineyear,
|
||||
$lesson->deadlinemonth, $lesson->deadlineday, $lesson->deadlinehour,
|
||||
$lesson->deadlineminute);
|
||||
|
||||
/// CDC-FLAG ///
|
||||
if (!empty($lesson->password)) {
|
||||
$lesson->password = md5($lesson->password);
|
||||
} else {
|
||||
unset($lesson->password);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
$lesson->deadlinemonth, $lesson->deadlineday, $lesson->deadlinehour,
|
||||
$lesson->deadlineminute);
|
||||
|
||||
/// CDC-FLAG ///
|
||||
if (!empty($lesson->password)) {
|
||||
$lesson->password = md5($lesson->password);
|
||||
} else {
|
||||
unset($lesson->password);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
|
||||
if ($lesson->lessondefault) {
|
||||
$lessondefault = $lesson;
|
||||
unset($lessondefault->lessondefault);
|
||||
unset($lessondefault->name);
|
||||
unset($lessondefault->timemodified);
|
||||
unset($lessondefault->available);
|
||||
unset($lessondefault->deadline);
|
||||
if ($lessondefault->id = get_field("lesson_default", "id", "course", $lessondefault->course)) {
|
||||
update_record("lesson_default", $lessondefault);
|
||||
} else {
|
||||
insert_record("lesson_default", $lessondefault);
|
||||
}
|
||||
} else {
|
||||
unset($lesson->lessondefault);
|
||||
}
|
||||
|
||||
if ($lesson->lessondefault) {
|
||||
$lessondefault = $lesson;
|
||||
unset($lessondefault->lessondefault);
|
||||
unset($lessondefault->name);
|
||||
unset($lessondefault->timemodified);
|
||||
unset($lessondefault->available);
|
||||
unset($lessondefault->deadline);
|
||||
if ($lessondefault->id = get_field("lesson_default", "id", "course", $lessondefault->course)) {
|
||||
update_record("lesson_default", $lessondefault);
|
||||
} else {
|
||||
insert_record("lesson_default", $lessondefault);
|
||||
}
|
||||
} else {
|
||||
unset($lesson->lessondefault);
|
||||
}
|
||||
|
||||
return insert_record("lesson", $lesson);
|
||||
}
|
||||
|
||||
@@ -61,81 +61,81 @@ function lesson_update_instance($lesson) {
|
||||
|
||||
$lesson->timemodified = time();
|
||||
$lesson->available = make_timestamp($lesson->availableyear,
|
||||
$lesson->availablemonth, $lesson->availableday, $lesson->availablehour,
|
||||
$lesson->availableminute);
|
||||
$lesson->availablemonth, $lesson->availableday, $lesson->availablehour,
|
||||
$lesson->availableminute);
|
||||
$lesson->deadline = make_timestamp($lesson->deadlineyear,
|
||||
$lesson->deadlinemonth, $lesson->deadlineday, $lesson->deadlinehour,
|
||||
$lesson->deadlineminute);
|
||||
$lesson->deadlinemonth, $lesson->deadlineday, $lesson->deadlinehour,
|
||||
$lesson->deadlineminute);
|
||||
$lesson->id = $lesson->instance;
|
||||
|
||||
/// CDC-FLAG ///
|
||||
if (!empty($lesson->password)) {
|
||||
$lesson->password = md5($lesson->password);
|
||||
} else {
|
||||
unset($lesson->password);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
/// CDC-FLAG ///
|
||||
if (!empty($lesson->password)) {
|
||||
$lesson->password = md5($lesson->password);
|
||||
} else {
|
||||
unset($lesson->password);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
|
||||
if ($lesson->lessondefault) {
|
||||
$lessondefault = $lesson;
|
||||
unset($lessondefault->lessondefault);
|
||||
unset($lessondefault->name);
|
||||
unset($lessondefault->timemodified);
|
||||
unset($lessondefault->available);
|
||||
unset($lessondefault->deadline);
|
||||
if ($lessondefault->id = get_field("lesson_default", "id", "course", $lessondefault->course)) {
|
||||
update_record("lesson_default", $lessondefault);
|
||||
} else {
|
||||
insert_record("lesson_default", $lessondefault);
|
||||
}
|
||||
} else {
|
||||
unset($lesson->lessondefault);
|
||||
}
|
||||
|
||||
if (!empty($lesson->deleteattempts)) {
|
||||
$subject = "Delete User Attempts";
|
||||
$message = "";
|
||||
if ($lesson->lessondefault) {
|
||||
$lessondefault = $lesson;
|
||||
unset($lessondefault->lessondefault);
|
||||
unset($lessondefault->name);
|
||||
unset($lessondefault->timemodified);
|
||||
unset($lessondefault->available);
|
||||
unset($lessondefault->deadline);
|
||||
if ($lessondefault->id = get_field("lesson_default", "id", "course", $lessondefault->course)) {
|
||||
update_record("lesson_default", $lessondefault);
|
||||
} else {
|
||||
insert_record("lesson_default", $lessondefault);
|
||||
}
|
||||
} else {
|
||||
unset($lesson->lessondefault);
|
||||
}
|
||||
|
||||
if (!empty($lesson->deleteattempts)) {
|
||||
$subject = "Delete User Attempts";
|
||||
$message = "";
|
||||
|
||||
if ($userid = get_field("user", "id", "username", $lesson->deleteattempts)) {
|
||||
if (delete_records("lesson_attempts", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted attempts from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete attempts from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
if (delete_records("lesson_grades", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted grades from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete grades from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
if (delete_records("lesson_timer", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted time records from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete time records from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
if ($userid = get_field("user", "id", "username", $lesson->deleteattempts)) {
|
||||
if (delete_records("lesson_attempts", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted attempts from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete attempts from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
if (delete_records("lesson_grades", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted grades from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete grades from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
if (delete_records("lesson_timer", "lessonid", $lesson->id, "userid", $userid)) {
|
||||
// email good
|
||||
$message .= "Successfully deleted time records from \"$lesson->name\" lesson!<br />";
|
||||
} else {
|
||||
// email couldnt delete
|
||||
$message .= "Failed to delete time records from \"$lesson->name\" lesson!<br />";
|
||||
}
|
||||
|
||||
} else {
|
||||
// email couldnt find user
|
||||
$message .= "Could not find user in database.<br />";
|
||||
}
|
||||
$message .= "<br /> User ID used: $lesson->deleteattempts <br />";
|
||||
|
||||
$txt = format_text_email($message, FORMAT_HTML);
|
||||
|
||||
if ($currentuser = get_record("user", "id", $lesson->deleteattemptsid)) {
|
||||
email_to_user($currentuser, $currentuser, $subject, $txt, $message);
|
||||
}
|
||||
// unset lessondefault
|
||||
}
|
||||
unset($lesson->deleteattempts);
|
||||
unset($lesson->deleteattemptsid);
|
||||
|
||||
return update_record("lesson", $lesson);
|
||||
} else {
|
||||
// email couldnt find user
|
||||
$message .= "Could not find user in database.<br />";
|
||||
}
|
||||
$message .= "<br /> User ID used: $lesson->deleteattempts <br />";
|
||||
|
||||
$txt = format_text_email($message, FORMAT_HTML);
|
||||
|
||||
if ($currentuser = get_record("user", "id", $lesson->deleteattemptsid)) {
|
||||
email_to_user($currentuser, $currentuser, $subject, $txt, $message);
|
||||
}
|
||||
// unset lessondefault
|
||||
}
|
||||
unset($lesson->deleteattempts);
|
||||
unset($lesson->deleteattemptsid);
|
||||
|
||||
return update_record("lesson", $lesson);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,27 +205,27 @@ function lesson_user_complete($course, $user, $mod, $lesson) {
|
||||
if ($attempts = get_records_select("lesson_attempts", "lessonid = $lesson->id AND userid = $user->id",
|
||||
"retry, timeseen")) {
|
||||
print_simple_box_start();
|
||||
$table->head = array (get_string("attempt", "lesson"), get_string("numberofpagesviewed", "lesson"),
|
||||
get_string("numberofcorrectanswers", "lesson"), get_string("time"));
|
||||
$table->width = "100%";
|
||||
$table->align = array ("center", "center", "center", "center");
|
||||
$table->size = array ("*", "*", "*", "*");
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
$table->head = array (get_string("attempt", "lesson"), get_string("numberofpagesviewed", "lesson"),
|
||||
get_string("numberofcorrectanswers", "lesson"), get_string("time"));
|
||||
$table->width = "100%";
|
||||
$table->align = array ("center", "center", "center", "center");
|
||||
$table->size = array ("*", "*", "*", "*");
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
|
||||
$retry = 0;
|
||||
$npages = 0;
|
||||
$ncorrect = 0;
|
||||
|
||||
foreach ($attempts as $attempt) {
|
||||
if ($attempt->retry == $retry) {
|
||||
$npages++;
|
||||
foreach ($attempts as $attempt) {
|
||||
if ($attempt->retry == $retry) {
|
||||
$npages++;
|
||||
if ($attempt->correct) {
|
||||
$ncorrect++;
|
||||
}
|
||||
$timeseen = $attempt->timeseen;
|
||||
} else {
|
||||
$table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
|
||||
$table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
|
||||
$retry++;
|
||||
$npages = 1;
|
||||
if ($attempt->correct) {
|
||||
@@ -233,13 +233,13 @@ function lesson_user_complete($course, $user, $mod, $lesson) {
|
||||
} else {
|
||||
$ncorrect = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($npages) {
|
||||
$table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
|
||||
}
|
||||
}
|
||||
print_table($table);
|
||||
print_simple_box_end();
|
||||
if ($npages) {
|
||||
$table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
|
||||
}
|
||||
print_table($table);
|
||||
print_simple_box_end();
|
||||
// also print grade summary
|
||||
if ($grades = get_records_select("lesson_grades", "lessonid = $lesson->id AND userid = $user->id",
|
||||
"grade DESC")) {
|
||||
@@ -290,9 +290,9 @@ function lesson_grades($lessonid) {
|
||||
/// indexed by user. It also returns a maximum allowed grade.
|
||||
global $CFG;
|
||||
|
||||
if (!$lesson = get_record("lesson", "id", $lessonid)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!$lesson = get_record("lesson", "id", $lessonid)) {
|
||||
return NULL;
|
||||
}
|
||||
if ($lesson->usemaxgrade) {
|
||||
$grades = get_records_sql_menu("SELECT userid,MAX(grade) FROM {$CFG->prefix}lesson_grades WHERE
|
||||
lessonid = $lessonid GROUP BY userid");
|
||||
@@ -302,18 +302,18 @@ function lesson_grades($lessonid) {
|
||||
}
|
||||
|
||||
// convert grades from percentages and tidy the numbers
|
||||
if (!$lesson->practice) { // dont display practice lessons CDC-FLAG
|
||||
if ($grades) {
|
||||
foreach ($grades as $userid => $grade) {
|
||||
$return->grades[$userid] = number_format($grade * $lesson->grade / 100.0, 1);
|
||||
}
|
||||
}
|
||||
$return->maxgrade = $lesson->grade;
|
||||
|
||||
return $return;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
if (!$lesson->practice) { // dont display practice lessons CDC-FLAG
|
||||
if ($grades) {
|
||||
foreach ($grades as $userid => $grade) {
|
||||
$return->grades[$userid] = number_format($grade * $lesson->grade / 100.0, 1);
|
||||
}
|
||||
}
|
||||
$return->maxgrade = $lesson->grade;
|
||||
|
||||
return $return;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
+554
-554
File diff suppressed because it is too large
Load Diff
+88
-88
@@ -4,13 +4,13 @@
|
||||
echo "<style type=\"text/css\">@import url($CFG->wwwroot/mod/lesson/styles.php);</style>";
|
||||
require("$CFG->dirroot/mod/lesson/locallib.php"); // for parameter array
|
||||
if ($form->mode == "add") {
|
||||
if ($defaults = get_record("lesson_default", "course", $form->course)) {
|
||||
foreach ($defaults as $name => $value) {
|
||||
if (!is_numeric($name)) {
|
||||
$form->$name = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($defaults = get_record("lesson_default", "course", $form->course)) {
|
||||
foreach ($defaults as $name => $value) {
|
||||
if (!is_numeric($name)) {
|
||||
$form->$name = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the defaults
|
||||
@@ -45,11 +45,11 @@ if ($form->mode == "add") {
|
||||
$form->available = 0;
|
||||
}
|
||||
if (!isset($form->deadline)) {
|
||||
$currentdate = usergetdate(time());
|
||||
$currentdate = usergetdate(time());
|
||||
$form->deadline = gmmktime($currentdate["hours"], $currentdate["minutes"], $currentdate["seconds"], $currentdate["mon"]+1, $currentdate["mday"], $currentdate["year"]);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
if (!isset($form->usepassword)) {
|
||||
/// CDC-FLAG ///
|
||||
if (!isset($form->usepassword)) {
|
||||
$form->usepassword = 0;
|
||||
}
|
||||
if (!isset($form->custom)) {
|
||||
@@ -79,32 +79,32 @@ if ($form->mode == "add") {
|
||||
if (!isset($form->bgcolor)) {
|
||||
$form->bgcolor = "#FFFFFF";
|
||||
}
|
||||
if (!isset($form->displayleft)) {
|
||||
$form->displayleft = 0;
|
||||
}
|
||||
if (!isset($form->highscores)) {
|
||||
$form->highscores = 0;
|
||||
}
|
||||
if (!isset($form->displayleft)) {
|
||||
$form->displayleft = 0;
|
||||
}
|
||||
if (!isset($form->highscores)) {
|
||||
$form->highscores = 0;
|
||||
}
|
||||
if (!isset($form->maxhighscores)) {
|
||||
$form->maxhighscores = 10;
|
||||
}
|
||||
if (!isset($form->practice)) {
|
||||
$form->practice = 0;
|
||||
}
|
||||
if (!isset($form->review)) {
|
||||
$form->review = 0;
|
||||
}
|
||||
if (!isset($form->lessondefault)) {
|
||||
$form->lessondefault = 0;
|
||||
}
|
||||
if (!isset($form->modattempts)) {
|
||||
$form->modattempts = 0;
|
||||
}
|
||||
if (!isset($form->practice)) {
|
||||
$form->practice = 0;
|
||||
}
|
||||
if (!isset($form->review)) {
|
||||
$form->review = 0;
|
||||
}
|
||||
if (!isset($form->lessondefault)) {
|
||||
$form->lessondefault = 0;
|
||||
}
|
||||
if (!isset($form->modattempts)) {
|
||||
$form->modattempts = 0;
|
||||
}
|
||||
|
||||
|
||||
$form->deleteattempts = "";
|
||||
|
||||
$form->deleteattempts = "";
|
||||
|
||||
/// CDC-FLAG ///
|
||||
/// CDC-FLAG ///
|
||||
?>
|
||||
|
||||
<form name="form" method="post" action="mod.php">
|
||||
@@ -113,9 +113,9 @@ if ($form->mode == "add") {
|
||||
<table cellpadding="5">
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?php print_heading(get_string("general", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<?php print_heading(get_string("general", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
@@ -129,9 +129,9 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("timed", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "timed", $form->timed, "");
|
||||
choose_from_menu($options, "timed", $form->timed, "");
|
||||
helpbutton("timed", get_string("timed", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -141,7 +141,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("maxtime", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="maxtime" maxlength="7" size="7" value="<?php p($form->maxtime) ?>" />
|
||||
<?php helpbutton("maxtime", get_string("maxtime", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("maxtime", get_string("maxtime", "lesson"), "lesson"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -149,7 +149,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("maximumnumberofanswersbranches", "lesson") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
$numbers = array();
|
||||
$numbers = array();
|
||||
for ($i=20; $i>1; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
@@ -160,18 +160,18 @@ if ($form->mode == "add") {
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("practice", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "practice", $form->practice, "");
|
||||
choose_from_menu($options, "practice", $form->practice, "");
|
||||
helpbutton("practice", get_string("practice", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -181,9 +181,9 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("customscoring", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "custom", $form->custom, "");
|
||||
choose_from_menu($options, "custom", $form->custom, "");
|
||||
helpbutton("custom", get_string("customscoring", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -193,7 +193,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
$grades = array();
|
||||
$grades = array();
|
||||
for ($i=100; $i>=0; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("canretake", "lesson", $course->student) ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "retake", $form->retake, "");
|
||||
helpbutton("retake", get_string("canretake", "lesson", $course->student), "lesson");
|
||||
@@ -219,7 +219,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("handlingofretakes", "lesson") ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("usemean", "lesson"); $options[1] = get_string("usemaximum", "lesson");
|
||||
choose_from_menu($options, "usemaxgrade", $form->usemaxgrade, "");
|
||||
helpbutton("handlingofretakes", get_string("handlingofretakes", "lesson"), "lesson");
|
||||
@@ -231,27 +231,27 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("ongoing", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "ongoing", $form->ongoing, "");
|
||||
choose_from_menu($options, "ongoing", $form->ongoing, "");
|
||||
helpbutton("ongoing", get_string("ongoing", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("flowcontrol", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("flowcontrol", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("modattempts", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "modattempts", $form->modattempts, "");
|
||||
choose_from_menu($options, "modattempts", $form->modattempts, "");
|
||||
helpbutton("modattempts", get_string("modattempts", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -261,9 +261,9 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("displayreview", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "review", $form->review, "");
|
||||
choose_from_menu($options, "review", $form->review, "");
|
||||
helpbutton("review", get_string("displayreview", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -322,18 +322,18 @@ if ($form->mode == "add") {
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("slideshow", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "slideshow", $form->slideshow, "");
|
||||
choose_from_menu($options, "slideshow", $form->slideshow, "");
|
||||
helpbutton("slideshow", get_string("slideshow", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -343,7 +343,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("slideshowwidth", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="width" maxlength="7" size="7" value="<?php p($form->width) ?>" />px
|
||||
<?php helpbutton("width", get_string("slideshowwidth", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("width", get_string("slideshowwidth", "lesson"), "lesson"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -351,7 +351,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("slideshowheight", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="height" maxlength="7" size="7" value="<?php p($form->height) ?>" />px
|
||||
<?php helpbutton("height", get_string("slideshowheight", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("height", get_string("slideshowheight", "lesson"), "lesson"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -359,7 +359,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("slideshowbgcolor", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="bgcolor" maxlength="7" size="7" value="<?php p($form->bgcolor) ?>" />
|
||||
<?php helpbutton("bgcolor", get_string("slideshowbgcolor", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("bgcolor", get_string("slideshowbgcolor", "lesson"), "lesson"); ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@@ -368,27 +368,27 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("displayleftmenu", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "displayleft", $form->displayleft, "");
|
||||
choose_from_menu($options, "displayleft", $form->displayleft, "");
|
||||
helpbutton("displayleft", get_string("displayleftmenu", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("usepassword", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "usepassword", $form->usepassword, "");
|
||||
choose_from_menu($options, "usepassword", $form->usepassword, "");
|
||||
helpbutton("usepassword", get_string("usepassword", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -398,7 +398,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("password", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="password" size="7" value="" /> <?php echo " (".get_string("leavetokeep").")"; ?>
|
||||
<?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -416,23 +416,23 @@ if ($form->mode == "add") {
|
||||
<td><?php
|
||||
print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline);
|
||||
echo " - ";
|
||||
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
|
||||
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
|
||||
?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
<td>
|
||||
<br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
|
||||
</td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("treeview", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "tree", $form->tree, "");
|
||||
choose_from_menu($options, "tree", $form->tree, "");
|
||||
helpbutton("tree", get_string("treeview", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -442,9 +442,9 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("displayhighscores", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "highscores", $form->highscores, "");
|
||||
choose_from_menu($options, "highscores", $form->highscores, "");
|
||||
helpbutton("highscores", get_string("displayhighscores", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
@@ -454,7 +454,7 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("maxhighscores", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="maxhighscores" maxlength="7" size="7" value="<?php p($form->maxhighscores) ?>" />
|
||||
<?php helpbutton("maxhighscores", get_string("maxhighscores", "lesson"), "lesson"); ?>
|
||||
<?php helpbutton("maxhighscores", get_string("maxhighscores", "lesson"), "lesson"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -462,26 +462,26 @@ if ($form->mode == "add") {
|
||||
<td align="right"><b><?php print_string("lessondefault", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?PHP
|
||||
$options = array();
|
||||
$options = array();
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "lessondefault", $form->lessondefault, "");
|
||||
choose_from_menu($options, "lessondefault", $form->lessondefault, "");
|
||||
helpbutton("lessondefault", get_string("lessondefault", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($form->mode != "add") {
|
||||
if ($form->mode != "add") {
|
||||
?>
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("deleteattempts", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="deleteattempts" size="7" value="" />
|
||||
<?php helpbutton("deleteattempts", get_string("deleteattempts", "lesson"), "lesson"); ?>
|
||||
<input type="hidden" name="deleteattemptsid" value="<?php echo $USER->id; ?>" />
|
||||
<?php helpbutton("deleteattempts", get_string("deleteattempts", "lesson"), "lesson"); ?>
|
||||
<input type="hidden" name="deleteattemptsid" value="<?php echo $USER->id; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if statement if ($form->mode != "add") {
|
||||
} // end if statement if ($form->mode != "add") {
|
||||
?>
|
||||
<?php print_visible_setting($form); ?>
|
||||
</table>
|
||||
|
||||
+158
-158
@@ -3,176 +3,176 @@
|
||||
function removedoublecr($filename) {
|
||||
// This function will adjust a file in roughly Aiken style by replacing extra newlines with <BR> tags
|
||||
// so that instructors can have newlines wherever they like as long as the overall format is in Aiken
|
||||
|
||||
$filearray = file($filename);
|
||||
/// Check for Macintosh OS line returns (ie file on one line), and fix
|
||||
if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) {
|
||||
$outfile = explode("\r", $filearray[0]);
|
||||
} else {
|
||||
$outfile = $filearray;
|
||||
}
|
||||
|
||||
foreach ($outfile as $line) {
|
||||
// remove leading and trailing whitespace
|
||||
trim($line);
|
||||
// check it's length, if 0 do not output... if it is > 0 output
|
||||
if ($line[0] == "\n" OR strlen($line)==0 ) {
|
||||
if (count($outarray) ) {
|
||||
// get the last item in the outarray
|
||||
$cur_pos = (count($outarray) - 1);
|
||||
$outarray[$cur_pos] = trim($outarray[$cur_pos])."<br>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$length=strlen($line);
|
||||
if ($length==0) {
|
||||
// don't do anything
|
||||
}
|
||||
else {
|
||||
if ($line[$length-1] == "\n") {
|
||||
$outarray[] = $line;
|
||||
}
|
||||
else {
|
||||
$outarray[] = $line."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// output modified file to original
|
||||
if ( is_writable($filename) ) {
|
||||
|
||||
$filearray = file($filename);
|
||||
/// Check for Macintosh OS line returns (ie file on one line), and fix
|
||||
if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) {
|
||||
$outfile = explode("\r", $filearray[0]);
|
||||
} else {
|
||||
$outfile = $filearray;
|
||||
}
|
||||
|
||||
foreach ($outfile as $line) {
|
||||
// remove leading and trailing whitespace
|
||||
trim($line);
|
||||
// check it's length, if 0 do not output... if it is > 0 output
|
||||
if ($line[0] == "\n" OR strlen($line)==0 ) {
|
||||
if (count($outarray) ) {
|
||||
// get the last item in the outarray
|
||||
$cur_pos = (count($outarray) - 1);
|
||||
$outarray[$cur_pos] = trim($outarray[$cur_pos])."<br>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$length=strlen($line);
|
||||
if ($length==0) {
|
||||
// don't do anything
|
||||
}
|
||||
else {
|
||||
if ($line[$length-1] == "\n") {
|
||||
$outarray[] = $line;
|
||||
}
|
||||
else {
|
||||
$outarray[] = $line."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// output modified file to original
|
||||
if ( is_writable($filename) ) {
|
||||
|
||||
if (! $handle =fopen ($filename ,'w' )) {
|
||||
echo "Cannot open file ($filename)" ;
|
||||
exit;
|
||||
}
|
||||
foreach ($outarray as $outline) {
|
||||
fwrite($handle, $outline);
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
else {
|
||||
// file not writeable
|
||||
}
|
||||
if (! $handle =fopen ($filename ,'w' )) {
|
||||
echo "Cannot open file ($filename)" ;
|
||||
exit;
|
||||
}
|
||||
foreach ($outarray as $outline) {
|
||||
fwrite($handle, $outline);
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
else {
|
||||
// file not writeable
|
||||
}
|
||||
}
|
||||
|
||||
// jjg7:8/9/2004
|
||||
function importmodifiedaikenstyle($filename) {
|
||||
// This function converts from Brusca style to Aiken
|
||||
$lines = file($filename);
|
||||
$answer_found = 0;
|
||||
$responses = 0;
|
||||
$outlines = array();
|
||||
foreach ($lines as $line) {
|
||||
// strip leading and trailing whitespace
|
||||
$line = trim($line);
|
||||
// add a space at the end, quick hack to make sure words from different lines don't run together
|
||||
$line = $line. ' ';
|
||||
|
||||
// ignore lines less than 2 characters
|
||||
if (strlen($line) < 2) {
|
||||
continue;
|
||||
}
|
||||
$lines = file($filename);
|
||||
$answer_found = 0;
|
||||
$responses = 0;
|
||||
$outlines = array();
|
||||
foreach ($lines as $line) {
|
||||
// strip leading and trailing whitespace
|
||||
$line = trim($line);
|
||||
// add a space at the end, quick hack to make sure words from different lines don't run together
|
||||
$line = $line. ' ';
|
||||
|
||||
// ignore lines less than 2 characters
|
||||
if (strlen($line) < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// see if we have the answer line
|
||||
if ($line[0] =='*') {
|
||||
if ($line[0] == '*') {
|
||||
$answer_found = 1;
|
||||
$line[0]="\t";
|
||||
$line = ltrim($line);
|
||||
$answer = $line[0];
|
||||
}
|
||||
}
|
||||
|
||||
// see if we have the answer line
|
||||
if ($line[0] =='*') {
|
||||
if ($line[0] == '*') {
|
||||
$answer_found = 1;
|
||||
$line[0]="\t";
|
||||
$line = ltrim($line);
|
||||
$answer = $line[0];
|
||||
}
|
||||
}
|
||||
|
||||
$leadin = substr($line, 0,2);
|
||||
if (strpos(".A)B)C)D)E)F)G)H)I)J)a)b)c)d)e)f)g)h)i)j)A.B.C.D.E.F.G.H.I.J.a.b.c.d.e.f.g.h.i.j.", $leadin)>0) {
|
||||
$leadin = substr($line, 0,2);
|
||||
if (strpos(".A)B)C)D)E)F)G)H)I)J)a)b)c)d)e)f)g)h)i)j)A.B.C.D.E.F.G.H.I.J.a.b.c.d.e.f.g.h.i.j.", $leadin)>0) {
|
||||
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
|
||||
|
||||
$responses = 1;
|
||||
// make character uppercase
|
||||
$line[0]=strtoupper($line[0]);
|
||||
|
||||
// make entry followed by '.'
|
||||
$line[1]='.';
|
||||
}
|
||||
elseif ( ($responses AND $answer_found) OR (count(outlines)<=1) ) {
|
||||
// we have found responses and an answer and the current line is not an answer
|
||||
switch ($line[0]) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
|
||||
$responses = 1;
|
||||
// make character uppercase
|
||||
$line[0]=strtoupper($line[0]);
|
||||
|
||||
// make entry followed by '.'
|
||||
$line[1]='.';
|
||||
}
|
||||
elseif ( ($responses AND $answer_found) OR (count(outlines)<=1) ) {
|
||||
// we have found responses and an answer and the current line is not an answer
|
||||
switch ($line[0]) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
|
||||
// this next ugly block is to strip out the numbers at the beginning
|
||||
$np = 0;
|
||||
// this probably could be done cleaner... it escapes me at the moment
|
||||
while ($line[$np] == '0' OR $line[$np] == '1' OR $line[$np] == '2'
|
||||
OR $line[$np] == '3' OR $line[$np] == '4' OR $line[$np] == '5'
|
||||
OR $line[$np] == '6' OR $line[$np] == '7' OR $line[$np] == '8'
|
||||
OR $line[$np] == '9' ) {
|
||||
$np++;
|
||||
}
|
||||
// grab everything after '###.'
|
||||
$line = substr($line, $np+1, strlen($line));
|
||||
// this next ugly block is to strip out the numbers at the beginning
|
||||
$np = 0;
|
||||
// this probably could be done cleaner... it escapes me at the moment
|
||||
while ($line[$np] == '0' OR $line[$np] == '1' OR $line[$np] == '2'
|
||||
OR $line[$np] == '3' OR $line[$np] == '4' OR $line[$np] == '5'
|
||||
OR $line[$np] == '6' OR $line[$np] == '7' OR $line[$np] == '8'
|
||||
OR $line[$np] == '9' ) {
|
||||
$np++;
|
||||
}
|
||||
// grab everything after '###.'
|
||||
$line = substr($line, $np+1, strlen($line));
|
||||
|
||||
if ($responses AND $answer_found) {
|
||||
$responses = 0;
|
||||
$answer_found = 0;
|
||||
$answer = strtoupper($answer);
|
||||
$outlines[] = "ANSWER: $answer\n\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 14) == 'ANSWER CHOICES') {
|
||||
// don't output this line
|
||||
}
|
||||
else {
|
||||
$outlines[]=$line;
|
||||
}
|
||||
} // close for each line
|
||||
if ($responses AND $answer_found) {
|
||||
$responses = 0;
|
||||
$answer_found = 0;
|
||||
$answer = strtoupper($answer);
|
||||
$outlines[] = "ANSWER: $answer\n\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 14) == 'ANSWER CHOICES') {
|
||||
// don't output this line
|
||||
}
|
||||
else {
|
||||
$outlines[]=$line;
|
||||
}
|
||||
} // close for each line
|
||||
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
// re-add newline to indicate end of previous question/response
|
||||
if (count($outlines)) {
|
||||
$cur_pos = (count($outlines) - 1);
|
||||
$outlines[$cur_pos] = $outlines[$cur_pos]."\n";
|
||||
}
|
||||
|
||||
// output the last answer
|
||||
$answer = strtoupper($answer);
|
||||
$outlines[] = "ANSWER: $answer\n\n";
|
||||
|
||||
// output modified file to original
|
||||
if ( is_writable($filename) ) {
|
||||
if (! $handle =fopen ($filename ,'w' )) {
|
||||
echo "Cannot open file ($filename)" ;
|
||||
exit;
|
||||
}
|
||||
foreach ($outlines as $outline) {
|
||||
fwrite($handle, $outline);
|
||||
}
|
||||
fclose($handle);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
// output the last answer
|
||||
$answer = strtoupper($answer);
|
||||
$outlines[] = "ANSWER: $answer\n\n";
|
||||
|
||||
// output modified file to original
|
||||
if ( is_writable($filename) ) {
|
||||
if (! $handle =fopen ($filename ,'w' )) {
|
||||
echo "Cannot open file ($filename)" ;
|
||||
exit;
|
||||
}
|
||||
foreach ($outlines as $outline) {
|
||||
fwrite($handle, $outline);
|
||||
}
|
||||
fclose($handle);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
+26
-26
@@ -40,7 +40,7 @@
|
||||
if (! $grades = get_records('lesson_grades', 'lessonid', $lesson->id, 'completed')) {
|
||||
$grades = array();
|
||||
}
|
||||
|
||||
|
||||
if (! $times = get_records('lesson_timer', 'lessonid', $lesson->id, 'starttime')) {
|
||||
$times = array();
|
||||
}
|
||||
@@ -90,7 +90,7 @@
|
||||
if (!array_key_exists($attempt->userid, $studentdata) || !array_key_exists($attempt->retry, $studentdata[$attempt->userid])) {
|
||||
// restore/setup defaults
|
||||
$n = 0;
|
||||
$timestart = 0;
|
||||
$timestart = 0;
|
||||
$timeend = 0;
|
||||
$usergrade = NULL;
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
$n++; // if not equal, then increment n
|
||||
}
|
||||
}
|
||||
$n = 0;
|
||||
$n = 0;
|
||||
// search for the time record for this try. if not there, the nulls defined above will be used.
|
||||
foreach($times as $time) {
|
||||
// check to see if the grade matches the correct user
|
||||
@@ -239,32 +239,32 @@
|
||||
|
||||
// some stat calculations
|
||||
if ($numofattempts == 0) {
|
||||
$avescore = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$avescore = format_float($avescore/$numofattempts, 2, ".", ",");
|
||||
}
|
||||
if ($avetime == NULL) {
|
||||
$avetime = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$avetime = format_float($avetime/$numofattempts, 0, ".", ",");
|
||||
$avetime = format_time($avetime);
|
||||
}
|
||||
$avescore = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$avescore = format_float($avescore/$numofattempts, 2, ".", ",");
|
||||
}
|
||||
if ($avetime == NULL) {
|
||||
$avetime = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$avetime = format_float($avetime/$numofattempts, 0, ".", ",");
|
||||
$avetime = format_time($avetime);
|
||||
}
|
||||
if ($hightime == NULL) {
|
||||
$hightime = get_string("notcompleted", "lesson");
|
||||
$hightime = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$hightime = format_time($hightime);
|
||||
}
|
||||
if ($lowtime == NULL) {
|
||||
$lowtime = get_string("notcompleted", "lesson");
|
||||
$hightime = format_time($hightime);
|
||||
}
|
||||
if ($lowtime == NULL) {
|
||||
$lowtime = get_string("notcompleted", "lesson");
|
||||
} else {
|
||||
$lowtime = format_time($lowtime);
|
||||
}
|
||||
if ($highscore == NULL) {
|
||||
$highscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
if ($lowscore == NULL) {
|
||||
$lowscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
$lowtime = format_time($lowtime);
|
||||
}
|
||||
if ($highscore == NULL) {
|
||||
$highscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
if ($lowscore == NULL) {
|
||||
$lowscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
|
||||
// output the stats
|
||||
print_heading(get_string('lessonstats', 'lesson'));
|
||||
|
||||
+12
-12
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
require_once("../../config.php");
|
||||
require_once("../../config.php");
|
||||
?>
|
||||
|
||||
img {
|
||||
border:0;
|
||||
border:0;
|
||||
}
|
||||
|
||||
.hidden-label {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.footer {
|
||||
@@ -18,21 +18,21 @@ img {
|
||||
}
|
||||
|
||||
.leftmenutable {
|
||||
width:170px;
|
||||
height:400px;
|
||||
overflow:auto;
|
||||
background-color: <?PHP echo $THEME->cellheading2 ?>;
|
||||
vertical-align:top;
|
||||
width:170px;
|
||||
height:400px;
|
||||
overflow:auto;
|
||||
background-color: <?PHP echo $THEME->cellheading2 ?>;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
.leftmenu a:link, .leftmenu a:active, .leftmenu a:visited, .leftmenu1 a:link, .leftmenu1 a:active, .leftmenu1 a:visited{
|
||||
font-size:.7em;
|
||||
vertical-align:top;
|
||||
font-size:.7em;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
.main a:link, .main a:active, .main a:visited{
|
||||
font-size:.9em;
|
||||
vertical-align:top;
|
||||
font-size:.9em;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
.viewpos {
|
||||
|
||||
+86
-86
@@ -7,101 +7,101 @@
|
||||
// Mark Nielsen modified it to be a countdown timer
|
||||
// for the lesson module in moodle.
|
||||
//
|
||||
// Below is the code that is used to call this page.
|
||||
// echo "<script language=\"javascript\">\n";
|
||||
// echo "var starttime = ". $timer->starttime . ";\n";
|
||||
// echo "var servertime = ". time() . ";\n";
|
||||
// echo "var testlength = ". $lesson->maxtime * 60 .";\n";
|
||||
// echo "document.write('<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"liveclock_lite.js\"><\/SCRIPT>');\n";
|
||||
// echo "window.onload = function () { show_clock(); }";
|
||||
// echo "</script>\n";
|
||||
// Below is the code that is used to call this page.
|
||||
// echo "<script language=\"javascript\">\n";
|
||||
// echo "var starttime = ". $timer->starttime . ";\n";
|
||||
// echo "var servertime = ". time() . ";\n";
|
||||
// echo "var testlength = ". $lesson->maxtime * 60 .";\n";
|
||||
// echo "document.write('<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"liveclock_lite.js\"><\/SCRIPT>');\n";
|
||||
// echo "window.onload = function () { show_clock(); }";
|
||||
// echo "</script>\n";
|
||||
//
|
||||
//////////////////////////////////////////////////////////*/
|
||||
|
||||
var myfont_face = "Arial";
|
||||
var myfont_size = "12";
|
||||
var myfont_color = "#000000";
|
||||
var myback_color = "#FFFFFF";
|
||||
var mywidth = 80;
|
||||
var my12_hour = 1;
|
||||
var stopclock = 0;
|
||||
|
||||
var javatimeDate = new Date();
|
||||
var javatime = javatimeDate.getTime();
|
||||
javatime = Math.floor(javatime/1000);
|
||||
|
||||
difference = javatime - servertime;
|
||||
starttime = starttime + difference;
|
||||
var myfont_face = "Arial";
|
||||
var myfont_size = "12";
|
||||
var myfont_color = "#000000";
|
||||
var myback_color = "#FFFFFF";
|
||||
var mywidth = 80;
|
||||
var my12_hour = 1;
|
||||
var stopclock = 0;
|
||||
|
||||
var javatimeDate = new Date();
|
||||
var javatime = javatimeDate.getTime();
|
||||
javatime = Math.floor(javatime/1000);
|
||||
|
||||
difference = javatime - servertime;
|
||||
starttime = starttime + difference;
|
||||
|
||||
var dn = ""; var old = "";
|
||||
var dn = ""; var old = "";
|
||||
|
||||
if (document.all||document.getElementById) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px;"></span>'); }
|
||||
else if (document.layers) { document.write('<ilayer id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
|
||||
else { old = "true"; show_clock(); }
|
||||
|
||||
/*function leave() { // feable attempt to run a script when someone leaves a timed test early, failed so far
|
||||
window.onunload = window.open('http://www.google.com','','toolbar=no,menubar=no,location=no,height=500,width=500');
|
||||
}
|
||||
leave();*/
|
||||
|
||||
function show_clock() {
|
||||
if (document.all||document.getElementById) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px;"></span>'); }
|
||||
else if (document.layers) { document.write('<ilayer id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
|
||||
else { old = "true"; show_clock(); }
|
||||
|
||||
/*function leave() { // feable attempt to run a script when someone leaves a timed test early, failed so far
|
||||
window.onunload = window.open('http://www.google.com','','toolbar=no,menubar=no,location=no,height=500,width=500');
|
||||
}
|
||||
leave();*/
|
||||
|
||||
function show_clock() {
|
||||
|
||||
//show clock in NS 4
|
||||
if (document.layers)
|
||||
//show clock in NS 4
|
||||
if (document.layers)
|
||||
document.ClockPosNS.visibility="show"
|
||||
if (old == "die") { return; }
|
||||
if (old == "die") { return; }
|
||||
|
||||
currentDate = new Date();
|
||||
current = currentDate.getTime();
|
||||
current = Math.floor(current/1000);
|
||||
|
||||
if (current > starttime + testlength) {
|
||||
myclock = '';
|
||||
myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
|
||||
myclock += "Time is up";
|
||||
myclock += '</font>';
|
||||
stopclock = 1;
|
||||
} else {
|
||||
timeleft = starttime + testlength - current;
|
||||
dateobj = new Date(null, null, null, null, null, timeleft, null);
|
||||
hours = dateobj.getHours();
|
||||
minutes = dateobj.getMinutes();
|
||||
secs = dateobj.getSeconds();
|
||||
|
||||
if (secs < 10) {
|
||||
secs = "0"+secs;
|
||||
}
|
||||
|
||||
myclock = '';
|
||||
myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
|
||||
if (hours > 0) {
|
||||
myclock += hours+":";
|
||||
if (minutes < 10) {
|
||||
minutes = "0"+minutes;
|
||||
}
|
||||
}
|
||||
myclock += minutes+":"+secs;
|
||||
myclock += '</font>';
|
||||
}
|
||||
|
||||
if (old == "true") {
|
||||
document.write(myclock);
|
||||
old = "die"; return;
|
||||
}
|
||||
currentDate = new Date();
|
||||
current = currentDate.getTime();
|
||||
current = Math.floor(current/1000);
|
||||
|
||||
if (current > starttime + testlength) {
|
||||
myclock = '';
|
||||
myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
|
||||
myclock += "Time is up";
|
||||
myclock += '</font>';
|
||||
stopclock = 1;
|
||||
} else {
|
||||
timeleft = starttime + testlength - current;
|
||||
dateobj = new Date(null, null, null, null, null, timeleft, null);
|
||||
hours = dateobj.getHours();
|
||||
minutes = dateobj.getMinutes();
|
||||
secs = dateobj.getSeconds();
|
||||
|
||||
if (secs < 10) {
|
||||
secs = "0"+secs;
|
||||
}
|
||||
|
||||
myclock = '';
|
||||
myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
|
||||
if (hours > 0) {
|
||||
myclock += hours+":";
|
||||
if (minutes < 10) {
|
||||
minutes = "0"+minutes;
|
||||
}
|
||||
}
|
||||
myclock += minutes+":"+secs;
|
||||
myclock += '</font>';
|
||||
}
|
||||
|
||||
if (old == "true") {
|
||||
document.write(myclock);
|
||||
old = "die"; return;
|
||||
}
|
||||
|
||||
if (document.layers) {
|
||||
clockpos = document.ClockPosNS;
|
||||
liveclock = clockpos.document.LiveClockNS;
|
||||
liveclock.document.write(myclock);
|
||||
liveclock.document.close();
|
||||
} else if (document.all) {
|
||||
LiveClockIE.innerHTML = myclock;
|
||||
} else if (document.getElementById) {
|
||||
document.getElementById("LiveClockIE").innerHTML = myclock;
|
||||
}
|
||||
if (document.layers) {
|
||||
clockpos = document.ClockPosNS;
|
||||
liveclock = clockpos.document.LiveClockNS;
|
||||
liveclock.document.write(myclock);
|
||||
liveclock.document.close();
|
||||
} else if (document.all) {
|
||||
LiveClockIE.innerHTML = myclock;
|
||||
} else if (document.getElementById) {
|
||||
document.getElementById("LiveClockIE").innerHTML = myclock;
|
||||
}
|
||||
|
||||
if (stopclock == 0) {
|
||||
setTimeout("show_clock()",1000);
|
||||
}
|
||||
if (stopclock == 0) {
|
||||
setTimeout("show_clock()",1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+584
-584
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user