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


PHP eZContentObjectTreeNode::addChildTo方法代码示例

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


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

示例1: createObject

 function createObject($contentClassID, $parentNodeID = 2)
 {
     $class = eZContentClass::fetch($contentClassID);
     $parentNode = eZContentObjectTreeNode::fetch($parentNodeID);
     $parentContentObject = $parentNode->attribute('object');
     $sectionID = $parentContentObject->attribute('section_id');
     $object = $class->instantiate(false, $sectionID);
     //        $parentContentObject = $parentNode->attribute( 'contentobject' );
     $node = eZContentObjectTreeNode::addChildTo($object->attribute("id"), $parentNodeID, true);
     //        $object->setAttribute( "main_node_id", $node->attribute( 'node_id' ) );
     $node->setAttribute('main_node_id', $node->attribute('node_id'));
     $object->store();
     $node->store();
     return $object;
 }
开发者ID:radca,项目名称:ezpublish,代码行数:15,代码来源:ezcontentobjecttreenode.php

示例2: addLocation

    /**
     * Adds a new location (node) to the current object.
     *
     * Transaction unsafe. If you call several transaction unsafe methods you must enclose
     * the calls within a db transaction; thus within db->begin and db->commit.
     *
     * @param int $parentNodeID The id of the node to use as parent.
     * @param bool $asObject If true it will return the new child-node as an object, if not it returns the ID.
     *
     * @return eZContentObjectTreeNode|int
     */
    function addLocation( $parentNodeID, $asObject = false )
    {
        $node = eZContentObjectTreeNode::addChildTo( $this->ID, $parentNodeID, true, $this->CurrentVersion );

        $data = array( 'contentobject_id' => $this->ID,
                       'contentobject_version' => $this->attribute( 'current_version' ),
                       'parent_node' => $parentNodeID,
                       // parent_remote_id in node assignment holds remote id of the added location,
                       // not of the parent location or of the node assignment itself
                       'parent_remote_id' => $node->attribute( 'remote_id' ),
                       'is_main' => 0 );
        $nodeAssignment = eZNodeAssignment::create( $data );
        $nodeAssignment->setAttribute( 'op_code', eZNodeAssignment::OP_CODE_CREATE_NOP );
        $nodeAssignment->store();

        if ( $asObject )
        {
            return $node;
        }
        else
        {
            return $node->attribute( 'node_id' );
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:35,代码来源:ezcontentobject.php


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