]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11836, show number of blocks but do not link if no reference to any course
authortoyomoyo <toyomoyo>
Fri, 26 Oct 2007 03:25:39 +0000 (03:25 +0000)
committertoyomoyo <toyomoyo>
Fri, 26 Oct 2007 03:25:39 +0000 (03:25 +0000)
admin/blocks.php

index 9e89eb65c56c23ca9039e3c3c51e352c4de6e389..1767fcf44d214c8f5ca4426cf15789e308665b88 100644 (file)
 
         // MDL-11167, blocks can be placed on mymoodle, or the blogs page
         // and it should not show up on course search page
+        
+        $totalcount = count_records('block_instance', 'blockid', $blockid);
+        
         $count = count_records_sql('SELECT COUNT(*) 
                                         FROM '.$CFG->prefix.'block_instance 
                                         WHERE blockid = '.$blockid.' AND
                                         pagetype = "course-view"');
+
         if ($count>0) {
             $blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey={$USER->sesskey}\" ";
-            $blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
+            $blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
         }
         else {
-            $blocklist = "$count";
+            $blocklist = "$totalcount";
         }
         $class = ''; // Nothing fancy, by default