function blocks_print_adminblock(&$page, &$pageblocks) { global $USER; $missingblocks = blocks_get_missing($page, $pageblocks); if (!empty($missingblocks)) { $strblocks = '<div class="title"><h2>'; $strblocks .= get_string('blocks'); $strblocks .= '</h2></div>'; $stradd = get_string('add'); foreach ($missingblocks as $blockid) { $block = blocks_get_record($blockid); $blockobject = block_instance($block->name); if ($blockobject === false) { continue; } if (!$blockobject->user_can_addto($page)) { continue; } $menu[$block->id] = $blockobject->get_title(); } asort($menu); $target = $page->url_get_full(array('sesskey' => $USER->sesskey, 'blockaction' => 'add')); $content = popup_form($target . '&blockid=', $menu, 'add_block', '', $stradd . '...', '', '', true); print_side_block($strblocks, $content, NULL, NULL, NULL, array('class' => 'block_adminblock')); } }
$pageblocks = blocks_get_by_page($PAGE); if ($editing) { if (!empty($blockaction) && confirm_sesskey()) { if (!empty($blockid)) { blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), intval($blockid)); } else { if (!empty($instanceid)) { $instance = blocks_find_instance($instanceid, $pageblocks); blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $instance); } } // This re-query could be eliminated by judicious programming in blocks_execute_action(), // but I'm not sure if it's worth the complexity increase... $pageblocks = blocks_get_by_page($PAGE); } $missingblocks = blocks_get_missing($PAGE, $pageblocks); } if (!empty($tagid)) { $taginstance = get_record('tag', 'id', $tagid); } elseif (!empty($tag)) { $taginstance = tag_id($tag); } /// navigations /// site blogs - sitefullname -> blogs -> (?tag) /// course blogs - sitefullname -> course fullname ->blogs ->(?tag) /// group blogs - sitefullname -> course fullname ->group ->(?tag) /// user blogs - sitefullname -> (?coursefullname) -> participants -> blogs -> (?tag) $blogstring = get_string('blogs', 'blog'); $tagstring = get_string('tag'); // needed also for user tabs later if (!($course = get_record('course', 'id', $courseid))) {