/**
  * @param \Nette\Application\UI\ITemplate $template
  */
 protected function prepareTemplate(ITemplate $template)
 {
     parent::prepareTemplate($template);
     $this->registerHelper($template);
     $template->menu = $this->tree->getTree();
     $template->currentPosition = $this->getCurrentPositionMap();
 }
 /**
  * Vytvori pole prvku option ze stromu
  * @param Tree $tree
  * @return array
  */
 public function createOptions(Tree $tree)
 {
     $items = [];
     $arrayTree = $tree->getTree();
     $this->fill($items, $arrayTree);
     return $items;
 }
 /**
  * @param int $id
  * @return array
  * @throws \Nette\InvalidStateException
  */
 public function findBranch($id)
 {
     $item = $this->findCurrent($id);
     if ($item['parentId']) {
         return $this->findCurrent($item['parentId'])['children'];
     } else {
         return $this->tree->getTree();
     }
 }
 /**
  * @param Tree $tree
  * @return array
  */
 public function convert(Tree $tree)
 {
     $items = [];
     $this->fillItems($items, $tree->getTree(), 0);
     return $items;
 }