Completed
Branch master (f11977)
by Leo
02:15
created
_config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('BLOCK_DIR',basename(dirname(__FILE__)));
4
-LeftAndMain::require_javascript( BLOCK_DIR. '/js/silverstripe-block.script.js' );
5 3
\ No newline at end of file
4
+define('BLOCK_DIR', basename(dirname(__FILE__)));
5
+LeftAndMain::require_javascript(BLOCK_DIR . '/js/silverstripe-block.script.js');
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
code/ExtendedBlocks/TriColumnBlock.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class TriColumnBlock extends Block {
4
-	protected static $db = array (
5
-		'LeftColumn'		=>	'HTMLText',
6
-		'MiddleColumn'	=>	'HTMLText',
7
-		'RightColumn'	=>	'HTMLText'
8
-	);
4
+    protected static $db = array (
5
+        'LeftColumn'		=>	'HTMLText',
6
+        'MiddleColumn'	=>	'HTMLText',
7
+        'RightColumn'	=>	'HTMLText'
8
+    );
9 9
 }
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class DualColumnBlock extends Block {
4
-	protected static $db = array (
4
+	protected static $db = array(
5 5
 		'LeftColumn'		=>	'HTMLText',
6 6
 		'RightColumn'	=>	'HTMLText'
7 7
 	);
Please login to merge, or discard this patch.
code/ExtendedBlocks/DualColumnBlock.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class DualColumnBlock extends Block {
4
-	protected static $db = array (
5
-		'LeftColumn'		=>	'HTMLText',
6
-		'RightColumn'	=>	'HTMLText'
7
-	);
4
+    protected static $db = array (
5
+        'LeftColumn'		=>	'HTMLText',
6
+        'RightColumn'	=>	'HTMLText'
7
+    );
8 8
 }
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class DualColumnBlock extends Block {
4
-	protected static $db = array (
4
+	protected static $db = array(
5 5
 		'LeftColumn'		=>	'HTMLText',
6 6
 		'RightColumn'	=>	'HTMLText'
7 7
 	);
Please login to merge, or discard this patch.
code/ExtendedBlocks/SingleColumnBlock.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class SingleColumnBlock extends Block {
4
-	protected static $db = array (
5
-		'Content'	=>	'HTMLText'
6
-	);
4
+    protected static $db = array (
5
+        'Content'	=>	'HTMLText'
6
+    );
7 7
 }
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class SingleColumnBlock extends Block {
4
-	protected static $db = array (
4
+	protected static $db = array(
5 5
 		'Content'	=>	'HTMLText'
6 6
 	);
7 7
 }
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
code/BlocksAdmin.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @file BlocksAdmin.php
4
- *
5
- * Left-hand-side tab : Admin Blocks
6
- * */
3
+     * @file BlocksAdmin.php
4
+     *
5
+     * Left-hand-side tab : Admin Blocks
6
+     * */
7 7
 
8 8
 class BlocksAdmin extends ModelAdmin {
9
-	private static $managed_models = array('Block');
10
-	private static $url_segment = 'blocks';
11
-	private static $menu_title = 'Blocks';
12
-	private static $menu_priority = 10;
13
-	private static $menu_icon = 'silverstripe-block/images/icon-block.png';
9
+    private static $managed_models = array('Block');
10
+    private static $url_segment = 'blocks';
11
+    private static $menu_title = 'Blocks';
12
+    private static $menu_priority = 10;
13
+    private static $menu_icon = 'silverstripe-block/images/icon-block.png';
14 14
 	
15
-	public function init() {
16
-		parent::init();
17
-		//Requirements::javascript("silverstripe-block/js/silverstripe-block.script.js");
18
-	}
15
+    public function init() {
16
+        parent::init();
17
+        //Requirements::javascript("silverstripe-block/js/silverstripe-block.script.js");
18
+    }
19 19
 	
20
-	public function getEditForm($id = null, $fields = null) {
21
-		$form = parent::getEditForm($id, $fields);
20
+    public function getEditForm($id = null, $fields = null) {
21
+        $form = parent::getEditForm($id, $fields);
22 22
 		
23
-		$grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
23
+        $grid = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
24 24
 		
25
-		$grid->getConfig()
26
-			->removeComponentsByType('GridFieldPaginator')
27
-			->removeComponentsByType('GridFieldAddNewButton')
28
-			->removeComponentsByType('GridFieldPrintButton')
29
-			->removeComponentsByType('GridFieldExportButton')
30
-			->addComponents(
31
-				new GridFieldPaginatorWithShowAll(30),
32
-				$multiClass = new GridFieldAddNewMultiClass(),
33
-				$sortable = new GridFieldSortableRows('SortOrder')
34
-			);
25
+        $grid->getConfig()
26
+            ->removeComponentsByType('GridFieldPaginator')
27
+            ->removeComponentsByType('GridFieldAddNewButton')
28
+            ->removeComponentsByType('GridFieldPrintButton')
29
+            ->removeComponentsByType('GridFieldExportButton')
30
+            ->addComponents(
31
+                new GridFieldPaginatorWithShowAll(30),
32
+                $multiClass = new GridFieldAddNewMultiClass(),
33
+                $sortable = new GridFieldSortableRows('SortOrder')
34
+            );
35 35
 		
36
-		$subBlocks = ClassInfo::subclassesFor('Block');
37
-		unset($subBlocks['Block']);
36
+        $subBlocks = ClassInfo::subclassesFor('Block');
37
+        unset($subBlocks['Block']);
38 38
 		
39
-		$multiClass->setClasses($subBlocks);
40
-		$grid->setTitle('All Blcoks');
41
-		return $form;
42
-	}
39
+        $multiClass->setClasses($subBlocks);
40
+        $grid->setTitle('All Blcoks');
41
+        return $form;
42
+    }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
code/Extensions/BlockinPage.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@
 block discarded – undo
1 1
 <?php
2 2
 class BlockinPage extends Extension {
3 3
 	
4
-	protected static $belongs_many_many = array (
5
-		'Blocks'			=>	'Block'
6
-	);
4
+    protected static $belongs_many_many = array (
5
+        'Blocks'			=>	'Block'
6
+    );
7 7
 	
8
-	public function updateCMSFields( FieldList $fields ) {
9
-		$blocks = $this->owner->Blocks();
10
-		if ($blocks->count() > 0) {
11
-			$blocks = Block::get()->filter(array(
12
-				'ID'				=>	$blocks->column('ID'),
13
-				'showBlockbyClass'	=>	false
14
-			))->sort('SortOrder','ASC');
15
-		}
16
-		$blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true,'GridFieldConfig_RelationEditor');
17
-		$docked_grid = $this->gridBuilder('DockedBlocks', $this->dockedBlocks(), '');
8
+    public function updateCMSFields( FieldList $fields ) {
9
+        $blocks = $this->owner->Blocks();
10
+        if ($blocks->count() > 0) {
11
+            $blocks = Block::get()->filter(array(
12
+                'ID'				=>	$blocks->column('ID'),
13
+                'showBlockbyClass'	=>	false
14
+            ))->sort('SortOrder','ASC');
15
+        }
16
+        $blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true,'GridFieldConfig_RelationEditor');
17
+        $docked_grid = $this->gridBuilder('DockedBlocks', $this->dockedBlocks(), '');
18 18
 		
19
-		$fields->addFieldToTab('Root.MyBlocks', $blocks_grid);
20
-		$fields->addFieldToTab('Root.DockedBlocks', $docked_grid);
21
-	}
19
+        $fields->addFieldToTab('Root.MyBlocks', $blocks_grid);
20
+        $fields->addFieldToTab('Root.DockedBlocks', $docked_grid);
21
+    }
22 22
 	
23
-	private function gridBuilder($name, $source, $label = '', $canAdd = false, $gridHeaderType = 'GridFieldConfig_RecordEditor') {
24
-		/*
23
+    private function gridBuilder($name, $source, $label = '', $canAdd = false, $gridHeaderType = 'GridFieldConfig_RecordEditor') {
24
+        /*
25 25
 		GridFieldConfig_Base
26 26
 		GridFieldConfig_RecordViewer
27 27
 		GridFieldConfig_RecordEditor
28 28
 		GridFieldConfig_RelationEditor
29 29
 		*/
30
-		if ($label == '') { $label = $name; }
31
-		$grid = new GridField($name, $label, $source);
32
-		$config = $gridHeaderType::create();
33
-		$config->removeComponentsByType('GridFieldAddNewButton');
34
-		if ( $canAdd ) {
35
-			$config->addComponents(
36
-				$multiClass = new GridFieldAddNewMultiClass(),
37
-				$sortable = new GridFieldSortableRows('SortOrder')
38
-			);
39
-			$subBlocks = ClassInfo::subclassesFor('Block');
40
-			unset($subBlocks['Block']);
41
-			$multiClass->setClasses($subBlocks);
42
-		}
43
-		$grid->setConfig($config);
44
-		return $grid;
45
-	}
30
+        if ($label == '') { $label = $name; }
31
+        $grid = new GridField($name, $label, $source);
32
+        $config = $gridHeaderType::create();
33
+        $config->removeComponentsByType('GridFieldAddNewButton');
34
+        if ( $canAdd ) {
35
+            $config->addComponents(
36
+                $multiClass = new GridFieldAddNewMultiClass(),
37
+                $sortable = new GridFieldSortableRows('SortOrder')
38
+            );
39
+            $subBlocks = ClassInfo::subclassesFor('Block');
40
+            unset($subBlocks['Block']);
41
+            $multiClass->setClasses($subBlocks);
42
+        }
43
+        $grid->setConfig($config);
44
+        return $grid;
45
+    }
46 46
 		
47
-	private function dockedBlocks($baseOn = 'Class') {
48
-		$blocks = Block::get();
49
-		$IDs = array();
50
-		$ClassName = $this->owner->ClassName;
51
-		$Classes = $blocks->map('ID', 'shownInClass');
52
-		foreach ($Classes as $BlockID => $Class) {
53
-			$listedClasses = explode(',', $Class);
54
-			if (in_array($ClassName, $listedClasses)) {
55
-				$IDs[] = $BlockID;
56
-			}
57
-		}
58
-		$blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder','ASC');
59
-		return $blocks;
60
-	}
47
+    private function dockedBlocks($baseOn = 'Class') {
48
+        $blocks = Block::get();
49
+        $IDs = array();
50
+        $ClassName = $this->owner->ClassName;
51
+        $Classes = $blocks->map('ID', 'shownInClass');
52
+        foreach ($Classes as $BlockID => $Class) {
53
+            $listedClasses = explode(',', $Class);
54
+            if (in_array($ClassName, $listedClasses)) {
55
+                $IDs[] = $BlockID;
56
+            }
57
+        }
58
+        $blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder','ASC');
59
+        return $blocks;
60
+    }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class BlockinPage extends Extension {
3 3
 	
4
-	protected static $belongs_many_many = array (
4
+	protected static $belongs_many_many = array(
5 5
 		'Blocks'			=>	'Block'
6 6
 	);
7 7
 	
8
-	public function updateCMSFields( FieldList $fields ) {
8
+	public function updateCMSFields(FieldList $fields) {
9 9
 		$blocks = $this->owner->Blocks();
10 10
 		if ($blocks->count() > 0) {
11 11
 			$blocks = Block::get()->filter(array(
12 12
 				'ID'				=>	$blocks->column('ID'),
13 13
 				'showBlockbyClass'	=>	false
14
-			))->sort('SortOrder','ASC');
14
+			))->sort('SortOrder', 'ASC');
15 15
 		}
16
-		$blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true,'GridFieldConfig_RelationEditor');
16
+		$blocks_grid = $this->gridBuilder('Blocks', $blocks, '', true, 'GridFieldConfig_RelationEditor');
17 17
 		$docked_grid = $this->gridBuilder('DockedBlocks', $this->dockedBlocks(), '');
18 18
 		
19 19
 		$fields->addFieldToTab('Root.MyBlocks', $blocks_grid);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$grid = new GridField($name, $label, $source);
32 32
 		$config = $gridHeaderType::create();
33 33
 		$config->removeComponentsByType('GridFieldAddNewButton');
34
-		if ( $canAdd ) {
34
+		if ($canAdd) {
35 35
 			$config->addComponents(
36 36
 				$multiClass = new GridFieldAddNewMultiClass(),
37 37
 				$sortable = new GridFieldSortableRows('SortOrder')
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				$IDs[] = $BlockID;
56 56
 			}
57 57
 		}
58
-		$blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder','ASC');
58
+		$blocks = Block::get()->filter('ID', $IDs)->sort('SortOrder', 'ASC');
59 59
 		return $blocks;
60 60
 	}
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
code/Block.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Block extends DataObject {
4
-	protected static $db = array (
4
+	protected static $db = array(
5 5
 		'SortOrder'			=>	'Int',
6 6
 		'Title'				=>	'Varchar(64)',
7 7
 		'hideTitle'			=>	'Boolean',
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		'shownInClass'		=>	'Text'
12 12
 	);
13 13
 	
14
-	protected static $many_many = array (
14
+	protected static $many_many = array(
15 15
 		'Pages'				=>	'Page'
16 16
 	);
17 17
 		
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		'MySQLDatabase'		=> 'ENGINE=MyISAM'
20 20
     );
21 21
 	
22
-	protected static $extensions = array (
22
+	protected static $extensions = array(
23 23
 		'StandardPermissions'
24 24
 	);
25 25
 	
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 		$lists = '';
44 44
 		if ($this->showBlockbyClass) {
45 45
 			if (strlen(trim($this->shownInClass)) > 0) {
46
-				$lists = 'Type: ' . str_replace(',','<br />Type: ', $this->shownInClass);
47
-			}else{
46
+				$lists = 'Type: ' . str_replace(',', '<br />Type: ', $this->shownInClass);
47
+			} else {
48 48
 				$lists = '<em>&lt;not assigned&gt;</em>';
49 49
 			}
50
-		}else{
50
+		} else {
51 51
 			$lists = 'Page: ' . implode('<br />Page: ', $this->Pages()->column('Title'));
52 52
 		}
53
-		return new LiteralField('shownOn',$lists);
53
+		return new LiteralField('shownOn', $lists);
54 54
 	}
55 55
 	
56 56
 	
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@
 block discarded – undo
44 44
 		if ($this->showBlockbyClass) {
45 45
 			if (strlen(trim($this->shownInClass)) > 0) {
46 46
 				$lists = 'Type: ' . str_replace(',','<br />Type: ', $this->shownInClass);
47
-			}else{
47
+			} else{
48 48
 				$lists = '<em>&lt;not assigned&gt;</em>';
49 49
 			}
50
-		}else{
50
+		} else{
51 51
 			$lists = 'Page: ' . implode('<br />Page: ', $this->Pages()->column('Title'));
52 52
 		}
53 53
 		return new LiteralField('shownOn',$lists);
Please login to merge, or discard this patch.
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -1,168 +1,168 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Block extends DataObject {
4
-	protected static $db = array (
5
-		'SortOrder'			=>	'Int',
6
-		'Title'				=>	'Varchar(64)',
7
-		'hideTitle'			=>	'Boolean',
8
-		'showBlockbyClass'	=>	'Boolean',
9
-		'Description'		=>	'Varchar(128)',
10
-		'MemberVisibility'	=>	'Varchar(255)',
11
-		'shownInClass'		=>	'Text'
12
-	);
4
+    protected static $db = array (
5
+        'SortOrder'			=>	'Int',
6
+        'Title'				=>	'Varchar(64)',
7
+        'hideTitle'			=>	'Boolean',
8
+        'showBlockbyClass'	=>	'Boolean',
9
+        'Description'		=>	'Varchar(128)',
10
+        'MemberVisibility'	=>	'Varchar(255)',
11
+        'shownInClass'		=>	'Text'
12
+    );
13 13
 	
14
-	protected static $many_many = array (
15
-		'Pages'				=>	'Page'
16
-	);
14
+    protected static $many_many = array (
15
+        'Pages'				=>	'Page'
16
+    );
17 17
 		
18
-	protected static $create_table_options = array(
19
-		'MySQLDatabase'		=> 'ENGINE=MyISAM'
18
+    protected static $create_table_options = array(
19
+        'MySQLDatabase'		=> 'ENGINE=MyISAM'
20 20
     );
21 21
 	
22
-	protected static $extensions = array (
23
-		'StandardPermissions'
24
-	);
22
+    protected static $extensions = array (
23
+        'StandardPermissions'
24
+    );
25 25
 	
26
-	protected static $summary_fields = array(
27
-		'BlockType',
28
-		'Title', 
29
-		'Description',
30
-		'shownOn'
31
-	);
26
+    protected static $summary_fields = array(
27
+        'BlockType',
28
+        'Title', 
29
+        'Description',
30
+        'shownOn'
31
+    );
32 32
 	
33
-	protected static $field_labels = array(
34
-		'BlockType'			=>	'Block type',
35
-		'shownOn'			=>	'is shown on'
36
-	);
33
+    protected static $field_labels = array(
34
+        'BlockType'			=>	'Block type',
35
+        'shownOn'			=>	'is shown on'
36
+    );
37 37
 	
38
-	public function BlockType() {
39
-		return $this->singular_name();
40
-	}
38
+    public function BlockType() {
39
+        return $this->singular_name();
40
+    }
41 41
 	
42
-	public function shownOn() {
43
-		$lists = '';
44
-		if ($this->showBlockbyClass) {
45
-			if (strlen(trim($this->shownInClass)) > 0) {
46
-				$lists = 'Type: ' . str_replace(',','<br />Type: ', $this->shownInClass);
47
-			}else{
48
-				$lists = '<em>&lt;not assigned&gt;</em>';
49
-			}
50
-		}else{
51
-			$lists = 'Page: ' . implode('<br />Page: ', $this->Pages()->column('Title'));
52
-		}
53
-		return new LiteralField('shownOn',$lists);
54
-	}
42
+    public function shownOn() {
43
+        $lists = '';
44
+        if ($this->showBlockbyClass) {
45
+            if (strlen(trim($this->shownInClass)) > 0) {
46
+                $lists = 'Type: ' . str_replace(',','<br />Type: ', $this->shownInClass);
47
+            }else{
48
+                $lists = '<em>&lt;not assigned&gt;</em>';
49
+            }
50
+        }else{
51
+            $lists = 'Page: ' . implode('<br />Page: ', $this->Pages()->column('Title'));
52
+        }
53
+        return new LiteralField('shownOn',$lists);
54
+    }
55 55
 	
56 56
 	
57
-	public function getCMSFields() {
58
-		$fields = parent::getCMSFields();
59
-		$fields->removeFieldFromTab('Root', 'Pages');
60
-		$fields->removeFieldsFromTab('Root.Main', array(
61
-			'SortOrder',
62
-			'showBlockbyClass',
63
-			'shownInClass',
64
-			'MemberVisibility'
65
-		));
57
+    public function getCMSFields() {
58
+        $fields = parent::getCMSFields();
59
+        $fields->removeFieldFromTab('Root', 'Pages');
60
+        $fields->removeFieldsFromTab('Root.Main', array(
61
+            'SortOrder',
62
+            'showBlockbyClass',
63
+            'shownInClass',
64
+            'MemberVisibility'
65
+        ));
66 66
 		
67
-		$memberGroups = Group::get();
68
-		$sourcemap = $memberGroups->map('Code', 'Title');
69
-		$source = array(
70
-			'anonymous'		=>	'Anonymous visitors'
71
-		);
72
-		foreach ($sourcemap as $mapping => $key) {
73
-			$source[$mapping] = $key;
74
-		}
67
+        $memberGroups = Group::get();
68
+        $sourcemap = $memberGroups->map('Code', 'Title');
69
+        $source = array(
70
+            'anonymous'		=>	'Anonymous visitors'
71
+        );
72
+        foreach ($sourcemap as $mapping => $key) {
73
+            $source[$mapping] = $key;
74
+        }
75 75
 		
76
-		$memberVisibility = new CheckboxSetField(
77
-			$name = "MemberVisibility",
78
-			$title = "Show block for specific groups",
79
-			$source
80
-		);
76
+        $memberVisibility = new CheckboxSetField(
77
+            $name = "MemberVisibility",
78
+            $title = "Show block for specific groups",
79
+            $source
80
+        );
81 81
 		
82
-		$memberVisibility->setDescription('Show this block only for the selected group(s). If you select no groups, the block will be visible to all members.');
82
+        $memberVisibility->setDescription('Show this block only for the selected group(s). If you select no groups, the block will be visible to all members.');
83 83
 		
84
-		$availabelClasses = $this->availableClasses();
85
-		$inClass = new CheckboxSetField(
86
-			$name = "shownInClass",
87
-			$title = "Show block for specific content types",
88
-			$availabelClasses
89
-		);
84
+        $availabelClasses = $this->availableClasses();
85
+        $inClass = new CheckboxSetField(
86
+            $name = "shownInClass",
87
+            $title = "Show block for specific content types",
88
+            $availabelClasses
89
+        );
90 90
 		
91
-		$filterSelector = OptionsetField::create(
92
-			'showBlockbyClass',
93
-			'Choose filter set',
94
-			array(
95
-				'0'			=>	'by page',
96
-				'1'			=>	'by page/data type'
97
-			)
98
-		)->setDescription('<p><br /><strong>by page</strong>: block will be displayed in the selected page(s)<br /><strong>by page/data type</strong>: block will be displayed on the pages created with the particular page/data type. e.g. is <strong>"InternalPage"</strong> is picked, the block will be displayed, and will ONLY be displayed on all <strong>Internal Pages</strong></p>');
91
+        $filterSelector = OptionsetField::create(
92
+            'showBlockbyClass',
93
+            'Choose filter set',
94
+            array(
95
+                '0'			=>	'by page',
96
+                '1'			=>	'by page/data type'
97
+            )
98
+        )->setDescription('<p><br /><strong>by page</strong>: block will be displayed in the selected page(s)<br /><strong>by page/data type</strong>: block will be displayed on the pages created with the particular page/data type. e.g. is <strong>"InternalPage"</strong> is picked, the block will be displayed, and will ONLY be displayed on all <strong>Internal Pages</strong></p>');
99 99
 		
100
-		$availablePages = Page::get()->exclude('ClassName', array(
101
-			'ErrorPage',
102
-			'RedirectorPage',
103
-			'VirtualPage'
104
-		));
105
-		$pageSelector = new CheckboxSetField(
106
-			$name = "Pages",
107
-			$title = "Show on Page(s)",
108
-			$availablePages
109
-		);
100
+        $availablePages = Page::get()->exclude('ClassName', array(
101
+            'ErrorPage',
102
+            'RedirectorPage',
103
+            'VirtualPage'
104
+        ));
105
+        $pageSelector = new CheckboxSetField(
106
+            $name = "Pages",
107
+            $title = "Show on Page(s)",
108
+            $availablePages
109
+        );
110 110
 		
111
-		$fields->addFieldsToTab('Root.VisibilitySettings', array(
112
-			$filterSelector,
113
-			$pageSelector,
114
-			$inClass,
115
-			$memberVisibility
116
-		));
117
-		return $fields;
118
-	}
111
+        $fields->addFieldsToTab('Root.VisibilitySettings', array(
112
+            $filterSelector,
113
+            $pageSelector,
114
+            $inClass,
115
+            $memberVisibility
116
+        ));
117
+        return $fields;
118
+    }
119 119
 	
120
-	private function availableClasses() {
121
-		$Classes = array_diff(
122
-			ClassInfo::subclassesFor('Page'),
123
-			ClassInfo::subclassesFor('ErrorPage'),
124
-			ClassInfo::subclassesFor('RedirectorPage'),
125
-			ClassInfo::subclassesFor('VirtualPage')
126
-		);
127
-		return $Classes;
128
-	}
120
+    private function availableClasses() {
121
+        $Classes = array_diff(
122
+            ClassInfo::subclassesFor('Page'),
123
+            ClassInfo::subclassesFor('ErrorPage'),
124
+            ClassInfo::subclassesFor('RedirectorPage'),
125
+            ClassInfo::subclassesFor('VirtualPage')
126
+        );
127
+        return $Classes;
128
+    }
129 129
 	
130
-	public function forTemplate() {
131
-		if ($this->canDisplayMemberCheck()) {
132
-			return $this->renderWith(array($this->getClassName(), 'BaseBlock'));
133
-		}
130
+    public function forTemplate() {
131
+        if ($this->canDisplayMemberCheck()) {
132
+            return $this->renderWith(array($this->getClassName(), 'BaseBlock'));
133
+        }
134 134
 		
135
-		return false;
136
-	}
135
+        return false;
136
+    }
137 137
 	
138
-	private function canDisplayMemberCheck() {
139
-		$rawVisibility = $this->MemberVisibility;
138
+    private function canDisplayMemberCheck() {
139
+        $rawVisibility = $this->MemberVisibility;
140 140
 		
141
-		if (empty($rawVisibility)) {
142
-			return true;
143
-		}
141
+        if (empty($rawVisibility)) {
142
+            return true;
143
+        }
144 144
 		
145
-		$visibility = explode(',', $rawVisibility);
146
-		$member = Member::currentUser();
145
+        $visibility = explode(',', $rawVisibility);
146
+        $member = Member::currentUser();
147 147
 		
148
-		if (!$member && in_array('anonymous', $visibility)) {
149
-			return true;
150
-		}
148
+        if (!$member && in_array('anonymous', $visibility)) {
149
+            return true;
150
+        }
151 151
 		
152
-		if ($member) {
153
-			$memberGroups = $member->Groups()->column('Code');
154
-			foreach ($memberGroups as $memberGroup) {
155
-				if (in_array($memberGroup, $visibility)) {
156
-					return true;
157
-				}
158
-			}
159
-		}
152
+        if ($member) {
153
+            $memberGroups = $member->Groups()->column('Code');
154
+            foreach ($memberGroups as $memberGroup) {
155
+                if (in_array($memberGroup, $visibility)) {
156
+                    return true;
157
+                }
158
+            }
159
+        }
160 160
 		
161
-		return false;
162
-	}
161
+        return false;
162
+    }
163 163
 	
164
-	public function frontendEditable() {
165
-		$member = Member::currentUser();		
166
-		return $this->canEdit($member);
167
-	}
164
+    public function frontendEditable() {
165
+        $member = Member::currentUser();		
166
+        return $this->canEdit($member);
167
+    }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
code/Extensions/PrintBlocks.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@
 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
-		return $this->owner->Blocks()->sort('SortOrder', 'ASC');
13
-	}
11
+    public function getMyBlocks() {
12
+        return $this->owner->Blocks()->sort('SortOrder', 'ASC');
13
+    }
14 14
 	
15
-	public function getDockedBlocks() {
16
-		$blocks = Block::get()->filter('showBlockbyClass', true);
17
-		$blocks_map = $blocks->map('ID', 'shownInClass');
18
-		foreach ($blocks_map as $blockID => $Classes) {
19
-			$Classes = explode(',', $Classes);
20
-			if (!in_array($this->owner->ClassName, $Classes)) {
21
-				$blocks = $blocks->exclude('ID', $blockID);
22
-			}
23
-		}
15
+    public function getDockedBlocks() {
16
+        $blocks = Block::get()->filter('showBlockbyClass', true);
17
+        $blocks_map = $blocks->map('ID', 'shownInClass');
18
+        foreach ($blocks_map as $blockID => $Classes) {
19
+            $Classes = explode(',', $Classes);
20
+            if (!in_array($this->owner->ClassName, $Classes)) {
21
+                $blocks = $blocks->exclude('ID', $blockID);
22
+            }
23
+        }
24 24
 		
25
-		return $blocks->sort('SortOrder', 'ASC');
26
-	}
25
+        return $blocks->sort('SortOrder', 'ASC');
26
+    }
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.