<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_UserView")) {
    /**
     * Class WpBookingPro_UserView
     */
    class WpBookingPro_UserView extends WooBookingView
    {
        /**
         * @var
         */
        public $item;

        /**
         * @param null $tpl
         * @return false|string
         * @throws Exception
         */
        public function display($tpl = null)
        {
            $modelCategory = $this->getModel('category');
            $input = Factory::getInput();
            switch ($tpl) {
                case "item":
                    $id = 2;
                    $this->item = $modelCategory->getItem($id);
                    $this->form = $modelCategory->getForm();
                    break;
                case "form":
                    $id = $input->getInt('id', 0);
                    $this->item = $modelCategory->getItem($id);
                    $this->form = $modelCategory->getForm();
                    break;
                case "list":
                default:
                    $modelUser = $this->getModel('user');
                    $this->filterForm = $modelUser->getFilterForm();
                    $this->list = $modelUser->getList();
                    break;
            }
            return parent::display($tpl);
        }
    }
}