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


PHP eZNodeAssignment::removeByID方法代码示例

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


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

示例1: array

 }
 if (!$hasOtherNodeType and !$hasLDAPNodeType) {
     $noRemoveAssignmentList[$defaultUserPlacement] = 1;
 }
 $newVersion = $contentObject->createNewVersion();
 $newVersionNr = $newVersion->attribute('version');
 $nodeAssignmentList = $newVersion->attribute('node_assignments');
 $noAddAssignmentList = array();
 foreach ($nodeAssignmentList as $nodeAssignment) {
     $parentNodeID = $nodeAssignment->attribute('parent_node');
     if (array_key_exists($parentNodeID, $noRemoveAssignmentList)) {
         $noAddAssignmentList[] = $parentNodeID;
         $nodeAssignment->setAttribute('parent_remote_id', uniqid('LDAP_'));
         $nodeAssignment->store();
     } else {
         eZNodeAssignment::removeByID($nodeAssignment->attribute('id'));
     }
 }
 if ($hasOtherNodeType) {
     foreach ($otherNodeArray as $otherNode) {
         if (!in_array($otherNode['parent_node_id'], $noAddAssignmentList)) {
             $newVersion->assignToNode($otherNode['parent_node_id'], $otherNode['is_main']);
         }
     }
 }
 if ($hasLDAPNodeType) {
     foreach ($newLDAPNodeArray as $newLDAPNode) {
         if (!in_array($newLDAPNode['parent_node_id'], $noAddAssignmentList)) {
             $newVersion->assignToNode($newLDAPNode['parent_node_id'], $newLDAPNode['is_main']);
         }
         $assignment = eZNodeAssignment::fetch($contentObject->attribute('id'), $newVersionNr, $newLDAPNode['parent_node_id']);
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:ldapusermanage.php

示例2: checkNodeActions


//.........这里部分代码省略.........
                    continue;

                if( $node->childrenCount( false ) > 0 )
                    $hasChildren = true;

                unset( $assignment );
            }

            if ( $hasChildren )
            {
                // We need user confirmation if at least one node we want to remove assignment for contains children.
                // Aactual removal is done in content/removeassignment in this case.
                $http->setSessionVariable( 'AssignmentRemoveData',
                                           array( 'remove_list'   => $assignmentsIDs,
                                                  'object_id'     => $objectID,
                                                  'edit_version'  => $versionInt,
                                                  'edit_language' => $editLanguage,
                                                  'from_language' => $fromLanguage ) );
                $module->redirectToView( 'removeassignment' );
                return eZModule::HOOK_STATUS_CANCEL_RUN;

            }
            else
            {
                // Just remove all the selected locations.
                $mainNodeChanged = false;
                $db = eZDB::instance();
                $db->begin();
                foreach ( $assignments as $assignment )
                {
                    $assignmentID = $assignment->attribute( 'id' );
                    if ( $assignment->attribute( 'is_main' ) )
                        $mainNodeChanged = true;
                    eZNodeAssignment::removeByID( $assignmentID );
                }
                if ( $mainNodeChanged )
                    eZNodeAssignment::setNewMainAssignment( $objectID, $versionInt );
                $db->commit();
                unset( $mainNodeChanged );
            }
            unset( $assignmentsIDs, $assignments );

        }
        else
        {
            eZDebug::writeNotice( 'No nodes to remove selected' );
        }
    }

    if ( $module->isCurrentAction( 'MoveNode' ) )
    {
        $objectID = $object->attribute( 'id' );
        if ( $http->hasPostVariable( 'MoveNodeID' ) )
        {
            $fromNodeID = $http->postVariable( 'MoveNodeID' ); //$sourceNodeID[0];
            $oldAssignmentParentID = $fromNodeID;
            $fromNodeAssignment = eZNodeAssignment::fetch( $objectID, $version->attribute( 'version' ), $fromNodeID );
            $publishParentNodeID = $fromNodeAssignment->attribute( 'parent_node' );
            if ( $publishParentNodeID > 1 )
            {
                if( $fromNodeAssignment->attribute( 'from_node_id' ) != 0 )
                {
                    $fromNodeID = $fromNodeAssignment->attribute( 'from_node_id' );
                    $oldAssignmentParentID = $fromNodeAssignment->attribute( 'parent_node' );
                }
开发者ID:nottavi,项目名称:ezpublish,代码行数:66,代码来源:node_edit.php

示例3: removeNodeAssignments

 /**
  * Removes previously selected, now unselected assignments.
  * 
  * This hook is run at "post_store" time.
  *
  * @param mixed  $module                  Is eZModule.
  * @param mixed  $class                   Is eZContentClass.
  * @param mixed  $object                  Is eZContentObject.
  * @param mixed  $version                 Is eZContentObjectVersion.
  * @param mixed  $contentObjectAttributes Is eZContentObjectAttribute.
  * @param string $editVersion             Number as String.
  * @param string $editLanguage            E.g. eng-GB.
  * @param mixed  $fromLanguage            Or false.
  * @param mixed  &$validation             Array.
  * 
  * @return int eZModule::HOOK_STATUS_CANCEL_RUN
  */
 public function removeNodeAssignments($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, &$validation)
 {
     $http = eZHTTPTool::instance();
     if (!$http->hasPostVariable('ymcNodeAssignmentsPool')) {
         return eZModule::HOOK_STATUS_OK;
     }
     $ymcActiveNodeAssignmentsPool = $http->postVariable('ymcActiveNodeAssignmentsPool');
     $ymcNodeAssignmentsPool = $http->postVariable('ymcNodeAssignmentsPool');
     if (!is_array($ymcActiveNodeAssignmentsPool)) {
         $ymcActiveNodeAssignmentsPool = array();
     }
     if (!is_array($ymcNodeAssignmentsPool)) {
         $ymcNodeAssignmentsPool = array();
     }
     $selected = array();
     foreach ($ymcNodeAssignmentsPool as $ymcAllNodeAssignment) {
         if ((int) $ymcAllNodeAssignment > 0 and !in_array($ymcAllNodeAssignment, $ymcActiveNodeAssignmentsPool)) {
             $selected[] = (int) $ymcAllNodeAssignment;
         }
     }
     $objectID = $object->attribute('id');
     $versionInt = $version->attribute('version');
     $hasChildren = false;
     $assignmentsIDs = array();
     $assignments = array();
     // Determine if at least one node of ones we remove assignments for has children.
     foreach ($selected as $parentNodeID) {
         $assignment = eZNodeAssignment::fetch($objectID, $versionInt, $parentNodeID);
         if (!$assignment) {
             eZDebug::writeWarning("[ymcEdit] No assignment found for object {$objectID} version {$versionInt},\n                                       parent node {$parentNodeID}");
             continue;
         }
         $assignmentID = $assignment->attribute('id');
         $assignmentsIDs[] = $assignmentID;
         $assignments[] =& $assignment;
         $node =& $assignment->attribute('node');
         if (!$node) {
             continue;
         }
         if ($node->childrenCount(false) > 0) {
             $hasChildren = true;
         }
         unset($assignment);
     }
     if ($hasChildren) {
         // We need user confirmation if at least one node we want to
         // remove assignment for contains children.  Aactual removal is
         // done in content/removeassignment in this case.
         $http->setSessionVariable('AssignmentRemoveData', array('remove_list' => $assignmentsIDs, 'object_id' => $objectID, 'edit_version' => $versionInt, 'edit_language' => $editLanguage, 'from_language' => $fromLanguage));
         $module->redirectToView('removeassignment');
         return eZModule::HOOK_STATUS_CANCEL_RUN;
     } else {
         // Just remove all the selected locations.
         $mainNodeChanged = false;
         $db = eZDB::instance();
         $db->begin();
         foreach ($assignments as $assignment) {
             $assignmentID = $assignment->attribute('id');
             if ($assignment->attribute('is_main')) {
                 $mainNodeChanged = true;
             }
             eZNodeAssignment::removeByID($assignmentID);
         }
         if ($mainNodeChanged) {
             eZNodeAssignment::setNewMainAssignment($objectID, $versionInt);
         }
         $db->commit();
         unset($mainNodeChanged);
     }
     unset($assignmentsIDs, $assignments);
 }
开发者ID:kmajkowski,项目名称:ymc-ezp-datatypes,代码行数:88,代码来源:ymc_edit_hooks.php


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