Commit 3615b2b2 authored by defacer's avatar defacer
Browse files

Simplifying to death using the new blocks_setup()
parent ec79d3e4
......@@ -10,7 +10,6 @@
$name = optional_param('name');
$edit = optional_param('edit');
$idnumber = optional_param('idnumber');
$blockaction = optional_param('blockaction');
if (empty($id) && empty($name)) {
error("Must specify course id or short name");
......@@ -53,7 +52,7 @@
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
$pageblocks = blocks_get_by_page($PAGE);
$pageblocks = blocks_setup($PAGE);
if (!isset($USER->editing)) {
$USER->editing = false;
......@@ -78,13 +77,6 @@
set_section_visible($course->id, $show, '1');
}
if (!empty($blockaction)) {
blocks_execute_url_action($PAGE, $pageblocks);
// 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);
}
if (!empty($section)) {
if (!empty($move) and confirm_sesskey()) {
if (!move_section($course, $section, $move)) {
......
......@@ -18,8 +18,6 @@
require_once($CFG->dirroot .'/mod/resource/lib.php');
require_once($CFG->dirroot .'/mod/forum/lib.php');
$blockaction = optional_param('blockaction');
if (empty($SITE)) {
redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
}
......@@ -55,16 +53,8 @@
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
$pageblocks = blocks_get_by_page($PAGE);
$pageblocks = blocks_setup($PAGE);
$editing = $PAGE->user_is_editing();
if (!empty($blockaction)) {
blocks_execute_url_action($PAGE, $pageblocks);
// 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);
}
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH);
......
......@@ -10,7 +10,6 @@
$id = optional_param('id', 0, PARAM_INT);
$c = optional_param('c', 0, PARAM_INT);
$edit = optional_param('edit', '');
$blockaction = optional_param('blockaction');
if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
......@@ -47,17 +46,10 @@
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($chat->id);
$pageblocks = blocks_get_by_page($PAGE);
if (!empty($blockaction)) {
blocks_execute_url_action($PAGE, $pageblocks);
$pageblocks = blocks_get_by_page($PAGE);
}
$PAGE = page_create_instance($chat->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$strenterchat = get_string('enterchat', 'chat');
......
......@@ -10,7 +10,6 @@
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
$q = optional_param('q', 0, PARAM_INT); // quiz ID
$edit = optional_param('edit', '');
$blockaction = optional_param('blockaction');
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
......@@ -50,14 +49,8 @@
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($quiz->id);
$pageblocks = blocks_get_by_page($PAGE);
if (!empty($blockaction)) {
blocks_execute_url_action($PAGE, $pageblocks);
$pageblocks = blocks_get_by_page($PAGE);
}
$PAGE = page_create_instance($quiz->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
// Print the page header
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment