當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZContentObjectVersion::create方法代碼示例

本文整理匯總了PHP中eZContentObjectVersion::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentObjectVersion::create方法的具體用法?PHP eZContentObjectVersion::create怎麽用?PHP eZContentObjectVersion::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZContentObjectVersion的用法示例。


在下文中一共展示了eZContentObjectVersion::create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: instantiate

 function instantiate($userID = false, $sectionID = 0, $versionNumber = false, $languageCode = false, $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
 {
     $attributes = $this->fetchAttributes();
     if ($userID === false) {
         $user = eZUser::currentUser();
         $userID = $user->attribute('contentobject_id');
     }
     if ($languageCode == false) {
         $languageCode = eZContentObject::defaultLanguage();
     }
     $object = eZContentObject::create(ezpI18n::tr("kernel/contentclass", "New %1", null, array($this->name($languageCode))), $this->attribute("id"), $userID, $sectionID, 1, $languageCode);
     if ($this->attribute('always_available')) {
         $object->setAttribute('language_mask', (int) $object->attribute('language_mask') | 1);
     }
     $db = eZDB::instance();
     $db->begin();
     $object->store();
     $object->assignDefaultStates();
     $object->setName(ezpI18n::tr("kernel/contentclass", "New %1", null, array($this->name($languageCode))), false, $languageCode);
     if (!$versionNumber) {
         $version = $object->createInitialVersion($userID, $languageCode);
     } else {
         $version = eZContentObjectVersion::create($object->attribute("id"), $userID, $versionNumber, $languageCode);
     }
     if ($versionStatus !== false) {
         $version->setAttribute('status', $versionStatus);
     }
     $version->store();
     foreach ($attributes as $attribute) {
         $attribute->instantiate($object->attribute('id'), $languageCode);
     }
     if (isset($user) && $user instanceof eZUser && $user->isAnonymous()) {
         $createdObjectIDList = eZPreferences::value('ObjectCreationIDList');
         if (!$createdObjectIDList) {
             $createdObjectIDList = array($object->attribute('id'));
         } else {
             $createdObjectIDList = unserialize($createdObjectIDList);
             $createdObjectIDList[] = $object->attribute('id');
         }
         eZPreferences::setValue('ObjectCreationIDList', serialize($createdObjectIDList));
     }
     $db->commit();
     return $object;
 }
開發者ID:nlenardou,項目名稱:ezpublish,代碼行數:44,代碼來源:ezcontentclass.php

示例2: createInitialVersion

 /**
  * Creates an initial content object version
  *
  * @param int $userID
  * @param string|bool $initialLanguageCode
  * @return eZContentObjectVersion
  */
 function createInitialVersion( $userID, $initialLanguageCode = false )
 {
     return eZContentObjectVersion::create( $this->attribute( "id" ), $userID, 1, $initialLanguageCode );
 }
開發者ID:ezsystemstraining,項目名稱:ez54training,代碼行數:11,代碼來源:ezcontentobject.php


注:本文中的eZContentObjectVersion::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。