<?php

namespace TourOperatorProAdmin\app\views\sms;

use TourOperatorPro\Html\ToolBar;
use TourOperatorPro\Mvc\Model\Model;
use TourOperatorPro\Mvc\View\View;
use TourOperatorPro\Factory as FactoryAlias;

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

        $modelsms = Model::getInstance("sms");
        $input = FactoryAlias::getInput();
        switch ($tpl) {
            case "list":
                ToolBar::add("sms.add");
                ToolBar::delete("sms.delete_list");
                ToolBar::_clone("sms.clone_list");
                $model = Model::getInstance("sms");
                $this->list = $model->getList();
                break;
            case "form":
                ToolBar::setTitle('Edit sms');
                ToolBar::apply("sms.apply");
                ToolBar::save("sms.save_v1");
                ToolBar::cancel("sms.cancel");
                ToolBar::back_to_list("sms.back_to_list");
                $id = $input->getInt('id', 0);
                $this->item = $modelsms->getItem($id);
                $this->form = $modelsms->getForm();
                break;
        }
        return parent::display($tpl);
    }
}