public function execute() { $this->getInput(); $view = $this->getGlobalData()->getView(); $action = $this->action; // Show the list of settlements; $view->op_type = $this->operation_type; if ($action == 'firstpage') { $view->viewmode = 'firstpage'; $list = new RealEstateAgency_Object_SettlementList(); $list->setGlobalData($this->getGlobalData()); $list->setAreaId(1); $list->loadBy(); $view->list_of_links = $list->getArray(); } else { if ($action == 'secondpage') { $this->secondPage($view); //$view->settlement_name = $this->getSettlementName(); } else { if ($action == 'submit') { $view->viewmode = 'show'; $obj = new RealEstateAgency_Object_RealEstateObject(); $obj->setGlobalData($this->getGlobalData()); $brokerID = $this->getGlobalData()->getLoginObject()->getLoggedUserID(); $obj->setBrokerID($brokerID); //tools_log_debug($this->getGlobalData(),"validate reo",tools_get_input('op_type')); $obj->readWebForm(); $obj->toWebForm($view); $validation = $obj->validate(); if (count($validation) > 0) { $view->validation = $validation; $this->secondPage($view); //$view->settlement_name = $this->getSettlementName(); } else { // Submit; $view->settlement_name = $this->getSettlementName(); $time = tools_date2database(time()); $obj->setDateOfStart($time); $obj->setDateOfUpdate($time); if (!$this->do_not_save) { $obj->insert(); } } } } } }
public function execute() { // 1 - just load and show; // 2 - after the submit, when incorrect: read from the form + loaded object, show; // 3 - after the submit, whem correct: read from the form + loaded object, submit; $this->getInput(); $action = $this->action; $objectID = $this->objectID; $globalData = $this->getGlobalData(); $view = $globalData->getView(); $view->op_type = $this->operation_type; $object = RealEstateAgency_Object_RealEstateObject::loadById($globalData, $objectID); $view->location_details = $object->getLocationDetails(); if ($action == 'showpage') { $view->viewmode = 'showpage'; $this->getCityDistricts($view, $object); $object->toWebForm($view); } else { if ($action == 'submit') { $write = $object->isEditable(); if ($write) { $object->readWebFormForUpdate(); $view->location_details = $object->getLocationDetails(); $validation = $object->validate(); if (count($validation) > 0) { // Show again; $view->validation = $validation; $view->viewmode = 'showpage'; $this->getCityDistricts($view, $object); $object->toWebForm($view); } else { // Update this object; Show result page; $time = tools_date2database(time()); $object->setDateOfUpdate($time); $object->update(); $this->uploadFile($view, $object); $view->viewmode = 'resultpage'; } } } } }
<?php include "header_active.php"; require_once 'RealEstateAgency/Object/RealEstateObject.php'; ?> <div class="main_section"> <?php $objectID = $this->object_id; $globalData = $this->global_data; $object = RealEstateAgency_Object_RealEstateObject::loadById($globalData, $objectID); if ($object != NULL) { if ($object->isEditable()) { RealEstateAgency_Object_RealEstateObject::deleteById($globalData, $objectID); $dir = RealEstateAgency_Const::UPLOAD_IMAGES_DIR; $data = $object->getImagesList(); if ($data != NULL) { foreach ($data as $index => $name) { $filename = $dir . $name; unlink($filename); } } echo '<p style="color:green;">Даний об\'єкт нерухомості було видалено зі списку.</p>'; } } ?> </div> <!-- main_section : end -->
/** * Returns the list of names of images or NULL; */ public function getImagesList() { // clearstatcache(); $object_id = $this->getObjectID(); $result = RealEstateAgency_Object_RealEstateObject::getImagesListStatic($object_id); return $result; }
private function completeFillByArray($array) { $result = array(); $globalData = $this->getGlobalData(); //$objectsOfDistrict = $this->districts; foreach ($array as $index => $hash) { $object = new RealEstateAgency_Object_RealEstateObject(); $object->setGlobalData($globalData); $object->completeFillByArray($hash); $result[] = $object; } return $result; }
<?php include "header_active.php"; require_once 'RealEstateAgency/Object/RealEstateObject.php'; ?> <div class="main_section"> <?php $object_id = $this->object_id; $data = RealEstateAgency_Object_RealEstateObject::getImagesListStatic($object_id); $started = false; if ($data != NULL) { foreach ($data as $index => $filename) { $filename = basename($filename); $url = tools_image_url($filename); if (!$started) { echo '<hr>'; } $started = true; echo '<p align="center">'; echo '<img src="'; echo $url; echo '" />'; echo '</p>'; echo '<hr>'; } } ?> </div> <!-- main_section : end -->