tp = new $plugin($page); } parent::__construct($page); if (is_file(dirname(dirname(__FILE__)).'/views/library/'.$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() { if (isset($this->tp->test) && is_object($this->tp->test) && $this->tp->test->getId()) { if ($this->tp->test->getType()!="Folder") { $actions = $this->tp->test->getActions(); $this->genNavTree($this->tp->test->getNavigationTree()); foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"library/".$this->page[0]."/".$this->page[1]."/".$action, 'current'=>false); } } else if (isset($this->tp->test) && !$this->tp->test->getId() && $this->tp->test->getType()!="TestFolder") { $tf_id = $this->tp->test->getFolder(); $tf = $this->tp->loadType("TestFolder", $tf_id); $actions = $tf->getActions(); $this->genNavTree($tf->getNavigationTree()); foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"library/TestFolder/".$this->page[2]."/".$action, 'current'=>false); } } else { $actions = array("Folder/".$this->tp->test->getId()."/view"=>_("View"), "Folder/".$this->tp->test->getId()."/edit"=>_("Edit"), "TestFolder/Folder/".$this->tp->test->getId()."/add"=>_("New test folder"), "Folder/".$this->tp->test->getId()."/import"=>_("Import test folder")); $this->genNavTree($this->tp->test->getNavigationTree()); foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"library/".$action, 'current'=>false); } } } else { if (is_manager()) { $actions = array("view"=>_("View"), "Folder/add"=>_("New folder"),"TestFolder/add"=>_("New test folder"), "import"=>_("Import test folder")); } else { $actions = array("view"=>_("View")); } foreach ($actions as $action => $title) { $this->navigation []= array('title'=>$title, 'url'=>"library/".$action, 'current'=>false); } } } } ?>