MDL-11167, admin blocks page should not show blocks not placed on course pages
This commit is contained in:
+6
-1
@@ -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&sesskey={$USER->sesskey}\" ";
|
||||
$blocklist .= "title=\"$strshowblockcourse\" >$count</a>";
|
||||
|
||||
+3
-1
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user