/** */ function parse($name, $replace = [], $params = []) { if (!class_exists('Blitz')) { return $params['string']; } if ($params['string']) { $view = new Blitz(); $view->load($params['string']); return $view->parse($replace); } // TODO: test me and connect YF template loader }
$total_pages = ceil($total_results / RPP); if ($total_pages > 1) { $pagination = array_fill(1, $total_pages, array('selected' => false, 'category' => urlencode($category), 'days' => urlencode($days), 'minsize' => urlencode($minsize))); $pagination[$page]['selected'] = true; $tpl_values['pagination'] = true; $tpl_values['pagination_viewlast'] = $pagination; if ($page > 1) { if ($page == 2) { $tpl_values['prevlink'] = '?cat=' . urlencode($category) . '&d=' . $days . '&minsize=' . urlencode($minsize); } else { $tpl_values['prevlink'] = '?p=' . ($page - 1) . '&cat=' . urlencode($category) . '&d=' . $days . '&minsize=' . urlencode($minsize); } } if ($page < $total_pages) { $tpl_values['nextlink'] = '?p=' . ($page + 1) . '&cat=' . urlencode($category) . '&d=' . $days . '&minsize=' . urlencode($minsize); } } if (!count($results)) { $tpl_values['nofound'] = true; } $tpl_values['results'] = $results; $tpl_values['time'] = $time; $tpl_values['powered_mysql'] = true; $tpl_values['latest_form'] = true; } else { $tpl_values['normal_form'] = true; $tpl_values['viewlast_categories'] = Searcher::getCategories(); } $T->set($tpl_values); echo $T->parse();
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(); }