本文整理汇总了PHP中eZContentClass::storeVersioned方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass::storeVersioned方法的具体用法?PHP eZContentClass::storeVersioned怎么用?PHP eZContentClass::storeVersioned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::storeVersioned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Create a scheduled script that will store the modification made to an eZContentClass.
*
* @param eZContentClass Content class to be stored.
* @param array[eZContentClassAttribute] Attributes of the new content class.
* @param array Unordered view parameters
*/
public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
{
$script = eZScheduledScript::create('syncobjectattributes.php', eZINI::instance('ezscriptmonitor.ini')->variable('GeneralSettings', 'PhpCliCommand') . ' extension/ezscriptmonitor/bin/' . eZScheduledScript::SCRIPT_NAME_STRING . ' -s ' . eZScheduledScript::SITE_ACCESS_STRING . ' --classid=' . $class->attribute('id'));
$script->store();
$unorderedParameters['ScheduledScriptID'] = $script->attribute('id');
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_MODIFIED);
}
示例2: sync
//.........这里部分代码省略.........
$mainGroupID = $classGroups[0]->attribute('group_id');
$mainGroupName = $classGroups[0]->attribute('group_name');
}
} else {
$user = eZUser::currentUser();
$contentIni = eZINI::instance('content.ini');
$timeOut = $contentIni->variable('ClassSettings', 'DraftTimeout');
/** @var eZContentClassClassGroup[] $groupList */
$groupList = $temporary->fetchGroupList();
if (count($groupList) > 0) {
$mainGroupID = $groupList[0]->attribute('group_id');
$mainGroupName = $groupList[0]->attribute('group_name');
}
if ($temporary->attribute('modifier_id') != $user->attribute('contentobject_id') && $temporary->attribute('modified') + $timeOut > time()) {
throw new Exception("Modifica alla classe non permessa");
}
}
/** @var eZContentClassAttribute[] $localeAttributes */
$localeAttributes = array();
foreach ($this->currentClass->fetchAttributes() as $attribute) {
/** @var eZContentClassAttribute $attribute */
$attribute->setAttribute('version', eZContentClass::VERSION_STATUS_TEMPORARY);
$localeAttributes[$attribute->attribute('identifier')] = $attribute;
}
$this->currentClass->setAttribute('version', eZContentClass::VERSION_STATUS_TEMPORARY);
$remote = $this->getRemote();
if ($remote === null) {
throw new Exception("Classe remota non trovata");
}
if ($force && $this->getData()->hasError) {
foreach ($this->getData()->errors as $identifier => $value) {
if (!$localeAttributes[$identifier] instanceof eZContentClassAttribute) {
throw new Exception('Errore forzando la sincronizzazione');
}
foreach ($remote->DataMap[0] as $originalAttribute) {
if ($originalAttribute->Identifier == $identifier) {
ezpEvent::getInstance()->notify('classtools/switch_class_attribute', array($localeAttributes[$identifier], $originalAttribute));
if ($value == 'data_type_string') {
$localeAttributes[$identifier]->setAttribute('data_type_string', $originalAttribute->DataTypeString);
$localeAttributes[$identifier]->store();
$this->changeContentObjectAttributeDataTypeString($localeAttributes[$identifier], $originalAttribute->DataTypeString);
unset($this->notifications[self::ERROR][$originalAttribute->Identifier]);
} else {
$this->data->missingAttributes[] = $originalAttribute;
$this->currentClass->removeAttributes(array($localeAttributes[$identifier]));
unset($localeAttributes[$identifier]);
}
break;
}
}
}
}
$attributes = array();
foreach ($this->properties as $identifier => $remoteProperty) {
if ($remote->{$remoteProperty} != $this->currentClass->attribute($identifier)) {
$this->currentClass->setAttribute($identifier, $remote->{$remoteProperty});
if ($identifier == 'serialized_name_list') {
$nameList = new eZContentClassNameList();
$nameList->initFromSerializedList($remote->{$remoteProperty});
$this->currentClass->NameList = $nameList;
} elseif ($identifier == 'serialized_description_list') {
$descriptionList = new eZSerializedObjectNameList();
$descriptionList->initFromSerializedList($remote->{$remoteProperty});
$this->currentClass->DescriptionList = $descriptionList;
}
}
}
foreach ($this->getData()->missingAttributes as $originalAttribute) {
$add = $this->addAttribute($originalAttribute);
if ($add) {
$attributes[] = $add;
}
}
foreach ($remote->DataMap[0] as $originalAttribute) {
if (isset($localeAttributes[$originalAttribute->Identifier])) {
$modified = $this->syncAttribute($originalAttribute, $localeAttributes[$originalAttribute->Identifier]);
if ($modified) {
$attributes[] = $modified;
}
}
}
if (!$removeExtras) {
foreach ($this->extraContentObjectAttributes as $extra) {
$extra->setAttribute('placement', count($attributes) + 1);
$attributes[] = $extra;
}
}
$this->currentClass->store($attributes);
$db = eZDB::instance();
$db->begin();
$unorderedParameters = array('Language' => $this->EditLanguage);
if (eZContentObject::fetchSameClassListCount($this->id) > 0) {
eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'ContentClassEditHandler')))->store($this->currentClass, $attributes, $unorderedParameters);
} else {
$unorderedParameters['ScheduledScriptID'] = 0;
$this->currentClass->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
}
$db->commit();
$this->syncGroups();
}