<?php

class Menu extends Frame
{
    public function getTemplate()
    {
        if (!($template = $this->template)) {
            $template = './menu/'.getVal('type').'.tpl';
        }

        if ($this->smarty->templateExists($template)) {
            return $template;
        }

        return './menu.tpl';
    }

    public function get_vars()
    {
        $vars = parent::get_vars();

        return array_merge($vars, [
            'dateToday' => date('Y-m-d'),
            'dateFrom' => date('Y-m-d', time() - (14 * 86400)),
            'type' => getVal('type'),
        ]);
    }
}
