Пример #1
0
    function data()
    {
        $domain = $this->f3->get("domain");
        $result = array();
        $catID = isset($_GET['catID']) ? $_GET['catID'] : "";
        $catWhewre = "AND catID ='{$catID}'";
        $items = models\items::format(models\items::getInstance()->getAll("gps_long!='' AND gps_lat!='' {$catWhewre}"));
        $item_json = array();
        foreach ($items as $item) {
            $photo = "";
            if ($item['photo']) {
                $photo = "<img alt='' src='/thumbnail/110/90?crop=false&file=/files/{$item['photo']}' class='img-thumbnail' />";
            }
            $str = "";
            if ($item['phone']) {
                $str = $str . "<em class='dg'>Phone:</em> " . $item['phone'] . "<br>";
            }
            if ($item['website']) {
                $str = $str . "<em class='dg'>Website:</em> " . $item['website'] . "<br>";
            }
            $item_json[] = array("ID" => $item['ID'], "placeTitle" => $item['name'], "tooltip" => '<div class="scrollFix"><strong>' . $item["name"] . '</strong><br><div>
<div class="c" style="margin:10px;">' . $photo . '</div><div>' . $str . '</div></div>', "url" => "/item/{$item['ID']}/{$item['url']}", "lat" => $item['gps_lat'], "lng" => $item['gps_long']);
        }
        return $GLOBALS["output"]['data'] = $item_json;
    }
Пример #2
0
 function page()
 {
     $user = $this->f3->get("user");
     $catID = $this->f3->get("PARAMS['catID']");
     $category = models\categories::getInstance()->get($catID);
     $categories = $this->f3->get("categories");
     $c = array();
     foreach ($categories as $item) {
         $c["ID-" . $item['ID']] = $item;
     }
     $this->catparents($category, $c);
     $this->breadcrumb = array_reverse($this->breadcrumb);
     $parentIDs = array();
     foreach ($this->breadcrumb as $item) {
         $parentIDs[] = $item['ID'];
     }
     $category['parentIDs'] = $parentIDs;
     //	test_array($c);
     $items = array("suggested" => models\items::format(models\items::getInstance()->getAll("catID='{$category['ID']}' AND recommended='1'", "name ASC")), "other" => models\items::format(models\items::getInstance()->getAll("catID='{$category['ID']}' AND recommended='0'", "name ASC")));
     $relationships = array();
     if ($category['relationship']) {
         $relationships = models\categories::getInstance()->getAll("dir_categories.ID in ({$category['relationship']}) OR parentID='{$category['ID']}'");
     }
     //	test_array($relationships);
     //	test_array($category);
     //	test_array(array("breadcrumbs"=>$this->breadcrumb,"categories"=>$c));
     $tmpl = new \template("template.twig");
     $tmpl->page = array("section" => "categories", "sub_section" => $category['ID'], "template" => "list_category", "meta" => array("title" => "Directory | {$category['category']}"), "css" => "", "js" => "");
     $tmpl->breadcrumb = $this->breadcrumb;
     $tmpl->category = $category;
     $tmpl->related = $relationships;
     $tmpl->items = $items;
     $tmpl->output();
 }
Пример #3
0
 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;
 }
Пример #4
0
    function page()
    {
        $user = $this->f3->get("user");
        //$categories = $this->f3->get("categories");
        //$categories = models\categories::format($categories,true);
        //test_array($categories);
        $items = models\items::format(models\items::getInstance()->getAll("gps_long!='' AND gps_lat!=''"));
        $item_json = array();
        foreach ($items as $item) {
            $photo = "";
            if ($item['photo']) {
                $photo = "<img alt='' src='/thumbnail/110/90?crop=false&file=/files/{$item['photo']}' class='img-thumbnail' />";
            }
            $str = "";
            if ($item['phone']) {
                $str = $str . "<em class='dg'>Phone:</em> " . $item['phone'] . "<br>";
            }
            if ($item['website']) {
                $str = $str . "<em class='dg'>Website:</em> " . $item['website'] . "<br>";
            }
            $item_json[] = array("ID" => $item['ID'], "placeTitle" => $item['name'], "tooltip" => '<div class="scrollFix"><strong>' . $item["name"] . '</strong><br><div>
<div class="c" style="margin:10px;">' . $photo . '</div><div>' . $str . '</div></div>', "url" => "/item/{$item['ID']}/{$item['url']}", "lat" => $item['gps_lat'], "lng" => $item['gps_long']);
        }
        //	test_array($item_json);
        $tmpl = new \template("template.twig");
        $tmpl->page = array("section" => "map", "sub_section" => "map", "template" => "map", "meta" => array("title" => "Directory | Map"), "css" => "", "js" => "http://maps.google.com/maps/api/js");
        $tmpl->item_json = json_encode($item_json);
        $tmpl->output();
    }
Пример #5
0
 function page()
 {
     $user = $this->f3->get("user");
     $tmpl = new \template("template.twig");
     $tmpl->page = array("section" => "items", "sub_section" => "items", "template" => "_items", "meta" => array("title" => "Directory | Items"), "css" => "", "js" => "");
     $tmpl->items = models\items::format(models\items::getInstance()->getAll());
     $tmpl->output();
 }
Пример #6
0
 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();
 }
Пример #7
0
 function page()
 {
     $user = $this->f3->get("user");
     $recent = models\items::format(models\items::getInstance()->getAll("", 'datein DESC', '0,5'));
     $items = models\items::format(models\items::getInstance()->getAll("recommended='1' and dir_items.photo != ''"));
     $rand = array_rand($items, 10);
     $n = array();
     foreach ($rand as $i) {
         $n[] = $items[$i];
     }
     $suggested = $n;
     //test_array(($n));
     //test_array($suggested);
     $tmpl = new \template("template.twig");
     $tmpl->page = array("section" => "home", "sub_section" => "home", "template" => "home", "meta" => array("title" => "Directory | Home"), "css" => "", "js" => "");
     $tmpl->suggested = $suggested;
     $tmpl->recent = $recent;
     $tmpl->output();
 }
Пример #8
0
 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();
 }
Пример #9
0
 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();
 }
Пример #10
0
 function _delete()
 {
     $ID = isset($_GET['ID']) && $_GET['ID'] ? $_GET['ID'] : "";
     return $GLOBALS["output"]['data'] = models\items::remove($ID);
 }