From: toyomoyo Date: Fri, 26 Oct 2007 03:25:39 +0000 (+0000) Subject: MDL-11836, show number of blocks but do not link if no reference to any course X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ab9519556665786c79fa4b8f572a2b219d0ebd1a;p=moodle.git MDL-11836, show number of blocks but do not link if no reference to any course --- diff --git a/admin/blocks.php b/admin/blocks.php index 9e89eb65c5..1767fcf44d 100644 --- a/admin/blocks.php +++ b/admin/blocks.php @@ -184,16 +184,20 @@ // 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 = "wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" "; - $blocklist .= "title=\"$strshowblockcourse\" >$count"; + $blocklist .= "title=\"$strshowblockcourse\" >$totalcount"; } else { - $blocklist = "$count"; + $blocklist = "$totalcount"; } $class = ''; // Nothing fancy, by default