本文整理汇总了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'));
}
}