当前位置: 首页>>代码示例>>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;未经允许,请勿转载。