]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed some notices ... thanks, Eloy! For some reason my server
authormoodler <moodler>
Wed, 28 Jul 2004 05:52:18 +0000 (05:52 +0000)
committermoodler <moodler>
Wed, 28 Jul 2004 05:52:18 +0000 (05:52 +0000)
isn't displaying these even though it's set up ...

mod/resource/type/directory/resource.class.php
mod/resource/type/file/resource.class.php
mod/resource/type/html/resource.class.php
mod/resource/type/reference/resource.class.php
mod/resource/type/text/resource.class.php

index 844db005102c68f4755714962a5e5135e430e62a..ced302d6e7113febafce076830f7f91b22824214 100644 (file)
@@ -11,7 +11,6 @@ function resource($cmid=0) {
 function display() {
     global $CFG, $THEME;
 
-
     $strresource = get_string("modulename", "resource");
     $strresources = get_string("modulenameplural", "resource");
     $strlastmodified = get_string("lastmodified");
@@ -19,15 +18,13 @@ function display() {
     if ($this->course->category) {
         require_login($this->course->id);
         $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> ->              
-                       <a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->";
+            <a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->";
     } else {
-        $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->";             }                                                                                                             
+        $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$strresources</a> ->";     }
 
     require_once("../../files/mimetypes.php");
 
-    if (isset($_GET['subdir'])) {
-        $subdir = $_GET['subdir'];
-    }
+    $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);
 
@@ -37,115 +34,115 @@ function display() {
         $relativepath = "{$this->course->id}";
     }
 
-            if ($subdir) {
-                if (detect_munged_arguments($subdir)) {
-                    error("The value for 'subdir' contains illegal characters!");
-                }
-                $relativepath = "$relativepath$subdir";
-
-                $subs = explode('/', $subdir);
-                array_shift($subs);
-                $countsubs = count($subs);
-                $count = 0;
-                $subnav = "<a href=\"view.php?id={$this->cm->id}\">{$this->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>";
-                    } else {
-                        $subnav .= " -> $sub";
-                    }
-                }
+    if ($subdir) {
+        if (detect_munged_arguments($subdir)) {
+            error("The value for 'subdir' contains illegal characters!");
+        }
+        $relativepath = "$relativepath$subdir";
+
+        $subs = explode('/', $subdir);
+        array_shift($subs);
+        $countsubs = count($subs);
+        $count = 0;
+        $subnav = "<a href=\"view.php?id={$this->cm->id}\">{$this->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>";
             } else {
-                $subnav = $this->resource->name;
+                $subnav .= " -> $sub";
             }
+        }
+    } else {
+        $subnav = $this->resource->name;
+    }
 
+    $pagetitle = strip_tags($this->course->shortname.': '.$this->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, $this->course->fullname, "$navigation $subnav",
+            "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource),
+            navmenu($this->course, $this->cm));
 
-            if (isteacheredit($this->course->id)) {
-                echo "<div align=\"right\"><img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\">&nbsp".
-                     "<a href=\"$CFG->wwwroot/files/index.php?id={$this->course->id}&wdir=/{$this->resource->reference}$subdir\">".
-                      get_string("editfiles")."...</a></div>";
-            }
+    if (isteacheredit($this->course->id)) {
+        echo "<div align=\"right\"><img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\">&nbsp".
+            "<a href=\"$CFG->wwwroot/files/index.php?id={$this->course->id}&wdir=/{$this->resource->reference}$subdir\">".
+            get_string("editfiles")."...</a></div>";
+    }
 
-            if (trim($this->resource->summary)) {
-                print_simple_box(text_to_html($this->resource->summary), "center");
-                print_spacer(10,10);
-            }
+    if (trim($this->resource->summary)) {
+        print_simple_box(text_to_html($this->resource->summary), "center");
+        print_spacer(10,10);
+    }
 
-            $files = get_directory_list("$CFG->dataroot/$relativepath", 'moddata', false, true, true);
+    $files = get_directory_list("$CFG->dataroot/$relativepath", 'moddata', false, true, true);
 
 
-            if (!$files) {
-                print_heading(get_string("nofilesyet"));
-                print_footer($this->course);
-                exit;
-            }
+    if (!$files) {
+        print_heading(get_string("nofilesyet"));
+        print_footer($this->course);
+        exit;
+    }
 
-            print_simple_box_start("center", "", "$THEME->cellcontent", '0' );
-
-            $strftime = get_string('strftimedatetime');
-            $strname = get_string("name");
-            $strsize = get_string("size");
-            $strmodified = get_string("modified");
-
-            echo '<table cellpadding="4" cellspacing="1">';
-            echo "<tr><th colspan=\"2\">$strname</th>".
-                     "<th align=\"right\" colspan=\"2\">$strsize</th>".
-                     "<th align=\"right\">$strmodified</th>".
-                 "</tr>";
-            foreach ($files as $file) {
-                if (is_dir("$CFG->dataroot/$relativepath/$file")) {          // Must be a directory
-                    $icon = "folder.gif";
-                    $relativeurl = "/view.php?blah";
-                    $filesize = display_size(get_directory_size("$CFG->dataroot/$relativepath/$file"));
-
-                } else {
-                    $icon = mimeinfo("icon", $file);
-
-                    if ($CFG->slasharguments) {
-                        $relativeurl = "/file.php/$relativepath/$file";
-                    } else {
-                        $relativeurl = "/file.php?file=/$relativepath/$file";
-                    }
-                    $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file"));
-                }
-
-                echo '<tr>';
-                echo '<td>';
-                echo "<img src=\"$CFG->pixpath/f/$icon\" width=\"16\" height=\"16\">";
-                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>";
-                } else {
-                    link_to_popup_window($relativeurl, "resourcedirectory{$this->resource->id}", "$file", 450, 600, '');
-                }
-                echo '</p></td>';
-                echo '<td>&nbsp;</td>';
-                echo '<td align="right" nowrap="nowrap"><p><font size="-1">';
-                echo $filesize;
-                echo '</font></p></td>';
-                echo '<td align="right" nowrap="nowrap"><p><font size="-1">';
-                echo userdate(filectime("$CFG->dataroot/$relativepath/$file"), $strftime);
-                echo '</font></p></td>';
-                echo '</tr>';
+    print_simple_box_start("center", "", "$THEME->cellcontent", '0' );
+
+    $strftime = get_string('strftimedatetime');
+    $strname = get_string("name");
+    $strsize = get_string("size");
+    $strmodified = get_string("modified");
+
+    echo '<table cellpadding="4" cellspacing="1">';
+    echo "<tr><th colspan=\"2\">$strname</th>".
+         "<th align=\"right\" colspan=\"2\">$strsize</th>".
+         "<th align=\"right\">$strmodified</th>".
+         "</tr>";
+    foreach ($files as $file) {
+        if (is_dir("$CFG->dataroot/$relativepath/$file")) {          // Must be a directory
+            $icon = "folder.gif";
+            $relativeurl = "/view.php?blah";
+            $filesize = display_size(get_directory_size("$CFG->dataroot/$relativepath/$file"));
+
+        } else {
+            $icon = mimeinfo("icon", $file);
+
+            if ($CFG->slasharguments) {
+                $relativeurl = "/file.php/$relativepath/$file";
+            } else {
+                $relativeurl = "/file.php?file=/$relativepath/$file";
             }
-            echo '</table>';
+            $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file"));
+        }
+
+        echo '<tr>';
+        echo '<td>';
+        echo "<img src=\"$CFG->pixpath/f/$icon\" width=\"16\" height=\"16\">";
+        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>";
+        } else {
+            link_to_popup_window($relativeurl, "resourcedirectory{$this->resource->id}", "$file", 450, 600, '');
+        }
+        echo '</p></td>';
+        echo '<td>&nbsp;</td>';
+        echo '<td align="right" nowrap="nowrap"><p><font size="-1">';
+        echo $filesize;
+        echo '</font></p></td>';
+        echo '<td align="right" nowrap="nowrap"><p><font size="-1">';
+        echo userdate(filectime("$CFG->dataroot/$relativepath/$file"), $strftime);
+        echo '</font></p></td>';
+        echo '</tr>';
+    }
+    echo '</table>';
 
-            print_simple_box_end();
+    print_simple_box_end();
 
-            print_footer($this->course);
+    print_footer($this->course);
 
 }
 
 
-
 function setup($form) {
     global $CFG;
     
index a39a35774f77a6d47c715905d30f771f22457ca6..67de708427e55030055e7474d316b691c093ee1c 100644 (file)
@@ -202,7 +202,8 @@ function display() {
     /// First, find out what sort of file we are dealing with.
     require_once("$CFG->dirroot/files/mimetypes.php");
 
-    $resourcetype = "";
+    $querystring = '';
+    $resourcetype = '';
     $embedded = false;
     $mimetype = mimeinfo("type", $this->resource->reference);
 
@@ -248,7 +249,7 @@ function display() {
 
     if (resource_is_url($this->resource->reference)) {
         $fullurl = $this->resource->reference;
-        if ($querystring) {
+        if (!empty($querystring)) {
             $urlpieces = parse_url($this->resource->reference);
             if (empty($urlpieces['query'])) {
                 $fullurl .= '?'.$querystring;
@@ -276,6 +277,8 @@ function display() {
 
     if ($this->resource->popup and !$inpopup) {    /// Make a page and a pop-up window
 
+        $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
+
         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));
 
 
@@ -322,7 +325,7 @@ function display() {
 
     /// If we are in a frameset, just print the top of it
 
-    if ($_GET['frameset'] == "top") {
+    if (!empty($_GET['frameset']) and $_GET['frameset'] == "top") {
         print_header($pagetitle, $this->course->fullname, "$navigation <a target=\"$CFG->framename\" href=\"$fullurl\">{$this->resource->name}</a>", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm, "parent"));
 
         echo "<center><font size=-1>".text_to_html($this->resource->summary, true, false)."</font></center>";
index f6e2e4ca3a7111e290f2cef14c9551edebd4181d..a571857ab6511f24f6ed41a60dc446f8f8d649b4 100644 (file)
@@ -25,6 +25,7 @@ function display() {
 
 
     add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id);
+    $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
     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));
 
index 70b4cdc0290fddeeb8f0cb0ff8d82b22421c689c..e2eb2817702f60023efe285067bda5f5c4cd7421 100644 (file)
@@ -25,6 +25,7 @@ function display() {
 
 
     add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id);
+    $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
     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));
 
index 2d918d31537e6f002e8a7bbfdedb52f22880ecf3..1b18bdd6454af3b62ee74459bfb562e0073e7475 100644 (file)
@@ -25,6 +25,8 @@ function display() {
 
 
     add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id);
+    $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name);
+
     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));