Completed
Push — master ( 29ed75...a64902 )
by Jason
29s
created
code/Locator.php 2 patches
Spacing   +15 added lines, -19 removed lines patch added patch discarded remove patch
@@ -86,44 +86,40 @@  discard block
 block discarded – undo
86 86
         Requirements::css('locator/css/map.css');
87 87
 
88 88
         $featured = (Locator::getLocations(array('Featured' => 1))->count() > 0) ?
89
-            'featuredLocations: true' :
90
-            'featuredLocations: false';
89
+            'featuredLocations: true' : 'featuredLocations: false';
91 90
 
92 91
         // map config based on user input in Settings tab
93 92
         // AutoGeocode or Full Map
94 93
         $load = ($this->data()->AutoGeocode) ?
95
-            'autoGeocode: true, fullMapStart: false,' :
96
-            'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
94
+            'autoGeocode: true, fullMapStart: false,' : 'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
97 95
 
98 96
         $base = Director::baseFolder();
99
-        $themePath = $base.'/'.$themeDir;
97
+        $themePath = $base . '/' . $themeDir;
100 98
 
101
-        $listTemplatePath = (file_exists($themePath.'/templates/location-list-description.html')) ?
102
-            $themeDir.'/templates/location-list-description.html' :
103
-            'locator/templates/location-list-description.html';
104
-        $infowindowTemplatePath = (file_exists($themePath.'/templates/infowindow-description.html')) ?
105
-            $themeDir.'/templates/infowindow-description.html' :
106
-            'locator/templates/infowindow-description.html';
99
+        $listTemplatePath = (file_exists($themePath . '/templates/location-list-description.html')) ?
100
+            $themeDir . '/templates/location-list-description.html' : 'locator/templates/location-list-description.html';
101
+        $infowindowTemplatePath = (file_exists($themePath . '/templates/infowindow-description.html')) ?
102
+            $themeDir . '/templates/infowindow-description.html' : 'locator/templates/infowindow-description.html';
107 103
 
108 104
         // in page or modal
109 105
         $modal = ($this->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';
110 106
 
111 107
         $kilometer = ($this->data()->Unit == 'km') ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
112 108
 
113
-        $link = $this->Link().'xml.xml';
109
+        $link = $this->Link() . 'xml.xml';
114 110
 
115 111
         // init map
116 112
         if (Locator::getLocations()) {
117 113
             Requirements::customScript("
118 114
                 $(function($) {
119 115
                     $('#map-container').storeLocator({
120
-                        ".$load."
121
-                        dataLocation: '".$link."',
122
-                        listTemplatePath: '".$listTemplatePath."',
123
-                        infowindowTemplatePath: '".$infowindowTemplatePath."',
116
+                        ".$load . "
117
+                        dataLocation: '".$link . "',
118
+                        listTemplatePath: '".$listTemplatePath . "',
119
+                        infowindowTemplatePath: '".$infowindowTemplatePath . "',
124 120
                         originMarker: true,
125
-                        ".$modal.',
126
-                        '.$featured.",
121
+                        ".$modal . ',
122
+                        '.$featured . ",
127 123
                         slideMap: false,
128 124
                         zoomLevel: 0,
129 125
                         distanceAlert: 120,
@@ -131,7 +127,7 @@  discard block
 block discarded – undo
131 127
                         inputID: 'Form_LocationSearch_address',
132 128
                         categoryID: 'Form_LocationSearch_category',
133 129
                         distanceAlert: -1,
134
-                        ".$kilometer.'
130
+                        ".$kilometer . '
135 131
                     });
136 132
                 });
137 133
             ');
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -2,143 +2,143 @@  discard block
 block discarded – undo
2 2
 
3 3
 class Locator extends Page
4 4
 {
5
-    private static $db = array(
6
-        'AutoGeocode' => 'Boolean',
7
-        'ModalWindow' => 'Boolean',
8
-        'Unit' => 'Enum("m,km","m")',
9
-    );
10
-
11
-    private static $many_many = array(
12
-        'Categories' => 'LocationCategory',
13
-    );
14
-
15
-    private static $defaults = array(
16
-        'AutoGeocode' => true,
17
-    );
18
-
19
-    private static $singular_name = 'Locator';
20
-    private static $plural_name = 'Locators';
21
-    private static $description = 'Find locations on a map';
22
-
23
-    public function getCMSFields()
24
-    {
25
-        $fields = parent::getCMSFields();
26
-
27
-        // Settings
28
-        $fields->addFieldsToTab('Root.Settings', array(
29
-            HeaderField::create('DisplayOptions', 'Display Options', 3),
30
-            OptionsetField::create('Unit', 'Unit of measure', array('m' => 'Miles', 'km' => 'Kilometers')),
31
-            CheckboxField::create('AutoGeocode', 'Auto Geocode - Automatically filter map results based on user location')
32
-                ->setDescription('Note: if any locations are set as featured, the auto geocode is automatically disabled.'),
33
-            CheckboxField::create('ModalWindow', 'Modal Window - Show Map results in a modal window'),
34
-        ));
35
-
36
-        // Filter categories
37
-        $config = GridFieldConfig_RelationEditor::create();
38
-        if (class_exists('GridFieldAddExistingSearchButton')) {
39
-            $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
40
-            $config->addComponent(new GridFieldAddExistingSearchButton());
41
-        }
42
-        $categories = $this->Categories();
43
-        $categoriesField = GridField::create('Categories', 'Categories', $categories, $config)
44
-            ->setDescription('only show locations from the selected category');
45
-
46
-            // Filter
47
-            $fields->addFieldsToTab('Root.Filter', array(
48
-                HeaderField::create('CategoryOptionsHeader', 'Location Filtering', 3),
49
-                $categoriesField,
50
-            ));
51
-
52
-        $this->extend('updateCMSFields', $fields);
53
-
54
-        return $fields;
55
-    }
56
-
57
-    public static function getLocations($filter = array(), $exclude = array(), $filterAny = array())
58
-    {
59
-        $filter['ShowInLocator'] = true;
60
-        $exclude['Lat'] = 0;
61
-
62
-        $Locations = Location::get()->exclude($exclude)->filter($filter)->filterAny($filterAny);
63
-
64
-        return $Locations;
65
-    }
66
-
67
-    public function getAreLocations()
68
-    {
69
-        return self::getLocations();
70
-    }
71
-
72
-    public function getAllCategories()
73
-    {
74
-        return LocationCategory::get();
75
-    }
76
-
77
-    public static function getPageCategories($id = null)
78
-    {
79
-        if ($id) {
80
-            if ($locator = self::get()->byID($id)) {
81
-                return $locator->Categories();
82
-            }
83
-
84
-            return false;
85
-        }
86
-
87
-        return false;
88
-    }
5
+	private static $db = array(
6
+		'AutoGeocode' => 'Boolean',
7
+		'ModalWindow' => 'Boolean',
8
+		'Unit' => 'Enum("m,km","m")',
9
+	);
10
+
11
+	private static $many_many = array(
12
+		'Categories' => 'LocationCategory',
13
+	);
14
+
15
+	private static $defaults = array(
16
+		'AutoGeocode' => true,
17
+	);
18
+
19
+	private static $singular_name = 'Locator';
20
+	private static $plural_name = 'Locators';
21
+	private static $description = 'Find locations on a map';
22
+
23
+	public function getCMSFields()
24
+	{
25
+		$fields = parent::getCMSFields();
26
+
27
+		// Settings
28
+		$fields->addFieldsToTab('Root.Settings', array(
29
+			HeaderField::create('DisplayOptions', 'Display Options', 3),
30
+			OptionsetField::create('Unit', 'Unit of measure', array('m' => 'Miles', 'km' => 'Kilometers')),
31
+			CheckboxField::create('AutoGeocode', 'Auto Geocode - Automatically filter map results based on user location')
32
+				->setDescription('Note: if any locations are set as featured, the auto geocode is automatically disabled.'),
33
+			CheckboxField::create('ModalWindow', 'Modal Window - Show Map results in a modal window'),
34
+		));
35
+
36
+		// Filter categories
37
+		$config = GridFieldConfig_RelationEditor::create();
38
+		if (class_exists('GridFieldAddExistingSearchButton')) {
39
+			$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
40
+			$config->addComponent(new GridFieldAddExistingSearchButton());
41
+		}
42
+		$categories = $this->Categories();
43
+		$categoriesField = GridField::create('Categories', 'Categories', $categories, $config)
44
+			->setDescription('only show locations from the selected category');
45
+
46
+			// Filter
47
+			$fields->addFieldsToTab('Root.Filter', array(
48
+				HeaderField::create('CategoryOptionsHeader', 'Location Filtering', 3),
49
+				$categoriesField,
50
+			));
51
+
52
+		$this->extend('updateCMSFields', $fields);
53
+
54
+		return $fields;
55
+	}
56
+
57
+	public static function getLocations($filter = array(), $exclude = array(), $filterAny = array())
58
+	{
59
+		$filter['ShowInLocator'] = true;
60
+		$exclude['Lat'] = 0;
61
+
62
+		$Locations = Location::get()->exclude($exclude)->filter($filter)->filterAny($filterAny);
63
+
64
+		return $Locations;
65
+	}
66
+
67
+	public function getAreLocations()
68
+	{
69
+		return self::getLocations();
70
+	}
71
+
72
+	public function getAllCategories()
73
+	{
74
+		return LocationCategory::get();
75
+	}
76
+
77
+	public static function getPageCategories($id = null)
78
+	{
79
+		if ($id) {
80
+			if ($locator = self::get()->byID($id)) {
81
+				return $locator->Categories();
82
+			}
83
+
84
+			return false;
85
+		}
86
+
87
+		return false;
88
+	}
89 89
 }
90 90
 
91 91
 class Locator_Controller extends Page_Controller
92 92
 {
93
-    // allowed actions
94
-    private static $allowed_actions = array('xml');
93
+	// allowed actions
94
+	private static $allowed_actions = array('xml');
95 95
 
96
-    // Set Requirements based on input from CMS
97
-    public function init()
98
-    {
99
-        parent::init();
96
+	// Set Requirements based on input from CMS
97
+	public function init()
98
+	{
99
+		parent::init();
100 100
 
101
-        $themeDir = SSViewer::get_theme_folder();
101
+		$themeDir = SSViewer::get_theme_folder();
102 102
 
103
-        Requirements::javascript('framework/thirdparty/jquery/jquery.js');
104
-        if (Locator::getLocations()) {
105
-            Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
106
-            Requirements::javascript('locator/thirdparty/handlebars/handlebars-v1.3.0.js');
107
-            Requirements::javascript('locator/thirdparty/jquery-store-locator/js/jquery.storelocator.js');
108
-        }
103
+		Requirements::javascript('framework/thirdparty/jquery/jquery.js');
104
+		if (Locator::getLocations()) {
105
+			Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
106
+			Requirements::javascript('locator/thirdparty/handlebars/handlebars-v1.3.0.js');
107
+			Requirements::javascript('locator/thirdparty/jquery-store-locator/js/jquery.storelocator.js');
108
+		}
109 109
 
110
-        Requirements::css('locator/css/map.css');
110
+		Requirements::css('locator/css/map.css');
111 111
 
112
-        $featured = (Locator::getLocations(array('Featured' => 1))->count() > 0) ?
113
-            'featuredLocations: true' :
114
-            'featuredLocations: false';
112
+		$featured = (Locator::getLocations(array('Featured' => 1))->count() > 0) ?
113
+			'featuredLocations: true' :
114
+			'featuredLocations: false';
115 115
 
116
-        // map config based on user input in Settings tab
117
-        // AutoGeocode or Full Map
118
-        $load = ($this->data()->AutoGeocode) ?
119
-            'autoGeocode: true, fullMapStart: false,' :
120
-            'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
116
+		// map config based on user input in Settings tab
117
+		// AutoGeocode or Full Map
118
+		$load = ($this->data()->AutoGeocode) ?
119
+			'autoGeocode: true, fullMapStart: false,' :
120
+			'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
121 121
 
122
-        $base = Director::baseFolder();
123
-        $themePath = $base.'/'.$themeDir;
122
+		$base = Director::baseFolder();
123
+		$themePath = $base.'/'.$themeDir;
124 124
 
125
-        $listTemplatePath = (file_exists($themePath.'/templates/location-list-description.html')) ?
126
-            $themeDir.'/templates/location-list-description.html' :
127
-            'locator/templates/location-list-description.html';
128
-        $infowindowTemplatePath = (file_exists($themePath.'/templates/infowindow-description.html')) ?
129
-            $themeDir.'/templates/infowindow-description.html' :
130
-            'locator/templates/infowindow-description.html';
125
+		$listTemplatePath = (file_exists($themePath.'/templates/location-list-description.html')) ?
126
+			$themeDir.'/templates/location-list-description.html' :
127
+			'locator/templates/location-list-description.html';
128
+		$infowindowTemplatePath = (file_exists($themePath.'/templates/infowindow-description.html')) ?
129
+			$themeDir.'/templates/infowindow-description.html' :
130
+			'locator/templates/infowindow-description.html';
131 131
 
132
-        // in page or modal
133
-        $modal = ($this->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';
132
+		// in page or modal
133
+		$modal = ($this->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';
134 134
 
135
-        $kilometer = ($this->data()->Unit == 'km') ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
135
+		$kilometer = ($this->data()->Unit == 'km') ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
136 136
 
137
-        $link = $this->Link().'xml.xml';
137
+		$link = $this->Link().'xml.xml';
138 138
 
139
-        // init map
140
-        if (Locator::getLocations()) {
141
-            Requirements::customScript("
139
+		// init map
140
+		if (Locator::getLocations()) {
141
+			Requirements::customScript("
142 142
                 $(function($) {
143 143
                     $('#map-container').storeLocator({
144 144
                         ".$load."
@@ -159,73 +159,73 @@  discard block
 block discarded – undo
159 159
                     });
160 160
                 });
161 161
             ');
162
-        }
163
-    }
164
-
165
-    /**
166
-     * Find all locations for map.
167
-     *
168
-     * Will return a XML feed of all locations marked "show in locator".
169
-     *
170
-     * @return XML file
171
-     *
172
-     * @todo rename/refactor to allow for json/xml
173
-     * @todo allow $filter to run off of getVars key/val pair
174
-     */
175
-    public function xml(SS_HTTPRequest $request)
176
-    {
177
-        $filter = array();
178
-        $exclude = array();
179
-        $filterAny = array();
180
-
181
-        //if a category filter selected
182
-        if ($this->Categories()->exists()) {
183
-            $categories = $this->Categories();
184
-            foreach ($categories as $category) {
185
-                $filterAny['CategoryID'] = $category->ID;
186
-            }
187
-        }
188
-
189
-        $Locations = Locator::getLocations($filter, $exclude, $filterAny);
190
-
191
-        return $this->customise(array(
192
-            'Locations' => $Locations,
193
-        ))->renderWith('LocationXML');
194
-    }
195
-
196
-    /**
197
-     * LocationSearch form.
198
-     *
199
-     * Search form for locations, updates map and results list via AJAX
200
-     *
201
-     * @return Form
202
-     */
203
-    public function LocationSearch()
204
-    {
205
-        $fields = FieldList::create(
206
-            $address = TextField::create('address', '')
207
-        );
208
-        $address->setAttribute('placeholder', 'address or zip code');
209
-
210
-        $locatorCategories = Locator::getPageCategories($this->ID);
211
-
212
-        if (LocationCategory::get()->Count() > 0 && $locatorCategories && $locatorCategories->Count() != 1) {
213
-            $categories = LocationCategory::get();
214
-
215
-            if ($categories->count() > 0) {
216
-                $fields->push(
217
-                    DropdownField::create(
218
-                        'category',
219
-                        '',
220
-                        $categories->map('Title', 'Title')
221
-                    )->setEmptyString('Select Category'));
222
-            }
223
-        }
224
-
225
-        $actions = FieldList::create(
226
-            FormAction::create('', 'Search')
227
-        );
228
-
229
-        return Form::create($this, 'LocationSearch', $fields, $actions);
230
-    }
162
+		}
163
+	}
164
+
165
+	/**
166
+	 * Find all locations for map.
167
+	 *
168
+	 * Will return a XML feed of all locations marked "show in locator".
169
+	 *
170
+	 * @return XML file
171
+	 *
172
+	 * @todo rename/refactor to allow for json/xml
173
+	 * @todo allow $filter to run off of getVars key/val pair
174
+	 */
175
+	public function xml(SS_HTTPRequest $request)
176
+	{
177
+		$filter = array();
178
+		$exclude = array();
179
+		$filterAny = array();
180
+
181
+		//if a category filter selected
182
+		if ($this->Categories()->exists()) {
183
+			$categories = $this->Categories();
184
+			foreach ($categories as $category) {
185
+				$filterAny['CategoryID'] = $category->ID;
186
+			}
187
+		}
188
+
189
+		$Locations = Locator::getLocations($filter, $exclude, $filterAny);
190
+
191
+		return $this->customise(array(
192
+			'Locations' => $Locations,
193
+		))->renderWith('LocationXML');
194
+	}
195
+
196
+	/**
197
+	 * LocationSearch form.
198
+	 *
199
+	 * Search form for locations, updates map and results list via AJAX
200
+	 *
201
+	 * @return Form
202
+	 */
203
+	public function LocationSearch()
204
+	{
205
+		$fields = FieldList::create(
206
+			$address = TextField::create('address', '')
207
+		);
208
+		$address->setAttribute('placeholder', 'address or zip code');
209
+
210
+		$locatorCategories = Locator::getPageCategories($this->ID);
211
+
212
+		if (LocationCategory::get()->Count() > 0 && $locatorCategories && $locatorCategories->Count() != 1) {
213
+			$categories = LocationCategory::get();
214
+
215
+			if ($categories->count() > 0) {
216
+				$fields->push(
217
+					DropdownField::create(
218
+						'category',
219
+						'',
220
+						$categories->map('Title', 'Title')
221
+					)->setEmptyString('Select Category'));
222
+			}
223
+		}
224
+
225
+		$actions = FieldList::create(
226
+			FormAction::create('', 'Search')
227
+		);
228
+
229
+		return Form::create($this, 'LocationSearch', $fields, $actions);
230
+	}
231 231
 }
Please login to merge, or discard this patch.
code/LocationAdmin.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,41 +2,41 @@
 block discarded – undo
2 2
 
3 3
 class LocationAdmin extends ModelAdmin
4 4
 {
5
-    private static $managed_models = array(
6
-        'Location',
7
-        'LocationCategory',
8
-    );
5
+	private static $managed_models = array(
6
+		'Location',
7
+		'LocationCategory',
8
+	);
9 9
 
10
-    private static $model_importers = array(
11
-        'Location' => 'LocationCsvBulkLoader',
12
-        'LocationCategory' => 'CsvBulkLoader',
13
-    );
10
+	private static $model_importers = array(
11
+		'Location' => 'LocationCsvBulkLoader',
12
+		'LocationCategory' => 'CsvBulkLoader',
13
+	);
14 14
 
15
-    private static $menu_title = 'Locator';
16
-    private static $url_segment = 'locator';
15
+	private static $menu_title = 'Locator';
16
+	private static $url_segment = 'locator';
17 17
 
18
-    public function getExportFields()
19
-    {
20
-        if ($this->modelClass == 'Location') {
21
-            return array(
22
-                'Title' => 'Name',
23
-                'Address' => 'Address',
24
-                'Suburb' => 'City',
25
-                'State' => 'State',
26
-                'Postcode' => 'Postcode',
27
-                'Country' => 'Country',
28
-                'Website' => 'Website',
29
-                'Phone' => 'Phone',
30
-                'Fax' => 'Fax',
31
-                'Email' => 'Email',
32
-                'Category.Name' => 'Category',
33
-                'ShowInLocator' => 'ShowInLocator',
34
-                'Featured' => 'Featured',
35
-                'Lat' => 'Lat',
36
-                'Lng' => 'Lng',
37
-            );
38
-        }
18
+	public function getExportFields()
19
+	{
20
+		if ($this->modelClass == 'Location') {
21
+			return array(
22
+				'Title' => 'Name',
23
+				'Address' => 'Address',
24
+				'Suburb' => 'City',
25
+				'State' => 'State',
26
+				'Postcode' => 'Postcode',
27
+				'Country' => 'Country',
28
+				'Website' => 'Website',
29
+				'Phone' => 'Phone',
30
+				'Fax' => 'Fax',
31
+				'Email' => 'Email',
32
+				'Category.Name' => 'Category',
33
+				'ShowInLocator' => 'ShowInLocator',
34
+				'Featured' => 'Featured',
35
+				'Lat' => 'Lat',
36
+				'Lng' => 'Lng',
37
+			);
38
+		}
39 39
 
40
-        return parent::getExportFields();
41
-    }
40
+		return parent::getExportFields();
41
+	}
42 42
 }
Please login to merge, or discard this patch.
code/Location.php 1 patch
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -2,177 +2,177 @@
 block discarded – undo
2 2
 
3 3
 class Location extends DataObject implements PermissionProvider
4 4
 {
5
-    private static $db = array(
6
-        'Title' => 'Varchar(255)',
7
-        'Featured' => 'Boolean',
8
-        'Website' => 'Varchar(255)',
9
-        'Phone' => 'Varchar(40)',
10
-        'Email' => 'Varchar(255)',
11
-        'EmailAddress' => 'Varchar(255)',
12
-        'ShowInLocator' => 'Boolean',
13
-    );
14
-
15
-    private static $has_one = array(
16
-        'Category' => 'LocationCategory',
17
-    );
18
-
19
-    private static $casting = array(
20
-        'distance' => 'Int',
21
-    );
22
-
23
-    private static $default_sort = 'Title';
24
-
25
-    private static $defaults = array(
26
-        'ShowInLocator' => true,
27
-    );
28
-
29
-    private static $singular_name = 'Location';
30
-    private static $plural_name = 'Locations';
31
-
32
-    // api access via Restful Server module
33
-    private static $api_access = true;
34
-
35
-    // search fields for Model Admin
36
-    private static $searchable_fields = array(
37
-        'Title',
38
-        'Address',
39
-        'Suburb',
40
-        'State',
41
-        'Postcode',
42
-        'Country',
43
-        'Website',
44
-        'Phone',
45
-        'Email',
46
-        'Category.ID',
47
-        'ShowInLocator',
48
-        'Featured',
49
-    );
50
-
51
-    // columns for grid field
52
-    private static $summary_fields = array(
53
-        'Title',
54
-        'Address',
55
-        'Suburb',
56
-        'State',
57
-        'Postcode',
58
-        'Country',
59
-        'Category.Name',
60
-        'ShowInLocator.NiceAsBoolean',
61
-        'Featured.NiceAsBoolean',
62
-        'Coords',
63
-    );
64
-
65
-    // Coords status for $summary_fields
66
-    public function getCoords()
67
-    {
68
-        return ($this->Lat != 0 && $this->Lng != 0) ? 'true' : 'false';
69
-    }
70
-
71
-    // custom labels for fields
72
-    public function fieldLabels($includerelations = true)
73
-    {
74
-        $labels = parent::fieldLabels();
75
-
76
-        $labels['Title'] = 'Name';
77
-        $labels['Suburb'] = 'City';
78
-        $labels['Postcode'] = 'Postal Code';
79
-        $labels['ShowInLocator'] = 'Show';
80
-        $labels['ShowInLocator.NiceAsBoolean'] = 'Show';
81
-        $labels['Category.Name'] = 'Category';
82
-        $labels['Email'] = 'Email';
83
-        $labels['Featured.NiceAsBoolean'] = 'Featured';
84
-        $labels['Coords'] = 'Coords';
85
-
86
-        return $labels;
87
-    }
88
-
89
-    public function getCMSFields()
90
-    {
91
-        $fields = FieldList::create(
92
-            new TabSet(
93
-                $name = 'Root',
94
-                new Tab(
95
-                    $title = 'Main',
96
-                    HeaderField::create('ContactHD', 'Contact Information'),
97
-                    TextField::create('Title', 'Name'),
98
-                    TextField::create('Phone'),
99
-                    EmailField::create('Email', 'Email'),
100
-                    TextField::create('Website')
101
-                        ->setAttribute('placeholder', 'http://'),
102
-                    DropDownField::create('CategoryID', 'Category', LocationCategory::get()->map('ID', 'Title'))
103
-                        ->setEmptyString('-- select --'),
104
-                    CheckboxField::create('ShowInLocator', 'Show in results')
105
-                        ->setDescription('Location will be included in results list'),
106
-                    CheckboxField::create('Featured')
107
-                        ->setDescription('Location will show at/near the top of the results list')
108
-                )
109
-            )
110
-        );
111
-
112
-        // allow to be extended via DataExtension
113
-        $this->extend('updateCMSFields', $fields);
114
-
115
-        // override Suburb field name
116
-        $fields->dataFieldByName('Suburb')->setTitle('City');
117
-
118
-        return $fields;
119
-    }
120
-
121
-    public function validate()
122
-    {
123
-        $result = parent::validate();
124
-
125
-        return $result;
126
-    }
127
-
128
-    public function EmailAddress()
129
-    {
130
-        Deprecation::notice('3.0', 'Use "$Email" instead.');
131
-        if ($this->Email) {
132
-            return $this->Email;
133
-        } elseif ($this->EmailAddress) {
134
-            return $this->EmailAddress;
135
-        }
136
-
137
-        return false;
138
-    }
139
-
140
-    /**
141
-     * @param Member $member
142
-     *
143
-     * @return bool
144
-     */
145
-    public function canView($member = false)
146
-    {
147
-        return true;
148
-    }
149
-
150
-    public function canEdit($member = false)
151
-    {
152
-        return Permission::check('Location_EDIT');
153
-    }
154
-
155
-    public function canDelete($member = false)
156
-    {
157
-        return Permission::check('Location_DELETE');
158
-    }
159
-
160
-    public function canCreate($member = false)
161
-    {
162
-        return Permission::check('Location_CREATE');
163
-    }
164
-
165
-    public function providePermissions()
166
-    {
167
-        return array(
168
-            'Location_EDIT' => 'Edit a Location',
169
-            'Location_DELETE' => 'Delete a Location',
170
-            'Location_CREATE' => 'Create a Location',
171
-        );
172
-    }
173
-
174
-    public function onBeforeWrite()
175
-    {
176
-        parent::onBeforeWrite();
177
-    }
5
+	private static $db = array(
6
+		'Title' => 'Varchar(255)',
7
+		'Featured' => 'Boolean',
8
+		'Website' => 'Varchar(255)',
9
+		'Phone' => 'Varchar(40)',
10
+		'Email' => 'Varchar(255)',
11
+		'EmailAddress' => 'Varchar(255)',
12
+		'ShowInLocator' => 'Boolean',
13
+	);
14
+
15
+	private static $has_one = array(
16
+		'Category' => 'LocationCategory',
17
+	);
18
+
19
+	private static $casting = array(
20
+		'distance' => 'Int',
21
+	);
22
+
23
+	private static $default_sort = 'Title';
24
+
25
+	private static $defaults = array(
26
+		'ShowInLocator' => true,
27
+	);
28
+
29
+	private static $singular_name = 'Location';
30
+	private static $plural_name = 'Locations';
31
+
32
+	// api access via Restful Server module
33
+	private static $api_access = true;
34
+
35
+	// search fields for Model Admin
36
+	private static $searchable_fields = array(
37
+		'Title',
38
+		'Address',
39
+		'Suburb',
40
+		'State',
41
+		'Postcode',
42
+		'Country',
43
+		'Website',
44
+		'Phone',
45
+		'Email',
46
+		'Category.ID',
47
+		'ShowInLocator',
48
+		'Featured',
49
+	);
50
+
51
+	// columns for grid field
52
+	private static $summary_fields = array(
53
+		'Title',
54
+		'Address',
55
+		'Suburb',
56
+		'State',
57
+		'Postcode',
58
+		'Country',
59
+		'Category.Name',
60
+		'ShowInLocator.NiceAsBoolean',
61
+		'Featured.NiceAsBoolean',
62
+		'Coords',
63
+	);
64
+
65
+	// Coords status for $summary_fields
66
+	public function getCoords()
67
+	{
68
+		return ($this->Lat != 0 && $this->Lng != 0) ? 'true' : 'false';
69
+	}
70
+
71
+	// custom labels for fields
72
+	public function fieldLabels($includerelations = true)
73
+	{
74
+		$labels = parent::fieldLabels();
75
+
76
+		$labels['Title'] = 'Name';
77
+		$labels['Suburb'] = 'City';
78
+		$labels['Postcode'] = 'Postal Code';
79
+		$labels['ShowInLocator'] = 'Show';
80
+		$labels['ShowInLocator.NiceAsBoolean'] = 'Show';
81
+		$labels['Category.Name'] = 'Category';
82
+		$labels['Email'] = 'Email';
83
+		$labels['Featured.NiceAsBoolean'] = 'Featured';
84
+		$labels['Coords'] = 'Coords';
85
+
86
+		return $labels;
87
+	}
88
+
89
+	public function getCMSFields()
90
+	{
91
+		$fields = FieldList::create(
92
+			new TabSet(
93
+				$name = 'Root',
94
+				new Tab(
95
+					$title = 'Main',
96
+					HeaderField::create('ContactHD', 'Contact Information'),
97
+					TextField::create('Title', 'Name'),
98
+					TextField::create('Phone'),
99
+					EmailField::create('Email', 'Email'),
100
+					TextField::create('Website')
101
+						->setAttribute('placeholder', 'http://'),
102
+					DropDownField::create('CategoryID', 'Category', LocationCategory::get()->map('ID', 'Title'))
103
+						->setEmptyString('-- select --'),
104
+					CheckboxField::create('ShowInLocator', 'Show in results')
105
+						->setDescription('Location will be included in results list'),
106
+					CheckboxField::create('Featured')
107
+						->setDescription('Location will show at/near the top of the results list')
108
+				)
109
+			)
110
+		);
111
+
112
+		// allow to be extended via DataExtension
113
+		$this->extend('updateCMSFields', $fields);
114
+
115
+		// override Suburb field name
116
+		$fields->dataFieldByName('Suburb')->setTitle('City');
117
+
118
+		return $fields;
119
+	}
120
+
121
+	public function validate()
122
+	{
123
+		$result = parent::validate();
124
+
125
+		return $result;
126
+	}
127
+
128
+	public function EmailAddress()
129
+	{
130
+		Deprecation::notice('3.0', 'Use "$Email" instead.');
131
+		if ($this->Email) {
132
+			return $this->Email;
133
+		} elseif ($this->EmailAddress) {
134
+			return $this->EmailAddress;
135
+		}
136
+
137
+		return false;
138
+	}
139
+
140
+	/**
141
+	 * @param Member $member
142
+	 *
143
+	 * @return bool
144
+	 */
145
+	public function canView($member = false)
146
+	{
147
+		return true;
148
+	}
149
+
150
+	public function canEdit($member = false)
151
+	{
152
+		return Permission::check('Location_EDIT');
153
+	}
154
+
155
+	public function canDelete($member = false)
156
+	{
157
+		return Permission::check('Location_DELETE');
158
+	}
159
+
160
+	public function canCreate($member = false)
161
+	{
162
+		return Permission::check('Location_CREATE');
163
+	}
164
+
165
+	public function providePermissions()
166
+	{
167
+		return array(
168
+			'Location_EDIT' => 'Edit a Location',
169
+			'Location_DELETE' => 'Delete a Location',
170
+			'Location_CREATE' => 'Create a Location',
171
+		);
172
+	}
173
+
174
+	public function onBeforeWrite()
175
+	{
176
+		parent::onBeforeWrite();
177
+	}
178 178
 }
Please login to merge, or discard this patch.
code/LocationCsvBulkLoader.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,30 +2,30 @@
 block discarded – undo
2 2
 
3 3
 class LocationCsvBulkLoader extends CsvBulkLoader
4 4
 {
5
-    public $columnMap = array(
6
-        'Name' => 'Title',
7
-        'City' => 'Suburb',
8
-        'EmailAddress' => 'Email',
9
-        'Category' => 'Category.Name',
10
-    );
5
+	public $columnMap = array(
6
+		'Name' => 'Title',
7
+		'City' => 'Suburb',
8
+		'EmailAddress' => 'Email',
9
+		'Category' => 'Category.Name',
10
+	);
11 11
 
12
-    public $relationCallbacks = array(
13
-       'Category.Name' => array(
14
-           'relationname' => 'Category',
15
-           'callback' => 'getCategoryByName',
16
-        ),
17
-    );
12
+	public $relationCallbacks = array(
13
+	   'Category.Name' => array(
14
+		   'relationname' => 'Category',
15
+		   'callback' => 'getCategoryByName',
16
+		),
17
+	);
18 18
 
19
-    public static function getCategoryByName(&$obj, $val, $record)
20
-    {
21
-        $val = Convert::raw2sql($val);
22
-        $category = LocationCategory::get()->filter(array('Name' => $val))->First();
23
-        if (!$category) {
24
-            $category = LocationCategory::create();
25
-            $category->Name = $val;
26
-            $category->write();
27
-        }
19
+	public static function getCategoryByName(&$obj, $val, $record)
20
+	{
21
+		$val = Convert::raw2sql($val);
22
+		$category = LocationCategory::get()->filter(array('Name' => $val))->First();
23
+		if (!$category) {
24
+			$category = LocationCategory::create();
25
+			$category->Name = $val;
26
+			$category->write();
27
+		}
28 28
 
29
-        return $category;
30
-    }
29
+		return $category;
30
+	}
31 31
 }
Please login to merge, or discard this patch.
tests/Locator_Test.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,26 +2,26 @@
 block discarded – undo
2 2
 
3 3
 class Locator_Test extends FunctionalTest
4 4
 {
5
-    protected static $fixture_file = 'locator/tests/Locator_Test.yml';
6
-    protected static $disable_themes = true;
7
-    protected static $use_draft_site = false;
5
+	protected static $fixture_file = 'locator/tests/Locator_Test.yml';
6
+	protected static $disable_themes = true;
7
+	protected static $use_draft_site = false;
8 8
 
9
-    public function setUp()
10
-    {
11
-        parent::setUp();
9
+	public function setUp()
10
+	{
11
+		parent::setUp();
12 12
 
13
-        ini_set('display_errors', 1);
14
-        ini_set('log_errors', 1);
15
-        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
16
-    }
13
+		ini_set('display_errors', 1);
14
+		ini_set('log_errors', 1);
15
+		error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
16
+	}
17 17
 
18
-    public function logOut()
19
-    {
20
-        $this->session()->clear('loggedInAs');
21
-        $this->session()->clear('logInWithPermission');
22
-    }
18
+	public function logOut()
19
+	{
20
+		$this->session()->clear('loggedInAs');
21
+		$this->session()->clear('logInWithPermission');
22
+	}
23 23
 
24
-    public function testLocator_Test()
25
-    {
26
-    }
24
+	public function testLocator_Test()
25
+	{
26
+	}
27 27
 }
Please login to merge, or discard this patch.
tests/LocationTest.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -2,117 +2,117 @@
 block discarded – undo
2 2
 
3 3
 class LocationTest extends Locator_Test
4 4
 {
5
-    public function testGetCoords()
6
-    {
7
-        $location = $this->objFromFixture('Location', 'dynamic');
8
-        $location->write();
5
+	public function testGetCoords()
6
+	{
7
+		$location = $this->objFromFixture('Location', 'dynamic');
8
+		$location->write();
9 9
 
10
-        $coords = ($location->Lat && $location->Lng) ? 'true' : 'false';
11
-        $geoCodable = Location::get()->byID($location->ID);
10
+		$coords = ($location->Lat && $location->Lng) ? 'true' : 'false';
11
+		$geoCodable = Location::get()->byID($location->ID);
12 12
 
13
-        $this->assertEquals($coords, $geoCodable->getCoords());
14
-    }
13
+		$this->assertEquals($coords, $geoCodable->getCoords());
14
+	}
15 15
 
16
-    public function testFieldLabels()
17
-    {
18
-        $location = $this->objFromFixture('Location', 'dynamic');
19
-        $labels = $location->FieldLabels();
20
-        $expected = array(
21
-            'Title' => 'Name',
22
-            'Featured' => 'Featured',
23
-            'Website' => 'Website',
24
-            'Phone' => 'Phone',
25
-            'Email' => 'Email',
26
-            'EmailAddress' => 'Email Address',
27
-            'ShowInLocator' => 'Show',
28
-            'Address' => 'Address',
29
-            'Suburb' => 'City',
30
-            'State' => 'State',
31
-            'Postcode' => 'Postal Code',
32
-            'Country' => 'Country',
33
-            'Lat' => 'Lat',
34
-            'Lng' => 'Lng',
35
-            'Category' => 'Category',
36
-            'ShowInLocator.NiceAsBoolean' => 'Show',
37
-            'Category.Name' => 'Category',
38
-            'Featured.NiceAsBoolean' => 'Featured',
39
-            'Coords' => 'Coords',
40
-        );
41
-        $this->assertEquals($expected, $labels);
42
-    }
16
+	public function testFieldLabels()
17
+	{
18
+		$location = $this->objFromFixture('Location', 'dynamic');
19
+		$labels = $location->FieldLabels();
20
+		$expected = array(
21
+			'Title' => 'Name',
22
+			'Featured' => 'Featured',
23
+			'Website' => 'Website',
24
+			'Phone' => 'Phone',
25
+			'Email' => 'Email',
26
+			'EmailAddress' => 'Email Address',
27
+			'ShowInLocator' => 'Show',
28
+			'Address' => 'Address',
29
+			'Suburb' => 'City',
30
+			'State' => 'State',
31
+			'Postcode' => 'Postal Code',
32
+			'Country' => 'Country',
33
+			'Lat' => 'Lat',
34
+			'Lng' => 'Lng',
35
+			'Category' => 'Category',
36
+			'ShowInLocator.NiceAsBoolean' => 'Show',
37
+			'Category.Name' => 'Category',
38
+			'Featured.NiceAsBoolean' => 'Featured',
39
+			'Coords' => 'Coords',
40
+		);
41
+		$this->assertEquals($expected, $labels);
42
+	}
43 43
 
44
-    public function testGetCMSFields()
45
-    {
46
-        $object = new Location();
47
-        $fieldset = $object->getCMSFields();
48
-        $this->assertTrue(is_a($fieldset, 'FieldList'));
49
-    }
44
+	public function testGetCMSFields()
45
+	{
46
+		$object = new Location();
47
+		$fieldset = $object->getCMSFields();
48
+		$this->assertTrue(is_a($fieldset, 'FieldList'));
49
+	}
50 50
 
51
-    public function testValidate()
52
-    {
53
-    }
51
+	public function testValidate()
52
+	{
53
+	}
54 54
 
55
-    public function testEmailAddress()
56
-    {
57
-    }
55
+	public function testEmailAddress()
56
+	{
57
+	}
58 58
 
59
-    public function testCanView()
60
-    {
61
-        $object = $this->objFromFixture('Location', 'dynamic');
62
-        $object->write();
63
-        $this->logInWithPermission('ADMIN');
64
-        $this->assertTrue($object->canView());
65
-        $this->logOut();
66
-        $nullMember = Member::create();
67
-        $nullMember->write();
68
-        $this->assertTrue($object->canView($nullMember));
69
-        $nullMember->delete();
70
-    }
59
+	public function testCanView()
60
+	{
61
+		$object = $this->objFromFixture('Location', 'dynamic');
62
+		$object->write();
63
+		$this->logInWithPermission('ADMIN');
64
+		$this->assertTrue($object->canView());
65
+		$this->logOut();
66
+		$nullMember = Member::create();
67
+		$nullMember->write();
68
+		$this->assertTrue($object->canView($nullMember));
69
+		$nullMember->delete();
70
+	}
71 71
 
72
-    public function testCanEdit()
73
-    {
74
-        $object = $this->objFromFixture('Location', 'dynamic');
75
-        $object->write();
76
-        $objectID = $object->ID;
77
-        $this->logInWithPermission('Location_EDIT');
78
-        $originalTitle = $object->Title;
79
-        $this->assertEquals($originalTitle, 'Dynamic, Inc.');
80
-        $this->assertTrue($object->canEdit());
81
-        $object->Title = 'Changed Title';
82
-        $object->write();
83
-        $testEdit = Location::get()->byID($objectID);
84
-        $this->assertEquals($testEdit->Title, 'Changed Title');
85
-        $this->logOut();
86
-    }
72
+	public function testCanEdit()
73
+	{
74
+		$object = $this->objFromFixture('Location', 'dynamic');
75
+		$object->write();
76
+		$objectID = $object->ID;
77
+		$this->logInWithPermission('Location_EDIT');
78
+		$originalTitle = $object->Title;
79
+		$this->assertEquals($originalTitle, 'Dynamic, Inc.');
80
+		$this->assertTrue($object->canEdit());
81
+		$object->Title = 'Changed Title';
82
+		$object->write();
83
+		$testEdit = Location::get()->byID($objectID);
84
+		$this->assertEquals($testEdit->Title, 'Changed Title');
85
+		$this->logOut();
86
+	}
87 87
 
88
-    public function testCanDelete()
89
-    {
90
-        $object = $this->objFromFixture('Location', 'dynamic');
91
-        $object->write();
92
-        $this->logInWithPermission('Location_DELETE');
93
-        $this->assertTrue($object->canDelete());
94
-        $checkObject = $object;
95
-        $object->delete();
96
-        $this->assertEquals($checkObject->ID, 0);
97
-    }
88
+	public function testCanDelete()
89
+	{
90
+		$object = $this->objFromFixture('Location', 'dynamic');
91
+		$object->write();
92
+		$this->logInWithPermission('Location_DELETE');
93
+		$this->assertTrue($object->canDelete());
94
+		$checkObject = $object;
95
+		$object->delete();
96
+		$this->assertEquals($checkObject->ID, 0);
97
+	}
98 98
 
99
-    public function testCanCreate()
100
-    {
101
-        $object = singleton('Location');
102
-        $this->logInWithPermission('Location_CREATE');
103
-        $this->assertTrue($object->canCreate());
104
-        $this->logOut();
105
-        $nullMember = Member::create();
106
-        $nullMember->write();
107
-        $this->assertFalse($object->canCreate($nullMember));
108
-        $nullMember->delete();
109
-    }
99
+	public function testCanCreate()
100
+	{
101
+		$object = singleton('Location');
102
+		$this->logInWithPermission('Location_CREATE');
103
+		$this->assertTrue($object->canCreate());
104
+		$this->logOut();
105
+		$nullMember = Member::create();
106
+		$nullMember->write();
107
+		$this->assertFalse($object->canCreate($nullMember));
108
+		$nullMember->delete();
109
+	}
110 110
 
111
-    public function testProvidePermissions()
112
-    {
113
-    }
111
+	public function testProvidePermissions()
112
+	{
113
+	}
114 114
 
115
-    public function testOnBeforeWrite()
116
-    {
117
-    }
115
+	public function testOnBeforeWrite()
116
+	{
117
+	}
118 118
 }
Please login to merge, or discard this patch.
code/LocationCategory.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@
 block discarded – undo
2 2
 
3 3
 class LocationCategory extends DataObject
4 4
 {
5
-    private static $db = array(
6
-        'Name' => 'Varchar(100)',
7
-    );
5
+	private static $db = array(
6
+		'Name' => 'Varchar(100)',
7
+	);
8 8
 
9
-    private static $has_many = array(
10
-        'Locations' => 'Location',
11
-    );
9
+	private static $has_many = array(
10
+		'Locations' => 'Location',
11
+	);
12 12
 
13
-    private static $belogs_many_many = array(
14
-        'Locators' => 'Locator',
15
-    );
13
+	private static $belogs_many_many = array(
14
+		'Locators' => 'Locator',
15
+	);
16 16
 
17
-    private static $singular_name = 'Category';
18
-    private static $plural_name = 'Categories';
17
+	private static $singular_name = 'Category';
18
+	private static $plural_name = 'Categories';
19 19
 
20
-    private static $default_sort = 'Name';
20
+	private static $default_sort = 'Name';
21 21
 }
Please login to merge, or discard this patch.
tests/LocatorTest.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -2,68 +2,68 @@
 block discarded – undo
2 2
 
3 3
 class LocatorTest extends Locator_Test
4 4
 {
5
-    public function testGetCMSFields()
6
-    {
7
-        $object = new Locator();
8
-        $fieldset = $object->getCMSFields();
9
-        $this->assertTrue(is_a($fieldset, 'FieldList'));
10
-    }
5
+	public function testGetCMSFields()
6
+	{
7
+		$object = new Locator();
8
+		$fieldset = $object->getCMSFields();
9
+		$this->assertTrue(is_a($fieldset, 'FieldList'));
10
+	}
11 11
 
12
-    public function testGetLocations()
13
-    {
14
-        $locator = singleton('Locator');
15
-        $count = Location::get()->filter('ShowInLocator', 1)->exclude('Lat', 0)->Count();
16
-        $this->assertEquals($locator->getLocations()->Count(), $count);
17
-    }
12
+	public function testGetLocations()
13
+	{
14
+		$locator = singleton('Locator');
15
+		$count = Location::get()->filter('ShowInLocator', 1)->exclude('Lat', 0)->Count();
16
+		$this->assertEquals($locator->getLocations()->Count(), $count);
17
+	}
18 18
 
19
-    public function testGetAreLocations()
20
-    {
21
-        $locator = singleton('Locator');
22
-        $this->assertEquals($locator->getLocations(), $locator->getAreLocations());
23
-    }
19
+	public function testGetAreLocations()
20
+	{
21
+		$locator = singleton('Locator');
22
+		$this->assertEquals($locator->getLocations(), $locator->getAreLocations());
23
+	}
24 24
 
25
-    public function testGetAllCategories()
26
-    {
27
-        $locator = singleton('Locator');
28
-        $count = LocationCategory::get();
29
-        $this->assertEquals($locator->getAllCategories(), $count);
30
-    }
25
+	public function testGetAllCategories()
26
+	{
27
+		$locator = singleton('Locator');
28
+		$count = LocationCategory::get();
29
+		$this->assertEquals($locator->getAllCategories(), $count);
30
+	}
31 31
 
32
-    public function testGetPageCategories()
33
-    {
34
-        $locator = Locator::create();
35
-        $this->assertFalse($locator->getPageCategories());
32
+	public function testGetPageCategories()
33
+	{
34
+		$locator = Locator::create();
35
+		$this->assertFalse($locator->getPageCategories());
36 36
 
37
-        $this->assertFalse($locator->getPageCategories(500));
37
+		$this->assertFalse($locator->getPageCategories(500));
38 38
 
39
-        $locator->write();
40
-        $category = $this->objFromFixture('LocationCategory', 'service');
41
-        $locator->Categories()->add($category);
42
-        $this->assertEquals($locator->getPageCategories($locator->ID), $locator->Categories());
43
-    }
39
+		$locator->write();
40
+		$category = $this->objFromFixture('LocationCategory', 'service');
41
+		$locator->Categories()->add($category);
42
+		$this->assertEquals($locator->getPageCategories($locator->ID), $locator->Categories());
43
+	}
44 44
 
45
-    public function testInit()
46
-    {
47
-    }
45
+	public function testInit()
46
+	{
47
+	}
48 48
 
49
-    public function testXml()
50
-    {
51
-    }
49
+	public function testXml()
50
+	{
51
+	}
52 52
 
53
-    public function testLocationSearch()
54
-    {
55
-        $locator = $this->objFromFixture('Locator', 'locator1');
56
-        $object = Locator_Controller::create($locator);
57
-        $form = $object->LocationSearch();
58
-        $this->assertTrue(is_a($form, 'Form'));
53
+	public function testLocationSearch()
54
+	{
55
+		$locator = $this->objFromFixture('Locator', 'locator1');
56
+		$object = Locator_Controller::create($locator);
57
+		$form = $object->LocationSearch();
58
+		$this->assertTrue(is_a($form, 'Form'));
59 59
 
60
-        $category = $this->objFromFixture('LocationCategory', 'service');
61
-        $category2 = $this->objFromFixture('LocationCategory', 'manufacturing');
62
-        $locator->Categories()->add($category);
63
-        $locator->Categories()->add($category2);
60
+		$category = $this->objFromFixture('LocationCategory', 'service');
61
+		$category2 = $this->objFromFixture('LocationCategory', 'manufacturing');
62
+		$locator->Categories()->add($category);
63
+		$locator->Categories()->add($category2);
64 64
 
65
-        $form = $object->LocationSearch();
66
-        $fields = $form->Fields();
67
-        $this->assertNotNull($fields->fieldByName('category'));
68
-    }
65
+		$form = $object->LocationSearch();
66
+		$fields = $form->Fields();
67
+		$this->assertNotNull($fields->fieldByName('category'));
68
+	}
69 69
 }
Please login to merge, or discard this patch.