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

This commit is contained in:
toyomoyo
2007-10-19 07:54:30 +00:00
parent b3f0a052b2
commit deb2988f39
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>";
+3 -1
View File
@@ -131,7 +131,9 @@
$courses = array();
foreach ($blocks as $block) {
$courseid = $block->pageid;
if ($courseid==0) {
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
if ($courseid==0 || $block->pagetype != 'course-view') {
continue;
}
if (!$course = get_record('course', 'id', $courseid)) {