Completed
Push — master ( 5dcbd9...ad771e )
by Leo
03:21
created
code/Extensions/PrintBlocks.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2 2
 class PrintBlocks extends Extension {
3 3
 	
4
-	public function getAllBlocks() {
5
-		$blocks = new ArrayList();
6
-		$blocks->merge($this->getMyBlocks());
7
-		$blocks->merge($this->getDockedBlocks());
8
-		return $blocks;
9
-	}
4
+    public function getAllBlocks() {
5
+        $blocks = new ArrayList();
6
+        $blocks->merge($this->getMyBlocks());
7
+        $blocks->merge($this->getDockedBlocks());
8
+        return $blocks;
9
+    }
10 10
 		
11
-	public function getMyBlocks() {
12
-		$blocks = $this->owner->Blocks()->sort(array('SortOrder' => 'ASC', 'ID' => 'DESC'));
13
-		$published_blocks = new ArrayList();
14
-		foreach ($blocks as $block) {
15
-			if ($block->isPublished()) {
16
-				$published_blocks->push($block);
17
-			}
18
-		}
11
+    public function getMyBlocks() {
12
+        $blocks = $this->owner->Blocks()->sort(array('SortOrder' => 'ASC', 'ID' => 'DESC'));
13
+        $published_blocks = new ArrayList();
14
+        foreach ($blocks as $block) {
15
+            if ($block->isPublished()) {
16
+                $published_blocks->push($block);
17
+            }
18
+        }
19 19
 		
20
-		return $published_blocks;
21
-	}
20
+        return $published_blocks;
21
+    }
22 22
 	
23
-	public function getDockedBlocks() {
24
-		$blocks = Block::get()->filter(array('showBlockbyClass' => true));
25
-		$blocks_map = $blocks->map('ID', 'shownInClass');
26
-		foreach ($blocks_map as $blockID => $Classes) {
27
-			$Classes = explode(',', $Classes);
28
-			if (!in_array($this->owner->ClassName, $Classes)) {
29
-				$blocks = $blocks->exclude('ID', $blockID);
30
-			}
31
-		}
32
-		$published_blocks = new ArrayList();
33
-		foreach ($blocks as $block) {
34
-			if ($block->isPublished()) {
35
-				$published_blocks->push($block);
36
-			}
37
-		}
23
+    public function getDockedBlocks() {
24
+        $blocks = Block::get()->filter(array('showBlockbyClass' => true));
25
+        $blocks_map = $blocks->map('ID', 'shownInClass');
26
+        foreach ($blocks_map as $blockID => $Classes) {
27
+            $Classes = explode(',', $Classes);
28
+            if (!in_array($this->owner->ClassName, $Classes)) {
29
+                $blocks = $blocks->exclude('ID', $blockID);
30
+            }
31
+        }
32
+        $published_blocks = new ArrayList();
33
+        foreach ($blocks as $block) {
34
+            if ($block->isPublished()) {
35
+                $published_blocks->push($block);
36
+            }
37
+        }
38 38
 		
39
-		return $published_blocks->sort('SortOrder', 'ASC');
40
-	}
39
+        return $published_blocks->sort('SortOrder', 'ASC');
40
+    }
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
code/OrderableBlocks.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class OrderableBlocks extends GridFieldOrderableRows {
4
-	protected function reorderItems($list, array $values, array $order) {
5
-		$pool = array_values($values);
6
-		sort($pool);
4
+    protected function reorderItems($list, array $values, array $order) {
5
+        $pool = array_values($values);
6
+        sort($pool);
7 7
 
8
-		foreach(array_values($order) as $pos => $id) {
9
-			if($values[$id] != $pool[$pos]) {
10
-				DB::query(sprintf(
11
-					'UPDATE "%s" SET "%s" = %d WHERE %s',
12
-					$this->getSortTable($list),
13
-					$this->getSortField(),
14
-					$pool[$pos],
15
-					$this->getSortTableClauseForIds($list, $id)
16
-				));
17
-				DB::query(sprintf(
18
-					'UPDATE "%s_Live" SET "%s" = %d WHERE %s',
19
-					$this->getSortTable($list),
20
-					$this->getSortField(),
21
-					$pool[$pos],
22
-					$this->getSortTableClauseForIds($list, $id)
23
-				));
24
-			}
25
-		}
8
+        foreach(array_values($order) as $pos => $id) {
9
+            if($values[$id] != $pool[$pos]) {
10
+                DB::query(sprintf(
11
+                    'UPDATE "%s" SET "%s" = %d WHERE %s',
12
+                    $this->getSortTable($list),
13
+                    $this->getSortField(),
14
+                    $pool[$pos],
15
+                    $this->getSortTableClauseForIds($list, $id)
16
+                ));
17
+                DB::query(sprintf(
18
+                    'UPDATE "%s_Live" SET "%s" = %d WHERE %s',
19
+                    $this->getSortTable($list),
20
+                    $this->getSortField(),
21
+                    $pool[$pos],
22
+                    $this->getSortTableClauseForIds($list, $id)
23
+                ));
24
+            }
25
+        }
26 26
 
27
-		$this->extend('onAfterReorderItems', $list);
28
-	}
27
+        $this->extend('onAfterReorderItems', $list);
28
+    }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 		$pool = array_values($values);
6 6
 		sort($pool);
7 7
 
8
-		foreach(array_values($order) as $pos => $id) {
9
-			if($values[$id] != $pool[$pos]) {
8
+		foreach (array_values($order) as $pos => $id) {
9
+			if ($values[$id] != $pool[$pos]) {
10 10
 				DB::query(sprintf(
11 11
 					'UPDATE "%s" SET "%s" = %d WHERE %s',
12 12
 					$this->getSortTable($list),
Please login to merge, or discard this patch.