Created
March 7, 2013 13:00
-
-
Save kinglozzer/5107897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Plot extends DataObject { | |
public static $db = array( | |
'SortOrder' => 'Int', | |
'Title' => 'Varchar', | |
'Availability' => "Enum('Available, Reserved, Sold')", | |
'Price' => 'Currency', | |
'SalePrice' => 'Currency', | |
'Description' => 'HTMLText', | |
'Bedrooms' => 'Int', | |
'PlotType' => 'Varchar' | |
); | |
public static $summary_fields = array( | |
'Title' => 'Title', | |
'Availability' => 'Availability', | |
'PrettyPrice' => 'Price', | |
'PrettySalePrice' => 'Sale Price' | |
); | |
public static $default_sort = "SortOrder ASC"; | |
public function PrettyPrice() { | |
return '£' . number_format(abs($this->Price)); | |
} | |
public function PrettySalePrice() { | |
return '£' . number_format(abs($this->SalePrice)); | |
} | |
public function getDevelopmentPageTitle() { | |
return $this->DevelopmentPage()->Title; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment