<?php

namespace TourOperatorProAdmin\app\views\block;

use TourOperatorPro\Factory;
use TourOperatorPro\Mvc\Model\Model;
use TourOperatorPro\Mvc\View\View;

class BlockView extends View
{
    public function display($tpl)
    {

        $input = Factory::getInput();
        $modelBlock = Model::getInstance('block');
        switch ($tpl) {
            case "preview":
                $input = Factory::getInput();

                $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);
    }

}