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 -->