本文整理汇总了PHP中eZContentObjectVersion类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectVersion类的具体用法?PHP eZContentObjectVersion怎么用?PHP eZContentObjectVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentObjectVersion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: removeDrafts
function removeDrafts($user)
{
$list = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, array('creator_id' => $user->id(), 'status' => array(EZ_VERSION_STATUS_DRAFT, EZ_VERSION_STATUS_INTERNAL_DRAFT)), null, null, true);
foreach ($list as $item) {
$item->remove();
}
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:7,代码来源:eznewsletteraddons.php
示例2: groupedUserDrafts
/**
* @return array
*/
static function groupedUserDrafts()
{
$return = array();
$user = eZUser::currentUser();
$fetchParameters = array('status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)), 'creator_id' => $user->attribute('contentobject_id'));
$versions = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, $fetchParameters);
$return = array();
foreach ($versions as $version) {
$return[$version->attribute('contentobject_id')] = array('version' => $version, 'related' => array());
}
foreach ($return as $id => $entry) {
$eZObj = $entry['version']->attribute('contentobject');
switch ($eZObj->attribute('class_identifier')) {
case 'image':
$revese_related_objects = $eZObj->reverseRelatedObjectList(false, 0, false, array('AllRelations' => true));
foreach ($revese_related_objects as $rr_eZObj) {
if (isset($return[$rr_eZObj->attribute('id')])) {
$return[$rr_eZObj->attribute('id')]['related'][] = $entry['version'];
unset($return[$eZObj->attribute('id')]);
}
}
}
}
return array('result' => $return);
}
开发者ID:pkamps,项目名称:mugo_bootstrap_admin,代码行数:28,代码来源:MugoBootStrapAdminFunctions.php
示例3: testLinksAcrossTranslations
/**
* Test scenario for issue #13492: Links are lost after removing version
*
* Test Outline
* ------------
* 1. Create a Folder in English containing a link (in the short_description attribute).
* 2. Translate Folder into Norwegian containing another link (not the same link as above.)
* 3. Remove Folder version 1. (Version 2 is created when translating).
*
* @result: short_description in version 2 will have an empty link.
* @expected: short_description should contain same link as in version 1.
* @link http://issues.ez.no/13492
*/
public function testLinksAcrossTranslations()
{
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'eng-GB');
$xmlDataEng = '<link href="/some-where-random">a link</link>';
$xmlDataNor = '<link href="/et-tilfeldig-sted">en link</link>';
// Step 1: Create folder
$folder = new ezpObject("folder", 2);
$folder->name = "Folder Eng";
$folder->short_description = $xmlDataEng;
$folder->publish();
$version1Xml = $folder->short_description->attribute('output')->attribute('output_text');
// Step 2: Translate folder
$trData = array("name" => "Folder Nor", "short_description" => $xmlDataNor);
$folder->addTranslation("nor-NO", $trData);
// addTranslation() publishes too.
// Step 3: Remove version 1
$version1 = eZContentObjectVersion::fetchVersion(1, $folder->id);
$version1->removeThis();
// Grab current versions data and make sure it's fresh.
$folder->refresh();
$version2Xml = $folder->short_description->attribute('output')->attribute('output_text');
$folder->remove();
ezpINIHelper::restoreINISettings();
self::assertEquals($version1Xml, $version2Xml);
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:38,代码来源:ezxmltext_regression.php
示例4: add
/**
* Adds a draft to the publishing queue
*
* @param int $objectId
* @param int $version
*
* @return ezpContentPublishingProcess
*/
public static function add($objectId, $version)
{
self::init();
self::signals()->emit('preQueue', $version, $objectId);
$processObject = ezpContentPublishingProcess::queue(eZContentObjectVersion::fetchVersion($version, $objectId));
return $processObject;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:15,代码来源:ezpcontentpublishingqueue.php
示例5: status
public static function status( $args )
{
if ( count( $args ) != 2 )
{
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Missing argument(s)' );
}
list( $contentObjectId, $version ) = $args;
$process = ezpContentPublishingProcess::fetchByContentObjectVersion( $contentObjectId, $version );
// No process: check if the object's still a draft
// @todo Change to a PENDING check when applied (operation => step 2)
if ( $process instanceof ezpContentPublishingProcess )
{
$return = array();
$status = $process->attribute( 'status' ) == ezpContentPublishingProcess::STATUS_WORKING ? 'working' : 'finished';
switch( $process->attribute( 'status' ) )
{
case ezpContentPublishingProcess::STATUS_WORKING:
$status = 'working';
break;
case ezpContentPublishingProcess::STATUS_FINISHED:
$status = 'finished';
$objectVersion = $process->attribute( 'version' );
$object = $objectVersion->attribute( 'contentobject' );
$node = $object->attribute( 'main_node' );
$uri = $node->attribute( 'url_alias' );
eZURI::transformURI( $uri );
$return['node_uri'] = $uri;
break;
case ezpContentPublishingProcess::STATUS_PENDING:
$status = 'pending';
break;
case ezpContentPublishingProcess::STATUS_DEFERRED:
$status = 'deferred';
$versionViewUri = "content/versionview/{$contentObjectId}/{$version}";
eZURI::transformURI( $versionViewUri );
$return['versionview_uri'] = $versionViewUri;
break;
}
$return['status'] = $status;
}
else
{
$version = eZContentObjectVersion::fetchVersion( $version, $contentObjectId );
if ( $version === null )
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Object version not found' );
else
$return = array( 'status' => 'queued' );
}
return $return;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:57,代码来源:ezjscserverfunctionspublishingqueue.php
示例6: getDraftVersions
public function getDraftVersions($objects)
{
$return = array();
$user = eZUser::currentUser();
foreach ($objects as $object) {
// If this user already has a draft in this language
$filters = array('contentobject_id' => $object->attribute('id'), 'status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)), 'creator_id' => $user->attribute('contentobject_id'));
$existingDrafts = eZContentObjectVersion::fetchFiltered($filters, 0, 1);
if (!empty($existingDrafts)) {
$return[] = $existingDrafts[0];
} else {
$return[] = $object->createNewVersion(false, true);
}
}
return $return;
}
开发者ID:pkamps,项目名称:mugo_bootstrap_admin,代码行数:16,代码来源:MultiEdit.php
示例7: execute
public function execute($process, $event)
{
$processParameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($processParameters['object_id']);
$node = $object->mainNode();
$href = '/push/node/' . $node->attribute('node_id');
$version = eZContentObjectVersion::fetchVersion($processParameters['version'], $processParameters['object_id']);
if ($version instanceof eZContentObjectVersion) {
$language = eZContentLanguage::fetch($version->attribute('initial_language_id'));
if ($language instanceof eZContentLanguage) {
$href .= '/' . $language->attribute('locale');
}
}
eZURI::transformURI($href, false, 'full');
$http = eZHTTPTool::instance();
$http->setSessionVariable('RedirectURIAfterPublish', $href);
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:netgen,项目名称:ngpush,代码行数:18,代码来源:ngpushredirecttype.php
示例8: fetchByListObjectVersion
/**
* Spezific function to fetch NL list
* if it is an Virtual List return a CjwNewsletterListVirtual object
* otherwise CjwNewsletterList
*
* @param int $listContentObjectId
* @param int $listContentObjectVersion
*/
static function fetchByListObjectVersion($listContentObjectId, $listContentObjectVersion)
{
if ((int) $listContentObjectVersion == 0) {
$listContentObject = eZContentObject::fetch($listContentObjectId, true);
if (!is_object($listContentObject)) {
return false;
}
$listContentObjectVersion = $listContentObject->attribute('current');
} else {
$listContentObjectVersion = eZContentObjectVersion::fetchVersion($listContentObjectVersion, $listContentObjectId);
}
if (is_object($listContentObjectVersion)) {
$dataMap = $listContentObjectVersion->attribute('data_map');
if (isset($dataMap['newsletter_list'])) {
$newsletterListAttribute = $dataMap['newsletter_list'];
$newsletterListAttributeContent = $newsletterListAttribute->attribute('content');
return $newsletterListAttributeContent;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:32,代码来源:cjwnewsletterlist.php
示例9: array
$ini = eZINI::instance('content.ini');
$internalDraftsCleanUpLimit = $ini->hasVariable('VersionManagement', 'InternalDraftsCleanUpLimit') ? $ini->variable('VersionManagement', 'InternalDraftsCleanUpLimit') : 0;
$durationSetting = $ini->hasVariable('VersionManagement', 'InternalDraftsDuration') ? $ini->variable('VersionManagement', 'InternalDraftsDuration') : array('hours' => 24);
// by default, only remove drafts older than 1 day
$isDurationSet = false;
$duration = 0;
if (is_array($durationSetting)) {
if (isset($durationSetting['days']) and is_numeric($durationSetting['days'])) {
$duration += $durationSetting['days'] * 60 * 60 * 24;
$isDurationSet = true;
}
if (isset($durationSetting['hours']) and is_numeric($durationSetting['hours'])) {
$duration += $durationSetting['hours'] * 60 * 60;
$isDurationSet = true;
}
if (isset($durationSetting['minutes']) and is_numeric($durationSetting['minutes'])) {
$duration += $durationSetting['minutes'] * 60;
$isDurationSet = true;
}
if (isset($durationSetting['seconds']) and is_numeric($durationSetting['seconds'])) {
$duration += $durationSetting['seconds'];
$isDurationSet = true;
}
}
if ($isDurationSet) {
$expiryTime = time() - $duration;
$processedCount = eZContentObjectVersion::removeVersions(eZContentObjectVersion::STATUS_INTERNAL_DRAFT, $internalDraftsCleanUpLimit, $expiryTime);
$cli->output("Cleaned up " . $processedCount . " internal drafts");
} else {
$cli->output("Lifetime is not set for internal drafts (see your ini-settings, content.ini, VersionManagement section).");
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:internal_drafts_cleanup.php
示例10: array
//
// The "eZ publish professional licence" version 2 is available at
// http://ez.no/ez_publish/licences/professional/ and in the file
// PROFESSIONAL_LICENCE included in the packaging of this file.
// For pricing of this licence please contact us via e-mail to [email protected].
// Further contact information is available at http://ez.no/company/contact/.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Contact [email protected] if any conditions of this licencing isn't clear to
// you.
//
$ObjectID = $Params['ObjectID'];
$ObjectVersion = $Params['ObjectVersion'];
$object = eZContentObjectVersion::fetchVersion($ObjectVersion, $ObjectID);
$newsletter = eZNewsletter::fetchByContentObject($ObjectID, $ObjectVersion, false, true);
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('object', $object);
$tpl->setVariable('contentobject', $object);
$tpl->setVariable('newsletter', $newsletter);
if (!$newsletter) {
return false;
}
//skin selection
$skin_prefix = 'eznewsletter';
$custom_skin = $newsletter->attribute('design_to_use');
$Result = array();
if ($custom_skin) {
$skin_prefix = $custom_skin;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:previewfull.php
示例11: removeRelationObject
static function removeRelationObject($contentObjectAttribute, $deletionItem)
{
if (self::isItemPublished($deletionItem)) {
return;
}
$hostObject = $contentObjectAttribute->attribute('object');
$hostObjectID = $hostObject->attribute('id');
// Do not try removing the object if present in trash
// Only objects being really orphaned (not even being in trash) should be removed by this method.
// See issue #019457
if ((int) eZPersistentObject::count(eZContentObjectTrashNode::definition(), array("contentobject_id" => $hostObjectID)) > 0) {
return;
}
$hostObjectVersions = $hostObject->versions();
$isDeletionAllowed = true;
// check if the relation item to be deleted is unique in the domain of all host-object versions
foreach ($hostObjectVersions as $version) {
if ($isDeletionAllowed and $version->attribute('version') != $contentObjectAttribute->attribute('version')) {
$relationAttribute = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('version' => $version->attribute('version'), 'contentobject_id' => $hostObjectID, 'contentclassattribute_id' => $contentObjectAttribute->attribute('contentclassattribute_id')));
if (count($relationAttribute) > 0) {
$relationContent = $relationAttribute[0]->content();
if (is_array($relationContent) and is_array($relationContent['relation_list'])) {
foreach ($relationContent['relation_list'] as $relationItem) {
if ($deletionItem['contentobject_id'] == $relationItem['contentobject_id'] && $deletionItem['contentobject_version'] == $relationItem['contentobject_version']) {
$isDeletionAllowed = false;
break 2;
}
}
}
}
}
}
if ($isDeletionAllowed) {
$subObjectVersion = eZContentObjectVersion::fetchVersion($deletionItem['contentobject_version'], $deletionItem['contentobject_id']);
if ($subObjectVersion instanceof eZContentObjectVersion) {
$subObjectVersion->removeThis();
} else {
eZDebug::writeError('Cleanup of subobject-version failed. Could not fetch object from relation list.\\n' . 'Requested subobject id: ' . $deletionItem['contentobject_id'] . '\\n' . 'Requested Subobject version: ' . $deletionItem['contentobject_version'], __METHOD__);
}
}
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:41,代码来源:ezobjectrelationlisttype.php
示例12: getenv
} else {
$domain = getenv('HTTP_HOST');
$protocol = eZSys::serverProtocol();
$preFix = $protocol . "://" . $domain;
$preFix .= eZSys::wwwDir();
$link = preg_replace("/^\\//e", "", $link);
$link = $preFix . "/" . $link;
}
$viewParameters = array('offset' => $offset, 'limit' => $limit);
$http = eZHTTPTool::instance();
$objectList = eZURLObjectLink::fetchObjectVersionList($urlID, $viewParameters);
$urlViewCount = eZURLObjectLink::fetchObjectVersionCount($urlID);
if ($Module->isCurrentAction('EditObject')) {
if ($http->hasPostVariable('ObjectList')) {
$versionID = $http->postVariable('ObjectList');
$version = eZContentObjectVersion::fetch($versionID);
$contentObjectID = $version->attribute('contentobject_id');
$versionNr = $version->attribute('version');
$Module->redirect('content', 'edit', array($contentObjectID, $versionNr));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('Module', $Module);
$tpl->setVariable('url_object', $url);
$tpl->setVariable('full_url', $link);
$tpl->setVariable('object_list', $objectList);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('url_view_count', $urlViewCount);
$Result = array();
$Result['content'] = $tpl->fetch('design:url/view.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'URL')), array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'View')));
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:view.php
示例13: eventContent
function eventContent($event)
{
return eZContentObjectVersion::fetchVersion($event->attribute('data_int2'), $event->attribute('data_int1'));
}
开发者ID:netbliss,项目名称:ezpublish,代码行数:4,代码来源:ezpublishtype.php
示例14: foreach
foreach ( $deleteIDArray as $deleteID )
{
$version = eZContentObjectVersion::fetch( $deleteID );
if ( $version instanceof eZContentObjectVersion )
{
eZDebug::writeNotice( $deleteID, "deleteID" );
$version->removeThis();
}
}
$db->commit();
}
}
if ( $http->hasPostVariable( 'EmptyButton' ) )
{
$versions = eZContentObjectVersion::fetchForUser( $userID );
$db = eZDB::instance();
$db->begin();
foreach ( $versions as $version )
{
$version->removeThis();
}
$db->commit();
}
$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters );
$Result = array();
$Result['content'] = $tpl->fetch( 'design:content/draft.tpl' );
开发者ID:nottavi,项目名称:ezpublish,代码行数:31,代码来源:draft.php
示例15: removeVersions
/**
* @param int|bool $versionStatus
* @deprecated This method is left here only for backward compatibility. Use eZContentObjectVersion::removeVersions() method instead.
*/
static function removeVersions( $versionStatus = false )
{
eZContentObjectVersion::removeVersions( $versionStatus );
}
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:8,代码来源:ezcontentobject.php
示例16: array
// Cleaning up usual drafts
$ini = eZINI::instance('content.ini');
$draftsCleanUpLimit = $ini->hasVariable('VersionManagement', 'DraftsCleanUpLimit') ? $ini->variable('VersionManagement', 'DraftsCleanUpLimit') : 0;
$durationSetting = $ini->hasVariable('VersionManagement', 'DraftsDuration') ? $ini->variable('VersionManagement', 'DraftsDuration') : array('days' => 90);
$isDurationSet = false;
$duration = 0;
if (is_array($durationSetting)) {
if (isset($durationSetting['days']) and is_numeric($durationSetting['days'])) {
$duration += $durationSetting['days'] * 60 * 60 * 24;
$isDurationSet = true;
}
if (isset($durationSetting['hours']) and is_numeric($durationSetting['hours'])) {
$duration += $durationSetting['hours'] * 60 * 60;
$isDurationSet = true;
}
if (isset($durationSetting['minutes']) and is_numeric($durationSetting['minutes'])) {
$duration += $durationSetting['minutes'] * 60;
$isDurationSet = true;
}
if (isset($durationSetting['seconds']) and is_numeric($durationSetting['seconds'])) {
$duration += $durationSetting['seconds'];
$isDurationSet = true;
}
}
if ($isDurationSet) {
$expiryTime = time() - $duration;
$processedCount = eZContentObjectVersion::removeVersions(eZContentObjectVersion::STATUS_DRAFT, $draftsCleanUpLimit, $expiryTime);
$cli->output("Cleaned up " . $processedCount . " drafts");
} else {
$cli->output("Lifetime is not set for user's drafts (see your ini-settings, content.ini, VersionManagement section).");
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:old_drafts_cleanup.php
示例17: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
eZDebug::writeDebug($parameters, 'CreateSubtreeNotificationRuleType::execute process parameter_list');
include_once 'kernel/classes/ezcontentobject.php';
$object = eZContentObject::fetch($parameters['object_id']);
$datamap = $object->attribute('data_map');
$attributeIDList = $event->attribute('selected_attributes');
$mainNodeID = $object->attribute('main_node_id');
foreach ($datamap as $attribute) {
if (in_array($attribute->attribute('contentclassattribute_id'), $attributeIDList)) {
eZDebug::writeDebug('found matching attribute: ' . $attribute->attribute('contentclassattribute_id'), 'CreateSubtreeNotificationRuleType');
// get related objects
$relatedObjects = $object->relatedContentObjectList(false, false, $attribute->attribute('contentclassattribute_id'));
include_once 'kernel/classes/datatypes/ezuser/ezuser.php';
foreach ($relatedObjects as $relatedObject) {
// check if the related object is a user
$userID = $relatedObject->attribute('id');
$relatedUser = eZUser::fetch($userID);
if ($relatedUser) {
CreateSubtreeNotificationRuleType::createNotificationRuleIfNeeded($userID, $mainNodeID);
}
}
}
}
$ownerID = $object->attribute('owner_id');
if ($event->attribute('use_owner')) {
CreateSubtreeNotificationRuleType::createNotificationRuleIfNeeded($ownerID, $mainNodeID);
}
if ($event->attribute('use_creator')) {
$version = eZContentObjectVersion::fetchVersion($parameters['version'], $parameters['object_id']);
$creatorID = $version->attribute('creator_id');
if (!$event->attribute('use_owner') || $creatorID != $ownerID) {
CreateSubtreeNotificationRuleType::createNotificationRuleIfNeeded($creatorID, $mainNodeID);
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:Opencontent,项目名称:createsubtreenotificationruleevent,代码行数:38,代码来源:createsubtreenotificationruletype.php
示例18:
if ($dbUser !== false) {
$params['user'] = $dbUser;
$params['password'] = '';
}
if ($dbPassword !== false) {
$params['password'] = $dbPassword;
}
if ($dbName !== false) {
$params['database'] = $dbName;
}
$db = eZDB::instance($dbImpl, $params, true);
eZDB::setInstance($db);
}
$db->setIsSQLOutputEnabled($showSQL);
if ($flatten['contentobject']) {
$cli->output("Removing non-published content object versions");
eZContentObjectVersion::removeVersions();
}
if ($flatten['contentclass']) {
$cli->output("Removing temporary content classes");
eZContentClass::removeTemporary();
}
if ($flatten['workflow']) {
$cli->output("Removing temporary workflows");
eZWorkflow::removeTemporary();
}
if ($flatten['role']) {
$cli->output("Removing temporary roles");
eZRole::removeTemporary();
}
$script->shutdown();
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:flatten.php
示例19: installSuspendedObjectRelations
function installSuspendedObjectRelations( &$installParameters )
{
if ( !isset( $installParameters['suspended-relations'] ) )
{
return;
}
foreach( $installParameters['suspended-relations'] as $suspendedObjectRelation )
{
$contentObjectID = $suspendedObjectRelation['contentobject-id'];
$contentObjectVersionID = $suspendedObjectRelation['contentobject-version'];
$contentObjectVersion = eZContentObjectVersion::fetchVersion( $contentObjectVersionID, $contentObjectID );
if ( is_object( $contentObjectVersion ) )
{
$relatedObjectRemoteID = $suspendedObjectRelation['related-object-remote-id'];
$relatedObject = eZContentObject::fetchByRemoteID( $relatedObjectRemoteID );
$relatedObjectID = ( $relatedObject !== null ) ? $relatedObject->attribute( 'id' ) : null;
if ( $relatedObjectID )
{
$relatedObject->addContentObjectRelation( $relatedObjectID, $contentObjectVersionID, $contentObjectID );
}
else
{
eZDebug::writeError( 'Can not find related object by remote-id ID = ' . $relatedObjectRemoteID, __METHOD__ );
}
}
}
unset( $installParameters['suspended-relations'] );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:30,代码来源:ezcontentobjectpackagehandler.php
示例20: 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
注:本文中的eZContentObjectVersion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论