<?php
namespace WpBookingHotelFrontend\app\views\hotels;
use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Mvc\View\View;

class HotelsView extends View
{
    public function display($tpl){
        $modelHotel = Model::getInstance('hotel');
        $modelHotels = Model::getInstance('hotels');
        $modelCurrencies = Model::getInstance('currencies');
        $modelRoomtypes = Model::getInstance('roomtype');
        $this->form = $modelHotels->getFilterFormHotel();
        $this->formfield = $modelHotel->getForm();
        $this->list = $modelHotels->getList();
        $appConfig = Factory::getAppConfig();
        $symbol = $appConfig->get('currencies_in_list', '');
        $currencyModel = Model::getInstance('currency');
        if (isset($_SESSION["currency"])){
            $currency = $_SESSION["currency"];
            $this->symbol = $currencyModel->format_currency($currency);
        }else{
            $this->symbol = $currencyModel->format_currency($symbol);
        }
        $this->listCurrencies = $modelCurrencies->getList();
        $this->list_roomtype = $modelRoomtypes->getList();
        $this->total_item = $modelHotels->getTotalRecord();
        return parent::display($tpl);
    }
}