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


PHP eZContentObjectTreeNode::reverseRelatedCount方法代码示例

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


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

示例1: fetchNodeInfoFromId

 private function fetchNodeInfoFromId($nodeId)
 {
     if (!eepValidate::validateContentNodeId($nodeId)) {
         throw new Exception("This is not a node id: [" . $nodeId . "]");
     }
     $keepers = array("Name", "ContentObjectID", "MainNodeID", "ClassIdentifier", "PathIdentificationString", "PathString", "ParentNodeID", "CurrentLanguage", "ContentObjectVersion", "RemoteID", "IsHidden", "IsInvisible", "ContentObjectIsPublished");
     // get the node
     $node = eZContentObjectTreeNode::fetch($nodeId);
     //var_dump($node);
     // extract the members we want
     $results[] = array("key", "value");
     foreach ($keepers as $key) {
         $results[] = array($key, $node->{$key});
     }
     // additional info
     $results[] = array("Reverse related count", eZContentObjectTreeNode::reverseRelatedCount(array($nodeId)));
     $params = array('Depth' => 1, 'DepthOperator' => 'eq', 'Limitation' => array());
     $results[] = array("Children count", eZContentObjectTreeNode::subTreeCountByNodeID($params, $nodeId));
     $results[] = array("URL Alias", $node->urlAlias());
     // do output
     eep::printTable($results, "contentnode info [" . $nodeId . "]");
 }
开发者ID:truffo,项目名称:eep,代码行数:22,代码来源:index.php

示例2: removeSubtrees


//.........这里部分代码省略.........
             // to remove the current main node.
             if ($node->attribute('main_node_id') == $nodeID) {
                 if (count($allAssignedNodes) > 1) {
                     foreach ($allAssignedNodes as $assignedNode) {
                         $assignedNodeID = $assignedNode->attribute('node_id');
                         if ($assignedNodeID == $nodeID) {
                             continue;
                         }
                         $newMainNodeID = $assignedNodeID;
                         break;
                     }
                 }
             }
             if ($infoOnly) {
                 // Find the number of items in the subtree we are allowed to remove
                 // if this differs from the total count it means we have items we cannot remove
                 // We do this by fetching the limitation list for content/remove
                 // and passing it to the subtree count function.
                 $currentUser = eZUser::currentUser();
                 $accessResult = $currentUser->hasAccessTo('content', 'remove');
                 if ($accessResult['accessWord'] == 'limited') {
                     $limitationList = $accessResult['policies'];
                     $removeableChildCount = $node->subTreeCount(array('Limitation' => $limitationList, 'IgnoreVisibility' => true));
                     $canRemoveSubtree = $removeableChildCount == $childCount;
                     $canRemove = $canRemoveSubtree;
                 }
                 //check if there is sub object in pending status
                 $limitCount = 100;
                 $offset = 0;
                 while (1) {
                     $children = $node->subTree(array('Limitation' => array(), 'SortBy' => array('path', false), 'Offset' => $offset, 'Limit' => $limitCount, 'IgnoreVisibility' => true, 'AsObject' => false));
                     // fetch pending node assignment(pending object)
                     $idList = array();
                     //add node itself into idList
                     if ($offset === 0) {
                         $idList[] = $nodeID;
                     }
                     foreach ($children as $child) {
                         $idList[] = $child['node_id'];
                     }
                     if (count($idList) === 0) {
                         break;
                     }
                     $pendingChildCount = eZNodeAssignment::fetchChildCountByVersionStatus($idList, eZContentObjectVersion::STATUS_PENDING);
                     if ($pendingChildCount !== 0) {
                         // there is pending object
                         $hasPendingObject = true;
                         break;
                     }
                     $offset += $limitCount;
                 }
             }
             // We will only remove the subtree if are allowed
             // and are told to do so.
             if ($canRemove and !$infoOnly) {
                 $moveToTrashTemp = $moveToTrash;
                 if (!$moveToTrashAllowed) {
                     $moveToTrashTemp = false;
                 }
                 // Remove children, fetching them by 100 to avoid memory overflow.
                 // removeNodeFromTree -> removeThis handles cache clearing
                 while (1) {
                     // We should remove the latest subitems first,
                     // so we should fetch subitems sorted by 'path_string' DESC
                     $children = $node->subTree(array('Limitation' => array(), 'SortBy' => array('path', false), 'Limit' => 100, 'IgnoreVisibility' => true));
                     if (!$children) {
                         break;
                     }
                     foreach ($children as $child) {
                         $child->removeNodeFromTree($moveToTrashTemp);
                         eZContentObject::clearCache();
                     }
                 }
                 $node->removeNodeFromTree($moveToTrashTemp);
             }
         }
         if (!$canRemove) {
             $canRemoveAll = false;
         }
         // Do not create info list if we are removing subtrees
         if (!$infoOnly) {
             continue;
         }
         $soleNodeCount = $node->subtreeSoleNodeCount();
         $totalLoneNodeCount += $soleNodeCount;
         if ($objectNodeCount <= 1) {
             ++$totalLoneNodeCount;
         }
         $item = array("nodeName" => $nodeName, "childCount" => $childCount, "additionalWarning" => '', 'node' => $node, 'object' => $object, 'class' => $class, 'node_name' => $nodeName, 'child_count' => $childCount, 'object_node_count' => $objectNodeCount, 'sole_node_count' => $soleNodeCount, 'can_remove' => $canRemove, 'can_remove_subtree' => $canRemoveSubtree, 'real_child_count' => $readableChildCount, 'new_main_node_id' => $newMainNodeID);
         $deleteResult[] = $item;
     }
     $db->commit();
     if (!$infoOnly) {
         return true;
     }
     if ($moveToTrashAllowed and $totalLoneNodeCount == 0) {
         $moveToTrashAllowed = false;
     }
     return array('move_to_trash' => $moveToTrashAllowed, 'total_child_count' => $totalChildCount, 'can_remove_all' => $canRemoveAll, 'delete_list' => $deleteResult, 'has_pending_object' => $hasPendingObject, 'reverse_related_count' => eZContentObjectTreeNode::reverseRelatedCount($deleteIDArray));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezcontentobjecttreenode.php

示例3: isNodeOrphan

 /**
  * Checks if a node is an orphan
  *
  * An orphan node is a node without any reverse relations. (e.g no other
  * objects related to the node).
  *
  * @param eZContentObjectTreeNode $node
  * @return bool
  **/
 protected function isNodeOrphan( $node )
 {
     return ( eZContentObjectTreeNode::reverseRelatedCount( array( $node->attribute('node_id') ) ) <= 0 );
 }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:13,代码来源:mmorphantcleanup.php


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