当前位置: 首页>>代码示例>>PHP>>正文


PHP eZDataType::fetchActionValue方法代码示例

本文整理汇总了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 {
//.........这里部分代码省略.........
开发者ID:nfrp,项目名称:ezpublish,代码行数:101,代码来源:ezobjectrelationlisttype.php


注:本文中的eZDataType::fetchActionValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。