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


PHP eZContentObjectTreeNode::subTreeCount方法代码示例

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


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

示例1: getBrowseItems

 /**
  * Returns a struct containing the following values:
  *      - limit the number of element by page
  *      - offset the current offset
  *      - items array, each element contains
  *          - has_child boolean
  *          - can_create boolean
  *          - node eZContentObjectTreeNode
  *      - has_prev boolean, true if there's a previous page
  *      - has_next boolean, true if there's a next page
  *
  * @param eZContentObjectTreeNode $start the node where the browse will start
  * @param eZContentClass $class class of the object to be created
  * @param int $offset
  * @return array
  */
 private static function getBrowseItems( eZContentObjectTreeNode $start, eZContentClass $class, $offset = 0 )
 {
     $result = array(
         'limit' => 10,
         'offset' => $offset,
         'items' => array(),
         'has_prev' => ( $offset != 0 ),
         'has_next' => false
     );
     $containerClasses = eZPersistentObject::fetchObjectList(
         eZContentClass::definition(), null,
         array(
             'version' => eZContentClass::VERSION_STATUS_DEFINED,
             'is_container' => 1
         )
     );
     $classFilterArray = array();
     foreach ( $containerClasses as $c )
     {
         $classFilterArray[] = $c->attribute( 'identifier' );
     }
     $children = $start->subTree(
         array(
             'ClassFilterArray' => $classFilterArray,
             'ClassFilterType' => 'include',
             'Depth' => 1,
             'Limit' => $result['limit'],
             'Offset' => $offset
         )
     );
     $count = $start->subTreeCount(
         array(
             'ClassFilterArray' => $classFilterArray,
             'ClassFilterType' => 'include',
             'Depth' => 1
         )
     );
     if ( $count > ( $offset + $result['limit'] ) )
     {
         $result['has_next'] = true;
     }
     foreach( $children as $node )
     {
         $elt = array();
         $elt['node'] = $node;
         $canCreateClassist = $node->canCreateClassList();
         foreach( $canCreateClassist as $c )
         {
             if ( $c['id'] == $class->attribute( 'id' ) )
             {
                 $elt['can_create'] = true;
                 break;
             }
         }
         if ( !isset( $elt['can_create'] ) )
         {
             $elt['can_create'] = false;
         }
         $childrenContainerCount = $node->subTreeCount(
             array(
                 'ClassFilterArray' => $classFilterArray,
                 'ClassFilterType' => 'include',
                 'Depth' => 1
             )
         );
         $elt['has_child'] = ( $childrenContainerCount > 0 );
         $result['items'][] = $elt;
     }
     return $result;
 }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:86,代码来源:ezjscserverfunctionsajaxuploader.php

示例2: clearViewCacheForSubtree

 /**
  * Clears the view cache for a subtree
  *
  * @param eZContentObjectTreeNode $node
  * @param bool $clearForRootNode
  * @return bool
  */
 static function clearViewCacheForSubtree(eZContentObjectTreeNode $node, $clearForRootNode = true)
 {
     // Max nodes to fetch at a time
     static $limit = 200;
     if ($clearForRootNode) {
         $objectID = $node->attribute('contentobject_id');
         eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     }
     $offset = 0;
     $params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array());
     // Empty array means no permission checking
     $subtreeCount = $node->subTreeCount($params);
     while ($offset < $subtreeCount) {
         $params['Offset'] = $offset;
         $params['Limit'] = $limit;
         $subtreeChunk = $node->subTree($params);
         $nNodesInChunk = count($subtreeChunk);
         $offset += $nNodesInChunk;
         if ($nNodesInChunk == 0) {
             break;
         }
         $objectIDList = array();
         foreach ($subtreeChunk as $curNode) {
             $objectIDList[] = $curNode['id'];
         }
         unset($subtreeChunk);
         eZContentCacheManager::clearContentCacheIfNeeded(array_unique($objectIDList));
     }
     return true;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:37,代码来源:ezcontentobjecttreenode.php

示例3: fetchCount

 public function fetchCount()
 {
     return $this->mainNode->subTreeCount($this->fetchParameters);
 }
开发者ID:OpencontentCoop,项目名称:ocexportas,代码行数:4,代码来源:abstractexporter.php


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