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


PHP Tree::hasChilds方法代码示例

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


在下文中一共展示了Tree::hasChilds方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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['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

示例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['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

示例5: _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

示例6: perform

    public function perform(IHttpContext $context, $params = null)
    {
        $tree = new Tree();
        $db = PluginManager::getInstance()->getPlugin('creole')->getC();
        if ($params[0] == null) {
            $rs = $db->executeQuery('SELECT t.object_id, o.* FROM tree t, objects o WHERE t.object_id = o.id AND depth = 2');
            $ret = array();
            while ($rs->next()) {
                $ret[] = $rs->getRow();
            }
            return array('result' => $ret, 'type' => 'cat');
        } else {
            if ($tree->hasChilds($params[0])) {
                $rs = $db->executeQuery('SELECT o.*
								     FROM objects o
									 LEFT JOIN tree t ON ( t.object_id = o.id )
									 WHERE t.parent_id =' . $params[0]);
                $ret = array();
                while ($rs->next()) {
                    $ret[] = $rs->getRow();
                }
                return array('result' => $ret, 'type' => 'titles');
            } else {
                $rs = $db->executeQuery('SELECT o.*, u.FirstName, u.LastName
								     FROM objects o
									 LEFT JOIN tree t ON ( t.object_id = o.id )
									 LEFT JOIN lum_user u ON (o.user_id = u.id)
									 WHERE t.object_id =' . $params[0]);
                $ret = array();
                while ($rs->next()) {
                    $ret = $rs->getRow();
                }
                return array('result' => $ret, 'type' => 'text');
            }
        }
    }
开发者ID:BackupTheBerlios,项目名称:nodin-svn,代码行数:36,代码来源:TreeAction.php

示例7: _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

示例8: Tree

    return $s;
};
$pagesTree = $this->get('pagesTree');
$tree = new Tree();
$menuData = $this->get('menuData');
$config = $this->get('config');
if (is_array($menuData) && !empty($menuData)) {
    foreach ($menuData as $k => $v) {
        $tree->addItem($v['tree_id'], $v['parent_id'], $v, $v['order']);
    }
}
?>
<div class="blockItem">
<?php 
if ($config['show_title']) {
    echo '<div class="blockTitle">', $config['title'], '</div>';
}
?>
	<div class="blockContent">	
<?php 
if ($tree->hasChilds(0)) {
    echo $createMenuNode($tree, 0, $this->get('page'), $pagesTree);
}
?>
	</div>
</div>
<div class="sep"></div>



开发者ID:vgrish,项目名称:dvelum,代码行数:27,代码来源:menu.php

示例9: _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

示例10: _compileColumns

 /**
  * Fill childs data array for columns tree
  * @param Tree $tree
  * @param mixed $root
  * @return array
  */
 protected function _compileColumns(Tree $tree, $root = 0)
 {
     $result = array();
     $childs = $tree->getChilds($root);
     if (empty($childs)) {
         return array();
     }
     foreach ($childs as $k => $v) {
         $column = $v['data'];
         $column->columns = '';
         if ($tree->hasChilds($v['id'])) {
             $column->columns = "[\n\t" . Utils_String::addIndent(implode(",\n", $this->_compileColumns($tree, $v['id'])), 2) . "\n]";
         }
         $result[] = Utils_String::addIndent($column->__toString(), 2);
     }
     return $result;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:23,代码来源:Grid.php

示例11: _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

示例12: hasChilds

 /**
  * Check if object has childs.
  * @param string $name
  * @return boolean
  */
 public function hasChilds($name)
 {
     return $this->_tree->hasChilds($name);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:9,代码来源:Project.php

示例13: testRemoveItem

 public function testRemoveItem()
 {
     $tree = new Tree();
     $item = new stdClass();
     $item->id = 1;
     $tree->addItem($item->id, 0, $item);
     $item2 = new stdClass();
     $item2->id = 2;
     $tree->addItem($item2->id, 1, $item2);
     $tree->removeItem(2);
     $this->assertEquals($tree->getItemsCount(), 1);
     $this->assertFalse($tree->itemExists(2));
     $this->assertFalse($tree->hasChilds(1));
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:14,代码来源:TreeTest.php


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