diff --git a/mod/resource/details.php b/mod/resource/details.php deleted file mode 100644 index f2e38e4e424..00000000000 --- 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 "
-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 eb644adc4bf..379699a57eb 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 " 
"; 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 "