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


PHP eZContentObjectTreeNode::create方法代码示例

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


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

示例1: addChildTo

 static function addChildTo($contentobjectID, $nodeID, $asObject = false, $contentObjectVersion = false)
 {
     $node = eZContentObjectTreeNode::fetch($nodeID);
     $contentObject = eZContentObject::fetch($contentobjectID);
     if (!$contentObject) {
         return false;
     }
     if (!$contentObjectVersion) {
         $contentObjectVersion = $contentObject->attribute('current_version');
     }
     $db = eZDB::instance();
     $parentMainNodeID = $node->attribute('node_id');
     //$parent->attribute( 'main_node_id' );
     $parentPath = $node->attribute('path_string');
     $parentDepth = $node->attribute('depth');
     $isInvinsible = $node->attribute('is_invisible');
     $nodeDepth = $parentDepth + 1;
     $insertedNode = eZContentObjectTreeNode::create($parentMainNodeID, $contentobjectID);
     // set default sorting from content class
     $contentClass = $contentObject->attribute('content_class');
     $insertedNode->setAttribute('sort_field', $contentClass->attribute('sort_field'));
     $insertedNode->setAttribute('sort_order', $contentClass->attribute('sort_order'));
     $insertedNode->setAttribute('depth', $nodeDepth);
     $insertedNode->setAttribute('path_string', '/TEMPPATH');
     $insertedNode->setAttribute('contentobject_version', $contentObjectVersion);
     // If the parent node is invisible, the new created node should be invisible as well.
     $insertedNode->setAttribute('is_invisible', $isInvinsible);
     $db->begin();
     $insertedNode->store();
     $insertedID = $insertedNode->attribute('node_id');
     $newNodePath = $parentPath . $insertedID . '/';
     $insertedNode->setAttribute('path_string', $newNodePath);
     $insertedNode->store();
     $db->commit();
     if ($asObject) {
         return $insertedNode;
     } else {
         return $insertedID;
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:40,代码来源:ezcontentobjecttreenode.php

示例2: tempMainNode

 function tempMainNode()
 {
     if ( $this->TempNode !== null )
         return $this->TempNode;
     $object = $this->contentObject();
     if ( $object->attribute( 'status' ) == eZContentObject::STATUS_DRAFT )
     {
         $nodeAssignments = $this->nodeAssignments();
         $mainNodeAssignment = null;
         foreach( $nodeAssignments as $nodeAssignment )
         {
             if ( $nodeAssignment->attribute( 'is_main' ) )
             {
                 $mainNodeAssignment = $nodeAssignment;
                 break;
             }
         }
         if ( $mainNodeAssignment === null and
              count( $nodeAssignments ) > 0 )
         {
             $mainNodeAssignment = $nodeAssignments[0];
         }
         if ( $mainNodeAssignment )
         {
             $this->TempNode = $mainNodeAssignment->tempNode();
         }
     }
     else if ( $object->attribute( 'status' ) == eZContentObject::STATUS_PUBLISHED )
     {
         $mainNode = $object->mainNode();
         if ( is_object( $mainNode ) )
         {
             $this->TempNode = eZContentObjectTreeNode::create( $mainNode->attribute( 'parent_node_id' ),
                                                                $mainNode->attribute( 'contentobject_id' ),
                                                                $this->attribute( 'version' ),
                                                                $mainNode->attribute( 'sort_field' ),
                                                                $mainNode->attribute( 'sort_order' ) );
             $this->TempNode->setName( $mainNode->Name );
         }
     }
     return $this->TempNode;
 }
开发者ID:ataxel,项目名称:tp,代码行数:42,代码来源:ezcontentobjectversion.php

示例3: foreach

     // #HACK#
     if ($object->attribute('contentclass_id') == 17) {
         foreach ($object->relatedContentObjectList($approveStatus->attribute('active_version'), false, false) as $relatedObject) {
             $relatedObject->setAttribute('flags', $relatedObject->attribute('flags') | EZ_CONTENT_OBJECT_FLAG_LOCK_EDIT | EZ_CONTENT_OBJECT_FLAG_LOCK_REMOVE);
             $relatedObject->sync();
         }
     }
 }
 $collaborationItemID = $approveStatus->createCollaboration();
 $approveINI = eZINI::instance('ezapprove2.ini');
 if ($approveINI->variable('ApproveSettings', 'NodeCreationOnDraft') == 'true') {
     // Create temporary contentobject tree node entry
     $db = eZDB::instance();
     #include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
     $parentNodeIDArray = $object->attribute('parent_nodes');
     $tmpNode = eZContentObjectTreeNode::create($parentNodeIDArray[0], $object->attribute('id'), $approveStatus->attribute('active_version'));
     $tmpNode->store();
     $parentNode = $tmpNode->attribute('parent');
     $tmpNode->setAttribute('main_node_id', $tmpNode->attribute('node_id'));
     $tmpNode->setAttribute('path_string', $parentNode->attribute('path_string') . $tmpNode->attribute('node_id') . '/');
     $tmpNode->setAttribute('depth', $parentNode->attribute('depth') + 1);
     //        $tmpNode->setAttribute( 'published', mktime() );
     $tmpNode->setAttribute('path_identification_string', $tmpNode->pathWithNames());
     $tmpNode->sync();
     #include_once( 'kernel/classes/ezurlalias.php' );
     $alias = eZURLAlias::create($tmpNode->attribute('path_identification_string'), 'content/versionview/' . $object->attribute('id') . '/' . $approveStatus->attribute('active_version'));
     $alias->store();
     #include_once( "kernel/classes/ezcontentcachemanager.php" );
     eZContentCacheManager::clearObjectViewCache($parentNode->attribute('contentobject_id'));
 }
 return $Module->redirect('collaboration', 'item', array('full', $collaborationItemID));
开发者ID:brucem,项目名称:ezapprove2,代码行数:31,代码来源:select_approver.php


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