function view() { if (!self::$menu) { self::loadSiteMenu(); } $menu_name = params::get('menu'); if (!isset(self::$menu[$menu_name])) { return false; } $menu_id = self::$menu_id[$menu_name]; /* Menu conf */ if (!self::$menu_conf) { self::$menu_conf = conf::parse('menus'); } $menu = self::$menu[$menu_name][0]; if (self::$menu_conf) { /* Menu pages */ $menu_conf_pages_in = conf::get('menus', 'in', $menu_id); $menu_conf_pages_out = conf::get('menus', 'out', $menu_id); if (!conf::testPages($menu_conf_pages_out)) { if (in_array(PAGE_ID, $menu_conf_pages_out)) { return true; } } else { if (!conf::testPages($menu_conf_pages_in)) { if (!in_array(PAGE_ID, $menu_conf_pages_in)) { return true; } } } /* Menu events */ if (conf::get('menus', 'events', $menu_id)) { foreach (conf::get('menus', 'events', $menu_id) as $v) { $arr = explode('::', trim($v)); if (events::targetDetect($arr[0], $arr[1], $arr[2])) { /* :TODO: добавить передачу в params события, его названия и его значения */ if ($arr[3] == 'replace') { $menu_id = $arr[4]; $menu_name = self::$menu_by_id[$menu_id]; $menu = self::$menu[$menu_name][0]; } else { if ($arr[3] == 'hide') { return true; } } } } } } // $points_conf = conf::parse('points'); $points = ''; $i = 0; foreach ($menu as $k => $v) { $i++; /* Points conf $conf_index = $menu_id.'.'.$v['point_id']; if ($points_conf) { $points_conf_pages = conf::get('points', 'pages', $conf_index); if ($points_conf_pages && $points_conf_pages[0] != 0) { if (!in_array(PAGE_ID, $points_conf_pages)) continue; } } */ $v = self::getPointLink($v, $menu_name); $v['index'] = $i; /* Check parents */ if (strstr($v['menu_tmpl_link'], '{POINTS}')) { if (isset(self::$menu[$menu_name][$v['point_id']])) { $parent_points = ''; foreach (self::$menu[$menu_name][$v['point_id']] as $d => $f) { $f = self::getPointLink($f, $menu_name); $parent_points .= s::parseVars($f['menu_tmpl_link'], $f); } $v['menu_tmpl_link'] = str_replace('{POINTS}', $parent_points, $v['menu_tmpl_link']); } } $points .= s::parseVars($v['menu_tmpl_link'], $v); $menu_tmpl = $v['menu_tmpl']; } buffer::set(str_replace('{POINTS}', $points, $menu_tmpl)); }