當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。