print_section now uses cached course modinfo to lessen load in database
authormoodler <moodler>
Sun, 10 Nov 2002 08:55:11 +0000 (08:55 +0000)
committermoodler <moodler>
Sun, 10 Nov 2002 08:55:11 +0000 (08:55 +0000)
course/lib.php

index 6da4541..a3ed29d 100644 (file)
@@ -468,6 +468,7 @@ function get_all_categories() {
 function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%") {
     global $CFG;
 
 function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%") {
     global $CFG;
 
+    $modinfo = unserialize($course->modinfo);
 
     echo "<TABLE WIDTH=\"$width\"><TR><TD>\n";
     if ($section->sequence) {
 
     echo "<TABLE WIDTH=\"$width\"><TR><TD>\n";
     if ($section->sequence) {
@@ -476,7 +477,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
 
         foreach ($sectionmods as $modnumber) {
             $mod = $mods[$modnumber];
 
         foreach ($sectionmods as $modnumber) {
             $mod = $mods[$modnumber];
-            $instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
+            $instancename = urldecode($modinfo[$modnumber]->name);
             echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
             echo " <FONT SIZE=2><A TITLE=\"$mod->modfullname\"";
             echo "   HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A></FONT>";
             echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
             echo " <FONT SIZE=2><A TITLE=\"$mod->modfullname\"";
             echo "   HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A></FONT>";