MDL-11167, admin blocks page should not show blocks not placed on course pages

This commit is contained in:
toyomoyo
2007-10-19 07:53:09 +00:00
parent 45bddb6e6d
commit 0b0ff32d3c
2 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -182,7 +182,12 @@
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
}
$count = count_records('block_instance', 'blockid', $blockid);
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
$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>";