Source of file Room.php
Size: 2,232 Bytes - Last Modified: 2021-12-23T10:51:36+00:00
/var/www/docs.ssmods.com/process/src/code/DataObjects/Room.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | <?php /** * * @package Realestate Listing System - Room DataObject * @requires DataObjectManager * @author Richard Rudy twitter:@thezenmonkey web: http://designplusawesome.com */ class Room extends DataObject { /** * Static vars * ----------------------------------*/ /** * Object vars * ----------------------------------*/ /** * Static methods * ----------------------------------*/ private static $db = array( 'Name' => 'Varchar', 'Type' => "Enum('Living Room,Dining Room,Kitchen,Family Room,Den,Laundry,Recreation Room,Bedroom,Bathroom,Utility,Storage,Garage,Other')", 'Level' => "Varchar", 'Length' => 'Varchar', 'Width' => 'Varchar', 'Note' => 'Varchar', 'Feature' => 'Boolean' ); private static $has_one = array( 'Listing' => 'Listing', 'MLSListing' => 'MLSListing' ); private static $has_many = array( 'Pictures' => 'Image' ); private static $summary_fields = array( 'Name', 'Level','Type', 'Width', 'Length' ); /** * Data model * ----------------------------------*/ /** * Common methods * ----------------------------------*/ function getCMSFields() { return new FieldList( new TextField('Name'), new DropdownField('Type','Type',singleton('Room')->dbObject('Type')->enumValues()), new TextField("Level"), new TextField('Length'), new TextField('Width'), new CheckboxField("Feature") ); } function getCMSFields_forPopup() { return new FieldList( new TextField('Name'), new DropdownField('Type','Type',singleton('Room')->dbObject('Type')->enumValues()), new TextField("Level"), new TextField('Length'), new TextField('Width'), new CheckboxField("Feature") ); } /** * Accessor methods * ----------------------------------*/ public function getTitle() { if($this->Type == "Other") { return $this->Name; } else { return $this->Name." ".$this->Type; } } /** * Controller actions * ----------------------------------*/ /** * Template accessors * ----------------------------------*/ /** * Object methods * ----------------------------------*/ } |