function toJEAData() { $data = array('ref' => $this->ref, 'title' => $this->title, 'type_id' => JEAPropertyInterface::getFeatureId('types', $this->type, $this->language), 'price' => floatval($this->price), 'address' => $this->address, 'department_id' => JEAPropertyInterface::getFeatureId('departments', $this->department), 'zip_code' => $this->zip_code, 'condition_id' => JEAPropertyInterface::getFeatureId('conditions', $this->condition, $this->language), 'living_space' => floatval($this->living_space), 'land_space' => floatval($this->land_space), 'rooms' => intval($this->rooms), 'bedrooms' => intval($this->bedrooms), 'charges' => floatval($this->charges), 'fees' => floatval($this->fees), 'deposit' => floatval($this->deposit), 'hot_water_type' => JEAPropertyInterface::getFeatureId('hotwatertypes', $this->hot_water_type, $this->language), 'heating_type' => JEAPropertyInterface::getFeatureId('heatingtypes', $this->heating_type, $this->language), 'bathrooms' => intval($this->bathrooms), 'toilets' => intval($this->toilets), 'availability' => $this->_convertTimestampToMysqlDate($this->availability, false), 'floor' => intval($this->floor), 'floors_number' => (int) $this->floors_number, 'orientation' => $this->orientation, 'description' => $this->description, 'published' => 1, 'created' => $this->_convertTimestampToMysqlDate($this->created), 'modified' => $this->_convertTimestampToMysqlDate($this->modified), 'created_by' => JEAPropertyInterface::getUserId($this->author_email, $this->author_name), 'latitude' => floatval($this->latitude), 'longitude' => floatval($this->longitude), 'language' => $this->language); $this->transaction_type = strtoupper($this->transaction_type); if ($this->transaction_type == 'RENTING' || $this->transaction_type == 'SELLING') { $data['transaction_type'] = $this->transaction_type; } else { $data['transaction_type'] = '0'; } $data['town_id'] = JEAPropertyInterface::getFeatureId('towns', $this->town, null, $data['department_id']); $data['area_id'] = JEAPropertyInterface::getFeatureId('areas', $this->area, null, $data['town_id']); $orientations = array('0', 'N', 'NE', 'NW', 'NS', 'E', 'EW', 'W', 'SW', 'SE'); $orientation = strtoupper($this->orientation); if (in_array($orientation, $orientations)) { $data['orientation'] = $orientation; } else { $data['orientation'] = 'O'; } if (is_array($this->amenities)) { $data['amenities'] = array(); foreach ($this->amenities as $value) { $data['amenities'][] = JEAPropertyInterface::getFeatureId('amenities', $value, $this->language); } } $validExtensions = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG'); $data['images'] = array(); foreach ($this->images as $image) { $image = basename($image); if (!empty($image)) { if (in_array(JFile::getExt($image), $validExtensions)) { $img = new stdClass(); $img->name = $image; $img->title = ''; $img->description = ''; $data['images'][] = $img; } } } return $data; }