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


PHP Tree::getChilds方法代码示例

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


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

示例1: getActions

 /**
  * Get actions list
  * @return $array
  */
 public function getActions()
 {
     if (!$this->_actions->hasChilds(0)) {
         return array();
     }
     $list = $this->_actions->getChilds(0);
     $result = array();
     if (!empty($list)) {
         foreach ($list as $k => $v) {
             $result[$v['id']] = $v['data'];
         }
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:18,代码来源:Action.php

示例2: _fillChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillChilds(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $row = $v['data'];
         $obj = new stdClass();
         $obj->id = $row['tree_id'];
         $obj->text = $row['title'];
         $obj->expanded = true;
         $obj->leaf = false;
         $obj->allowDrag = true;
         $obj->page_id = $row['page_id'];
         $obj->parent_id = $row['parent_id'];
         $obj->published = $row['published'];
         $obj->url = isset($row['url']) ? $row['url'] : '';
         $obj->resource_id = isset($row['resource_id']) ? $row['resource_id'] : '';
         $obj->link_type = isset($row['link_type']) ? $row['link_type'] : '';
         if ($row['published']) {
             $obj->iconCls = 'pagePublic';
         } else {
             $obj->iconCls = 'pageHidden';
         }
         $cld = array();
         if ($tree->hasChilds($row['tree_id'])) {
             $cld = $this->_fillChilds($tree, $row['tree_id']);
         }
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:41,代码来源:Item.php

示例3: _fillChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillChilds(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     $appConfig = Registry::get('main', 'config');
     foreach ($childs as $k => $v) {
         $row = $v['data'];
         $obj = new stdClass();
         $obj->id = $row['id'];
         $obj->text = $row['menu_title'] . ' <i>(' . $row['code'] . $appConfig['urlExtension'] . ')</i>';
         $obj->expanded = true;
         $obj->leaf = false;
         if ($row['published']) {
             $obj->qtip = $row['menu_title'] . ' <i>(' . $row['code'] . $appConfig['urlExtension'] . ')</i> published';
             $obj->iconCls = 'pagePublic';
         } else {
             $obj->qtip = $row['menu_title'] . ' <i>(' . $row['code'] . $appConfig['urlExtension'] . ')</i> not published';
             $obj->iconCls = 'pageHidden';
         }
         if ($row['is_fixed']) {
             $obj->allowDrag = false;
         }
         $cld = array();
         if ($tree->hasChilds($row['id'])) {
             $cld = $this->_fillChilds($tree, $row['id']);
         }
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:40,代码来源:Page.php

示例4: _fillChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillChilds(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $row = $v['data'];
         $obj = new stdClass();
         $obj->id = $row['id'];
         $obj->text = $row['name'];
         $obj->expanded = false;
         $obj->isDir = $row['isDir'];
         $obj->path = $row['path'];
         $obj->name = $row['name'];
         $obj->hid = $row['hid'];
         if ($row['isDir']) {
             $obj->leaf = false;
         } else {
             $obj->leaf = true;
         }
         $cld = array();
         if ($tree->hasChilds($row['id'])) {
             $cld = $this->_fillChilds($tree, $row['id']);
         }
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:37,代码来源:File.php

示例5: moveColumn

 /**
  * Move column
  * @param string $column
  * @param integer $from
  * @param integer $to
  */
 public function moveColumn($column, $from, $to)
 {
     if (!$this->columnExists($column)) {
         return;
     }
     $this->changeParent($column, 0);
     $columns = $this->_columns->getChilds(0);
     $order = 0;
     if ($to > sizeof($columns) - 1) {
         $to = sizeof($columns) - 1;
     }
     foreach ($columns as $item) {
         $colName = $item['data']->getName();
         if ($order == $to) {
             $this->setItemOrder($column, $order);
             $order++;
             continue;
         }
         if ($colName !== $column) {
             $this->setItemOrder($colName, $order);
         }
         $order++;
     }
     $this->reindexColumns();
     $data = $this->_columns->getChilds(0);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:32,代码来源:Grid.php

示例6: getValuesNumber

    public static function getValuesNumber($path)
    {
        $data = array();
        $tree = Tree::getTreeByUrl();
        $ids[] = $tree['id'];
        $ids = array_merge($ids, Tree::getChilds($tree['id']));
        $sql = '
			SELECT DISTINCT type FROM {{data}}
			WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
		';
        $type = DB::getOne($sql);
        if ($type) {
            $sql = '
				SELECT MAX(' . Fields::$fieldsName[$type] . ') AS maxv, MIN(' . Fields::$fieldsName[$type] . ') AS minv FROM {{data}}
				WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
			';
            $data = DB::getRow($sql);
            $data['type'] = substr($type, 0, 1);
        }
        if ($data['maxv'] > 0) {
            return $data;
        } else {
            return array();
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:25,代码来源:OptionsWidget.php

示例7: del

    function del()
    {
        $ids = Tree::getChilds($_GET['id']);
        $ids[] = $_GET['id'];
        $sql = '
			DELETE FROM {{forum}} 
			WHERE id IN (' . implode(',', $ids) . ')
		';
        DB::exec($sql);
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:10,代码来源:ForumModel.php

示例8: _fillQuery

 /**
  * Recursive method
  * @param string $parent - parent part id
  * @param Db_Select $sql
  */
 protected function _fillQuery($partId, $sql, $countOnly = false)
 {
     $parentItem = $this->_tree->getItem($partId);
     $childs = $this->_tree->getChilds($partId);
     foreach ($childs as $child) {
         $this->_addSqlPart($child['data'], $sql, $parentItem['data'], $countOnly);
         $part = $child['data'];
         if ($this->_tree->hasChilds($part->getId())) {
             $this->_fillQuery($part->getId(), $sql, $countOnly);
         }
     }
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:17,代码来源:Query.php

示例9: _fillContainers

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillContainers(Tree $tree, $root = 0, $exceptStorage = true)
 {
     $exceptions = array('Store', 'Data_Store', 'Data_Store_Tree', 'Model');
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $object = $v['data'];
         $objectClass = $object->getClass();
         $objectName = $object->getName();
         if ($exceptStorage && in_array($objectClass, $exceptions, true)) {
             continue;
         }
         $item = new stdClass();
         $item->id = $v['id'];
         $inst = '';
         $ext = '';
         if ($object->isInstance()) {
             $inst = ' <span class="extInstanceLabel" data-qtip="Object instance">instance of </span>' . $object->getObject()->getName();
         } elseif ($object->isExtendedComponent()) {
             $ext = ' <span class="extCmpLabel" data-qtip="Extended component">ext</span> ';
             if ($object->defineOnly) {
                 $objectName = '<span class="extClassLabel" data-qtip="defineOnly:true">' . $objectName . '</span>';
             }
         }
         $item->text = $ext . $objectName . ' (' . $objectClass . ')' . $inst;
         $item->expanded = true;
         $item->objClass = $objectClass;
         $item->isInstance = $object->isInstance();
         $item->leaf = true;
         $item->iconCls = self::getIconClass($objectClass);
         $item->allowDrag = Designer_Project::isDraggable($objectClass);
         if ($objectClass == 'Docked') {
             $item->iconCls = 'objectDocked';
             $item->text = 'Docked Items';
         } elseif ($objectClass == 'Menu') {
             $item->text = 'Menu Items';
             $item->iconCls = 'menuItemsIcon';
         }
         if (Designer_Project::isContainer($objectClass) && !$object->isInstance()) {
             $item->leaf = false;
             $item->children = array();
         }
         if ($tree->hasChilds($v['id'])) {
             $item->children = $this->_fillContainers($tree, $v['id'], $exceptStorage);
         }
         $result[] = $item;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:58,代码来源:Objects.php

示例10: getList

    public function getList($parent)
    {
        $data = array();
        $ids[] = $parent;
        $ids = array_merge($ids, Tree::getChilds($parent));
        $sql = '
			SELECT * FROM {{tree}}
			WHERE parent=' . $parent . ' AND visible=1
			ORDER BY num
		';
        $list = DB::getPagi($sql);
        foreach ($list as $item) {
            $fields = Fields::getFieldsByTree($item['id'], 'wide');
            $data[] = array('name' => $item['name'], 'path' => $path, 'udate' => date('d.m.Y', strtotime($item['udate'])), 'answer' => $fields['answer']);
        }
        return $data;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:17,代码来源:FaqModel.php

示例11: getRootPanels

 /**
  * Get root panels list
  * @return array
  */
 public function getRootPanels()
 {
     $list = $this->_tree->getChilds(0);
     $names = array();
     if (empty($list)) {
         return array();
     }
     foreach ($list as $k => $v) {
         $object = $v['data'];
         $class = $object->getClass();
         if ($class === 'Object_Instance') {
             $class = $object->getObject()->getClass();
         }
         if (in_array($class, Designer_Project::$_containers, true) && $class !== 'Window' && $class != 'Menu' && !Designer_Project::isWindowComponent($class)) {
             $names[] = $object->getName();
         }
     }
     return $names;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:23,代码来源:Project.php

示例12: getMarket

    public static function getMarket($id)
    {
        $data = array();
        $tree = Tree::getInfo($id);
        if (strpos($tree['modul2'], 'catalog') !== 'false') {
            $sql = 'SHOW COLUMNS FROM {{catalog}}';
            $cols = DB::getAll($sql);
            $x = 0;
            foreach ($cols as $item) {
                if ($item['Field'] == 'market') {
                    $x = 1;
                }
            }
            if ($x) {
                $ids = Tree::getChilds($id);
                $ids[] = $id;
                $sql = '
					SELECT COUNT(*) FROM {{catalog}}
					WHERE tree IN (' . implode(',', $ids) . ') AND market=1
				';
                $m1 = DB::getOne($sql);
                $sql = '
					SELECT COUNT(*) FROM {{catalog}}
					WHERE tree IN (' . implode(',', $ids) . ') AND market=0
				';
                $m2 = DB::getOne($sql);
                if ($m1 >= $m2) {
                    return 1;
                } else {
                    return 0;
                }
            } else {
                return 0;
            }
        }
        return 0;
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:37,代码来源:Extra.php

示例13: _fillCatChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillCatChilds(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $row = $v['data'];
         $obj = new stdClass();
         $obj->id = $row['id'];
         $obj->text = $row['title'];
         $obj->expanded = !intval($root);
         $obj->leaf = false;
         $obj->allowDrag = true;
         $cld = array();
         if ($tree->hasChilds($row['id'])) {
             $cld = $this->_fillCatChilds($tree, $row['id']);
         }
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:30,代码来源:Mediacategory.php

示例14: _fillChilds

 /**
  * Fill childs data array for tree panel
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _fillChilds(Tree $tree, $root = 0)
 {
     $expanded = array('system', 'system/app', 'system/library');
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $obj = new stdClass();
         $obj->id = $v['id'];
         $obj->text = $v['data'];
         $obj->expanded = false;
         $cld = array();
         if (strpos($obj->text, '.php')) {
             $obj->leaf = true;
         } else {
             if ($tree->hasChilds($v['id'])) {
                 $cld = $this->_fillChilds($tree, $v['id']);
                 if (empty($cld)) {
                     continue;
                 }
             } else {
                 continue;
             }
             $obj->leaf = false;
             $obj->expanded = in_array($v['id'], $expanded, true);
         }
         $obj->checked = false;
         $obj->allowDrag = false;
         $obj->children = $cld;
         $result[] = $obj;
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:41,代码来源:Controller.php

示例15: del

    public static function del()
    {
        if ($_SESSION['user']) {
            $ids = Tree::getChilds($_GET['id']);
            $ids[] = $_GET['id'];
            $sql = '
				DELETE FROM {{forum}} 
				WHERE id IN (' . implode(',', $ids) . ')
			';
            DB::exec($sql);
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:12,代码来源:ForumModel.php


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