2002-10-17 14:03:59 +00:00
|
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
|
require_once("../../config.php");
|
|
|
|
|
require_once("lib.php");
|
2003-11-27 19:09:47 +00:00
|
|
|
|
|
2002-10-17 14:03:59 +00:00
|
|
|
|
require_variable($id); // Course Module ID
|
2003-04-29 13:31:47 +00:00
|
|
|
|
optional_variable($frameset, "");
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
|
|
|
error("Course is misconfigured");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $resource = get_record("resource", "id", $cm->instance)) {
|
|
|
|
|
error("Resource ID was incorrect");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$strresource = get_string("modulename", "resource");
|
|
|
|
|
$strresources = get_string("modulenameplural", "resource");
|
|
|
|
|
$strlastmodified = get_string("lastmodified");
|
|
|
|
|
|
|
|
|
|
if ($course->category) {
|
|
|
|
|
require_login($course->id);
|
2003-05-18 06:05:23 +00:00
|
|
|
|
$navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
|
|
|
|
<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strresources</a> ->";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
} else {
|
2003-05-18 06:05:23 +00:00
|
|
|
|
$navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strresources</a> ->";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-05-18 06:05:23 +00:00
|
|
|
|
$pagetitle = strip_tags("$course->shortname: $resource->name");
|
|
|
|
|
|
2003-05-15 18:03:22 +00:00
|
|
|
|
if (!$cm->visible and !isteacher($course->id)) {
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name", "", "", true,
|
|
|
|
|
update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
2003-05-15 18:03:22 +00:00
|
|
|
|
notice(get_string("activityiscurrentlyhidden"));
|
|
|
|
|
}
|
2002-11-10 14:03:25 +00:00
|
|
|
|
|
2002-10-17 14:03:59 +00:00
|
|
|
|
switch ($resource->type) {
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case REFERENCE:
|
2002-10-17 14:03:59 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name", "", "", true,
|
|
|
|
|
update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
print_simple_box($resource->reference, "center");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<center><p>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
echo text_to_html($resource->summary);
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "</p>";
|
|
|
|
|
echo "<p> </p>";
|
|
|
|
|
echo "<p><font size=1>$strlastmodified: ".userdate($resource->timemodified)."</p>";
|
|
|
|
|
echo "</center>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
print_footer($course);
|
|
|
|
|
break;
|
|
|
|
|
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case WEBLINK:
|
2004-01-08 12:20:11 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
|
|
|
|
|
|
|
|
|
$inpopup = !empty($_GET["inpopup"]);
|
|
|
|
|
|
|
|
|
|
if ($resource->alltext and !$inpopup) { /// Make a page and a pop-up window
|
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name", "", "", true,
|
|
|
|
|
update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
|
|
|
|
|
|
|
|
|
echo "\n<script language=\"Javascript\">";
|
|
|
|
|
echo "\n<!--\n";
|
|
|
|
|
echo "openpopup('/mod/resource/view.php?inpopup=true&id=$cm->id',".
|
|
|
|
|
"'resource$resource->id','$resource->alltext');\n";
|
|
|
|
|
echo "\n-->\n";
|
|
|
|
|
echo '</script>';
|
|
|
|
|
|
|
|
|
|
if (trim($resource->summary)) {
|
|
|
|
|
print_simple_box(text_to_html($resource->summary), "center");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id=$cm->id\" target=\"resource$resource->id\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id=$cm->id', 'resource$resource->id','$resource->alltext');\">$resource->name</a>";
|
|
|
|
|
|
|
|
|
|
echo "<p> </p>";
|
|
|
|
|
echo '<p align="center">';
|
|
|
|
|
print_string('popupresource', 'resource');
|
|
|
|
|
echo '<br />';
|
|
|
|
|
print_string('popupresourcelink', 'resource', $link);
|
|
|
|
|
echo "</p>";
|
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
die;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-28 02:11:02 +00:00
|
|
|
|
if ($CFG->resource_filterexternalpages) {
|
2003-11-27 19:09:47 +00:00
|
|
|
|
$url = "fetch.php?id=$cm->id&url=$resource->reference";
|
|
|
|
|
} else {
|
|
|
|
|
$url = "$resource->reference";
|
|
|
|
|
}
|
|
|
|
|
redirect($url, "", 0);
|
2002-10-17 14:03:59 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case WEBPAGE:
|
2003-04-29 13:31:47 +00:00
|
|
|
|
if ($frameset == "top") {
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname",
|
|
|
|
|
"$navigation <a target=\"{$CFG->framename}\" href=\"$resource->reference\"
|
|
|
|
|
title=\"$resource->reference\">$resource->name</a>", "", "", true,
|
2003-08-26 06:01:13 +00:00
|
|
|
|
update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm, "parent"));
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<center><font size=-1>".text_to_html($resource->summary, true, false)."</font></center>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
} else {
|
2003-11-28 02:11:02 +00:00
|
|
|
|
if ($CFG->resource_filterexternalpages) {
|
2003-11-27 19:09:47 +00:00
|
|
|
|
$url = "fetch.php?id=$cm->id&url=$resource->reference";
|
|
|
|
|
} else {
|
|
|
|
|
$url = "$resource->reference";
|
|
|
|
|
}
|
2002-10-17 14:03:59 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<head><title>$course->shortname: $resource->name</title></head>\n";
|
2003-10-10 06:02:43 +00:00
|
|
|
|
echo "<frameset rows=\"$CFG->resource_framesize,*\" border=\"2\">";
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<frame src=\"view.php?id=$cm->id&frameset=top\">";
|
2003-11-27 19:09:47 +00:00
|
|
|
|
echo "<frame src=\"$url\">";
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "</frameset>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case UPLOADEDFILE:
|
2003-12-30 06:53:53 +00:00
|
|
|
|
/// Possible display modes are:
|
|
|
|
|
/// File displayed in a frame in a normal window
|
|
|
|
|
/// File displayed embedded in a normal page
|
|
|
|
|
/// File displayed in a popup window
|
|
|
|
|
/// File displayed emebedded in a popup window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// First, find out what sort of file we are dealing with.
|
2003-04-29 13:31:47 +00:00
|
|
|
|
require_once("../../files/mimetypes.php");
|
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
$resourcetype = "";
|
|
|
|
|
$embedded = false;
|
2004-01-09 03:31:28 +00:00
|
|
|
|
$mimetype = mimeinfo("type", $resource->reference);
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
2004-01-09 03:31:28 +00:00
|
|
|
|
if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // It's an image
|
2003-12-30 06:53:53 +00:00
|
|
|
|
$resourcetype = "image";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
$embedded = true;
|
|
|
|
|
|
|
|
|
|
} else if ($mimetype == "audio/mp3") { // It's an MP3 audio file
|
|
|
|
|
$resourcetype = "mp3";
|
|
|
|
|
$embedded = true;
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
2004-01-20 11:22:09 +00:00
|
|
|
|
} else if ($mimetype == "video/x-ms-wmv") { // It's a Media Player file
|
|
|
|
|
$resourcetype = "wmv";
|
|
|
|
|
$embedded = true;
|
|
|
|
|
|
2004-01-09 03:31:28 +00:00
|
|
|
|
} else if ($mimetype == "text/html") { // It's a web page
|
2003-12-30 06:53:53 +00:00
|
|
|
|
$resourcetype = "html";
|
2003-11-27 19:09:47 +00:00
|
|
|
|
}
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Set up some variables
|
|
|
|
|
|
|
|
|
|
$inpopup = !empty($_GET["inpopup"]);
|
|
|
|
|
|
2003-03-11 21:35:12 +00:00
|
|
|
|
if ($CFG->slasharguments) {
|
2004-01-08 12:20:11 +00:00
|
|
|
|
$relativeurl = "/file.php/$course->id/$resource->reference";
|
2003-03-11 21:35:12 +00:00
|
|
|
|
} else {
|
2004-01-08 12:20:11 +00:00
|
|
|
|
$relativeurl = "/file.php?file=/$course->id/$resource->reference";
|
2003-03-11 21:35:12 +00:00
|
|
|
|
}
|
2004-01-08 12:20:11 +00:00
|
|
|
|
$fullurl = "$CFG->wwwroot$relativeurl";
|
2003-03-11 21:35:12 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
if ($CFG->resource_filterexternalpages and $resourcetype == "html") {
|
|
|
|
|
$fullurl = "$CFG->wwwroot/mod/resource/fetch.php?id=$cm->id&url=$fullurl";
|
|
|
|
|
}
|
2003-04-29 13:31:47 +00:00
|
|
|
|
|
2003-12-06 07:34:55 +00:00
|
|
|
|
|
2004-01-08 12:20:11 +00:00
|
|
|
|
/// Check whether this is supposed to be a popup, but was called directly
|
|
|
|
|
|
|
|
|
|
if ($resource->alltext and !$inpopup) { /// Make a page and a pop-up window
|
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name", "", "", true,
|
|
|
|
|
update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
|
|
|
|
|
|
|
|
|
echo "\n<script language=\"Javascript\">";
|
|
|
|
|
echo "\n<!--\n";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
echo "openpopup('/mod/resource/view.php?inpopup=true&id=$cm->id','resource$resource->id','$resource->alltext');\n";
|
2004-01-08 12:20:11 +00:00
|
|
|
|
echo "\n-->\n";
|
|
|
|
|
echo '</script>';
|
|
|
|
|
|
|
|
|
|
if (trim($resource->summary)) {
|
|
|
|
|
print_simple_box(text_to_html($resource->summary), "center");
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-09 03:31:28 +00:00
|
|
|
|
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id=$cm->id\" target=\"resource$resource->id\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id=$cm->id', 'resource$resource->id','$resource->alltext');\">$resource->name</a>";
|
2004-01-08 12:20:11 +00:00
|
|
|
|
|
|
|
|
|
echo "<p> </p>";
|
|
|
|
|
echo '<p align="center">';
|
|
|
|
|
print_string('popupresource', 'resource');
|
|
|
|
|
echo '<br />';
|
|
|
|
|
print_string('popupresourcelink', 'resource', $link);
|
|
|
|
|
echo "</p>";
|
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
/// Now check whether we need to display a frameset
|
2003-05-13 07:51:26 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
if (empty($frameset) and !$embedded and !$inpopup) {
|
|
|
|
|
echo "<head><title>$course->shortname: $resource->name</title></head>\n";
|
|
|
|
|
echo "<frameset rows=\"$CFG->resource_framesize,*\" border=\"2\">";
|
|
|
|
|
echo "<frame src=\"view.php?id=$cm->id&frameset=top\">";
|
|
|
|
|
echo "<frame src=\"$fullurl\">";
|
|
|
|
|
echo "</frameset>";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2003-11-27 19:09:47 +00:00
|
|
|
|
|
2003-10-19 14:21:54 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
/// We can only get here once per resource, so add an entry to the log
|
2003-05-13 07:51:26 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-08-26 06:01:13 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
|
|
|
|
/// If we are in a frameset, just print the top of it
|
|
|
|
|
|
|
|
|
|
if ($frameset == "top") {
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname",
|
2003-12-30 06:53:53 +00:00
|
|
|
|
"$navigation <a target=\"$CFG->framename\" href=\"$fullurl\">$resource->name</a>",
|
2003-03-12 08:02:05 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource),
|
2003-12-30 06:53:53 +00:00
|
|
|
|
navmenu($course, $cm, "parent"));
|
2003-04-29 13:31:47 +00:00
|
|
|
|
echo "<center><font size=-1>".text_to_html($resource->summary, true, false)."</font></center>";
|
2003-12-30 06:53:53 +00:00
|
|
|
|
echo "</body></html>";
|
|
|
|
|
exit;
|
2003-05-13 07:51:26 +00:00
|
|
|
|
}
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Display the actual resource
|
|
|
|
|
|
2003-05-13 07:51:26 +00:00
|
|
|
|
if ($embedded) { // Display resource embedded in page
|
2004-01-20 11:22:09 +00:00
|
|
|
|
$strdirectlink = get_string("directlink", "resource");
|
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
if ($inpopup) {
|
|
|
|
|
print_header($pagetitle);
|
|
|
|
|
} else {
|
|
|
|
|
print_header($pagetitle, "$course->fullname",
|
2004-01-20 11:22:09 +00:00
|
|
|
|
"$navigation <a title=\"$strdirectlink\" target=\"$CFG->framename\" ".
|
|
|
|
|
"href=\"$fullurl\">$resource->name</a>",
|
2003-12-30 06:53:53 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource),
|
|
|
|
|
navmenu($course, $cm, "self"));
|
|
|
|
|
}
|
2004-01-09 06:36:43 +00:00
|
|
|
|
|
|
|
|
|
if ($resourcetype == "image") {
|
|
|
|
|
echo "<center><p>";
|
|
|
|
|
echo "<img title=\"$resource->name\" class=\"resourceimage\" src=\"$fullurl\">";
|
|
|
|
|
echo "</p></center>";
|
|
|
|
|
|
|
|
|
|
} else if ($resourcetype == "mp3") {
|
|
|
|
|
echo "<center><p>";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
|
|
|
|
|
echo ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
|
2004-01-09 06:52:54 +00:00
|
|
|
|
echo ' width="600" height="70" id="mp3player" align="">';
|
2004-01-09 08:47:37 +00:00
|
|
|
|
echo "<param name=movie value=\"$CFG->wwwroot/lib/mp3player/mp3player.swf?src=$fullurl&autostart=yes\">";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
echo '<param name=quality value=high>';
|
|
|
|
|
echo '<param name=bgcolor value="#333333">';
|
2004-01-09 08:47:37 +00:00
|
|
|
|
echo "<embed src=\"$CFG->wwwroot/lib/mp3player/mp3player.swf?src=$fullurl&autostart=yes\" ";
|
2004-01-09 06:52:54 +00:00
|
|
|
|
echo " quality=high bgcolor=\"#333333\" width=\"600\" height=\"70\" name=\"mp3player\" ";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
echo ' type="application/x-shockwave-flash" ';
|
|
|
|
|
echo ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
|
|
|
|
|
echo '</embed>';
|
|
|
|
|
echo '</object>';
|
2004-01-09 06:36:43 +00:00
|
|
|
|
echo "</p></center>";
|
2004-01-20 11:22:09 +00:00
|
|
|
|
|
|
|
|
|
} else if ($resourcetype == "wmv") {
|
|
|
|
|
echo "<center><p>";
|
|
|
|
|
echo '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
|
|
|
|
|
echo ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
|
|
|
|
|
echo ' standby="Loading Microsoft<66> Windows<77> Media Player components..." ';
|
|
|
|
|
echo ' id="wmvplayer" align="" type="application/x-oleobject">';
|
|
|
|
|
echo "<param name=\"Filename\" value=\"$fullurl\">";
|
|
|
|
|
echo '<param name="ShowControls" value=true>';
|
|
|
|
|
echo '<param name="AutoRewind" value=true>';
|
|
|
|
|
echo '<param name="AutoStart" value=true>';
|
|
|
|
|
echo '<param name="Autosize" value=true>';
|
|
|
|
|
echo '<param name="EnableContextMenu" value=true>';
|
|
|
|
|
echo '<param name="TransparentAtStart" value=false>';
|
|
|
|
|
echo '<param name="AnimationAtStart" value=false>';
|
|
|
|
|
echo '<param name="ShowGotoBar" value=false>';
|
|
|
|
|
echo '<param name="EnableFullScreenControls" value=true>';
|
|
|
|
|
echo "\n<embed src=\"$fullurl\" name=\"wmvplayer\" type=\"application/x-mplayer2\" ";
|
|
|
|
|
echo ' ShowControls="1" AutoRewind="1" AutoStart="1" Autosize="1" EnableContextMenu="1"';
|
|
|
|
|
echo ' TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1"';
|
|
|
|
|
echo ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
|
|
|
|
|
echo '</embed>';
|
|
|
|
|
echo '</object>';
|
|
|
|
|
echo "</p></center>";
|
2004-01-09 03:31:28 +00:00
|
|
|
|
}
|
2004-01-20 11:22:09 +00:00
|
|
|
|
|
2004-01-09 06:52:54 +00:00
|
|
|
|
if ($resource->summary) {
|
|
|
|
|
print_simple_box(format_text($resource->summary), 'center');
|
|
|
|
|
}
|
2004-01-20 11:22:09 +00:00
|
|
|
|
|
|
|
|
|
if ($inpopup) {
|
|
|
|
|
echo "<center><p>(<a href=\"$fullurl\">$strdirectlink</a>)</p></center>";
|
|
|
|
|
} else {
|
2004-01-09 06:52:54 +00:00
|
|
|
|
print_spacer(20,20);
|
2003-10-19 14:21:54 +00:00
|
|
|
|
print_footer($course);
|
|
|
|
|
}
|
2004-01-08 12:20:11 +00:00
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
} else { // Display the resource on it's own
|
|
|
|
|
redirect($fullurl);
|
2002-10-17 14:03:59 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2003-12-30 06:53:53 +00:00
|
|
|
|
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case PLAINTEXT:
|
2002-10-17 14:03:59 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name",
|
2002-11-10 07:37:15 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
2003-10-28 14:01:15 +00:00
|
|
|
|
print_simple_box(format_text($resource->alltext), "center", "", "$THEME->cellcontent", "20");
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<center><p><font size=1>$strlastmodified: ".userdate($resource->timemodified)."</p></center>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
break;
|
|
|
|
|
|
2002-11-10 14:03:25 +00:00
|
|
|
|
case HTML:
|
2002-10-17 14:03:59 +00:00
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name",
|
2002-11-10 07:37:15 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_simple_box_start("center", "", "$THEME->cellcontent", "20");
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
2003-10-28 14:01:15 +00:00
|
|
|
|
echo format_text($resource->alltext, FORMAT_HTML);
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
print_simple_box_end();
|
|
|
|
|
|
2003-05-18 06:05:23 +00:00
|
|
|
|
echo "<center><p><font size=1>$strlastmodified: ".userdate($resource->timemodified)."</p></center>";
|
2002-10-17 14:03:59 +00:00
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
break;
|
|
|
|
|
|
2002-12-24 07:01:03 +00:00
|
|
|
|
case PROGRAM: // Code provided by Mark Kimes <hectorp@buckfoodsvc.com>
|
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
|
|
|
|
|
|
|
|
|
$temptime = gmdate("YmdHis",time());
|
|
|
|
|
|
|
|
|
|
$temproot = $CFG->wwwroot . "/mod/resource/";
|
|
|
|
|
|
|
|
|
|
// I tried to get around this. I really did. But here we
|
|
|
|
|
// are, redefining the navigation resources specifically anyway.
|
|
|
|
|
// On the plus side, you can change the format of the navigation
|
|
|
|
|
// strings above without worrying what it'll do to this code. On
|
|
|
|
|
// the negative side, you'll have to update this code if you
|
|
|
|
|
// change the structure of the navigation completely. Bonus
|
|
|
|
|
// is that now we can have a chain of cooperative sites, each
|
|
|
|
|
// adding to the navigation string as it moves down the line,
|
|
|
|
|
// which could be quite cool. -- Mark
|
|
|
|
|
|
|
|
|
|
if ($course->category) {
|
|
|
|
|
$tempref = "<$course->shortname><" . $temproot . "../../course/view.php?id=$course->id>" .
|
|
|
|
|
"<$strresources><" . $temproot . "index.php?id=$course->id>";
|
|
|
|
|
} else {
|
|
|
|
|
$tempref = "<$strresources><index.php?id=$course->id>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tempurl = trim($resource->reference);
|
|
|
|
|
|
|
|
|
|
if ($tempquerystring = strstr($tempurl,'?')) {
|
|
|
|
|
$tempquerystring = substr($tempquerystring,1);
|
|
|
|
|
$tempurl = substr($tempurl,0,strlen($tempurl) - strlen($tempquerystring));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($tempquerystring)) {
|
|
|
|
|
$tempquerystring = preg_replace("/(.*=)([^&]*)/e",
|
|
|
|
|
"'\\1' . urlencode('\\2')",
|
|
|
|
|
$tempquerystring);
|
|
|
|
|
}
|
|
|
|
|
$temp = $tempurl . $tempquerystring .
|
|
|
|
|
((strstr($tempurl,'?')) ? "&" : "?") .
|
|
|
|
|
"extern_nav=" . urlencode($tempref) .
|
|
|
|
|
"&extern_usr=" .
|
|
|
|
|
urlencode($USER->username) .
|
|
|
|
|
"&extern_nam=" . urlencode("$USER->firstname $USER->lastname") .
|
|
|
|
|
"&extern_tim=" . urlencode($temptime) .
|
|
|
|
|
"&extern_pwd=" .
|
|
|
|
|
urlencode(md5($temptime . $USER->password));
|
|
|
|
|
redirect($temp);
|
|
|
|
|
break;
|
|
|
|
|
|
2003-05-01 03:43:16 +00:00
|
|
|
|
case WIKITEXT:
|
|
|
|
|
add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name",
|
2003-05-01 03:43:16 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
|
|
|
|
|
2003-10-28 14:01:15 +00:00
|
|
|
|
print_simple_box(format_text($resource->alltext, FORMAT_WIKI), "center", "", "$THEME->cellcontent", "20" );
|
2003-05-01 03:43:16 +00:00
|
|
|
|
|
|
|
|
|
echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</p></center>";
|
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
2002-10-17 14:03:59 +00:00
|
|
|
|
default:
|
2003-05-18 06:05:23 +00:00
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $resource->name",
|
2002-11-10 07:37:15 +00:00
|
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
|
2002-10-17 14:03:59 +00:00
|
|
|
|
print_heading($resource->name);
|
|
|
|
|
|
|
|
|
|
print_simple_box("Error: unknown type of resource", "center");
|
|
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-06 07:34:55 +00:00
|
|
|
|
?>
|