1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
<?php
class Application_Model_Property {
protected $id;
protected $reference_no;
protected $title_en;
protected $text_en;
protected $disposition_id;
protected $area;
protected $floor;
protected $lift;
protected $cellar;
protected $balcony;
protected $location_id;
protected $price;
protected $created_on;
protected $street;
protected $property_build_id;
protected $terace;
protected $loggia;
protected $garden;
protected $garage;
protected $parking_place;
public function getCoverObject() {
$pictures = new Application_Model_PropertyPicturesMapper();
$results = $pictures->fetchAll("cover = 1 and property_id = " . $this->getId());
foreach ($results as $result) {
return $result;
}
}
public function __construct(array $options = null) {
if (is_array($options)) {
$this->setOptions($options);
}
}
public function __set($name, $value) {
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid content property');
}
$this->$method($value);
}
public function __get($name) {
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid content property');
}
return $this->$method();
}
public function setOptions(array $options) {
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
return $this;
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getReference_no() {
return $this->reference_no;
}
public function setReference_no($reference_no) {
$this->reference_no = $reference_no;
}
public function getTitle_en() {
return $this->title_en;
}
public function setTitle_en($title_en) {
$this->title_en = $title_en;
}
public function getText_en() {
return $this->text_en;
}
public function setText_en($text_en) {
$this->text_en = $text_en;
}
public function getDisposition_id() {
return $this->disposition_id;
}
public function setDisposition_id($disposition_id) {
$this->disposition_id = $disposition_id;
}
public function getArea()
{
return str_replace(".0", "", $this->area);
}
public function getAreaFormatted() {
return number_format($this->area, 0, ".", " ");
}
public function setArea($area) {
$this->area = str_replace(",", ".", $area);
}
public function getFloor() {
return $this->floor;
}
public function setFloor($floor) {
$this->floor = $floor;
}
public function getLift() {
return $this->lift;
}
public function setLift($lift) {
$this->lift = $lift;
}
public function getCellar() {
return str_replace('.0', '', $this->cellar);
}
public function setCellar($cellar) {
$this->cellar = str_replace(",", ".",$cellar);
}
public function getBalcony() {
return str_replace('.0', '', $this->balcony);
}
public function setBalcony($balcony) {
$this->balcony = str_replace(",", ".",$balcony);
}
public function getLocation_id() {
return $this->location_id;
}
public function setLocation_id($location_id) {
$this->location_id = $location_id;
}
public function getPrice() {
return round($this->price);
}
public function setPrice($price) {
$this->price = $price;
}
public function getCreated_on() {
return $this->created_on;
}
public function setCreated_on($created_on) {
$this->created_on = $created_on;
}
public function getLocation() {
$location = new Application_Model_PropertyLocationMapper();
return $location->fetchAll('id = ' . $this->getLocation_id());
}
public function getDisposition() {
$disposition = new Application_Model_DispositionMapper();
foreach ($disposition->fetchAll('id = ' . $this->getDisposition_id()) as $disposition_type) {
return $disposition_type->getText_en();
}
}
public function getTextLocation() {
foreach ($this->getLocation() as $location) {
return $location;
}
}
public function getStreet() {
return $this->street;
}
public function setStreet($street) {
$this->street = $street;
}
public function getFormattedPrice() {
return number_format($this->getPrice(), 0, ".", " ");
}
public function getProperty_build_id() {
return $this->property_build_id;
}
public function setProperty_build_id($property_build_id) {
$this->property_build_id = $property_build_id;
}
public function getProperty_build_type() {
$m = new Application_Model_PropertyBuildTypeMapper();
$res = $m->fetch($this->property_build_id);
return $res;
}
public function getTerace() {
return str_replace('.0', '', $this->terace);
}
public function setTerace($terace) {
$this->terace = str_replace(",", ".",$terace);
}
public function getLoggia() {
return str_replace('.0', '', $this->loggia);
}
public function setLoggia($loggia) {
$this->loggia = str_replace(",", ".",$loggia);
}
public function getGarden() {
return str_replace('.0', '', $this->garden);
}
public function setGarden($garden) {
$this->garden = str_replace(",", ".",$garden);
}
public function getGarage() {
return str_replace('.0', '', $this->garage);
}
public function setGarage($garage) {
$this->garage = str_replace(",", ".",$garage);
}
public function getParking_place() {
return $this->parking_place;
}
public function setParking_place($parking_place) {
$this->parking_place = $parking_place;
}
}
|