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


PHP eZContentObject::fixReverseRelations方法代码示例

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


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

示例1: switch

        switch ($operationResult['status']) {
            case eZModuleOperationInfo::STATUS_HALTED:
            case eZModuleOperationInfo::STATUS_CANCELLED:
                $module->redirectToView('trash');
        }
    }
    $objectID = $object->attribute('id');
    $object = eZContentObject::fetch($objectID);
    $mainNodeID = $object->attribute('main_node_id');
    eZContentObjectTrashNode::purgeForObject($objectID);
    if ($locationAdded) {
        if ($object->attribute('contentclass_id') == $userClassID) {
            eZUser::purgeUserCacheByUserId($object->attribute('id'));
        }
    }
    eZContentObject::fixReverseRelations($objectID, 'restore');
    $db->commit();
    $module->redirectToView('view', array('full', $mainNodeID));
    return;
}
$tpl = eZTemplate::factory();
$res = eZTemplateDesignResource::instance();
$designKeys = array(array('object', $object->attribute('id')), array('remote_id', $object->attribute('remote_id')), array('class', $class->attribute('id')), array('class_identifier', $class->attribute('identifier')));
// Class identifier
$res->setKeys($designKeys);
$Result = array();
$tpl->setVariable("object", $object);
$tpl->setVariable("version", $version);
$tpl->setVariable("location", $location);
$Result['content'] = $tpl->fetch('design:content/restore.tpl');
$Result['path'] = array(array('uri' => false, 'text' => ezpI18n::tr("kernel/content/restore", "Restore object")), array('uri' => false, 'text' => $object->attribute('name')));
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:restore.php

示例2: swapNode

 /**
  * Swap a node with another one
  *
  * @param int $nodeID
  * @param int $selectedNodeID
  * @param array $nodeIdList
  *
  * @return array An array with operation status, always true
  */
 public static function swapNode($nodeID, $selectedNodeID, $nodeIdList = array())
 {
     $userClassIDArray = eZUser::contentClassIDs();
     $node = eZContentObjectTreeNode::fetch($nodeID);
     $selectedNode = eZContentObjectTreeNode::fetch($selectedNodeID);
     $object = $node->object();
     $nodeParentNodeID = $node->attribute('parent_node_id');
     $nodeParent = $node->attribute('parent');
     $objectID = $object->attribute('id');
     $objectVersion = $object->attribute('current_version');
     $selectedObject = $selectedNode->object();
     $selectedObjectID = $selectedObject->attribute('id');
     $selectedObjectVersion = $selectedObject->attribute('current_version');
     $selectedNodeParentNodeID = $selectedNode->attribute('parent_node_id');
     $selectedNodeParent = $selectedNode->attribute('parent');
     $db = eZDB::instance();
     $db->begin();
     $node->setAttribute('contentobject_id', $selectedObjectID);
     $node->setAttribute('contentobject_version', $selectedObjectVersion);
     $selectedNode->setAttribute('contentobject_id', $objectID);
     $selectedNode->setAttribute('contentobject_version', $objectVersion);
     // fix main node id
     if ($node->isMain() && !$selectedNode->isMain()) {
         $node->setAttribute('main_node_id', $selectedNode->attribute('main_node_id'));
         $selectedNode->setAttribute('main_node_id', $selectedNode->attribute('node_id'));
     } else {
         if ($selectedNode->isMain() && !$node->isMain()) {
             $selectedNode->setAttribute('main_node_id', $node->attribute('main_node_id'));
             $node->setAttribute('main_node_id', $node->attribute('node_id'));
         }
     }
     $node->store();
     $selectedNode->store();
     // clear user policy cache if this was a user object
     if (in_array($object->attribute('contentclass_id'), $userClassIDArray)) {
         eZUser::purgeUserCacheByUserId($object->attribute('id'));
     }
     if (in_array($selectedObject->attribute('contentclass_id'), $userClassIDArray)) {
         eZUser::purgeUserCacheByUserId($selectedObject->attribute('id'));
     }
     // modify path string
     $changedOriginalNode = eZContentObjectTreeNode::fetch($nodeID);
     $changedOriginalNode->updateSubTreePath();
     $changedTargetNode = eZContentObjectTreeNode::fetch($selectedNodeID);
     $changedTargetNode->updateSubTreePath();
     // modify section
     if ($changedOriginalNode->isMain()) {
         $changedOriginalObject = $changedOriginalNode->object();
         $parentObject = $nodeParent->object();
         if ($changedOriginalObject->attribute('section_id') != $parentObject->attribute('section_id')) {
             eZContentObjectTreeNode::assignSectionToSubTree($changedOriginalNode->attribute('main_node_id'), $parentObject->attribute('section_id'), $changedOriginalObject->attribute('section_id'));
         }
     }
     if ($changedTargetNode->isMain()) {
         $changedTargetObject = $changedTargetNode->object();
         $selectedParentObject = $selectedNodeParent->object();
         if ($changedTargetObject->attribute('section_id') != $selectedParentObject->attribute('section_id')) {
             eZContentObjectTreeNode::assignSectionToSubTree($changedTargetNode->attribute('main_node_id'), $selectedParentObject->attribute('section_id'), $changedTargetObject->attribute('section_id'));
         }
     }
     eZContentObject::fixReverseRelations($objectID, 'swap');
     eZContentObject::fixReverseRelations($selectedObjectID, 'swap');
     $db->commit();
     // clear cache for new placement.
     eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     eZSearch::swapNode($nodeID, $selectedNodeID, $nodeIdList = array());
     return array('status' => true);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:77,代码来源:ezcontentoperationcollection.php

示例3: removeThis

    /**
     * Archives the current object and removes assigned nodes
     *
     * 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 $nodeID
     */
    function removeThis( $nodeID = null )
    {
        $delID = $this->ID;

        // Who deletes which content should be logged.
        eZAudit::writeAudit( 'content-delete', array( 'Object ID' => $delID, 'Content Name' => $this->attribute( 'name' ),
                                                      'Comment' => 'Setted archived status for the current object: eZContentObject::remove()' ) );

        $nodes = $this->attribute( 'assigned_nodes' );

        if ( $nodeID === null or count( $nodes ) <= 1 )
        {
            $db = eZDB::instance();
            $db->begin();
            $mainNodeKey = false;
            foreach ( $nodes as $key => $node )
            {
                if ( $node->attribute( 'main_node_id' ) == $node->attribute( 'node_id' ) )
                {
                    $mainNodeKey = $key;
                }
                else
                {
                    $node->removeThis();
                }
            }

            if ( $mainNodeKey !== false )
            {
                $nodes[$mainNodeKey]->removeNodeFromTree( true );
            }


            $this->setAttribute( 'status', eZContentObject::STATUS_ARCHIVED );
            eZSearch::removeObjectById( $delID );
            $this->store();
            eZContentObject::fixReverseRelations( $delID, 'trash' );
            // Delete stored attribute from other tables
            $db->commit();

        }
        else if ( $nodeID !== null )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID , false );
            if ( is_object( $node ) )
            {
                if ( $node->attribute( 'main_node_id' ) == $nodeID )
                {
                    $db = eZDB::instance();
                    $db->begin();
                    foreach ( $additionalNodes as $additionalNode )
                    {
                        if ( $additionalNode->attribute( 'node_id' ) != $node->attribute( 'main_node_id' ) )
                        {
                            $additionalNode->remove();
                        }
                    }

                    $node->removeNodeFromTree( true );
                    $this->setAttribute( 'status', eZContentObject::STATUS_ARCHIVED );
                    eZSearch::removeObjectById( $delID );
                    $this->store();
                    eZContentObject::fixReverseRelations( $delID, 'trash' );
                    $db->commit();
                }
                else
                {
                    eZContentObjectTreeNode::removeNode( $nodeID );
                }
            }
        }
        else
        {
            eZContentObjectTreeNode::removeNode( $nodeID );
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:84,代码来源:ezcontentobject.php


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