<?php
namespace WpBookingHotelFrontend\app\views\block;
use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Mvc\View\View;
class BlockView extends View
{
    public function display($tpl){

        $input = Factory::getInput();
        $modelBlock = Model::getInstance('block');


        switch ($tpl) {
            case "preview":
                
                $id = $input->getInt('id', 0);
                $this->item = $modelBlock->getItem($id);
                break;
            case "config":
                $id = $input->getInt('id', 0);
                $this->item = $modelBlock->getItem($id);
                $this->form = $modelBlock->getFormBlockConfig($this->item->id);

            case "list":
                $modelBlocks = Model::getInstance('blocks');
                $this->items = $modelBlocks->getList();


                break;
        }
        return parent::display($tpl);
    }

}