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


PHP eZNodeAssignment::fetchForObject方法代码示例

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


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

示例1: removeNodes

 /**
  * Removes nodes
  *
  * This function does not check about permissions, this is the responsibility of the caller!
  *
  * @param array $removeNodeIdList Array of Node ID to remove
  *
  * @return array An array with operation status, always true
  */
 public static function removeNodes(array $removeNodeIdList)
 {
     $mainNodeChanged = array();
     $nodeAssignmentIdList = array();
     $objectIdList = array();
     $db = eZDB::instance();
     $db->begin();
     foreach ($removeNodeIdList as $nodeId) {
         $node = eZContentObjectTreeNode::fetch($nodeId);
         $objectId = $node->attribute('contentobject_id');
         foreach (eZNodeAssignment::fetchForObject($objectId, eZContentObject::fetch($objectId)->attribute('current_version'), 0, false) as $nodeAssignmentKey => $nodeAssignment) {
             if ($nodeAssignment['parent_node'] == $node->attribute('parent_node_id')) {
                 $nodeAssignmentIdList[$nodeAssignment['id']] = 1;
             }
         }
         if ($nodeId == $node->attribute('main_node_id')) {
             $mainNodeChanged[$objectId] = 1;
         }
         $node->removeThis();
         if (!isset($objectIdList[$objectId])) {
             $objectIdList[$objectId] = eZContentObject::fetch($objectId);
         }
     }
     eZNodeAssignment::purgeByID(array_keys($nodeAssignmentIdList));
     foreach (array_keys($mainNodeChanged) as $objectId) {
         $allNodes = $objectIdList[$objectId]->assignedNodes();
         // Registering node that will be promoted as 'main'
         $mainNodeChanged[$objectId] = $allNodes[0];
         eZContentObjectTreeNode::updateMainNodeID($allNodes[0]->attribute('node_id'), $objectId, false, $allNodes[0]->attribute('parent_node_id'));
     }
     // Give other search engines that the default one a chance to reindex
     // when removing locations.
     if (!eZSearch::getEngine() instanceof eZSearchEngine) {
         foreach (array_keys($objectIdList) as $objectId) {
             eZContentOperationCollection::registerSearchObject($objectId);
         }
     }
     $db->commit();
     //call appropriate method from search engine
     eZSearch::removeNodes($removeNodeIdList);
     $userClassIdList = eZUser::contentClassIDs();
     foreach ($objectIdList as $objectId => $object) {
         eZContentCacheManager::clearObjectViewCacheIfNeeded($objectId);
         // clear user policy cache if this was a user object
         if (in_array($object->attribute('contentclass_id'), $userClassIdList)) {
             eZUser::purgeUserCacheByUserId($object->attribute('id'));
         }
     }
     // we don't clear template block cache here since it's cleared in eZContentObjectTreeNode::removeNode()
     return array('status' => true);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:60,代码来源:ezcontentoperationcollection.php

示例2: storeNodeAssignments

function storeNodeAssignments( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage )
{
    $http = eZHTTPTool::instance();

    // If the object has been previously published we do not allow node assignment operations
    if ( $object->attribute( 'status' ) != eZContentObject::STATUS_DRAFT )
    {
        return;
    }

    // If node assignment handling is diabled we return immedieately
    $useNodeAssigments = true;
    if ( $http->hasPostVariable( 'UseNodeAssigments' ) )
        $useNodeAssigments = (bool)$http->postVariable( 'UseNodeAssigments' );

    if ( !$useNodeAssigments )
        return;

    $setPlacementNodeIDArray = array();
    if ( $http->hasPostVariable( 'SetPlacementNodeIDArray' ) )
        $setPlacementNodeIDArray = $http->postVariable( 'SetPlacementNodeIDArray' );

    // We will quit if some important POST variables are missing
    if ( !$http->hasPostVariable( 'MainNodeID' ) and
         !$http->hasPostVariable( 'SortOrderMap' ) and
         !$http->hasPostVariable( 'SortFieldMap' ) )
        return;

    $mainNodeID = false;
    if ( $http->hasPostVariable( 'MainNodeID' ) )
    {
        $mainNodeID = trim( $http->postVariable( 'MainNodeID' ) );
        if ( strlen( $mainNodeID ) == 0 )
            return;
    }

    // Check if dropdown placement is used
    if ( $http->hasPostVariable( 'MainAssignmentElementNumber' ) )
    {
        $elementNumber = $http->postVariable( 'MainAssignmentElementNumber' );

        $mainNodeID = $setPlacementNodeIDArray[$elementNumber];
    }

    $nodeID = eZContentObjectTreeNode::findNode( $mainNodeID, $object->attribute('id') );
    eZDebugSetting::writeDebug( 'kernel-content-edit', $nodeID, 'nodeID' );
//    $object->setAttribute( 'main_node_id', $nodeID );
    $nodeAssignments = eZNodeAssignment::fetchForObject( $object->attribute( 'id' ), $version->attribute( 'version' ) ) ;
    eZDebugSetting::writeDebug( 'kernel-content-edit', $mainNodeID, "mainNodeID" );


    $setPlacementNodeIDArray = array_unique( $setPlacementNodeIDArray );
    eZDebugSetting::writeDebug( 'kernel-content-edit', $setPlacementNodeIDArray, '$setPlacementNodeIDArray' );
    $remoteIDFieldMap = array();
    if ( $http->hasPostVariable( 'SetRemoteIDFieldMap' ) )
        $remoteIDFieldMap = $http->postVariable( 'SetRemoteIDFieldMap' );
    $remoteIDOrderMap = array();
    if ( $http->hasPostVariable( 'SetRemoteIDOrderMap' ) )
        $remoteIDOrderMap = $http->postVariable( 'SetRemoteIDOrderMap' );

    $db = eZDB::instance();
    $db->begin();
    if ( count( $setPlacementNodeIDArray ) > 0 )
    {
        foreach ( $setPlacementNodeIDArray as $setPlacementRemoteID => $setPlacementNodeID )
        {
            $hasAssignment = false;
            foreach ( $nodeAssignments as $nodeAssignment )
            {
                if ( $nodeAssignment->attribute( 'remote_id' ) == $setPlacementRemoteID )
                {
                    eZDebugSetting::writeDebug( 'kernel-content-edit', "Remote ID $setPlacementRemoteID already in use for node " . $nodeAssignment->attribute( 'parent_node' ), 'node_edit' );
                    if ( isset( $remoteIDFieldMap[$setPlacementRemoteID] ) )
                        $nodeAssignment->setAttribute( 'sort_field',  $remoteIDFieldMap[$setPlacementRemoteID] );
                    if ( isset( $remoteIDOrderMap[$setPlacementRemoteID] ) )
                        $nodeAssignment->setAttribute( 'sort_order', $remoteIDOrderMap[$setPlacementRemoteID] );
                    $nodeAssignment->setAttribute( 'parent_node', $setPlacementNodeID );
                    $nodeAssignment->sync();
                    $hasAssignment = true;
                    break;
                }
            }
            if ( !$hasAssignment )
            {
                eZDebugSetting::writeDebug( 'kernel-content-edit', "Adding to node $setPlacementNodeID", 'node_edit' );
                $sortField = null;
                $sortOrder = null;
                if ( isset( $remoteIDFieldMap[$setPlacementRemoteID] ) )
                    $sortField = $remoteIDFieldMap[$setPlacementRemoteID];
                if ( isset( $remoteIDOrderMap[$setPlacementRemoteID] ) )
                    $sortOrder = $remoteIDOrderMap[$setPlacementRemoteID];
                $version->assignToNode( $setPlacementNodeID, 0, 0, $sortField, $sortOrder, $setPlacementRemoteID );
            }
        }
        $nodeAssignments = eZNodeAssignment::fetchForObject( $object->attribute( 'id' ), $version->attribute( 'version' ) );
    }

    $sortOrderMap = false;
    if ( $http->hasPostVariable( 'SortOrderMap' ) )
        $sortOrderMap = $http->postVariable( 'SortOrderMap' );
//.........这里部分代码省略.........
开发者ID:nottavi,项目名称:ezpublish,代码行数:101,代码来源:node_edit.php

示例3: array

 $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']) {
                     $append = true;
                     break;
                 }
             }
             if ($append) {
                 $ignoreNodesSelect[] = $element['node_id'];
开发者ID:heliopsis,项目名称:ezpublish-legacy,代码行数:31,代码来源:action.php

示例4: getParentListObject

 /**
  * @return get the CjwNewsletterList Object of the parent nl list node
  */
 function getParentListObject()
 {
     // in draft modus no node is available only node assignment
     $nodeAssignements = eZNodeAssignment::fetchForObject($this->attribute('contentobject_id'), $this->attribute('contentobject_attribute_version'), 1, true);
     if (isset($nodeAssignements[0]) && is_object($nodeAssignements[0])) {
         $parentListNodeId = $nodeAssignements[0]->attribute('parent_node');
         $parentListNode = eZContentObjectTreeNode::fetch($parentListNodeId);
     }
     if (is_object($parentListNode) && $parentListNode->attribute('class_identifier') == 'cjw_newsletter_list') {
         $parentListAttributeDataMap = $parentListNode->attribute('data_map');
         if (isset($parentListAttributeDataMap['newsletter_list'])) {
             $parentListAttribute = $parentListAttributeDataMap['newsletter_list'];
             if (!is_object($parentListAttribute)) {
                 return 0;
             }
             $parentListObject = $parentListAttribute->attribute('content');
             // CjwNewsletterListObject
             if (!is_object($parentListObject)) {
                 return 0;
             } else {
                 return $parentListObject;
             }
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:32,代码来源:cjwnewsletterlistvirtual.php

示例5: checkAccess

 function checkAccess($functionName, $originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false)
 {
     $classID = $originalClassID;
     $user = eZUser::currentUser();
     $userID = $user->attribute('contentobject_id');
     // Fetch the ID of the language if we get a string with a language code
     // e.g. 'eng-GB'
     $originalLanguage = $language;
     if (is_string($language) && strlen($language) > 0) {
         $language = eZContentLanguage::idByLocale($language);
     } else {
         $language = false;
     }
     // This will be filled in with the available languages of the object
     // if a Language check is performed.
     $languageList = false;
     // This will be filled if parent object is needed.
     $parentObject = false;
     $origFunctionName = $functionName;
     // The 'move' function simply reuses 'edit' for generic access
     // but adds another top-level check below
     // The original function is still available in $origFunctionName
     if ($functionName == 'move') {
         $functionName = 'edit';
     }
     // Manage locations depends if it's removal or not.
     if ($functionName == 'can_add_location' || $functionName == 'can_remove_location') {
         $functionName = 'manage_locations';
     }
     $accessResult = $user->hasAccessTo('content', $functionName);
     $accessWord = $accessResult['accessWord'];
     if ($origFunctionName == 'can_remove_location') {
         if ($this->ParentNodeID <= 1) {
             return 0;
         }
         $currentNode = eZContentObjectTreeNode::fetch($this->ParentNodeID);
         if (!$currentNode instanceof eZContentObjectTreeNode) {
             return 0;
         }
         $contentObject = $currentNode->attribute('object');
     } else {
         $currentNode = $this;
         $contentObject = $this->attribute('object');
     }
     /*
     // Uncomment this part if 'create' permissions should become implied 'edit'.
     // Merges in 'create' policies with 'edit'
     if ( $functionName == 'edit' &&
          !in_array( $accessWord, array( 'yes', 'no' ) ) )
     {
         // Add in create policies.
         $accessExtraResult = $user->hasAccessTo( 'content', 'create' );
         if ( $accessExtraResult['accessWord'] != 'no' )
         {
             $accessWord = $accessExtraResult['accessWord'];
             if ( isset( $accessExtraResult['policies'] ) )
             {
                 $accessResult['policies'] = array_merge( $accessResult['policies'],
                                                          $accessExtraResult['policies'] );
             }
             if ( isset( $accessExtraResult['accessList'] ) )
             {
                 $accessResult['accessList'] = array_merge( $accessResult['accessList'],
                                                            $accessExtraResult['accessList'] );
             }
         }
     }
     */
     if ($origFunctionName == 'remove' or $origFunctionName == 'move' or $origFunctionName == 'can_remove_location') {
         // We do not allow these actions on top-level nodes
         // - remove
         // - move
         if ($this->ParentNodeID <= 1) {
             return 0;
         }
     }
     if ($classID === false) {
         $classID = $contentObject->attribute('contentclass_id');
     }
     if ($accessWord == 'yes') {
         return 1;
     } else {
         if ($accessWord == 'no') {
             if ($functionName == 'edit') {
                 // Check if we have 'create' access under the main parent
                 $object = $currentNode->object();
                 if ($object && $object->attribute('current_version') == 1 && !$object->attribute('status')) {
                     $mainNode = eZNodeAssignment::fetchForObject($object->attribute('id'), $object->attribute('current_version'));
                     $parentObj = $mainNode[0]->attribute('parent_contentobject');
                     if ($parentObj instanceof eZContentObject) {
                         $result = $parentObj->checkAccess('create', $object->attribute('contentclass_id'), $parentObj->attribute('contentclass_id'), false, $originalLanguage);
                         return $result;
                     } else {
                         eZDebug::writeError("Error retrieving parent object of main node for object id: " . $object->attribute('id'), __METHOD__);
                     }
                 }
             }
             return 0;
         } else {
             $policies = $accessResult['policies'];
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezcontentobjecttreenode.php

示例6: execute

    function execute( $xmlNode )
    {
        $xmlObjectID = $xmlNode->getAttribute( 'contentObject' );
        $xmlParentNodeID = $xmlNode->getAttribute( 'addToNode' );
        $setReferenceID = $xmlNode->getAttribute( 'setReference' );
        $priority = $xmlNode->getAttribute( 'priority' );

        $objectID = $this->getReferenceID( $xmlObjectID );
        $parentNodeID = $this->getReferenceID( $xmlParentNodeID );

        if ( !$objectID )
        {
            $this->writeMessage( "\tNo object defined.", 'error' );
            return false;
        }
        if ( !$parentNodeID )
        {
            $this->writeMessage( "\tNo location defined.", 'error' );
            return false;
        }

        $object = eZContentObject::fetch( $objectID );
        if ( !$object )
        {
            $this->writeMessage( "\tObject not found.", 'error' );
            return false;
        }

        $parentNode =  eZContentObjectTreeNode::fetch( $parentNodeID );
        if ( !$parentNode )
        {
            $this->writeMessage( "\tparent node not found.", 'error' );
            return false;
        }
        $node = $object->attribute( 'main_node' );

        $nodeAssignmentList = eZNodeAssignment::fetchForObject( $objectID, $object->attribute( 'current_version' ), 0, false );
        $assignedNodes = $object->assignedNodes();

        $parentNodeIDArray = array();
        $setMainNode = false;
        $hasMainNode = false;
        foreach ( $assignedNodes as $assignedNode )
        {
            if ( $assignedNode->attribute( 'is_main' ) )
                $hasMainNode = true;
            $append = false;
            foreach ( $nodeAssignmentList as $nodeAssignment )
            {
                if ( $nodeAssignment['parent_node'] == $assignedNode->attribute( 'parent_node_id' ) )
                {
                    $append = true;
                    break;
                }
            }
            if ( $append )
            {
                $parentNodeIDArray[] = $assignedNode->attribute( 'parent_node_id' );
            }
        }
        if ( !$hasMainNode )
            $setMainNode = true;

        $mainNodeID = $parentNode->attribute( 'main_node_id' );
        $objectName = $object->attribute( 'name' );

        $db = eZDB::instance();
        $db->begin();
        $locationAdded = false;
        $destNode = null;
        if ( !in_array( $parentNodeID, $parentNodeIDArray ) )
        {
            $parentNodeObject = $parentNode->attribute( 'object' );

            $insertedNode = $object->addLocation( $parentNodeID, true );

            // Now set is as published and fix main_node_id
            $insertedNode->setAttribute( 'contentobject_is_published', 1 );
            $insertedNode->setAttribute( 'main_node_id', $node->attribute( 'main_node_id' ) );
            $insertedNode->setAttribute( 'contentobject_version', $node->attribute( 'contentobject_version' ) );
            // Make sure the url alias is set updated.
            $insertedNode->updateSubTreePath();
            $insertedNode->sync();

            $locationAdded = true;
        }
        if ( $locationAdded )
        {
            $ini = eZINI::instance();
            $userClassID = $ini->variable( "UserSettings", "UserClassID" );
            if ( $object->attribute( 'contentclass_id' ) == $userClassID )
            {
                eZUser::cleanupCache();
            }
            $this->writeMessage( "\tAdded location of " . $object->attribute( 'name' ) . "  to Node $parentNodeID", 'notice' );

            $destNode = $insertedNode;
        }
        else
        {
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezaddlocation.php

示例7: array

    if (!$discardConfirm) {
        $isConfirmed = true;
    }
}
if ($isConfirmed) {
    $object = eZContentObject::fetch($objectID);
    if ($object === null) {
        return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
    }
    $versionObject = $object->version($version);
    if (is_object($versionObject) and in_array($versionObject->attribute('status'), array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT))) {
        if (!$object->attribute('can_edit')) {
            // Check if it is a first created version of an object.
            // If so, then edit is allowed if we have an access to the 'create' function.
            if ($object->attribute('current_version') == 1 && !$object->attribute('status')) {
                $mainNode = eZNodeAssignment::fetchForObject($object->attribute('id'), 1);
                $parentObj = $mainNode[0]->attribute('parent_contentobject');
                $allowEdit = $parentObj->checkAccess('create', $object->attribute('contentclass_id'), $parentObj->attribute('contentclass_id'));
            } else {
                $allowEdit = false;
            }
            if (!$allowEdit) {
                return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array('AccessList' => $object->accessList('edit')));
            }
        }
        $versionCount = $object->getVersionCount();
        $nodeID = $versionCount == 1 ? $versionObject->attribute('main_parent_node_id') : $object->attribute('main_node_id');
        $versionObject->removeThis();
    }
    $hasRedirected = false;
    if ($http->hasSessionVariable('RedirectIfDiscarded')) {
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:removeeditversion.php

示例8: execute

 function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $objectId = $parameters['object_id'];
     $object = eZContentObject::fetch($objectId);
     $subtreeNodeID = $event->attribute('target_subtree');
     $subtreeNode = eZContentObjectTreeNode::fetch($subtreeNodeID);
     eZDebug::writeDebug("Event begins execution for object {$objectId}, subtree {$subtreeNodeID}", __METHOD__);
     if ($object != null && $subtreeNode != null) {
         $is_child = false;
         $locations = $object->assignedNodes();
         if ($locations == null) {
             // pre-creation event: obj has no node on its own, but a putative parent
             //eZDebug::writeDebug( 'Obj node is new!', __METHOD__ );
             $locations = eZNodeAssignment::fetchForObject($objectId, $object->attribute("current_version"));
             foreach ($locations as $key => $location) {
                 $locations[$key] = $location->getParentNode();
             }
         }
         foreach ($locations as $node) {
             $subtreeNodePath = $node->pathArray();
             //eZDebug::writeDebug( 'Testing if obj node '.$node->NodeID.' is child of : ' . $subtreeNodeID, __METHOD__ );
             if (in_array($subtreeNodeID, $subtreeNodePath)) {
                 eZDebug::writeDebug('Found that obj node ' . $node->NodeID . ' is child of node ' . $subtreeNodeID, __METHOD__);
                 $is_child = true;
                 break;
             }
         }
         if ($is_child) {
             $workflowToRun = $event->attribute('target_workflow');
             $user = eZUser::currentUser();
             $userID = $user->id();
             $processParameters = $process->attribute('parameter_list');
             // code copy+pasted from ez multoplexer worflow...
             $childParameters = array_merge($processParameters, array('workflow_id' => $workflowToRun, 'user_id' => $userID, 'parent_process_id' => $process->attribute('id')));
             $childProcessKey = eZWorkflowProcess::createKey($childParameters);
             $childProcessArray = eZWorkflowProcess::fetchListByKey($childProcessKey);
             $childProcess =& $childProcessArray[0];
             if ($childProcess == null) {
                 $childProcess = eZWorkflowProcess::create($childProcessKey, $childParameters);
                 $childProcess->store();
             }
             $workflow = eZWorkflow::fetch($childProcess->attribute("workflow_id"));
             $workflowEvent = null;
             if ($childProcess->attribute("event_id") != 0) {
                 $workflowEvent = eZWorkflowEvent::fetch($childProcess->attribute("event_id"));
             }
             $childStatus = $childProcess->run($workflow, $workflowEvent, $eventLog);
             $childProcess->store();
             if ($childStatus == eZWorkflow::STATUS_DEFERRED_TO_CRON) {
                 $this->setActivationDate($childProcess->attribute('activation_date'));
                 $childProcess->setAttribute("status", eZWorkflow::STATUS_WAITING_PARENT);
                 $childProcess->store();
                 return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
             } else {
                 if ($childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE) {
                     $process->Template =& $childProcess->Template;
                     return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
                 } else {
                     if ($childStatus == eZWorkflow::STATUS_REDIRECT) {
                         $process->RedirectUrl =& $childProcess->RedirectUrl;
                         return eZWorkflowType::STATUS_REDIRECT_REPEAT;
                     } else {
                         if ($childStatus == eZWorkflow::STATUS_DONE) {
                             $childProcess->removeThis();
                             return eZWorkflowType::STATUS_ACCEPTED;
                         } else {
                             if ($childStatus == eZWorkflow::STATUS_CANCELLED || $childStatus == eZWorkflow::STATUS_FAILED) {
                                 $childProcess->removeThis();
                                 return eZWorkflowType::STATUS_REJECTED;
                             }
                         }
                     }
                 }
             }
             return $childProcess->attribute('event_status');
         }
         return eZWorkflowType::STATUS_ACCEPTED;
     } else {
         eZDebug::writeError("Event triggered for inexisting object ({$objectId}) or subtree ({$subtreeNodeID})", __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
 }
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:83,代码来源:subtreemultiplexertype.php

示例9: nodeAssignments

 function nodeAssignments()
 {
     return eZNodeAssignment::fetchForObject( $this->attribute( 'contentobject_id' ), $this->attribute( 'version' ) );
 }
开发者ID:ataxel,项目名称:tp,代码行数:4,代码来源:ezcontentobjectversion.php

示例10: execute

 /**
  * Workflow Event Type execute method
  */
 function execute($process, $event)
 {
     /**
      * Fetch workflow process parameters
      */
     $parameters = $process->attribute('parameter_list');
     $objectID = $parameters['object_id'];
     self::writeDebug('writeNotice', "Start '" . self::WORKFLOW_TYPE_STRING . "' workflow event execute method");
     $ini = eZINI::instance('site.ini');
     $bcUserRegisterUserPlacementINI = eZINI::instance('bcuserregisteruserplacement.ini');
     /**
      * Reading the default user class id as it is required to check that we only
      * perform the workflow event on user class content and not other class of objects
      */
     $defaultUserClassID = $ini->hasVariable('UserSettings', 'UserClassID') == true ? $ini->variable('UserSettings', 'UserClassID') : false;
     /**
      * Reading the default user placement nodeID as it is the default location where new users are stored
      */
     $userGroupID = $ini->hasVariable('UserSettings', 'DefaultUserPlacement') == true ? $ini->variable('UserSettings', 'DefaultUserPlacement') : 0;
     self::writeDebug('writeNotice', "User class id is: " . $defaultUserClassID . ' Default user group is: ' . $userGroupID);
     $userGroups = $bcUserRegisterUserPlacementINI->hasVariable('BCUserRegisterUserPlacement', 'MoveToUserGroupId') == true ? $bcUserRegisterUserPlacementINI->variable('BCUserRegisterUserPlacement', 'MoveToUserGroupId') : array();
     $objectSelectionAttributeIdentifier = $bcUserRegisterUserPlacementINI->hasVariable('BCUserRegisterUserPlacement', 'UserAttributeSelectionIdentifier') == true ? $bcUserRegisterUserPlacementINI->variable('BCUserRegisterUserPlacement', 'UserAttributeSelectionIdentifier') : false;
     $move = $bcUserRegisterUserPlacementINI->hasVariable('BCUserRegisterUserPlacement', 'Move') == true && strtolower($bcUserRegisterUserPlacementINI->variable('BCUserRegisterUserPlacement', 'Move')) == 'enabled' ? true : false;
     $setMainNode = $bcUserRegisterUserPlacementINI->hasVariable('BCUserRegisterUserPlacement', 'SetMainNode') == true && strtolower($bcUserRegisterUserPlacementINI->variable('BCUserRegisterUserPlacement', 'SetMainNode')) == 'enabled' ? true : false;
     $selectedNodeID = false;
     // Fetch content object from the workflow process provided object_id
     $object = eZContentObject::fetch($objectID);
     // Fetch content object attributes required
     $objectName = $object->attribute('name');
     self::writeDebug('writeNotice', "Object name: " . $objectName);
     $objectContentClass = $object->attribute('class_name');
     self::writeDebug('writeNotice', "Content Class is: " . $objectContentClass);
     $objectContentClassID = $object->attribute('contentclass_id');
     self::writeDebug('writeNotice', "Default user class id is: " . $defaultUserClassID . ". This object class id is: " . $objectContentClassID);
     /**
      * Test if content object class ID matches ini settings default user content object class ID
      * Only perform workflow event operations on content objects of the correct content class
      */
     if ($objectContentClassID == $defaultUserClassID) {
         // Fetch content object attributes needed
         $assignedNodes = $object->attribute('assigned_nodes');
         $objectDataMap = $object->attribute('data_map');
         $objectNodeAssignments = eZNodeAssignment::fetchForObject($objectID, $object->attribute('current_version'), 0, false);
         //$objectNodeAssignments = $object->attribute( 'assigned_nodes' );
         // Get the selection content
         $objectSelectionAttributeContent = $objectDataMap[$objectSelectionAttributeIdentifier]->attribute('content');
         $objectSelectionAttributeContentString = implode(',', $objectSelectionAttributeContent);
         self::writeDebug('writeNotice', "User object attribute " . $objectSelectionAttributeIdentifier . " content is set to: " . $objectSelectionAttributeContentString);
         /**
          * Test to ensure that object selection attribute content is greater than 0 (no selection) or
          * that object selection attribute count is less than the count of userGroups (defined in ini settings)
          */
         if ($objectSelectionAttributeContent > 0 || $objectSelectionAttributeContent < count($userGroups)) {
             // Set userGroupID from ini defined user groups based on content object selection attribute content
             $userGroupID = $userGroups[$objectSelectionAttributeContentString];
             $selectedNodeID = $userGroupID;
         }
         $parentNodeIDs = array();
         $ourNode = false;
         /**
          * Iterate over object assigned nodes and object node assignements
          * test for parent node id matches and build array of parent_node_ids
          * test for user content object selection attribute content selected node id
          * and set node to move based on match
          */
         foreach ($assignedNodes as $assignedNode) {
             $append = false;
             foreach ($objectNodeAssignments as $nodeAssignment) {
                 if ($nodeAssignment['parent_node'] == $assignedNode->attribute('parent_node_id')) {
                     $append = true;
                     break;
                 }
             }
             if ($append) {
                 $parentNodeIDs[] = $assignedNode->attribute('parent_node_id');
             }
             if ($assignedNode->attribute('parent_node_id') == $selectedNodeID) {
                 $ourNode = $assignedNode;
             }
         }
         /**
          * Test if we are to move the current main node to the selected location
          */
         if ($move) {
             self::writeDebug('writeDebug', 'Moving tactic');
             if (!is_object($ourNode)) {
                 self::writeDebug('writeDebug', 'Node not found, so moving existing main node...');
                 eZContentObjectTreeNodeOperations::move($object->attribute('main_node_id'), $selectedNodeID);
             }
         } else {
             /**
              * Create a new node location assignment
              */
             self::writeDebug('writeDebug', 'New node tactic');
             if (!is_object($ourNode)) {
                 self::writeDebug('writeDebug', 'Node not found, so creating a new one ...');
                 $parentNode = eZContentObjectTreeNode::fetch($selectedNodeID);
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:bcuserregisteruserplacement,代码行数:101,代码来源:bcuserregisteruserplacementtype.php

示例11: removeObject

 /**
  * Removes content object
  *
  * @param eZContentObject $object
  * @return bool true if object was removed, otherwise false
  */
 public function removeObject(eZContentObject $object)
 {
     $objectName = $object->attribute('name');
     $this->debug('Removing "' . $objectName . '" object (class: ' . $object->attribute('class_name') . ') with remote ID ' . $object->attribute('remote_id'));
     $this->db->begin();
     $object->resetDataMap();
     eZContentObject::clearCache($object->attribute('id'));
     if (is_null($object->attribute('main_node'))) {
         $object->purge();
         $this->db->commit();
         $this->debug('[Removed] "' . $objectName . '"');
         return true;
     } else {
         $removeNodeIDs = array($object->attribute('main_node')->attribute('node_id'));
         $nodeAssigments = eZNodeAssignment::fetchForObject($object->attribute('id'));
         foreach ($nodeAssigments as $assigment) {
             $node = $assigment->attribute('node');
             if ($node instanceof eZContentObjectTreeNode) {
                 $removeNodeIDs[] = $node->attribute('node_id');
             }
         }
         $removeNodeIDs = array_unique($removeNodeIDs);
         $info = eZContentObjectTreeNode::subtreeRemovalInformation($removeNodeIDs);
         foreach ($info['delete_list'] as $deleteItem) {
             $node = $deleteItem['node'];
             if ($node === null) {
                 continue;
             }
             if ($deleteItem['can_remove']) {
                 eZContentObjectTreeNode::removeSubtrees(array($node->attribute('node_id')), false);
                 $this->debug('[Removed] "' . $objectName . '", Node ID: ' . $node->attribute('node_id'), array('red'));
             }
         }
         $this->db->commit();
     }
     return false;
 }
开发者ID:nxc,项目名称:nxc_powercontent,代码行数:43,代码来源:powercontent.php


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