public function fetch($data) { $dirs = $this->get_dirs(isset($data['dir']) ? $data['dir'] : 0); $classes = array(); $T = new Blitz($this->template_dir . "tree/tree_relations.html"); $T->setGlobal(array("current_node" => $data['node_id'])); if (isset($data['message'])) { $T->setGlobal(array("glob_message" => $data['message'])); } if (isset($data['dir'])) { $T->setGlobal(array("current_dir" => $data['dir'])); $classes = $this->get_classes($data['dir']); } else { $T->setGlobal(array("dir_not_selected" => true)); } $current_relations = $this->get_relations($data['node_id']); $T->block("dirs", $dirs); $T->block("classes", $classes); $T->block("current_relations", $current_relations); echo $T->parse(); }
public function show_main($data = false) { $current_node = array(); if ($data['tree_id']) { $current_node = $this->get_node($data['tree_id']); $current_node['parents'] = $this->get_parents($current_node['tree_parent'], $current_node['tree_id']); $current_node['groups'] = $this->get_groups($current_node['tree_group']); } else { $current_node['parents'] = $this->get_parents(); $current_node['groups'] = $this->get_groups(); } $current_tree = $this->get_tree(isset($current_node['tree_id']) ? $current_node['tree_id'] : 0, isset($current_node['tree_parent']) ? $current_node['tree_parent'] : 0); $T = new Blitz($_SERVER['DOCUMENT_ROOT'] . "/templates/admin/tree/index.html"); if (count($current_tree) == 0) { $T->block("current_tree", array("tree_message" => "Tree is empty.")); } else { #$T->setGlobal(array("current_node"=>$data['tree_id'],"current_parent"=>$data['tree_parent'])); $T->block("current_tree", array("tree_nodes" => $current_tree)); } $T->block("current_node", $current_node); if ($current_node['parents'] == false) { $T->block("current_node/parents_message"); } echo $T->parse(); }