コード例 #1
0
 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();
                     }
                 }
             }
         }
     }
 }