| 1 | <?php |
||
| 3 | class Location extends DataObject implements PermissionProvider |
||
| 4 | { |
||
| 5 | private static $db = array( |
||
|
1 ignored issue
–
show
|
|||
| 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( |
||
|
1 ignored issue
–
show
|
|||
| 16 | 'Category' => 'LocationCategory', |
||
| 17 | ); |
||
| 18 | |||
| 19 | private static $casting = array( |
||
|
1 ignored issue
–
show
|
|||
| 20 | 'distance' => 'Int', |
||
| 21 | ); |
||
| 22 | |||
| 23 | private static $default_sort = 'Title'; |
||
| 24 | |||
| 25 | private static $defaults = array( |
||
|
1 ignored issue
–
show
|
|||
| 26 | 'ShowInLocator' => true, |
||
| 27 | ); |
||
| 28 | |||
| 29 | private static $singular_name = 'Location'; |
||
|
1 ignored issue
–
show
|
|||
| 30 | private static $plural_name = 'Locations'; |
||
|
1 ignored issue
–
show
|
|||
| 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( |
||
|
1 ignored issue
–
show
|
|||
| 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( |
||
|
1 ignored issue
–
show
|
|||
| 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 | 1 | public function getCoords() |
|
| 70 | |||
| 71 | // custom labels for fields |
||
| 72 | 1 | public function fieldLabels($includerelations = true) |
|
| 89 | 1 | ||
| 90 | public function getCMSFields() |
||
| 121 | 5 | ||
| 122 | public function validate() |
||
| 128 | |||
| 129 | public function EmailAddress() |
||
| 140 | |||
| 141 | public function getCustomSearchContext() |
||
| 162 | 1 | ||
| 163 | /** |
||
| 164 | * @param Member $member |
||
| 165 | * |
||
| 166 | * @return bool |
||
| 167 | */ |
||
| 168 | public function canView($member = false) |
||
| 172 | |||
| 173 | public function canEdit($member = false) |
||
| 177 | 20 | ||
| 178 | public function canDelete($member = false) |
||
| 182 | |||
| 183 | public function canCreate($member = false) |
||
| 187 | |||
| 188 | public function providePermissions() |
||
| 196 | |||
| 197 | public function onBeforeWrite() |
||
| 198 | { |
||
| 199 | parent::onBeforeWrite(); |
||
| 200 | } |
||
| 201 | } |
||
| 202 |
This check marks private properties in classes that are never used. Those properties can be removed.