Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created March 7, 2013 13:00
Show Gist options
  • Save kinglozzer/5107897 to your computer and use it in GitHub Desktop.
Save kinglozzer/5107897 to your computer and use it in GitHub Desktop.
<?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