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


PHP eZContentOperationCollection::updateSectionID方法代码示例

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


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

示例1: publishNode

 public static function publishNode($parentNodeID, $objectID, $versionNum, $mainNodeID)
 {
     $object = eZContentObject::fetch($objectID);
     $nodeAssignment = eZNodeAssignment::fetch($objectID, $versionNum, $parentNodeID);
     $version = $object->version($versionNum);
     $fromNodeID = $nodeAssignment->attribute('from_node_id');
     $originalObjectID = $nodeAssignment->attribute('contentobject_id');
     $nodeID = $nodeAssignment->attribute('parent_node');
     $opCode = $nodeAssignment->attribute('op_code');
     $parentNode = eZContentObjectTreeNode::fetch($nodeID);
     // if parent doesn't exist, return. See issue #18320
     if (!$parentNode instanceof eZContentObjectTreeNode) {
         eZDebug::writeError("Parent node doesn't exist. object id: {$objectID}, node_assignment id: " . $nodeAssignment->attribute('id'), __METHOD__);
         return;
     }
     $parentNodeID = $parentNode->attribute('node_id');
     $existingNode = null;
     $db = eZDB::instance();
     $db->begin();
     if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
         $existingNode = eZContentObjectTreeNode::fetchByRemoteID($nodeAssignment->attribute('parent_remote_id'));
     }
     if (!$existingNode) {
     }
     $existingNode = eZContentObjectTreeNode::findNode($nodeID, $object->attribute('id'), true);
     $updateSectionID = false;
     // now we check the op_code to see what to do
     if (($opCode & 1) == eZNodeAssignment::OP_CODE_NOP) {
         // There is nothing to do so just return
         $db->commit();
         if ($mainNodeID == false) {
             return $object->attribute('main_node_id');
         }
         return;
     }
     $updateFields = false;
     if ($opCode == eZNodeAssignment::OP_CODE_MOVE || $opCode == eZNodeAssignment::OP_CODE_CREATE) {
         //            if ( $fromNodeID == 0 || $fromNodeID == -1)
         if ($opCode == eZNodeAssignment::OP_CODE_CREATE || $opCode == eZNodeAssignment::OP_CODE_SET) {
             // If the node already exists it means we have a conflict (for 'CREATE').
             // We resolve this by leaving node-assignment data be.
             if ($existingNode == null) {
                 $parentNode = eZContentObjectTreeNode::fetch($nodeID);
                 $user = eZUser::currentUser();
                 if (!eZSys::isShellExecution() and !$user->isAnonymous()) {
                     eZContentBrowseRecent::createNew($user->id(), $parentNode->attribute('node_id'), $parentNode->attribute('name'));
                 }
                 $updateFields = true;
                 $existingNode = $parentNode->addChild($object->attribute('id'), true);
                 if ($fromNodeID == -1) {
                     $updateSectionID = true;
                 }
             } elseif ($opCode == eZNodeAssignment::OP_CODE_SET) {
                 $updateFields = true;
             }
         } elseif ($opCode == eZNodeAssignment::OP_CODE_MOVE) {
             if ($fromNodeID == 0 || $fromNodeID == -1) {
                 eZDebug::writeError("NodeAssignment '" . $nodeAssignment->attribute('id') . "' is marked with op_code='{$opCode}' but has no data in from_node_id. Cannot use it for moving node.", __METHOD__);
             } else {
                 // clear cache for old placement.
                 $additionalNodeIDList = array($fromNodeID);
                 eZContentCacheManager::clearContentCacheIfNeeded($objectID, $versionNum, $additionalNodeIDList);
                 $originalNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $fromNodeID);
                 if ($originalNode->attribute('main_node_id') == $originalNode->attribute('node_id')) {
                     $updateSectionID = true;
                 }
                 $originalNode->move($parentNodeID);
                 $existingNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $parentNodeID);
                 $updateFields = true;
             }
         }
     } elseif ($opCode == eZNodeAssignment::OP_CODE_REMOVE) {
         $db->commit();
         return;
     }
     if ($updateFields) {
         if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
             $existingNode->setAttribute('remote_id', $nodeAssignment->attribute('parent_remote_id'));
         }
         $existingNode->setAttribute('sort_field', $nodeAssignment->attribute('sort_field'));
         $existingNode->setAttribute('sort_order', $nodeAssignment->attribute('sort_order'));
     }
     $existingNode->setAttribute('contentobject_is_published', 1);
     eZDebug::createAccumulatorGroup('nice_urls_total', 'Nice urls');
     if ($mainNodeID > 0) {
         $existingNodeID = $existingNode->attribute('node_id');
         if ($existingNodeID != $mainNodeID) {
             eZContentBrowseRecent::updateNodeID($existingNodeID, $mainNodeID);
         }
         $existingNode->setAttribute('main_node_id', $mainNodeID);
     } else {
         $existingNode->setAttribute('main_node_id', $existingNode->attribute('node_id'));
     }
     $existingNode->store();
     if ($updateSectionID) {
         eZContentOperationCollection::updateSectionID($objectID, $versionNum);
     }
     $db->commit();
     if ($mainNodeID == false) {
         return $existingNode->attribute('node_id');
//.........这里部分代码省略.........
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:101,代码来源:ezcontentoperationcollection.php


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