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


PHP eZContentOperationCollection::updateInitialLanguage方法代码示例

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


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

示例1: 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

示例2: array

}
$objectID = $module->actionParameter('ObjectID');
$object = eZContentObject::fetch($objectID);
if (!$object) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($module->isCurrentAction('UpdateInitialLanguage')) {
    if ($module->hasActionParameter('InitialLanguageID')) {
        $newInitialLanguageID = $module->actionParameter('InitialLanguageID');
        if (!$object->canEdit()) {
            return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array());
        }
        if (eZOperationHandler::operationIsAvailable('content_updateinitiallanguage')) {
            $operationResult = eZOperationHandler::execute('content', 'updateinitiallanguage', array('object_id' => $objectID, 'new_initial_language_id' => $newInitialLanguageID, 'node_id' => $nodeID));
        } else {
            eZContentOperationCollection::updateInitialLanguage($objectID, $newInitialLanguageID);
        }
    }
    return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
} else {
    if ($module->isCurrentAction('UpdateAlwaysAvailable')) {
        if (!$object->canEdit()) {
            return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array());
        }
        $newAlwaysAvailable = $module->hasActionParameter('AlwaysAvailable');
        if (eZOperationHandler::operationIsAvailable('content_updatealwaysavailable')) {
            $operationResult = eZOperationHandler::execute('content', 'updatealwaysavailable', array('object_id' => $objectID, 'new_always_available' => $newAlwaysAvailable, 'node_id' => $nodeID));
        } else {
            eZContentOperationCollection::updateAlwaysAvailable($objectID, $newAlwaysAvailable);
        }
        return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:translation.php


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