function format()
 {
     $vars['menu'] = week_menu($this->week);
     for ($d = 0; $d < 7; $d++) {
         $timestamp = $this->timestamp_of_day($d);
         $vars['hfield'][$d] = array('cal_dow' => output::mask(date('D', $timestamp)), 'cal_date' => date('d.m.', $timestamp));
     }
     $vars['time'] = $this->format_time();
     $this->output = new tmpl('index.html', $vars);
 }
 function format_menuitem($url, $caption, $level, $dir = false)
 {
     $url = Path::linkto($GLOBALS['root'] . $url);
     $caption = output::mask($caption);
     $m = array('menu_spacer' => array(), 'menu_entry' => array(), 'menu_dir' => array(), 'menu_url' => $url, 'menu_caption' => array(), 'menu_caption_this' => array());
     for ($i = 0; $i < $level; $i++) {
         $m['menu_spacer'][] = array();
     }
     if ($dir) {
         $m['menu_dir'][] = array();
     } else {
         $m['menu_entry'][] = array();
     }
     $document_root = $_SERVER['DOCUMENT_ROOT'];
     if (substr($document_root, -1) == '/') {
         $document_root = substr($document_root, 0, -1);
     }
     $a = Path::absolute($url);
     $b = sessionurl($a);
     $c = $document_root . $_SERVER['REQUEST_URI'];
     if ($a == $c || $b == $c) {
         $m['menu_caption_this'][0]['menu_caption'] = $caption;
     } else {
         $m['menu_caption'][0]['menu_caption'] = $caption;
     }
     return $m;
 }