fwrite ($bf,full_tag("NAME",4,false,$lesson->name));
fwrite ($bf,full_tag("PRACTICE",4,false,$lesson->practice));
fwrite ($bf,full_tag("MODATTEMPTS",4,false,$lesson->modattempts));
- fwrite ($bf,full_tag("PASSWORD",4,false,$lesson->password));
fwrite ($bf,full_tag("USEPASSWORD",4,false,$lesson->usepassword));
+ fwrite ($bf,full_tag("PASSWORD",4,false,$lesson->password));
fwrite ($bf,full_tag("DEPENDENCY",4,false,$lesson->dependency));
fwrite ($bf,full_tag("CONDITIONS",4,false,$lesson->conditions));
fwrite ($bf,full_tag("GRADE",4,false,$lesson->grade));
fwrite ($bf,full_tag("TIMED",4,false,$lesson->timed));
fwrite ($bf,full_tag("MAXTIME",4,false,$lesson->maxtime));
fwrite ($bf,full_tag("RETAKE",4,false,$lesson->retake));
+ fwrite ($bf,full_tag("ACTIVITYLINK",4,false,$lesson->activitylink));
fwrite ($bf,full_tag("MEDIAFILE",4,false,$lesson->mediafile));
+ fwrite ($bf,full_tag("MEDIAHEIGHT",4,false,$lesson->mediaheight));
+ fwrite ($bf,full_tag("MEDIAWIDTH",4,false,$lesson->mediawidth));
+ fwrite ($bf,full_tag("MEDIACLOSE",4,false,$lesson->mediaclose));
fwrite ($bf,full_tag("SLIDESHOW",4,false,$lesson->slideshow));
fwrite ($bf,full_tag("WIDTH",4,false,$lesson->width));
fwrite ($bf,full_tag("HEIGHT",4,false,$lesson->height));
fwrite ($bf,full_tag("BGCOLOR",4,false,$lesson->bgcolor));
fwrite ($bf,full_tag("DISPLAYLEFT",4,false,$lesson->displayleft));
+ fwrite ($bf,full_tag("DISPLAYLEFTIF",4,false,$lesson->displayleftif));
+ fwrite ($bf,full_tag("PROGRESSBAR",4,false,$lesson->progressbar));
fwrite ($bf,full_tag("SHOWHIGHSCORES",4,false,$lesson->highscores));
fwrite ($bf,full_tag("MAXHIGHSCORES",4,false,$lesson->maxhighscores));
fwrite ($bf,full_tag("AVAILABLE",4,false,$lesson->available));
//Print default data
fwrite ($bf,full_tag("PRACTICE",5,false,$default->practice));
fwrite ($bf,full_tag("MODATTEMPTS",5,false,$default->modattempts));
- fwrite ($bf,full_tag("PASSWORD",5,false,$default->password));
fwrite ($bf,full_tag("USEPASSWORD",5,false,$default->usepassword));
+ fwrite ($bf,full_tag("PASSWORD",5,false,$default->password));
+ fwrite ($bf,full_tag("CONDITIONS",5,false,$default->conditions));
fwrite ($bf,full_tag("GRADE",5,false,$default->grade));
fwrite ($bf,full_tag("CUSTOM",5,false,$default->custom));
fwrite ($bf,full_tag("ONGOING",5,false,$default->ongoing));
fwrite ($bf,full_tag("TIMED",5,false,$default->timed));
fwrite ($bf,full_tag("MAXTIME",5,false,$default->maxtime));
fwrite ($bf,full_tag("RETAKE",5,false,$default->retake));
+ fwrite ($bf,full_tag("MEDIAHEIGHT",5,false,$default->mediaheight));
+ fwrite ($bf,full_tag("MEDIAWIDTH",5,false,$default->mediawidth));
+ fwrite ($bf,full_tag("MEDIACLOSE",5,false,$default->mediaclose));
fwrite ($bf,full_tag("SLIDESHOW",5,false,$default->slideshow));
fwrite ($bf,full_tag("WIDTH",5,false,$default->width));
fwrite ($bf,full_tag("HEIGHT",5,false,$default->height));
fwrite ($bf,full_tag("BGCOLOR",5,false,$default->bgcolor));
fwrite ($bf,full_tag("DISPLAYLEFT",5,false,$default->displayleft));
+ fwrite ($bf,full_tag("DISPLAYLEFTIF",5,false,$default->displayleftif));
+ fwrite ($bf,full_tag("PROGRESSBAR",5,false,$default->progressbar));
fwrite ($bf,full_tag("HIGHSCORES",5,false,$default->highscores));
fwrite ($bf,full_tag("MAXHIGHSCORES",5,false,$default->maxhighscores));
$status =fwrite ($bf,end_tag("DEFAULTS",4,true));
table_column('lesson', '', 'mediawidth', 'int', '10', 'unsigned', '650', 'not null', 'mediafile');
}
- if ($oldversion < 2005110200) {
+ if ($oldversion < 2005110200) {
table_column('lesson', '', 'activitylink', 'int', '10', 'unsigned', '0', 'not null', 'tree');
- }
-
- if ($oldversion < 2006031900) {
- execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson DROP COLUMN tree');
- execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson_default DROP COLUMN tree');
- }
-
+ }
+
+ if ($oldversion < 2006031900) {
+ execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson DROP COLUMN tree');
+ execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson_default DROP COLUMN tree');
+ }
+
+ if ($oldversion < 2006050100) {
+ table_column('lesson_default', '', 'conditions', 'text', '', '', '', 'not null', 'password');
+ table_column('lesson_default', '', 'progressbar', 'tinyint', '3', 'unsigned', '0', 'not null', 'displayleft');
+ table_column('lesson_default', '', 'displayleftif', 'int', '3', 'unsigned', '0', 'not null', 'displayleft');
+ table_column('lesson_default', '', 'mediaclose', 'tinyint', '3', 'unsigned', '0', 'not null', 'retake');
+ table_column('lesson_default', '', 'mediaheight', 'int', '10', 'unsigned', '100', 'not null', 'retake');
+ table_column('lesson_default', '', 'mediawidth', 'int', '10', 'unsigned', '650', 'not null', 'retake');
+ }
+
return true;
}
`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',
+ `password` varchar(32) NOT NULL default '',
+ `conditions` text NOT NULL default '',
`grade` tinyint(3) NOT NULL default '0',
`custom` int(3) unsigned NOT NULL default '0',
`ongoing` 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',
+ `mediaheight` INT(10) UNSIGNED NOT NULL DEFAULT '100',
+ `mediawidth` INT(10) UNSIGNED NOT NULL DEFAULT '650',
+ `mediaclose` TINYINT(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',
+ `displayleftif` INT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `progressbar` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`highscores` int(3) unsigned NOT NULL default '0',
`maxhighscores` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
table_column('lesson', '', 'mediawidth', 'INT', '10', 'unsigned', '650', 'not null', 'mediafile');
}
- if ($oldversion < 2005110200) {
+ if ($oldversion < 2005110200) {
table_column('lesson', '', 'activitylink', 'INT', '10', 'unsigned', '0', 'not null', 'tree');
- }
-
- if ($oldversion < 2006031900) {
- execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson DROP COLUMN tree');
- execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson_default DROP COLUMN tree');
- }
+ }
+
+ if ($oldversion < 2006031900) {
+ execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson DROP COLUMN tree');
+ execute_sql('ALTER TABLE '. $CFG->prefix . 'lesson_default DROP COLUMN tree');
+ }
+
+ if ($oldversion < 2006050100) {
+ table_column('lesson_default', '', 'conditions', 'text', '', '', '', 'not null', 'password');
+ table_column('lesson_default', '', 'progressbar', 'tinyint', '3', 'unsigned', '0', 'not null', 'displayleft');
+ table_column('lesson_default', '', 'displayleftif', 'int', '3', 'unsigned', '0', 'not null', 'displayleft');
+ table_column('lesson_default', '', 'mediaclose', 'tinyint', '3', 'unsigned', '0', 'not null', 'retake');
+ table_column('lesson_default', '', 'mediaheight', 'int', '10', 'unsigned', '100', 'not null', 'retake');
+ table_column('lesson_default', '', 'mediawidth', 'int', '10', 'unsigned', '650', 'not null', 'retake');
+ }
return true;
}
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',
+ password varchar(32) NOT NULL default '',
+ conditions text NOT NULL DEFAULT '',
grade INT NOT NULL default '0',
custom INT NOT NULL default '0',
ongoing INT NOT NULL default '0',
timed INT NOT NULL default '0',
maxtime INT8 NOT NULL default '0',
retake INT NOT NULL default '1',
+ mediaheight INT NOT NULL DEFAULT '100',
+ mediawidth INT NOT NULL DEFAULT '650',
+ mediaclose 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',
+ displayleftif INT NOT NULL DEFAULT '0',
+ progressbar INT NOT NULL DEFAULT '0',
highscores INT NOT NULL default '0',
maxhighscores INT8 NOT NULL default '0'
) ;
$lesson->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$lesson->practice = backup_todb($info['MOD']['#']['PRACTICE']['0']['#']);
$lesson->modattempts = backup_todb($info['MOD']['#']['MODATTEMPTS']['0']['#']);
- $lesson->password = backup_todb($info['MOD']['#']['PASSWORD']['0']['#']);
$lesson->usepassword = backup_todb($info['MOD']['#']['USEPASSWORD']['0']['#']);
+ $lesson->password = backup_todb($info['MOD']['#']['PASSWORD']['0']['#']);
$lesson->dependency = backup_todb($info['MOD']['#']['DEPENDENCY']['0']['#']);
$lesson->conditions = backup_todb($info['MOD']['#']['CONDITIONS']['0']['#']);
$lesson->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
$lesson->timed = backup_todb($info['MOD']['#']['TIMED']['0']['#']);
$lesson->maxtime = backup_todb($info['MOD']['#']['MAXTIME']['0']['#']);
$lesson->retake = backup_todb($info['MOD']['#']['RETAKE']['0']['#']);
+ $lesson->activitylink = backup_todb($info['MOD']['#']['ACTIVITYLINK']['0']['#']);
$lesson->mediafile = backup_todb($info['MOD']['#']['MEDIAFILE']['0']['#']);
+ $lesson->mediaheight = backup_todb($info['MOD']['#']['MEDIAHEIGHT']['0']['#']);
+ $lesson->mediawidth = backup_todb($info['MOD']['#']['MEDIAWIDTH']['0']['#']);
+ $lesson->mediaclose = backup_todb($info['MOD']['#']['MEDIACLOSE']['0']['#']);
$lesson->slideshow = backup_todb($info['MOD']['#']['SLIDESHOW']['0']['#']);
$lesson->width = backup_todb($info['MOD']['#']['WIDTH']['0']['#']);
$lesson->height = backup_todb($info['MOD']['#']['HEIGHT']['0']['#']);
$lesson->bgcolor = backup_todb($info['MOD']['#']['BGCOLOR']['0']['#']);
$lesson->displayleft = backup_todb($info['MOD']['#']['DISPLAYLEFT']['0']['#']);
+ $lesson->displayleftif = backup_todb($info['MOD']['#']['DISPLAYLEFTIF']['0']['#']);
+ $lesson->progressbar = backup_todb($info['MOD']['#']['PROGRESSBAR']['0']['#']);
$lesson->highscores = backup_todb($info['MOD']['#']['SHOWHIGHSCORES']['0']['#']);
$lesson->maxhighscores = backup_todb($info['MOD']['#']['MAXHIGHSCORES']['0']['#']);
$lesson->available = backup_todb($info['MOD']['#']['AVAILABLE']['0']['#']);
return false;
}
}
- // restore the default for the course. There might not be one, but if there
- // is, there will only be one.
- $status = lesson_default_restore_mods($info,$restore);
+ // restore the default for the course. Only do this once by checking for an id for lesson_default
+ $lessondefault = backup_getid($restore->backup_unique_code,'lesson_default',$restore->course_id);
+ if (!$lessondefault) {
+ $status = lesson_default_restore_mods($info,$restore);
+ }
+
}
} else {
$status = false;
$default->course = $restore->course_id;
$default->practice = backup_todb($default_info['#']['PRACTICE']['0']['#']);
$default->modattempts = backup_todb($default_info['#']['MODATTEMPTS']['0']['#']);
- $default->password = backup_todb($default_info['#']['PASSWORD']['0']['#']);
$default->usepassword = backup_todb($default_info['#']['USEPASSWORD']['0']['#']);
+ $default->password = backup_todb($default_info['#']['PASSWORD']['0']['#']);
+ $default->conditions = backup_todb($default_info['#']['CONDITIONS']['0']['#']);
$default->grade = backup_todb($default_info['#']['GRADE']['0']['#']);
$default->custom = backup_todb($default_info['#']['CUSTOM']['0']['#']);
$default->ongoing = backup_todb($default_info['#']['ONGOING']['0']['#']);
$default->timed = backup_todb($default_info['#']['TIMED']['0']['#']);
$default->maxtime = backup_todb($default_info['#']['MAXTIME']['0']['#']);
$default->retake = backup_todb($default_info['#']['RETAKE']['0']['#']);
+ $default->mediaheight = backup_todb($default_info['#']['MEDIAHEIGHT']['0']['#']);
+ $default->mediawidth = backup_todb($default_info['#']['MEDIAWIDTH']['0']['#']);
+ $default->mediaclose = backup_todb($default_info['#']['MEDIACLOSE']['0']['#']);
$default->slideshow = backup_todb($default_info['#']['SLIDESHOW']['0']['#']);
$default->width = backup_todb($default_info['#']['WIDTH']['0']['#']);
$default->height = backup_todb($default_info['#']['HEIGHT']['0']['#']);
$default->bgcolor = backup_todb($default_info['#']['BGCOLOR']['0']['#']);
$default->displayleft = backup_todb($default_info['#']['DISPLAYLEFT']['0']['#']);
+ $default->displayleftif = backup_todb($default_info['#']['DISPLAYLEFTIF']['0']['#']);
+ $default->progressbar = backup_todb($default_info['#']['PROGRESSBAR']['0']['#']);
$default->highscores = backup_todb($default_info['#']['HIGHSCORES']['0']['#']);
$default->maxhighscores = backup_todb($default_info['#']['MAXHIGHSCORES']['0']['#']);
//The structure is equal to the db, so insert the lesson_grade
$newid = insert_record ("lesson_default",$default);
-
+
+ if ($newid) {
+ backup_putid($restore->backup_unique_code,'lesson_default',
+ $restore->course_id, $newid);
+ }
+
//Do some output
if (($i+1) % 50 == 0) {
if (!defined('RESTORE_SILENTLY')) {
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006031900; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2006050100; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)