本文整理匯總了PHP中eZContentObjectTreeNode::setVersionByObjectID方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentObjectTreeNode::setVersionByObjectID方法的具體用法?PHP eZContentObjectTreeNode::setVersionByObjectID怎麽用?PHP eZContentObjectTreeNode::setVersionByObjectID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::setVersionByObjectID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setObjectStatusPublished
public static function setObjectStatusPublished($objectID, $versionNum)
{
$object = eZContentObject::fetch($objectID);
$version = $object->version($versionNum);
$db = eZDB::instance();
$db->begin();
$object->publishContentObjectRelations($versionNum);
$object->setAttribute('status', eZContentObject::STATUS_PUBLISHED);
$version->setAttribute('status', eZContentObjectVersion::STATUS_PUBLISHED);
$object->setAttribute('current_version', $versionNum);
$objectIsAlwaysAvailable = $object->isAlwaysAvailable();
$object->setAttribute('language_mask', eZContentLanguage::maskByLocale($version->translationList(false, false), $objectIsAlwaysAvailable));
if ($object->attribute('published') == 0) {
$object->setAttribute('published', time());
}
$object->setAttribute('modified', time());
$classID = $object->attribute('contentclass_id');
$class = eZContentClass::fetch($classID);
$objectName = $class->contentObjectName($object);
$object->setName($objectName, $versionNum);
$existingTranslations = $version->translations(false);
foreach ($existingTranslations as $translation) {
$translatedName = $class->contentObjectName($object, $versionNum, $translation);
$object->setName($translatedName, $versionNum, $translation);
}
if ($objectIsAlwaysAvailable) {
$initialLanguageID = $object->attribute('initial_language_id');
$object->setAlwaysAvailableLanguageID($initialLanguageID);
}
$version->store();
$object->store();
eZContentObjectTreeNode::setVersionByObjectID($objectID, $versionNum);
$nodes = $object->assignedNodes();
foreach ($nodes as $node) {
$node->setName($object->attribute('name'));
$node->updateSubTreePath();
}
$db->commit();
/* Check if current class is the user class, and if so, clean up the user-policy cache */
if (in_array($classID, eZUser::contentClassIDs())) {
eZUser::purgeUserCacheByUserId($object->attribute('id'));
}
}