<?php

/*
 * PuzzleApp
 * Webemyos
 * Jérôme Oliva
 * GNU Licence
 */

namespace Apps\Immo\Module\Front;

use Core\Control\Button\Button;
use Core\Controller\Controller;
use Core\View\View;
use Core\View\ElementView;

use Apps\Immo\Entity\ImmoCity;
use Apps\Immo\Widget\ImmoEstimateForm\ImmoEstimateForm;

/*
 * 
 */

class FrontController extends Controller {

    
    function EstimationCity($params){
       $view = new View(__DIR__ . "/View/estimate.tpl", $this->Core);
    
       $city = new ImmoCity($this->Core);
       $city = $city->GetByCode($params);
       
       if($city){         
           
         $this->Core->MasterView->Set("Title", $city->TitleEstimation->Value);
         $this->Core->MasterView->Set("Description", $city->MetaEstimationDescription->Value);
  
         $view->AddElement(new ElementView("city", $city));
 
        $estimateForm = new ImmoEstimateForm($this->Core);
        $view->AddElement(new ElementView("estimateForm", $estimateForm->Render()));
 
         
        return $view->Render();
       } else{
           
           //RETOU PAGE D4ACUCUIE
           
       }
    }
    
    
    function ImmobilierCity($params){
       $view = new View(__DIR__ . "/View/search.tpl", $this->Core);
    
       $city = new ImmoCity($this->Core);
       $city = $city->GetByCode($params);
       
       if($city){         
           
         $this->Core->MasterView->Set("Title", $city->TitleImmobilier->Value);
         $this->Core->MasterView->Set("Description", $city->MetaImmobilierDescription->Value);
           
         $view->AddElement(new ElementView("city", $city));
           
         
         return $view->Render();
       } else{
           
           //RETOU PAGE D4ACUCUIE
           
       }
    }
    
}