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


PHP eZContentOperationCollection::addAssignment方法代码示例

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


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

示例1: array

     return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
 }
 $existingNode = eZContentObjectTreeNode::fetch($nodeID);
 if (!$existingNode) {
     return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
 }
 $class = $object->contentClass();
 if ($module->isCurrentAction('AddAssignment')) {
     $selectedNodeIDArray = eZContentBrowse::result('AddNodeAssignment');
     if (!is_array($selectedNodeIDArray)) {
         $selectedNodeIDArray = array();
     }
     if (eZOperationHandler::operationIsAvailable('content_addlocation')) {
         $operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $nodeID, 'object_id' => $objectID, 'select_node_id_array' => $selectedNodeIDArray), null, true);
     } else {
         eZContentOperationCollection::addAssignment($nodeID, $objectID, $selectedNodeIDArray);
     }
 } else {
     if ($module->isCurrentAction('SelectAssignmentLocation')) {
         $ignoreNodesSelect = array();
         $ignoreNodesClick = array();
         $assigned = eZNodeAssignment::fetchForObject($objectID, $object->attribute('current_version'), 0, false);
         $publishedAssigned = $object->assignedNodes(false);
         $isTopLevel = false;
         foreach ($publishedAssigned as $element) {
             $append = false;
             if ($element['parent_node_id'] == 1) {
                 $isTopLevel = true;
             }
             foreach ($assigned as $ass) {
                 if ($ass['parent_node'] == $element['parent_node_id']) {
开发者ID:heliopsis,项目名称:ezpublish-legacy,代码行数:31,代码来源:action.php

示例2: addLocationToContent

 /**
  * Adds a location to provided content.
  * Prefer using SQLIContent::addLocation() instead of calling this method directly
  * @param SQLILocation $location
  * @param SQLIContent $content
  * @internal
  */
 public function addLocationToContent(SQLILocation $location, SQLIContent $content)
 {
     $nodeID = $content->attribute('main_node_id');
     if (!$nodeID) {
         // No main node ID, object has not been published at least once
         throw new SQLIContentException(__METHOD__ . ' => Cannot directly add a location to a not-yet-published content. Content Object ID = ' . $content->attribute('id') . '. Try to use SQLIContent::addLocation()');
     }
     $objectID = $content->attribute('id');
     $locationNodeID = $location->getNodeID();
     // Check first if content has already an assigned node in provided location
     $assignedNodes = $content->assignedNodes(false);
     for ($i = 0, $iMax = count($assignedNodes); $i < $iMax; ++$i) {
         if ($locationNodeID == $assignedNodes[$i]['parent_node_id']) {
             eZDebug::writeWarning(__METHOD__ . ' => Content with ObjectID #' . $objectID . ' already has a location as a child of node #' . $locationNodeID);
             return;
         }
     }
     eZDebug::accumulatorStart('sqlicontentpublisher_add_location', 'sqlicontentpublisher', 'Adding a location for object #' . $objectID);
     $selectedNodeIDArray = array($locationNodeID);
     if (eZOperationHandler::operationIsAvailable('content_addlocation')) {
         $operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $nodeID, 'object_id' => $objectID, 'select_node_id_array' => $selectedNodeIDArray), null, true);
     } else {
         eZContentOperationCollection::addAssignment($nodeID, $objectID, $selectedNodeIDArray);
     }
     $content->refreshLocations();
     eZDebug::accumulatorStop('sqlicontentpublisher_add_location');
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:34,代码来源:sqlicontentpublisher.php


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