Minor changes to support the new media file feature.

This commit is contained in:
michaelpenne
2005-06-15 23:35:11 +00:00
parent dbda1da801
commit f26cef7c22
9 changed files with 50 additions and 4 deletions
+1
View File
@@ -69,6 +69,7 @@
fwrite ($bf,full_tag("MAXTIME",4,false,$lesson->maxtime));
fwrite ($bf,full_tag("RETAKE",4,false,$lesson->retake));
fwrite ($bf,full_tag("TREE",4,false,$lesson->tree));
fwrite ($bf,full_tag("MEDIAFILE",4,false,$lesson->mediafile));
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));
+4
View File
@@ -167,6 +167,10 @@ function lesson_upgrade($oldversion) {
if ($oldversion < 2005060900) {
table_column('lesson_grades', 'grade', 'grade', 'float', '', 'unsigned', '0', 'not null');
}
if ($oldversion < 2005061500) {
table_column('lesson', '', 'mediafile', 'varchar', '255', '', '', 'not null', 'tree');
}
return true;
}
+1
View File
@@ -26,6 +26,7 @@ CREATE TABLE `prefix_lesson` (
`maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`retake` int(3) unsigned NOT NULL default '1',
`tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`mediafile` varchar(255) NOT NULL default '',
`slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`width` INT(10) UNSIGNED NOT NULL DEFAULT '640',
`height` INT(10) UNSIGNED NOT NULL DEFAULT '480',
+4
View File
@@ -215,6 +215,10 @@ function lesson_upgrade($oldversion) {
if ($oldversion < 2005060900) {
table_column('lesson_grades', 'grade', 'grade', 'real', '', 'unsigned', '0', 'not null');
}
if ($oldversion < 2005061500) {
table_column('lesson', '', 'mediafile', 'varchar', '255', '', '', 'not null', 'tree');
}
return true;
}
+1
View File
@@ -20,6 +20,7 @@ CREATE TABLE prefix_lesson (
maxtime INT8 NOT NULL DEFAULT '0',
retake INT NOT NULL default '1',
tree INT NOT NULL DEFAULT '0',
mediafile varchar(255) NOT NULL default '',
slideshow INT NOT NULL DEFAULT '0',
width INT8 NOT NULL DEFAULT '640',
height INT8 NOT NULL DEFAULT '480',
+15
View File
@@ -100,6 +100,9 @@ if ($form->mode == "add") {
$form->modattempts = 0;
}
if (!isset($form->mediafile)) {
$form->mediafile = '';
}
$form->deleteattempts = "";
@@ -437,6 +440,18 @@ if ($form->mode == "add") {
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("mediafile", "lesson"); ?>:</b></td>
<td>
<?PHP
$strchooseafile = get_string("chooseafile", "resource");
echo "<input name=\"mediafile\" size=\"50\" value=\"$form->mediafile\" /><br />";
button_to_popup_window ("/files/index.php?id=$course->id&choose=form.mediafile", "coursefiles", $strchooseafile, 500, 750, $strchooseafile);
helpbutton("mediafile", get_string("mediafile", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("displayhighscores", "lesson"); ?>:</b></td>
<td>
+1
View File
@@ -72,6 +72,7 @@
$lesson->maxtime = backup_todb($info['MOD']['#']['MAXTIME']['0']['#']);
$lesson->retake = backup_todb($info['MOD']['#']['RETAKE']['0']['#']);
$lesson->tree = backup_todb($info['MOD']['#']['TREE']['0']['#']);
$lesson->mediafile = backup_todb($info['MOD']['#']['MEDIAFILE']['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']['#']);
+1 -1
View File
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005060900; // The current module version (Date: YYYYMMDDXX)
$module->version = 2005061500; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
+22 -3
View File
@@ -274,7 +274,7 @@
if (!$pageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) {
error('Navigation: first page not found');
}
/// CDC-FLAG /// -- This is the code for starting a timed test
/// This is the code for starting a timed test
if(!isset($USER->startlesson[$lesson->id]) && !isteacher($course->id)) {
$USER->startlesson[$lesson->id] = true;
$startlesson = new stdClass;
@@ -290,7 +290,18 @@
$timedflag = true;
}
}
/// CDC-FLAG ///
if (!empty($lesson->mediafile)) {
// open our pop-up
$url = '/mod/lesson/mediafile.php?id='.$cm->id;
$name = $lesson->mediafile;
$options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. 650 .',height='. 100;
echo "\n<script language=\"javascript\" type=\"text/javascript\">";
echo "\n<!--\n";
echo " openpopup('$url', '$name', '$options', 0);";
echo "\n-->\n";
echo '</script>';
}
}
if ($pageid != LESSON_EOL) {
@@ -387,7 +398,15 @@
// This is where several messages (usually warnings) are displayed
// all of this is displayed above the actual page
if (!empty($lesson->mediafile)) {
$url = '/mod/lesson/mediafile.php?id='.$cm->id;
$options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. 650 .',height='. 100;
echo '<div align="right">';
link_to_popup_window ($url, $lesson->mediafile, get_string('mediafilepopup', 'lesson'), '', '', get_string('mediafilepopup', 'lesson'), $options);
helpbutton("mediafilestudent", get_string("mediafile", "lesson"), "lesson");
echo '</div>';
}
// clock code
// get time information for this user
if(!isteacher($course->id)) {