tp = new $plugin($page); } parent::__construct($page); if (is_file(dirname(dirname(__FILE__)).'/views/tests/'.$this->name."_".$page[0].'.html')) { $this->setTemplate($this->name."_".$page[0]); } } function genNavTree($tree_items) { foreach ($tree_items as $item) { $this->navigation_main []= $item; } } public function setNavigation() { $current_context = "view"; if (isset($this->tp->test) && $this->tp->test->getId()) { if (isset($this->page[2])) { $current_context = $this->page[2]; } $actions = $this->tp->test->getActions(); $this->genNavTree($this->tp->test->getNavigationTree("tests")); foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"tests/".$this->page[0]."/".$this->page[1]."/".$action, 'current'=>$this->is_current_page($current_context, $action)); } } else { if (isset($this->page[0]) && isset($this->page[1])) { $current_context = $this->page[0] . '/' . $this->page[1]; } if (is_manager()) { $actions = array("view"=>_("View"), "Test/add"=>_("New test")); } else { $actions = array("view"=>_("View")); } foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"tests/".$action, 'current'=>$this->is_current_page($current_context, $action)); } } } } ?>