mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
made changes to the way the block movment was handled to eliminate some errors that came up.
This commit is contained in:
parent
77e65ff786
commit
bb781a70c5
@ -31,7 +31,6 @@ if (!$course = get_record('course', 'id', $courseid)) {
|
||||
|
||||
$PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
|
||||
$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
|
||||
|
||||
if (!empty($instanceid)) {
|
||||
$blockinstance = blocks_find_instance($instanceid, $pageblocks);
|
||||
if (!$blockinstance || $blockinstance->pageid != $course->id || $blockinstance->pagetype != 'course-view') {
|
||||
@ -57,14 +56,8 @@ switch($_SERVER['REQUEST_METHOD']) {
|
||||
break;
|
||||
|
||||
case 'position':
|
||||
$newblockinstance = new object;
|
||||
$newblockinstance->id = $blockinstance->id;
|
||||
$newblockinstance->position = $column;
|
||||
$newblockinstance->weight = $value;
|
||||
if (!update_record('block_instance',$newblockinstance)) {
|
||||
error_log('AJAX commands.php: Failed to update block with ID '.$blockinstance->id);
|
||||
die;
|
||||
}
|
||||
//while not entirely restful this will handle all the details of moving a block
|
||||
blocks_execute_repositioning_atomic($blockinstance, $column, $value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user