From: toyomoyo Date: Fri, 19 Oct 2007 07:54:30 +0000 (+0000) Subject: MDL-11167, admin blocks page should not show blocks not placed on course pages X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=deb2988f3946a62dc2786dee2b73dc4b592828ec;p=moodle.git MDL-11167, admin blocks page should not show blocks not placed on course pages --- diff --git a/admin/blocks.php b/admin/blocks.php index 3b296beeb9..9e89eb65c5 100644 --- a/admin/blocks.php +++ b/admin/blocks.php @@ -182,7 +182,12 @@ $settings = ''.$strsettings.''; } - $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 = "wwwroot}/course/search.php?blocklist=$blockid&sesskey={$USER->sesskey}\" "; $blocklist .= "title=\"$strshowblockcourse\" >$count"; diff --git a/course/search.php b/course/search.php index c7ff0d658f..a497cee698 100644 --- a/course/search.php +++ b/course/search.php @@ -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)) {