function catparents($current, $categoryList) { $this->breadcrumb[] = models\categories::format($current); if ($current['parentID']) { $this->catparents($categoryList["ID-" . $current['parentID']], $categoryList); } }
function data() { $domain = $this->f3->get("domain"); $result = array(); $ID = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : ""; $catID = isset($_REQUEST['catID']) ? $_REQUEST['catID'] : ""; $details = new models\items(); $details = $details->get($ID); $details['categories'] = ""; $result['details'] = $details; $where = ""; if ($catID) { $where = "catID = '{$catID}'"; } $cats = models\categories::getInstance()->getAll("itemID='{$details['ID']}'"); if (count($cats)) { $n = array(); foreach ($cats as $item) { $n[] = $item["ID"]; } $result['details']['categories'] = implode(",", $n); } //test_array($cats); $records = models\items::getInstance()->getAll($where, "name ASC"); $result['records'] = models\items::format($records, true); return $GLOBALS["output"]['data'] = $result; }
function page() { $user = $this->f3->get("user"); $categories = models\categories::getInstance()->getAll("", "category ASC"); $tmpl = new \template("template.twig", "app/admin/"); $tmpl->page = array("section" => "categories", "sub_section" => "categories", "template" => "categories", "meta" => array("title" => "Directory | Admin | Categories"), "css" => "", "js" => ""); $tmpl->categories = $categories; $tmpl->output(); }
function data() { $domain = $this->f3->get("domain"); $result = array(); $ID = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : ""; $details = new models\categories(); $details = $details->get($ID); $result['details'] = $details; $where = ""; $records = models\categories::getInstance()->getAll($where, "category ASC"); $result['records'] = models\categories::format($records, true); return $GLOBALS["output"]['data'] = $result; }
function page() { $user = $this->f3->get("user"); $ID = $this->f3->get("PARAMS['ID']"); $highlight = isset($_REQUEST['highlight']) ? $_REQUEST['highlight'] : false; $details = models\items::getInstance()->get($ID); $details = models\items::format($details, $highlight); $categories = models\categories::format(models\categories::getInstance()->getAll("dir_items.ID='{$details['ID']}'", "category ASC"), false, $highlight); $title = $details['name']; // test_array($category); // test_array(array("breadcrumbs"=>$this->breadcrumb,"categories"=>$c)); $tmpl = new \template("template.twig"); $tmpl->page = array("section" => "details", "sub_section" => "item-" . $details['ID'], "template" => "item_details", "meta" => array("title" => "Directory | {$this->f3->scrub($title)}"), "css" => "", "js" => "http://maps.google.com/maps/api/js"); $tmpl->details = $details; $tmpl->categories = $categories; $tmpl->output(); }
function page() { $user = $this->f3->get("user"); $letter = $this->f3->get("PARAMS['letter']"); //$category = models\categories::getInstance()->get($catID); $where = "name LIKE '{$letter}%'"; $where_cat = "category LIKE '{$letter}%'"; if ($letter == "other") { $where = 'ucase(mid(name, 1, 1)) not between "A" and "Z"'; $where_cat = 'ucase(mid(category, 1, 1)) not between "A" and "Z"'; } $items = array("suggested" => models\items::format(models\items::getInstance()->getAll("{$where} AND recommended='1'", "name ASC")), "other" => models\items::format(models\items::getInstance()->getAll("{$where} AND recommended='0'", "name ASC"))); $categories = models\categories::format(models\categories::getInstance()->getAll("{$where_cat}", "category ASC")); //test_array($items); $tmpl = new \template("template.twig"); $tmpl->page = array("section" => "alphabet", "sub_section" => "{$letter}", "template" => "list_alphabet", "meta" => array("title" => "Directory | starts with '{$letter}'"), "css" => "", "js" => ""); $tmpl->items = $items; $tmpl->categories = $categories; $tmpl->letter = $letter; $tmpl->output(); }
function page() { $user = $this->f3->get("user"); $search = isset($_REQUEST['search-box']) ? $_REQUEST['search-box'] : ""; $columns = $this->f3->get("DB")->exec("EXPLAIN dir_items;"); $str = array(); foreach ($columns as $item) { $str[] = "dir_items.{$item['Field']} LIKE '%{$search}%'"; } $str = implode(" OR ", $str); //test_array(array($str,$columns)); $where = "({$str}) "; $where_cat = "(dir_categories.category LIKE '%{$search}%' OR dir_categories.text LIKE '%{$search}%') "; $items = array("suggested" => models\items::format(models\items::getInstance()->getAll("{$where} AND recommended='1'", "name ASC"), $search), "other" => models\items::format(models\items::getInstance()->getAll("{$where} AND recommended='0'", "name ASC"), $search)); $categories = models\categories::format(models\categories::getInstance()->getAll("{$where_cat}", "category ASC"), false, $search); //test_array($search); $tmpl = new \template("template.twig"); $tmpl->page = array("section" => "search", "sub_section" => "search", "template" => "search", "meta" => array("title" => "Directory | Search '{$search}'"), "css" => "", "js" => ""); $tmpl->items = $items; $tmpl->categories = $categories; $tmpl->search = $search; $tmpl->output(); }
function _delete() { $ID = isset($_GET['ID']) && $_GET['ID'] ? $_GET['ID'] : ""; return $GLOBALS["output"]['data'] = models\categories::remove($ID); }