From 518f01ce4f62854ce9cdc26a188c8a67128b4eb7 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 9 Aug 2004 15:45:22 +0000 Subject: [PATCH] Cleaned up some more things using some shortcut variables, and also fixed bug 1711 that was preventing glossaries from working properly --- mod/resource/details.php | 462 ------------------ .../type/directory/resource.class.php | 47 +- mod/resource/type/file/resource.class.php | 68 +-- mod/resource/type/html/resource.class.php | 50 +- mod/resource/type/text/resource.class.php | 52 +- 5 files changed, 113 insertions(+), 566 deletions(-) delete mode 100644 mod/resource/details.php diff --git a/mod/resource/details.php b/mod/resource/details.php deleted file mode 100644 index f2e38e4e42..0000000000 --- a/mod/resource/details.php +++ /dev/null @@ -1,462 +0,0 @@ -course)) { - error("This course doesn't exist"); - } - - require_login($course->id); - - if (!isteacher($course->id)) { - error("You can't modify this course!"); - } - - $stredit = get_string("edit"); - $strediting = get_string("editingaresource", "resource"); - $strname = get_string("name"); - $strtypename = $RESOURCE_TYPE["$form->type"]; - $strexample = get_string("example", "resource"); - $strresources = get_string("modulenameplural", "resource"); - - $form->name = stripslashes($form->name); // remove slashes - - print_header("$course->shortname: $strediting", "$course->shortname: $strediting", - "wwwroot/course/view.php?id=$course->id\">$course->shortname -> - id\">$strresources -> $form->name ($stredit)"); - - if (!$form->name or !$form->type or !$form->summary) { - error(get_string("filloutallfields"), $_SERVER["HTTP_REFERER"]); - } - - $form->alltext = ""; - if ($form->instance) { - $form->alltext = get_field("resource", "alltext", "id", "$form->instance"); - } - - print_simple_box_start("center", "", "$THEME->cellheading"); - - echo "
destination\">"; - echo ""; - echo ""; - - - switch ($form->type) { - case REFERENCE: - $strexamplereference = get_string("examplereference", "resource"); - ?> - - - - - - - - - - reference)) { - $form->reference = $CFG->resource_defaulturl; - } - ?> - - - - - - - - - - reference)) { - $form->reference = $CFG->resource_defaulturl; - } - - foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) { - $stringname = "str$optionname"; - $$stringname = get_string("new$optionname", "resource"); - $window->$optionname = ""; - $jsoption[] = "\"$optionname\""; - } - $alljsoptions = implode(",", $jsoption); - - if ($form->instance) { // Re-editing - if (!$form->alltext) { - $newwindow = ""; // Disable the new window - } else { - $newwindow = "checked"; - $rawoptions = explode(',', $form->alltext); - foreach ($rawoptions as $rawoption) { - $option = explode('=', trim($rawoption)); - $optionname = $option[0]; - $optionvalue = $option[1]; - if ($optionname == "height" or $optionname == "width") { - $window->$optionname = $optionvalue; - } else if ($optionvalue) { - $window->$optionname = "checked"; - } - } - } - } else { - foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) { - $defaultvalue = "resource_popup$optionname"; - $window->$optionname = $CFG->$defaultvalue; - } - $newwindow = $CFG->resource_popup; - } - - ?> - - - - - - - - - - - - - - - $optionname = ""; - $jsoption[] = "\"$optionname\""; - } - $alljsoptions = implode(",", $jsoption); - - if ($form->instance) { // Re-editing - if (!$form->alltext) { - $newwindow = ""; // Disable the new window - } else { - $newwindow = "checked"; - $rawoptions = explode(',', $form->alltext); - foreach ($rawoptions as $rawoption) { - $option = explode('=', trim($rawoption)); - $optionname = $option[0]; - $optionvalue = $option[1]; - if ($optionname == "height" or $optionname == "width") { - $window->$optionname = $optionvalue; - } else if ($optionvalue) { - $window->$optionname = "checked"; - } - } - } - } else { - foreach ($RESOURCE_WINDOW_OPTIONS as $optionname) { - $defaultvalue = "resource_popup$optionname"; - $window->$optionname = $CFG->$defaultvalue; - } - $newwindow = $CFG->resource_popup; - } - - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dataroot/$course->id", 'moddata', true, true, false); - $dirs = array(); - foreach ($rawdirs as $rawdir) { - $dirs[$rawdir] = $rawdir; - } - $strdirectoryinfo = get_string("directoryinfo", "resource"); - $strmaindirectory = get_string("maindirectory", "resource"); - ?> - - - - - - - - - - -

$strname:

$form->name

-

:

-
- -
-

()

-
-

-
-

:

-
- - resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">\n"; - ?> -
  - -

-
-

:

-
- - resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\">\n"; - ?> -
  - -

-
-

-
- - - - onclick="return lockoptions('theform','newwindow', subitems)"> - -
    - $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo ""; - echo "$name.">"; - $stringname = "str$name"; - echo $$stringname."
    "; - } - ?> - - - -
    - - - -
    - "; - echo "lockoptions('theform','newwindow', subitems);"; - echo ""; - } - ?> -
-

-
-

:

-
- reference\"> "; - button_to_popup_window ("/mod/resource/coursefiles.php?id=$course->id", - "coursefiles", $strchooseafile, 500, 750, $strchooseafile); - ?> -
-

-
- - - - onclick="return lockoptions('theform','newwindow', subitems)"> - -
    - $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo ""; - echo "$name.">"; - $stringname = "str$name"; - echo $$stringname."
    "; - } - ?> - - - -
    - - - -
    - "; - echo "lockoptions('theform','newwindow', subitems);"; - echo ""; - } - ?> -
-

-
-

:

-
- -
  - -

-
-

:


- -
-
-
-
-
- -
-

:


- -
-
-
-
- -
-

:


- -
-
-
-
- alltext); ?> -
-

:

-
- reference, $strmaindirectory, '', '') ?> -
  - -

-
- - - - - - - - - - - -
- "> - "> -
-
-type == HTML) { - use_html_editor("alltext"); - } - print_simple_box_end(); - print_footer($course); - - } else { - error("This script was called incorrectly"); - } -?> diff --git a/mod/resource/type/directory/resource.class.php b/mod/resource/type/directory/resource.class.php index eb644adc4b..379699a57e 100644 --- a/mod/resource/type/directory/resource.class.php +++ b/mod/resource/type/directory/resource.class.php @@ -14,23 +14,26 @@ function display() { $strresources = get_string("modulenameplural", "resource"); $strlastmodified = get_string("lastmodified"); - if ($this->course->category) { - require_login($this->course->id); - $navigation = "framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname} -> - framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + $course = $this->course; // Shortcut + $resource = $this->resource; // Shortcut + + if ($course->category) { + require_login($course->id); + $navigation = "framename}\" href=\"../../course/view.php?id={$course->id}\">{$course->shortname} -> + framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } else { - $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; } + $navigation = "framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } require_once("../../files/mimetypes.php"); $subdir = isset($_GET['subdir']) ? $_GET['subdir'] : ''; - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id); - if ($this->resource->reference) { - $relativepath = "{$this->course->id}/{$this->resource->reference}"; + if ($resource->reference) { + $relativepath = "{$course->id}/{$resource->reference}"; } else { - $relativepath = "{$this->course->id}"; + $relativepath = "{$course->id}"; } if ($subdir) { @@ -43,7 +46,7 @@ function display() { array_shift($subs); $countsubs = count($subs); $count = 0; - $subnav = "cm->id}\">{$this->resource->name}"; + $subnav = "cm->id}\">{$resource->name}"; $backsub = ''; foreach ($subs as $sub) { $count++; @@ -55,24 +58,24 @@ function display() { } } } else { - $subnav = $this->resource->name; + $subnav = $resource->name; } - $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + $pagetitle = strip_tags($course->shortname.': '.$resource->name); - print_header($pagetitle, $this->course->fullname, "$navigation $subnav", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + print_header($pagetitle, $course->fullname, "$navigation $subnav", + "", "", true, update_module_button($this->cm->id, $course->id, $strresource), + navmenu($course, $this->cm)); - if (isteacheredit($this->course->id)) { + if (isteacheredit($course->id)) { echo "
pixpath/i/files.gif\" height=16 width=16 alt=\"\"> ". - "wwwroot/files/index.php?id={$this->course->id}&wdir=/{$this->resource->reference}$subdir\">". + "wwwroot/files/index.php?id={$course->id}&wdir=/{$resource->reference}$subdir\">". get_string("editfiles")."...
"; } - if (trim(strip_tags($this->resource->summary))) { + if (trim(strip_tags($resource->summary))) { $formatoptions->noclean = true; - print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center"); + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); print_spacer(10,10); } @@ -81,7 +84,7 @@ function display() { if (!$files) { print_heading(get_string("nofilesyet")); - print_footer($this->course); + print_footer($course); exit; } @@ -122,7 +125,7 @@ function display() { if ($icon == 'folder.gif') { echo "cm->id}&subdir=$subdir/$file\">$file"; } else { - link_to_popup_window($relativeurl, "resourcedirectory{$this->resource->id}", "$file", 450, 600, ''); + link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "$file", 450, 600, ''); } echo '

'; echo ' '; @@ -138,7 +141,7 @@ function display() { print_simple_box_end(); - print_footer($this->course); + print_footer($course); } diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php index 8266199848..57ee8ab711 100644 --- a/mod/resource/type/file/resource.class.php +++ b/mod/resource/type/file/resource.class.php @@ -178,17 +178,19 @@ function display() { $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 ($this->course->category) { - require_login($this->course->id); - $navigation = "framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname} -> - framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + if ($course->category) { + require_login($course->id); + $navigation = "framename}\" href=\"../../course/view.php?id={$course->id}\">{$course->shortname} -> + framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } else { - $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + $navigation = "framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } @@ -208,10 +210,10 @@ function display() { $querystring = ''; $resourcetype = ''; $embedded = false; - $mimetype = mimeinfo("type", $this->resource->reference); - $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + $mimetype = mimeinfo("type", $resource->reference); + $pagetitle = strip_tags($course->shortname.': '.$resource->name); - if ($this->resource->options != "frame") { + if ($resource->options != "frame") { if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // It's an image $resourcetype = "image"; $embedded = true; @@ -236,9 +238,9 @@ function display() { /// Form the parse string - if (!empty($this->resource->alltext)) { + if (!empty($resource->alltext)) { $querys = array(); - $parray = explode(',', $this->resource->alltext); + $parray = explode(',', $resource->alltext); foreach ($parray as $fieldstring) { $field = explode('=', $fieldstring); $querys[] = urlencode($field[1]).'='.urlencode($this->parameters[$field[0]]['value']); @@ -251,10 +253,10 @@ function display() { $inpopup = !empty($_GET["inpopup"]); - if (resource_is_url($this->resource->reference)) { - $fullurl = $this->resource->reference; + if (resource_is_url($resource->reference)) { + $fullurl = $resource->reference; if (!empty($querystring)) { - $urlpieces = parse_url($this->resource->reference); + $urlpieces = parse_url($resource->reference); if (empty($urlpieces['query'])) { $fullurl .= '?'.$querystring; } else { @@ -263,12 +265,12 @@ function display() { } } else { if ($CFG->slasharguments) { - $relativeurl = "/file.php/{$this->course->id}/{$this->resource->reference}"; + $relativeurl = "/file.php/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '?'.$querystring; } } else { - $relativeurl = "/file.php?file=/{$this->course->id}/{$this->resource->reference}"; + $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '&'.$querystring; } @@ -279,23 +281,23 @@ function display() { /// Check whether this is supposed to be a popup, but was called directly - if ($this->resource->popup and !$inpopup) { /// Make a page and a pop-up window + if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window - print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm)); + print_header($pagetitle, $course->fullname, "$navigation {$resource->name}", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm)); echo "\n'; - if (trim(strip_tags($this->resource->summary))) { + if (trim(strip_tags($resource->summary))) { $formatoptions->noclean = true; - print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center"); + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center"); } - $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}"; + $link = "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}"; echo "

 

"; echo '

'; @@ -304,17 +306,17 @@ function display() { print_string('popupresourcelink', 'resource', $link); echo "

"; - print_footer($this->course); + print_footer($course); exit; } /// Now check whether we need to display a frameset - if (empty($_GET['frameset']) and !$embedded and !$inpopup and $this->resource->options == "frame") { - echo "{$this->course->shortname}: {$this->resource->name}\n"; + if (empty($_GET['frameset']) and !$embedded and !$inpopup and $resource->options == "frame") { + echo "{$course->shortname}: {$resource->name}\n"; echo "resource_framesize,*\" border=\"2\">"; - echo "cm->id}&type={$this->resource->type}&frameset=top\">"; + echo "cm->id}&type={$resource->type}&frameset=top\">"; echo ""; echo ""; exit; @@ -323,15 +325,15 @@ function display() { /// We can only get here once per resource, so add an entry to the log - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->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, $this->course->fullname, "$navigation framename\" href=\"$fullurl\">{$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm, "parent")); + print_header($pagetitle, $course->fullname, "$navigation framename\" href=\"$fullurl\">{$resource->name}", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm, "parent")); - echo "
".text_to_html($this->resource->summary, true, false)."
"; + echo "
".text_to_html($resource->summary, true, false)."
"; echo ""; exit; } @@ -345,13 +347,13 @@ function display() { if ($inpopup) { print_header($pagetitle); } else { - print_header($pagetitle, $this->course->fullname, "$navigation framename\" href=\"$fullurl\"> {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm, "self")); + print_header($pagetitle, $course->fullname, "$navigation framename\" href=\"$fullurl\"> {$resource->name}", "", "", true, update_module_button($this->cm->id, $course->id, $strresource), navmenu($course, $this->cm, "self")); } if ($resourcetype == "image") { echo "

"; - echo "resource->name}\" class=\"resourceimage\" src=\"$fullurl\">"; + echo "name}\" class=\"resourceimage\" src=\"$fullurl\">"; echo "

"; } else if ($resourcetype == "mp3") { @@ -415,16 +417,16 @@ function display() { echo "

"; } - if (trim($this->resource->summary)) { + if (trim($resource->summary)) { $formatoptions->noclean = true; - print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center"); + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); } if ($inpopup) { echo "

($strdirectlink)

"; } else { print_spacer(20,20); - print_footer($this->course); + print_footer($course); } } else { // Display the resource on it's own diff --git a/mod/resource/type/html/resource.class.php b/mod/resource/type/html/resource.class.php index baca50709f..e94518b2d3 100644 --- a/mod/resource/type/html/resource.class.php +++ b/mod/resource/type/html/resource.class.php @@ -65,46 +65,48 @@ function update_instance($resource) { function display() { global $CFG, $THEME; + $course = $this->course; // Shortcut + $resource = $this->resource; // Shortcut $strresource = get_string("modulename", "resource"); $strresources = get_string("modulenameplural", "resource"); $strlastmodified = get_string("lastmodified"); - if ($this->course->category) { - require_login($this->course->id); - $navigation = "framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname} -> - framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + if ($course->category) { + require_login($course->id); + $navigation = "framename}\" href=\"../../course/view.php?id={$course->id}\">{$course->shortname} -> + framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } else { - $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + $navigation = "framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } - $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + $pagetitle = strip_tags($course->shortname.': '.$resource->name); $formatoptions->noclean = true; $inpopup = !empty($_GET["inpopup"]); - if ($this->resource->popup) { + if ($resource->popup) { if ($inpopup) { /// Popup only - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", $resource->id, $this->cm->id); print_header(); - print_simple_box(format_text($this->resource->alltext, FORMAT_HTML, $formatoptions), + print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20"); } else { /// Make a page and a pop-up window - print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + print_header($pagetitle, $course->fullname, "$navigation {$resource->name}", + "", "", true, update_module_button($this->cm->id, $course->id, $strresource), + navmenu($course, $this->cm)); echo "\n'; - if (trim(strip_tags($this->resource->summary))) { - print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center"); + if (trim(strip_tags($resource->summary))) { + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); } - $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}"; + $link = "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}"; echo "

 

"; echo '

'; @@ -113,20 +115,20 @@ function display() { print_string('popupresourcelink', 'resource', $link); echo "

"; - print_footer($this->course); + print_footer($course); } } else { /// not a popup at all - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); - print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + 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)); - print_simple_box(format_text($this->resource->alltext, FORMAT_HTML, $formatoptions), "center", "", "$THEME->cellcontent", "20"); + print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20"); - echo "

$strlastmodified: ".userdate($this->resource->timemodified)."

"; + echo "

$strlastmodified: ".userdate($resource->timemodified)."

"; - print_footer($this->course); + print_footer($course); } } diff --git a/mod/resource/type/text/resource.class.php b/mod/resource/type/text/resource.class.php index d45adc05f2..a3a7066dd8 100644 --- a/mod/resource/type/text/resource.class.php +++ b/mod/resource/type/text/resource.class.php @@ -63,46 +63,48 @@ function update_instance($resource) { function display() { global $CFG, $THEME; + $course = $this->course; // Shortcut + $resource = $this->resource; // Shortcut $strresource = get_string("modulename", "resource"); $strresources = get_string("modulenameplural", "resource"); $strlastmodified = get_string("lastmodified"); - if ($this->course->category) { - require_login($this->course->id); - $navigation = "framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname} -> - framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + if ($course->category) { + require_login($course->id); + $navigation = "framename}\" href=\"../../course/view.php?id={$course->id}\">{$course->shortname} -> + framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } else { - $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; } + $navigation = "framename}\" href=\"index.php?id={$course->id}\">$strresources ->"; } - $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + $pagetitle = strip_tags($course->shortname.': '.$resource->name); $formatoptions->noclean = true; $inpopup = !empty($_GET["inpopup"]); - if ($this->resource->popup) { + if ($resource->popup) { if ($inpopup) { /// Popup only - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", - $this->resource->id, $this->cm->id); + add_to_log($course->id, "resource", "view", "view.php?id={$this->cm->id}", + $resource->id, $this->cm->id); print_header(); - print_simple_box(format_text($this->resource->alltext, $this->resource->options, $formatoptions), + print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20"); } else { /// Make a page and a pop-up window - print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + print_header($pagetitle, $course->fullname, "$navigation {$resource->name}", + "", "", true, update_module_button($this->cm->id, $course->id, $strresource), + navmenu($course, $this->cm)); echo "\n'; - if (trim(strip_tags($this->resource->summary))) { - print_simple_box(format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions), "center"); + if (trim(strip_tags($resource->summary))) { + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); } - $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$this->cm->id}\" target=\"resource{$this->resource->id}\" onClick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$this->cm->id}', 'resource{$this->resource->id}','{$this->resource->popup}');\">{$this->resource->name}"; + $link = "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}"; echo "

 

"; echo '

'; @@ -111,21 +113,21 @@ function display() { print_string('popupresourcelink', 'resource', $link); echo "

"; - print_footer($this->course); + print_footer($course); } } else { /// not a popup at all - add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); - print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + 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)); - print_simple_box(format_text($this->resource->alltext, $this->resource->options, $formatoptions), + print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), "center", "", "$THEME->cellcontent", "20"); - echo "

$strlastmodified: ".userdate($this->resource->timemodified)."

"; + echo "

$strlastmodified: ".userdate($resource->timemodified)."

"; - print_footer($this->course); + print_footer($course); } } -- 2.39.5