]> git.mjollnir.org Git - moodle.git/commitdiff
made changes to the way the block movment was handled to eliminate some errors that...
authorcap2501 <cap2501>
Sun, 8 Oct 2006 20:24:15 +0000 (20:24 +0000)
committercap2501 <cap2501>
Sun, 8 Oct 2006 20:24:15 +0000 (20:24 +0000)
course/rest.php

index 4a04a1ea4ea6c1e02212aa1e3922483805942d48..0c1948e00b7a2c8db163789cb15381ab91a111c6 100644 (file)
@@ -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;