function display() {
global $CFG, $THEME;
- $strresource = get_string("modulename", "resource");
- $strresources = get_string("modulenameplural", "resource");
- $strlastmodified = get_string("lastmodified");
+/// Set up generic stuff first, including checking for access
+ parent::display();
- $course = $this->course; // Shortcut
- $resource = $this->resource; // Shortcut
-
- if ($course->category) {
- require_login($course->id);
- $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> ->";
- } else {
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$course->id}\">$strresources</a> ->"; }
+/// Set up some shorthand variables
+ $cm = $this->cm;
+ $course = $this->course;
+ $resource = $this->resource;
require_once("../../files/mimetypes.php");
$subdir = isset($_GET['subdir']) ? $_GET['subdir'] : '';
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id);
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
if ($resource->reference) {
$relativepath = "{$course->id}/{$resource->reference}";
array_shift($subs);
$countsubs = count($subs);
$count = 0;
- $subnav = "<a href=\"view.php?id={$this->cm->id}\">{$resource->name}</a>";
+ $subnav = "<a href=\"view.php?id={$cm->id}\">{$resource->name}</a>";
$backsub = '';
foreach ($subs as $sub) {
$count++;
if ($count < $countsubs) {
$backsub .= "/$sub";
- $subnav .= " -> <a href=\"view.php?id={$this->cm->id}&subdir=$backsub\">$sub</a>";
+ $subnav .= " -> <a href=\"view.php?id={$cm->id}&subdir=$backsub\">$sub</a>";
} else {
$subnav .= " -> $sub";
}
$pagetitle = strip_tags($course->shortname.': '.$resource->name);
- print_header($pagetitle, $course->fullname, "$navigation $subnav",
- "", "", true, update_module_button($this->cm->id, $course->id, $strresource),
- navmenu($course, $this->cm));
+ print_header($pagetitle, $course->fullname, "$this->navigation $subnav",
+ "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ navmenu($course, $cm));
if (isteacheredit($course->id)) {
echo "<div align=\"right\"><img src=\"$CFG->pixpath/i/files.gif\" height=\"16\" width=\"16\" alt=\"\" /> ".
echo '</td>';
echo '<td nowrap="nowrap"><p>';
if ($icon == 'folder.gif') {
- echo "<a href=\"view.php?id={$this->cm->id}&subdir=$subdir/$file\">$file</a>";
+ echo "<a href=\"view.php?id={$cm->id}&subdir=$subdir/$file\">$file</a>";
} else {
link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "$file", 450, 600, '');
}
function display() {
global $CFG, $THEME;
- $this->set_parameters(); // set the parameters array
-
- $course = $this->course; // shortcut
- $resource = $this->resource; // shortcut
-
- $strresource = get_string("modulename", "resource");
- $strresources = get_string("modulenameplural", "resource");
- $strlastmodified = get_string("lastmodified");
+/// Set up generic stuff first, including checking for access
+ parent::display();
- if ($course->category) {
- require_login($course->id);
- $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> ->";
- } else {
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$course->id}\">$strresources</a> ->";
- }
+/// Set up some shorthand variables
+ $cm = $this->cm;
+ $course = $this->course;
+ $resource = $this->resource;
+ $this->set_parameters(); // set the parameters array
///////////////////////////////////////////////
if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window
- print_header($pagetitle, $course->fullname, "$navigation {$resource->name}", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm));
+ print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}", "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
echo "\n<script language=\"javascript\" type=\"text/javascript\">";
echo "\n<!--\n";
- echo "openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}','resource{$resource->id}','{$resource->popup}');\n";
+ echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
echo "\n-->\n";
echo '</script>';
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$resource->id}','{$resource->popup}');\">{$resource->name}</a>";
+ $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->popup}');\">{$resource->name}</a>";
echo "<p> </p>";
echo '<p align="center">';
echo '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />';
echo "<title>{$course->shortname}: {$resource->name}</title></head>\n";
echo "<frameset rows=\"$CFG->resource_framesize,*\">";
- echo "<frame src=\"view.php?id={$this->cm->id}&type={$resource->type}&frameset=top\" />";
+ echo "<frame src=\"view.php?id={$cm->id}&type={$resource->type}&frameset=top\" />";
echo "<frame src=\"$fullurl\" />";
echo "</frameset>";
echo "</html>";
/// We can only get here once per resource, so add an entry to the log
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id);
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
/// If we are in a frameset, just print the top of it
if (!empty($_GET['frameset']) and $_GET['frameset'] == "top") {
- print_header($pagetitle, $course->fullname, "$navigation <a target=\"$CFG->framename\" href=\"$fullurl\">{$resource->name}</a>", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm, "parent"));
+ print_header($pagetitle, $course->fullname, "$this->navigation <a target=\"$CFG->framename\" href=\"$fullurl\">{$resource->name}</a>", "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
echo "<center><font size=\"-1\">".text_to_html($resource->summary, true, false)."</font></center>";
echo "</body></html>";
if ($inpopup) {
print_header($pagetitle);
} else {
- print_header($pagetitle, $course->fullname, "$navigation <a title=\"$strdirectlink\" target=\"$CFG->framename\" href=\"$fullurl\"> {$resource->name}</a>", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm, "self"));
+ print_header($pagetitle, $course->fullname, "$this->navigation <a title=\"$strdirectlink\" target=\"$CFG->framename\" href=\"$fullurl\"> {$resource->name}</a>", "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
}
function display() {
global $CFG, $THEME;
- $course = $this->course; // Shortcut
- $resource = $this->resource; // Shortcut
+/// Set up generic stuff first, including checking for access
+ parent::display();
- $strresource = get_string("modulename", "resource");
- $strresources = get_string("modulenameplural", "resource");
- $strlastmodified = get_string("lastmodified");
-
- if ($course->category) {
- require_login($course->id);
- $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> ->";
- } else {
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$course->id}\">$strresources</a> ->";
- }
+/// Set up some shorthand variables
+ $cm = $this->cm;
+ $course = $this->course;
+ $resource = $this->resource;
$pagetitle = strip_tags($course->shortname.': '.$resource->name);
$formatoptions->noclean = true;
if ($resource->popup) {
if ($inpopup) { /// Popup only
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id);
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
print_header();
print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id),
"center", "", "$THEME->cellcontent", "20");
print_footer($course);
} else { /// Make a page and a pop-up window
- print_header($pagetitle, $course->fullname, "$navigation {$resource->name}",
- "", "", true, update_module_button($this->cm->id, $course->id, $strresource),
- navmenu($course, $this->cm));
+ print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}",
+ "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ navmenu($course, $cm));
echo "\n<script language=\"javascript\" type=\"text/javascript\">";
echo "\n<!--\n";
- echo "openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}','resource{$resource->id}','{$resource->popup}');\n";
+ echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
echo "\n-->\n";
echo '</script>';
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$resource->id}','{$resource->popup}');\">{$resource->name}</a>";
+ $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->popup}');\">{$resource->name}</a>";
echo "<p> </p>";
echo '<p align="center">';
}
} else { /// not a popup at all
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id);
- print_header($pagetitle, $course->fullname, "$navigation {$resource->name}",
- "", "", true, update_module_button($this->cm->id, $course->id, $strresource),
- navmenu($course, $this->cm));
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
+ print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}",
+ "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ navmenu($course, $cm));
print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20");
+ $strlastmodified = get_string("lastmodified");
echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</font></p></center>";
print_footer($course);
function display() {
global $CFG, $THEME;
- $course = $this->course; // Shortcut
- $resource = $this->resource; // Shortcut
+/// Set up generic stuff first, including checking for access
+ parent::display();
- $strresource = get_string("modulename", "resource");
- $strresources = get_string("modulenameplural", "resource");
- $strlastmodified = get_string("lastmodified");
-
- if ($course->category) {
- require_login($course->id);
- $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> ->";
- } else {
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$course->id}\">$strresources</a> ->"; }
+/// Set up some shorthand variables
+ $cm = $this->cm;
+ $course = $this->course;
+ $resource = $this->resource;
$pagetitle = strip_tags($course->shortname.': '.$resource->name);
$formatoptions->noclean = true;
if ($resource->popup) {
if ($inpopup) { /// Popup only
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}",
- $resource->id, $this->cm->id);
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}",
+ $resource->id, $cm->id);
print_header();
print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id),
"center", "", "$THEME->cellcontent", "20");
print_footer($course);
} else { /// Make a page and a pop-up window
- print_header($pagetitle, $course->fullname, "$navigation {$resource->name}",
- "", "", true, update_module_button($this->cm->id, $course->id, $strresource),
- navmenu($course, $this->cm));
+ print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}",
+ "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ navmenu($course, $cm));
echo "\n<script language=\"javascript\" type=\"text/javascript\">";
echo "\n<!--\n";
- echo "openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}','resource{$resource->id}','{$resource->popup}');\n";
+ echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
echo "\n-->\n";
echo '</script>';
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$resource->id}','{$resource->popup}');\">{$resource->name}</a>";
+ $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->popup}');\">{$resource->name}</a>";
echo "<p> </p>";
echo '<p align="center">';
}
} else { /// not a popup at all
- add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id);
- print_header($pagetitle, $course->fullname, "$navigation {$resource->name}",
- "", "", true, update_module_button($this->cm->id, $course->id, $strresource),
- navmenu($course, $this->cm));
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
+ print_header($pagetitle, $course->fullname, "$this->navigation {$resource->name}",
+ "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ navmenu($course, $cm));
print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id),
"center", "", "$THEME->cellcontent", "20");
+ $strlastmodified = get_string("lastmodified");
echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</font></p></center>";
print_footer($course);