Also, a link will be printed out on every lesson page that re-opens the pop-up if necessary.</p>
<p>Optionally a "Close Window" button be printed at the bottom of the pop-up and the
-height and width of the window can be set as well.</p>
\ No newline at end of file
+height and width of the window can be set as well.</p>
+
+<p>Supported embedded file types:
+ <ul>
+ <li>MP3</li>
+ <li>Media Player</li>
+ <li>Quicktime</li>
+ <li>Realmedia</li>
+ <li>HTML</li>
+ <li>Plain Text</li>
+ <li>GIF</li>
+ <li>JPEG</li>
+ <li>PNG</li>
+ </ul>
+ All other file types will default to a link for download.</p>
\ No newline at end of file
$string['checknavigation'] = 'Check navigation';
$string['checkquestion'] = 'Check question';
$string['classstats'] = 'Class statistics';
+$string['clicktodownload'] = 'Click on the following link to download the file.';
$string['clicktopost'] = 'Click here to post your grade on the High Scores list.';
$string['clusterjump'] = 'Unseen question within a cluster';
$string['clustertitle'] = 'Cluster';
$string['yourcurrentgradeisoutof'] = 'Your current grade is $a->grade out of $a->total';
$string['youshouldview'] = 'You should answer at least: $a';
+
?>
require_login($course->id, false, $cm);
-
- // get the mimetype
- //$path_parts = pathinfo('http://www.apple.com'); //$lesson->mediafile
- $mimetype = mimeinfo("type", $lesson->mediafile); //$path_parts['basename']
-
- //print_header();
-
- if (substr_count($lesson->mediafile, '//') == 1) {
- // OK, taking a leap of faith here. We are assuming that teachers are cool
- // and thus the mediafile is a url
+ if (is_url($lesson->mediafile)) {
$fullurl = $lesson->mediafile;
} else {
// get the full url to the file while taking into consideration $CFG->slasharguments
$fullurl = "$CFG->wwwroot$relativeurl";
}
-
+ // Get the mimetype
+ $mimetype = mimeinfo("type", $lesson->mediafile);
// find the correct type and print it out
if ($mimetype == "audio/mp3") { // It's an MP3 audio file
echo '</object>';
echo "</p></center>";
- } else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
+ //} else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
- error('Flash is not supported yet');
+ // error('Flash is not supported yet');
} else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file
}
exit();
- } else {
- error('Unsupported mime type: '.$mimetype);
+ } else if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // Image
+
+ echo "<center><p>";
+ echo '<img class="lessonimage" src="'.s($fullurl).'" alt="" />';
+ echo "</p></center>";
+
+ } else { // Default
+
+ // Get the file name
+ $file = pathinfo($lesson->mediafile);
+ $filename = basename($file['basename'], '.'.$file['extension']);
+
+ echo "<center><p>";
+ notify(get_string('clicktodownload', 'lesson'));
+ echo "<a href=\"$fullurl\">".format_string($filename).'</a>';
+ echo "</p></center>";
+
}
function is_url($test_url) {