Merged changes from STABLE
This commit is contained in:
@@ -10,25 +10,19 @@ function resource_directory($cmid=0) {
|
||||
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}";
|
||||
@@ -46,13 +40,13 @@ function display() {
|
||||
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";
|
||||
}
|
||||
@@ -63,9 +57,9 @@ function display() {
|
||||
|
||||
$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=\"\" /> ".
|
||||
@@ -123,7 +117,7 @@ function display() {
|
||||
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, '');
|
||||
}
|
||||
|
||||
@@ -180,25 +180,17 @@ function update_instance($resource) {
|
||||
function display() {
|
||||
global $CFG, $THEME;
|
||||
|
||||
/// Set up generic stuff first, including checking for access
|
||||
parent::display();
|
||||
|
||||
/// Set up some shorthand variables
|
||||
$cm = $this->cm;
|
||||
$course = $this->course;
|
||||
$resource = $this->resource;
|
||||
|
||||
|
||||
$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");
|
||||
|
||||
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> ->";
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
|
||||
/// Possible display modes are:
|
||||
@@ -287,12 +279,12 @@ function display() {
|
||||
|
||||
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>';
|
||||
|
||||
@@ -301,7 +293,7 @@ function display() {
|
||||
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">';
|
||||
@@ -324,7 +316,7 @@ function display() {
|
||||
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>";
|
||||
@@ -334,13 +326,13 @@ function display() {
|
||||
|
||||
/// 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>";
|
||||
@@ -356,7 +348,7 @@ function display() {
|
||||
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"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -79,20 +79,13 @@ function update_instance($resource) {
|
||||
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;
|
||||
@@ -100,20 +93,20 @@ function display() {
|
||||
|
||||
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>';
|
||||
|
||||
@@ -121,7 +114,7 @@ function display() {
|
||||
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">';
|
||||
@@ -134,13 +127,14 @@ function display() {
|
||||
}
|
||||
} 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);
|
||||
|
||||
@@ -77,19 +77,13 @@ function update_instance($resource) {
|
||||
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;
|
||||
@@ -97,21 +91,21 @@ function display() {
|
||||
|
||||
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>';
|
||||
|
||||
@@ -119,7 +113,7 @@ function display() {
|
||||
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">';
|
||||
@@ -132,14 +126,15 @@ function display() {
|
||||
}
|
||||
} 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);
|
||||
|
||||
Reference in New Issue
Block a user