本文整理汇总了PHP中eZDataType::fetchActionValue方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDataType::fetchActionValue方法的具体用法?PHP eZDataType::fetchActionValue怎么用?PHP eZDataType::fetchActionValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDataType
的用法示例。
在下文中一共展示了eZDataType::fetchActionValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: customObjectAttributeHTTPAction
function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters)
{
$contentobjectID = false;
if (eZDataType::fetchActionValue($action, 'new_class', $classID) or $action == 'new_class') {
if ($action == 'new_class') {
$base = $parameters['base_name'];
$classVariableName = $base . '_new_class';
if ($http->hasPostVariable($classVariableName)) {
$classVariable = $http->postVariable($classVariableName);
$classID = $classVariable[$contentObjectAttribute->attribute('id')];
$class = eZContentClass::fetch($classID);
} else {
return false;
}
} else {
$class = eZContentClass::fetch($classID);
}
if ($class) {
$classAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
$class_content = $classAttribute->content();
$content = $contentObjectAttribute->content();
$priority = 0;
for ($i = 0; $i < count($content['relation_list']); ++$i) {
if ($content['relation_list'][$i]['priority'] > $priority) {
$priority = $content['relation_list'][$i]['priority'];
}
}
$base = $parameters['base_name'];
$nodePlacement = false;
$nodePlacementName = $base . '_object_initial_node_placement';
if ($http->hasPostVariable($nodePlacementName)) {
$nodePlacementMap = $http->postVariable($nodePlacementName);
if (isset($nodePlacementMap[$contentObjectAttribute->attribute('id')])) {
$nodePlacement = $nodePlacementMap[$contentObjectAttribute->attribute('id')];
}
}
$relationItem = $this->createInstance($class, $priority + 1, $contentObjectAttribute, $nodePlacement);
if ($class_content['default_placement']) {
$relationItem['parent_node_id'] = $class_content['default_placement']['node_id'];
}
$content['relation_list'][] = $relationItem;
$hasAttributeInput = false;
$attributeInputVariable = $base . '_has_attribute_input';
if ($http->hasPostVariable($attributeInputVariable)) {
$attributeInputMap = $http->postVariable($attributeInputVariable);
if (isset($attributeInputMap[$contentObjectAttribute->attribute('id')])) {
$hasAttributeInput = $attributeInputMap[$contentObjectAttribute->attribute('id')];
}
}
if ($hasAttributeInput) {
$object = $relationItem['object'];
$attributes = $object->contentObjectAttributes();
foreach ($attributes as $attribute) {
$attributeBase = $base . '_ezorl_init_class_' . $object->attribute('contentclass_id') . '_attr_' . $attribute->attribute('contentclassattribute_id');
$oldAttributeID = $attribute->attribute('id');
$attribute->setAttribute('id', false);
if ($attribute->fetchInput($http, $attributeBase)) {
$attribute->setAttribute('id', $oldAttributeID);
$attribute->store();
}
}
}
$contentObjectAttribute->setContent($content);
$contentObjectAttribute->store();
} else {
eZDebug::writeError("Unknown class ID {$classID}, cannot instantiate object", __METHOD__);
}
} else {
if (eZDataType::fetchActionValue($action, 'edit_objects', $contentobjectID) or $action == 'edit_objects' or $action == 'remove_objects') {
$base = $parameters['base_name'];
$selectionBase = $base . '_selection';
$selections = array();
$http = eZHTTPTool::instance();
if ($http->hasPostVariable($selectionBase)) {
$selectionMap = $http->postVariable($selectionBase);
$selections = $selectionMap[$contentObjectAttribute->attribute('id')];
}
if ($contentobjectID !== false) {
$selections[] = $contentobjectID;
}
if ($action == 'edit_objects' or eZDataType::fetchActionValue($action, 'edit_objects', $contentobjectID)) {
$content = $contentObjectAttribute->content();
foreach ($content['relation_list'] as $key => $relationItem) {
if (!$relationItem['is_modified'] and in_array($relationItem['contentobject_id'], $selections)) {
$object = eZContentObject::fetch($relationItem['contentobject_id']);
if ($object->attribute('can_edit')) {
$content['relation_list'][$key]['is_modified'] = true;
$translationSourceBase = $base . '_translation_source_' . $contentObjectAttribute->attribute('id') . '_' . $relationItem['contentobject_id'];
$languageFrom = false;
if ($http->hasPostVariable($translationSourceBase) && $http->postVariable($translationSourceBase) !== '') {
$languageFrom = $http->postVariable($translationSourceBase);
}
$version = $object->createNewVersionIn($contentObjectAttribute->attribute('language_code'), $languageFrom);
$content['relation_list'][$key]['contentobject_version'] = $version->attribute('version');
}
}
}
$contentObjectAttribute->setContent($content);
$contentObjectAttribute->store();
} else {
//.........这里部分代码省略.........