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


PHP eZOperationHandler类代码示例

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


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

示例1: execute

 function execute($process, $event)
 {
     // get object being published
     $parameters = $process->attribute('parameter_list');
     $objectID = $parameters['object_id'];
     eZDebug::writeDebug('Update object state for object: ' . $objectID);
     $object = eZContentObject::fetch($objectID);
     $state_before = $event->attribute('state_before');
     $state_after = $event->attribute('state_after');
     if ($object == null) {
         eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     if ($state_before == null || $state_after == null) {
         eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     $currentStateIDArray = $object->attribute('state_id_array');
     if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
         $canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
         if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
             eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
         } else {
             eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
             if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
                 $operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
             } else {
                 eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
             }
         }
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:33,代码来源:objectstateupdatetype.php

示例2: runOperation

 function runOperation(&$node)
 {
     $object = $node->attribute('object');
     $object_id = $object->attribute('id');
     $objectLocales = $object->attribute('available_languages');
     // If the alternative locale does not exist for object, create it
     if (!in_array($this->altLocale, $objectLocales)) {
         // The only translation is in locate to be removed - create a version in another locale first.
         echo "Copying the single translation in " . $this->remLocale . " to " . $this->altLocale . " so former could be removed.\n";
         $newVersion = $object->createNewVersionIn($this->altLocale, $this->remLocale, false, true, eZContentObjectVersion::STATUS_DRAFT);
         $publishResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object_id, 'version' => $newVersion->attribute('version')));
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
     }
     // Change objects main language to alternative language, if its current main language is to be removed.
     if ($object->attribute('initial_language_code') == $this->remLocale) {
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
         echo "Switching initial language to {$this->altLocale} so that " . $this->remLocale . " could be removed.\n";
         $updateResult = eZContentOperationCollection::updateInitialLanguage($object_id, $this->altLangID);
         $object->store();
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
     }
     // Now it should be safe to remove translation.
     return $object->removeTranslation($this->remLangID);
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:27,代码来源:noderemovetranslation.php

示例3: execute

 public function execute($process, $event)
 {
     $params = $process->attribute('parameter_list');
     $object_id = $params['object_id'];
     $object = eZContentObject::fetch($object_id);
     if (!is_object($object)) {
         eZDebug::writeError("Unable to fetch object: '{$object_id}'", __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     // current parent node(s)
     $parentNodeIds = $object->attribute('parent_nodes');
     $checkedObjs = array();
     foreach ($parentNodeIds as $parentNodeId) {
         //eZDebug::writeDebug( "Checking parent node: " . $parentNodeId, __METHOD__ );
         $parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
         $parentObj = $parentNode->attribute('object');
         if (!in_array($parentObj->attribute('id'), $checkedObjs)) {
             //eZDebug::writeDebug( "Checking all nodes of parent obj: " . $parentObj->attribute( 'id' ), __METHOD__ );
             foreach ($parentObj->attribute('assigned_nodes') as $node) {
                 if (!in_array($node->attribute('node_id'), $parentNodeIds)) {
                     //eZDebug::writeDebug( "Found a node which is not parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
                     // the current obj has no node which is children of the given node of one of its parent objects
                     $operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $object->attribute('main_node_id'), 'object_id' => $object->attribute('id'), 'select_node_id_array' => array($node->attribute('node_id'))), null, true);
                     if ($operationResult == null || $operationResult['status'] != true) {
                         eZDebug::writeError("Unable to add new location to object: " . $object->attribute('id'), __METHOD__);
                     }
                 } else {
                     //eZDebug::writeDebug( "Found a node which is already parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
                 }
             }
         }
         $checkedObjs[] = $parentObj->attribute('id');
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:35,代码来源:copynodetoallparentlocationstype.php

示例4: createUser

 /**
  * Creates a user with provided auth data
  *
  * @param array $authResult
  *
  * @return bool|eZUser
  */
 public static function createUser($authResult)
 {
     $ngConnectINI = eZINI::instance('ngconnect.ini');
     $siteINI = eZINI::instance('site.ini');
     $defaultUserPlacement = $ngConnectINI->variable('LoginMethod_' . $authResult['login_method'], 'DefaultUserPlacement');
     $placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
     if (!$placementNode instanceof eZContentObjectTreeNode) {
         $defaultUserPlacement = $siteINI->variable('UserSettings', 'DefaultUserPlacement');
         $placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
         if (!$placementNode instanceof eZContentObjectTreeNode) {
             return false;
         }
     }
     $contentClass = eZContentClass::fetch($siteINI->variable('UserSettings', 'UserClassID'));
     $userCreatorID = $siteINI->variable('UserSettings', 'UserCreatorID');
     $defaultSectionID = $siteINI->variable('UserSettings', 'DefaultSectionID');
     $db = eZDB::instance();
     $db->begin();
     $contentObject = $contentClass->instantiate($userCreatorID, $defaultSectionID);
     $contentObject->store();
     $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $placementNode->attribute('node_id'), 'is_main' => 1));
     $nodeAssignment->store();
     $currentTimeStamp = eZDateTime::currentTimeStamp();
     /** @var eZContentObjectVersion $version */
     $version = $contentObject->currentVersion();
     $version->setAttribute('modified', $currentTimeStamp);
     $version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
     $version->store();
     $dataMap = $version->dataMap();
     self::fillUserObject($version->dataMap(), $authResult);
     if (!isset($dataMap['user_account'])) {
         $db->rollback();
         return false;
     }
     $userLogin = 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'];
     $userPassword = (string) rand() . 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'] . (string) rand();
     $userExists = false;
     if (eZUser::requireUniqueEmail()) {
         $userExists = eZUser::fetchByEmail($authResult['email']) instanceof eZUser;
     }
     if (empty($authResult['email']) || $userExists) {
         $email = md5('ngconnect_' . $authResult['login_method'] . '_' . $authResult['id']) . '@localhost.local';
     } else {
         $email = $authResult['email'];
     }
     $user = new eZUser(array('contentobject_id' => $contentObject->attribute('id'), 'email' => $email, 'login' => $userLogin, 'password_hash' => md5("{$userLogin}\n{$userPassword}"), 'password_hash_type' => 1));
     $user->store();
     $userSetting = new eZUserSetting(array('is_enabled' => true, 'max_login' => 0, 'user_id' => $contentObject->attribute('id')));
     $userSetting->store();
     $dataMap['user_account']->setContent($user);
     $dataMap['user_account']->store();
     $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $version->attribute('version')));
     if (array_key_exists('status', $operationResult) && $operationResult['status'] == eZModuleOperationInfo::STATUS_CONTINUE) {
         $db->commit();
         return $user;
     }
     $db->rollback();
     return false;
 }
开发者ID:netgen,项目名称:ngconnect,代码行数:66,代码来源:ngconnectfunctions.php

示例5: sectionEditActionCheck

function sectionEditActionCheck( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
{
    if ( $module->isCurrentAction( 'SectionEdit' ) )
    {
        $http = eZHTTPTool::instance();
        if ( $http->hasPostVariable( 'SelectedSectionId' ) )
        {
            $selectedSectionID = (int) $http->postVariable( 'SelectedSectionId' );
            $selectedSection = eZSection::fetch( $selectedSectionID );
            if ( is_object( $selectedSection ) )
            {
                $currentUser = eZUser::currentUser();
                if ( $currentUser->canAssignSectionToObject( $selectedSectionID, $object ) )
                {
                    $db = eZDB::instance();
                    $db->begin();
                    $assignedNodes = $object->attribute( 'assigned_nodes' );
                    if ( count( $assignedNodes ) > 0 )
                    {
                        foreach ( $assignedNodes as $node )
                        {
                            if ( eZOperationHandler::operationIsAvailable( 'content_updatesection' ) )
                            {
                                $operationResult = eZOperationHandler::execute( 'content',
                                                                                'updatesection',
                                                                                array( 'node_id'             => $node->attribute( 'node_id' ),
                                                                                       'selected_section_id' => $selectedSectionID ),
                                                                                null,
                                                                                true );

                            }
                            else
                            {
                                eZContentOperationCollection::updateSection( $node->attribute( 'node_id' ), $selectedSectionID );
                            }
                        }
                    }
                    else
                    {
                        // If there are no assigned nodes we should update db for the current object.
                        $objectID = $object->attribute( 'id' );
                        $db->query( "UPDATE ezcontentobject SET section_id='$selectedSectionID' WHERE id = '$objectID'" );
                        $db->query( "UPDATE ezsearch_object_word_link SET section_id='$selectedSectionID' WHERE  contentobject_id = '$objectID'" );
                    }
                    $object->expireAllViewCache();
                    $db->commit();
                }
                else
                {
                    eZDebug::writeError( "You do not have permissions to assign the section <" . $selectedSection->attribute( 'name' ) .
                                         "> to the object <" . $object->attribute( 'name' ) . ">." );
                }
                $module->redirectToView( 'edit', array( $object->attribute( 'id' ), $editVersion, $editLanguage, $fromLanguage ) );
            }
        }
    }
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:57,代码来源:section_edit.php

示例6: runOperation

 function runOperation(&$node)
 {
     if (eZOperationHandler::operationIsAvailable('content_updatealwaysavailable')) {
         $operationResult = eZOperationHandler::execute('content', 'updatealwaysavailable', array('object_id' => $node->attribute('contentobject_id'), 'new_always_available' => $this->available, 'node_id' => $node->attribute('node_id')));
     } else {
         eZContentOperationCollection::updateAlwaysAvailable($node->attribute('contentobject_id'), $this->available);
     }
     return true;
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:9,代码来源:nodealwaysavailable.php

示例7: execute

 static function execute($moduleName, $operationName, $operationParameters, $lastTriggerName = null, $useTriggers = true)
 {
     $moduleOperationInfo = eZOperationHandler::moduleOperationInfo($moduleName, $useTriggers);
     if (!$moduleOperationInfo->isValid()) {
         eZDebug::writeError("Cannot execute operation '{$operationName}' in module '{$moduleName}', no valid data", __METHOD__);
         return null;
     }
     return $moduleOperationInfo->execute($operationName, $operationParameters, $lastTriggerName);
 }
开发者ID:nlescure,项目名称:ezpublish,代码行数:9,代码来源:ezoperationhandler.php

示例8: execute

 public function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     try {
         // WORKFLOW HERE
         if ($parameters['trigger_name'] == 'post_updateobjectstate') {
             $objectId = $parameters['object_id'];
             $object = eZContentObject::fetch($objectId);
             $parentStateIDArray = $object->stateIDArray();
             $fetch_parameters = array('parent_node_id' => $object->mainNodeID());
             $childs = eZFunctionHandler::execute('content', 'list', $fetch_parameters);
             $stateGroups = eZINI::instance('patbase.ini')->variable('ChildsPropagationState', 'StateGroupID');
             foreach ($childs as $child) {
                 $childStateIDArray = $child->object()->stateIDArray();
                 $stateChanged = FALSE;
                 foreach ($stateGroups as $stateGroup) {
                     if ($childStateIDArray[$stateGroup] !== $parentStateIDArray[$stateGroup]) {
                         $stateChanged = TRUE;
                         $childStateIDArray[$stateGroup] = $parentStateIDArray[$stateGroup];
                     }
                 }
                 if ($stateChanged) {
                     eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $child->ContentObjectID, 'state_id_list' => $childStateIDArray));
                 }
             }
         } else {
             if ($parameters['trigger_name'] == 'post_publish') {
                 if ($parameters['version'] === '1') {
                     $objectId = $parameters['object_id'];
                     $object = eZContentObject::fetch($objectId);
                     $objectStateIDArray = $object->stateIDArray();
                     $fetch_parameters = array('node_id' => $object->mainParentNodeID());
                     $parent = eZFunctionHandler::execute('content', 'node', $fetch_parameters);
                     $stateGroups = eZINI::instance('patbase.ini')->variable('ChildsPropagationState', 'StateGroupID');
                     $parentStateIDArray = $parent->object()->stateIDArray();
                     $stateChanged = FALSE;
                     foreach ($stateGroups as $stateGroup) {
                         if ($objectStateIDArray[$stateGroup] !== $parentStateIDArray[$stateGroup]) {
                             $stateChanged = TRUE;
                             $objectStateIDArray[$stateGroup] = $parentStateIDArray[$stateGroup];
                         }
                     }
                     if ($stateChanged) {
                         eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectId, 'state_id_list' => $objectStateIDArray));
                     }
                 }
             }
         }
         //
         return eZWorkflowType::STATUS_ACCEPTED;
     } catch (Exception $e) {
         eZDebug::writeError($e->getMessage(), __METHOD__);
         return eZWorkflowType::STATUS_REJECTED;
     }
 }
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:55,代码来源:childspropagationstatetype.php

示例9: testEnablingPartialOperation

 /**
  * Test scenario for issue #15883: Enable only before (or after) operation doesn't work (patch)
  *
  * Test outline
  * -------------
  * 1. Enable a partial operation in workflow.ini (before_content_read)
  * 2. Call eZOperationHandler::isOperationAvailable( 'content_read' )
  *
  * @result: false
  * @expected: true
  * @link http://issues.ez.no/15883
  * @group issue_15883
  */
 function testEnablingPartialOperation()
 {
     $wfINI = eZINI::instance('workflow.ini');
     // before
     $wfINI->setVariable('OperationSettings', 'AvailableOperationList', array('before_content_read'));
     $this->assertTrue(eZOperationHandler::operationIsAvailable('content_read'));
     // after
     $wfINI->setVariable('OperationSettings', 'AvailableOperationList', array('after_content_read'));
     $this->assertTrue(eZOperationHandler::operationIsAvailable('content_read'));
     // complete
     $wfINI->setVariable('OperationSettings', 'AvailableOperationList', array('content_read'));
     $this->assertTrue(eZOperationHandler::operationIsAvailable('content_read'));
     // unknown one
     $this->assertFalse(eZOperationHandler::operationIsAvailable('foo_bar'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:28,代码来源:ezoperationhandler_regression.php

示例10: stateEditActionCheck

function stateEditActionCheck($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
    if ($module->isCurrentAction('StateEdit')) {
        $http = eZHTTPTool::instance();
        if ($http->hasPostVariable('SelectedStateIDList')) {
            $selectedStateIDList = $http->postVariable('SelectedStateIDList');
            $objectID = $object->attribute('id');
            if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
                $operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => $selectedStateIDList));
            } else {
                eZContentOperationCollection::updateObjectState($objectID, $selectedStateIDList);
            }
        }
    }
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:15,代码来源:state_edit.php

示例11: createNewVersionWithImage

 protected function createNewVersionWithImage(eZContentObject $object)
 {
     $version = $object->createNewVersion(false, true, false, false, eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
     $contentObjectAttributes = $version->contentObjectAttributes();
     foreach ($contentObjectAttributes as $contentObjectAttribute) {
         if ($contentObjectAttribute->attribute('contentclass_attribute_identifier') != 'image') {
             continue;
         }
         $contentObjectAttribute->fromString(self::IMAGE_FILE_PATH);
         $contentObjectAttribute->store();
         break;
     }
     $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object->attribute('id'), 'version' => $version->attribute('version')));
     self::assertEquals(1, $operationResult['status']);
     return $this->forceFetchContentObject($object->attribute('id'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:16,代码来源:ezcachetest.php

示例12: runOperation

 function runOperation(&$node)
 {
     $object = $node->attribute('object');
     $object_id = $object->attribute('id');
     $objectLocales = $object->attribute('available_languages');
     // If the new locale does not exist for object, create it
     if (!in_array($this->newLocale, $objectLocales)) {
         // Create a new version of the original in another locale.
         $cli = eZCLI::instance();
         $cli->output("Copying the single translation in {$this->orgLocale} to {$this->newLocale}");
         $newVersion = $object->createNewVersionIn($this->newLocale, $this->orgLocale, false, true, eZContentObjectVersion::STATUS_DRAFT);
         $publishResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object_id, 'version' => $newVersion->attribute('version')));
         eZContentObject::clearCache();
         $object = eZContentObject::fetch($object_id);
     }
     return true;
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:17,代码来源:nodecreatetranslation.php

示例13: create

 public function create($parentNodeId, $classIdentifier, $dataSet)
 {
     $result = array("result" => false);
     $parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
     if (!is_object($parentNode)) {
         throw new Exception("createObject::create(): Failed to locate parent node. id='" . $parentNodeId . "'");
     }
     $contentClass = eZContentClass::fetchByIdentifier($classIdentifier);
     if (!$contentClass) {
         throw new Exception("Failed to instantiate content class [" . $classIdentifier . "]");
     }
     // take care over clustered setups
     $db = eZDB::instance();
     $db->begin();
     $contentObject = $contentClass->instantiate(false, 0, false);
     $dataMap = $contentObject->attribute('data_map');
     foreach ($dataSet as $key => $value) {
         // attributes are lower case
         $key = strtolower($key);
         // if the field exists in the object, write to it
         if (isset($dataMap[$key])) {
             $dataMap[$key]->fromString($value);
             $dataMap[$key]->store();
         }
     }
     $contentObject->store();
     $result["objectid"] = $contentObject->attribute('id');
     $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $parentNodeId, 'is_main' => 1));
     if (!$nodeAssignment) {
         throw new Exception("createObject::create(): Failed to create matching node for object of class '" . $classIdentifier . "'");
     }
     $nodeAssignment->store();
     $obj_version = $contentObject->currentVersion();
     $publish = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $obj_version->attribute('version')));
     $db->commit();
     $result["publish"] = $publish;
     $result["parentnodeid"] = $parentNodeId;
     $result["mainnodeid"] = $contentObject->mainNodeID();
     $result["contentclass"] = $classIdentifier;
     $result["contentobjectid"] = $contentObject->attribute('id');
     $result["result"] = true;
     return $result;
 }
开发者ID:truffo,项目名称:eep,代码行数:43,代码来源:index.php

示例14: copyObject

function copyObject($Module, $object, $allVersions, $newParentNodeID)
{
    if (!$newParentNodeID) {
        return $Module->redirectToView('view', array('full', 2));
    }
    // check if we can create node under the specified parent node
    if (($newParentNode = eZContentObjectTreeNode::fetch($newParentNodeID)) === null) {
        return $Module->redirectToView('view', array('full', 2));
    }
    $classID = $object->attribute('contentclass_id');
    if (!$newParentNode->checkAccess('create', $classID)) {
        $objectID = $object->attribute('id');
        eZDebug::writeError("Cannot copy object {$objectID} to node {$newParentNodeID}, " . "the current user does not have create permission for class ID {$classID}", 'content/copy');
        return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
    }
    $db = eZDB::instance();
    $db->begin();
    $newObject = $object->copy($allVersions);
    // We should reset section that will be updated in updateSectionID().
    // If sectionID is 0 then the object has been newly created
    $newObject->setAttribute('section_id', 0);
    $newObject->store();
    $curVersion = $newObject->attribute('current_version');
    $curVersionObject = $newObject->attribute('current');
    $newObjAssignments = $curVersionObject->attribute('node_assignments');
    unset($curVersionObject);
    // remove old node assignments
    foreach ($newObjAssignments as $assignment) {
        $assignment->purge();
    }
    // and create a new one
    $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $newObject->attribute('id'), 'contentobject_version' => $curVersion, 'parent_node' => $newParentNodeID, 'is_main' => 1));
    $nodeAssignment->store();
    // publish the newly created object
    eZOperationHandler::execute('content', 'publish', array('object_id' => $newObject->attribute('id'), 'version' => $curVersion));
    // Update "is_invisible" attribute for the newly created node.
    $newNode = $newObject->attribute('main_node');
    eZContentObjectTreeNode::updateNodeVisibility($newNode, $newParentNode);
    $db->commit();
    return $Module->redirectToView('view', array('full', $newParentNodeID));
}
开发者ID:legende91,项目名称:ez,代码行数:41,代码来源:copy.php

示例15: updatePriority

    /**
     * Updating priority sorting for given node
     *
     * @param mixed $args
     * @return array
     */
    public static function updatePriority( $args )
    {
        $http = eZHTTPTool::instance();

        if ( !$http->hasPostVariable('ContentNodeID')
                || !$http->hasPostVariable('PriorityID')
                    || !$http->hasPostVariable('Priority') )
        {
            return array();
        }

        $contentNodeID = $http->postVariable('ContentNodeID');
        $priorityArray = $http->postVariable('Priority');
        $priorityIDArray = $http->postVariable('PriorityID');

        $contentNode = eZContentObjectTreeNode::fetch( $contentNodeID );
        if ( !$contentNode->attribute( 'can_edit' ) )
        {
            eZDebug::writeError( 'Current user can not update the priorities because he has no permissions to edit the node' );
            return array();
        }

        if ( eZOperationHandler::operationIsAvailable( 'content_updatepriority' ) )
        {
            $operationResult = eZOperationHandler::execute( 'content', 'updatepriority',
                                                             array( 'node_id' => $contentNodeID,
                                                                    'priority' => $priorityArray,
                                                                    'priority_id' => $priorityIDArray ), null, true );
        }
        else
        {
            eZContentOperationCollection::updatePriority( $contentNodeID, $priorityArray, $priorityIDArray );
        }

        if ( $http->hasPostVariable( 'ContentObjectID' ) )
        {
            $objectID = $http->postVariable( 'ContentObjectID' );
            eZContentCacheManager::clearContentCache( $objectID );
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:46,代码来源:ezwtservercallfunctions.php


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