当前位置: 首页>>代码示例>>PHP>>正文


PHP Tree::getPathToTree方法代码示例

本文整理汇总了PHP中Tree::getPathToTree方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getPathToTree方法的具体用法?PHP Tree::getPathToTree怎么用?PHP Tree::getPathToTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree::getPathToTree方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getList

 public function getList($parent)
 {
     $data = array();
     if ($limit != '') {
         $limit = 'LIMIT ' . $limit;
     }
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $parent . ' AND visible=1 ORDER BY name ';
     $list = DB::getPagi($sql);
     $i = 0;
     foreach ($list as $item) {
         $field = Fields::getFieldsByTree($item['id'], 'gal');
         $path = Tree::getPathToTree($item['id']);
         $data['list'][] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path, 'udate' => date('d.m.Y', strtotime($item['udate'])), 'fields' => $field, 'pic' => $field['files_gal1']['image'][0]['path']);
         if (preg_match("/^[0-9]+\$/", substr($item['name'], 0, 1))) {
             $data['list2']['0-9'][] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path);
         }
         if (preg_match("/^[a-zA-Z]+\$/", substr($item['name'], 0, 1))) {
             $data['list2'][strtoupper(substr($item['name'], 0, 1))][] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path);
         }
         if (preg_match("/^[а-яА-Я]+\$/", substr($item['name'], 0, 1))) {
             $data['list2']['А-Я'][] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path);
         }
     }
     return $data;
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:25,代码来源:VendorsModel.php

示例2: atb

 function atb()
 {
     $model = Catalog::getOne($_GET['id']);
     $model['parentpath'] = Tree::getPathToTree($model['parent']);
     $temp = Basket::getSimpleOrder();
     $model['sum'] = $temp['sum'];
     $model['goods'] = $temp['goods'];
     View::$layout = 'popup';
     View::render('popup/addtobasket', $model);
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:10,代码来源:PopupController.php

示例3: getList

 public function getList($parent, $order = 'num', $limit = '')
 {
     $data = array();
     if ($limit != '') {
         $limit = 'LIMIT ' . $limit;
     }
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $parent . ' ORDER BY ' . $order . ' ' . $limit;
     $list = DB::getPagi($sql);
     foreach ($list as $item) {
         $field = Fields::getFieldsByTree($item['id'], 'gal');
         $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => Tree::getPathToTree($item['id']), 'udate' => date('d.m.Y', strtotime($item['udate'])), 'fields' => $field, 'pic' => $field['files_gal1']['image'][0]['path']);
     }
     return $data;
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:14,代码来源:SpageModel.php

示例4: run

 function run($id = '')
 {
     $fullURI = Funcs::$uri;
     if ($id) {
         $fullURI = explode('/', Tree::getPathToTree($id));
         unset($fullURI[0]);
         unset($fullURI[count($fullURI)]);
     }
     $data = array();
     $parent = Funcs::$siteDB;
     $path = '';
     foreach ($fullURI as $uri) {
         $path = $path . '/' . $uri;
         if (is_numeric($uri)) {
             $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $parent . ' AND id=' . $uri . '';
         } else {
             $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $parent . ' AND path=\'' . $uri . '\'';
         }
         $row = DB::getRow($sql);
         $row['path'] = $path . '/';
         $parent = $row['id'];
         if ($parent == '') {
             $parent = 0;
         }
         $data[] = $row;
     }
     if ($fullURI[0] == 'catalog' && is_numeric($fullURI[count(Funcs::$uri) - 1])) {
         $uri = explode('/', $_SERVER['REQUEST_URI']);
         $num = count($data);
         $data[count($data)] = $data[count($data) - 1];
         $path = $data;
         unset($path[count($path) - 1]);
         unset($path[count($path) - 1]);
         $items = array();
         foreach ($path as $item) {
             $items[] = $item['path'];
         }
         Funcs::$reference['vendor'][$uri[$num]]['path'] = $items[count($items) - 1] . Funcs::$reference['vendor'][$uri[$num]]['path'] . '/';
         $data[count($data) - 2] = Funcs::$reference['vendor'][$uri[$num]];
     } elseif (isset($_GET['ve'])) {
         $path = $items[count($items)] . Funcs::$reference['vendor'][$uri[$num]]['path'] . '/';
         $data[] = array('name' => Funcs::$referenceId['vendor'][$_GET['ve']]['name'], 'path' => $path);
     }
     View::widget('crumbs', array('list' => $data));
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:45,代码来源:CrumbsWidget.php

示例5: getList

 function getList()
 {
     $data = array();
     $xml = Sitemap::getSitemapXML();
     //$site=Control::getSite(Funcs::$siteDB);
     $sql = 'SELECT * FROM {{tree}} WHERE visible=1 ORDER BY mdate DESC, cdate DESC';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $info = Tree::getInfo($item['id']);
         if ($info['id2'] != 0 && $info['params'] != '') {
             $path = 'http://' . $_SERVER['HTTP_HOST'] . Tree::getPathToTree($item['id'], $info['params']);
         } else {
             $path = 'http://' . $_SERVER['HTTP_HOST'] . Tree::getPathToTree($item['id']);
         }
         $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path, 'mdate' => date('Y-m-d', strtotime($item['mdate'])), 'changefreq' => $xml[str_replace('/', '_', $path)]['changefreq'], 'priority' => $xml[str_replace('/', '_', $path)]['priority'], 'checked' => is_array($xml[str_replace('/', '_', $path)]) ? 'checked' : '');
     }
     return $data;
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:18,代码来源:SitemapModel.php

示例6: getResult

    public function getResult()
    {
        $data = array();
        $q = trim(strip_tags($_GET['q']));
        if ($q) {
            $sql = '
				SELECT * FROM {{search}}
				INNER JOIN {{tree}} ON  {{search}}.tree={{tree}}.id
				WHERE search LIKE \'%' . $q . '%\' AND visible=1
				ORDER BY {{search}}.cdate DESC
			';
            $list = DB::getAll($sql);
            foreach ($list as $item) {
                $fields = Fields::getFieldsByTree($item['tree'], 'gal');
                $path = Tree::getPathToTree($item['tree']);
                $data[] = array('id' => $item['tree'], 'name' => $item['name'], 'path' => $path, 'fields' => $fields, 'info' => Tree::getInfo($item['tree']));
            }
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:20,代码来源:SearchModel.php

示例7: getList

    public function getList($parent, $order = 'num', $limit = '')
    {
        $data = array();
        if ($limit != '') {
            $limit = 'LIMIT ' . $limit;
        }
        $act = '';
        if (isset($_GET['act'])) {
            $act = ' AND value_int=' . $_GET['act'] . '';
        }
        $sql = '
			SELECT DISTINCT {{tree}}.* FROM {{tree}} 
			INNER JOIN {{data}} ON {{data}}.tree={{tree}}.id
			WHERE parent=' . $parent . ' AND {{data}}.path=\'act\' ' . $act . ' 
			ORDER BY ' . $order . '	' . $limit . '
		';
        $list = DB::getPagi($sql);
        foreach ($list as $item) {
            $field = Fields::getFieldsByTree($item['id'], 'gal');
            $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => Tree::getPathToTree($item['id']), 'udate' => date('d.m.Y', strtotime($item['udate'])), 'fields' => $field, 'pic' => $field['files_gal1'][0]['path']);
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:23,代码来源:ActionsModel.php

示例8: OffersMenu

 public function OffersMenu()
 {
     $data = array();
     $sql = 'SELECT id FROM {{tree}} WHERE parent=1 AND path=\'offers\' AND visible=1 ORDER BY num';
     $parent = DB::getOne($sql);
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $parent . ' AND visible=1 AND menu=1 ORDER BY num';
     $list = DB::getAll($sql);
     foreach ($list as $i => $item) {
         $data[$i % 4][] = array('name' => $item['name'], 'path' => Tree::getPathToTree($item['id']), 'id' => $item['id']);
     }
     View::widget('menu/offers', array('list' => $data));
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:12,代码来源:MenuWidget.php

示例9: getPrev

    public static function getPrev()
    {
        $tree = Tree::getTreeByUrl();
        $parent = ' parent=' . $tree['parent'] . ' AND ';
        if ($_GET['ids']) {
            $parent = ' id IN (' . $_GET['ids'] . ') AND ';
        }
        $sql = 'SELECT count(*) FROM {{tree}} WHERE ' . $parent . ' visible=1 AND id<>' . $tree['id'] . '';
        if (DB::getOne($sql) > 0) {
            $sql = '
				SELECT id FROM {{tree}}	
				WHERE ' . $parent . ' visible=1 AND id<>' . $tree['id'] . ' AND num<=\'' . $tree['num'] . '\'
				ORDER BY num
			';
            $id = DB::getOne($sql);
            if ($id) {
                return Tree::getPathToTree($id) . ($_GET['ids'] != '' ? '?ids=' . $_GET['ids'] : '');
            } else {
                return Video::getNext();
            }
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:22,代码来源:NewsModel.php

示例10: getServices

    public static function getServices($parent)
    {
        $data = array();
        $sql = '
			SELECT * FROM {{tree}} 
			WHERE visible=1 AND parent=' . $parent . ' AND menu=1
			ORDER BY num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $item['path'] = Tree::getPathToTree($item['id']);
            $fields = Fields::getFieldsByTree($item['id'], 'gal');
            $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $item['path'], 'preview' => $fields['preview'], 'pic' => $fields['files_gal1']['image'][0]['path'], 'picname' => $fields['files_gal1']['image'][0]['name']);
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:16,代码来源:IndexModel.php

示例11: getRecurs

    public function getRecurs($parent)
    {
        $data = array('sub' => array(), 'count' => 0);
        $sql = '
			SELECT * FROM {{tree}}
			WHERE parent=' . $parent . ' AND visible=1 AND menu=0
			ORDER BY num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $items = Faq::getRecurs($item['id']);
            $path = Tree::getPathToTree($item['id']);
            $data['sub'][] = array('name' => $item['name'], 'path' => $path, 'sub' => $items['sub'], 'count' => $countAll);
        }
        $data['count'] = $countAll;
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:17,代码来源:FaqModel.php

示例12: getPrev

    public static function getPrev($id, $parent, $date)
    {
        $sql = '
			SELECT id FROM {{tree}}	
			WHERE parent=' . $parent . ' AND visible=1 AND id<>' . $id . ' AND udate<=\'' . date('Y-m-d', strtotime($date)) . '\' 
			ORDER BY udate DESC
		';
        $news = DB::getOne($sql);
        if ($news) {
            return Tree::getPathToTree($news);
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:12,代码来源:ArticlesModel.php

示例13: getType

    public static function getType($id, $parent)
    {
        if (!Funcs::$uri[3]) {
            $parent = $id;
        }
        $sql = '
			SELECT {{tree}}.* FROM {{tree}} 
			LEFT JOIN {{catalog}} ON {{tree}}.id={{catalog}}.tree
			WHERE {{tree}}.parent=' . $parent . ' AND {{catalog}}.tree IS NULL ORDER BY {{tree}}.num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $item['path'] = Tree::getPathToTree($item['id']);
            $data['list'][] = $item;
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:17,代码来源:CatalogModel.php

示例14: __construct

 function __construct()
 {
     if ($_POST) {
         DB::escapePost();
         if (isset($_POST['report'])) {
             $tree = Tree::getTreeByUrl();
             $href = Catalog::getPathToTree($tree['id']);
             Catalog::setReport($tree['id']);
             View::$layout = 'empty';
             View::render('site/redirect', array('href' => $href, 'text' => 'Отзыв успешно добавлен!'));
             die;
         }
         if (isset($_POST['subscribe'])) {
             $tree = Tree::getTreeByUrl();
             $href = Tree::getPathToTree($tree['id']);
             Catalog::setSubscribe($tree['id']);
             die;
         }
     } else {
         DB::escapeGet();
         if (Funcs::$uri[1] == '' && isset($_GET['hits']) && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl();
             Funcs::setMeta($tree);
             $tree = Catalog::getHitCatalog($tree['id']);
             View::render('catalog/catalog', array('list' => $tree, 'name' => 'Все хиты'));
         } elseif (Funcs::$uri[1] == '' && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl();
             Funcs::setMeta($tree);
             $tree = Catalog::getPreviewCatalog($tree['id']);
             //View::render('catalog/catalog',array('list'=>$tree));
         } elseif (Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl(Funcs::$uri[0]);
             if ($tree['info']['type'] == 'struct') {
                 $temp = Catalog::getInnerListPagi($tree['id']);
                 $tree['list'] = $temp['list'];
                 $tree['vendors'] = Catalog::getVendors($tree['id'], $tree['list']);
                 //$tree['options']['available']=array();
                 //$tree['options']['catalog']=Catalog::getType($tree['id'],$tree['parent']);
                 //$tree['options']['vendors']=Catalog::getVendors($tree['id']);
                 if ($_GET['ve']) {
                     $tree['name'] = $tree['seo_description'] = $tree['name'] . ' ' . Funcs::$referenceId['vendor'][$_GET['ve']]['name'];
                     Funcs::setMeta($tree);
                 }
                 $tree['options']['price'] = Catalog::getValuesPrice($tree['id']);
                 $tree['options']['price2'] = Catalog::getLink('pricelink');
                 //$tree['options']['rating']=array();
                 Funcs::setMeta($tree);
                 $tree['quantity'] = $temp['quantity'];
                 if ($_GET['ajax'] == 'act') {
                     print $tree['quantity'];
                     die;
                 } else {
                     View::render('catalog/list', $tree);
                 }
             } else {
                 Funcs::setMeta($tree, 'goods');
                 $id = $tree['id'];
                 $tree = Catalog::getOne($id);
                 Catalog::setPopularity($id);
                 $tree['reports'] = Catalog::getReports($id);
                 Catalog::setViewed($id);
                 $tree['same_price'] = Catalog::getAdditionalgood($id, 'better_for_same_price');
                 $tree['accessories'] = Catalog::getAdditionalgood($id, 'accessories');
                 //$tree['similargoods']=Catalog::getAdditionalgood($id,'similargoods');
                 $tree['similargoods'] = Catalog::getMore($tree['id'], $tree['parent']);
                 $tree['reportme'] = Catalog::getReport($tree['id']);
                 if (isset($_GET['print'])) {
                     View::$layout = 'empty';
                     View::render('catalog/print', $tree);
                     die;
                 } else {
                     View::render('catalog/one', $tree);
                 }
             }
         }
     }
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:77,代码来源:CatalogController.php


注:本文中的Tree::getPathToTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。