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


PHP eZHTTPTool::setPostVariable方法代码示例

本文整理汇总了PHP中eZHTTPTool::setPostVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP eZHTTPTool::setPostVariable方法的具体用法?PHP eZHTTPTool::setPostVariable怎么用?PHP eZHTTPTool::setPostVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZHTTPTool的用法示例。


在下文中一共展示了eZHTTPTool::setPostVariable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: customClassAttributeHTTPAction


//.........这里部分代码省略.........
     $customActionKeyName = "{$id}_{$action}";
     $idArrayName = join('_', array($base, 'sckenhancedselection_id', $id));
     $idArray = array();
     if ($http->hasPostVariable($idArrayName)) {
         $idArray = $http->postVariable($idArrayName);
     }
     switch ($action) {
         case 'new_option':
             $maxID = 0;
             foreach ($content['options'] as $option) {
                 if (intval($option['id']) > $maxID) {
                     $maxID = intval($option['id']);
                 }
             }
             $maxID++;
             $content['options'][] = array('id' => $maxID, 'name' => '', 'identifier' => '', 'priority' => 1);
             break;
         case 'remove_optionlist':
             $removeArrayName = join('_', array($base, "sckenhancedselection_remove", $id));
             if ($http->hasPostVariable($removeArrayName)) {
                 $removeArray = $http->postVariable($removeArrayName);
                 foreach ($removeArray as $removeID) {
                     unset($idArray[$removeID]);
                     unset($content['options'][$removeID]);
                 }
             }
             break;
         case 'move_up':
             $customActionVar = $http->postVariable($customActionVarName);
             // This is where the user clicked
             $customActionValue = $customActionVar[$customActionKeyName];
             // Up == swap selected row with the one above
             // Or: Move the row above below the selected one
             $this->swapRows($customActionValue - 1, $customActionValue, $content, $idArray);
             break;
         case 'move_down':
             $customActionVar = $http->postVariable($customActionVarName);
             // This is where the user clicked
             $customActionValue = $customActionVar[$customActionKeyName];
             // Down == swap selected row with the one below
             // Or: Move the selected row below the one below
             $this->swapRows($customActionValue, $customActionValue + 1, $content, $idArray);
             break;
         case 'sort_optionlist':
             $sortName = join('_', array($base, 'sckenhancedselection_sort_order', $id));
             if ($http->hasPostVariable($sortName)) {
                 $sort = $http->postVariable($sortName);
                 $sortArray = array();
                 $sortOrder = SORT_ASC;
                 $sortType = SORT_STRING;
                 $numericSorts = array('prior');
                 if (strpos($sort, '_') !== false) {
                     list($type, $ranking) = explode('_', $sort);
                     $currentOptions = $content['options'];
                     if ($ranking === 'desc') {
                         $sortOrder = SORT_DESC;
                     }
                     if (in_array($type, $numericSorts)) {
                         $sortType = SORT_NUMERIC;
                     }
                     // Use POST priorities instead of the stored ones
                     // Otherwise you have to store new priorities before you can sort
                     $priorityArray = array();
                     if ($type == 'prior') {
                         $priorityArray = $http->postVariable(join('_', array($base, 'sckenhancedselection_priority', $id)));
                     }
                     foreach (array_keys($currentOptions) as $key) {
                         $option = $currentOptions[$key];
                         switch ($type) {
                             case 'prior':
                                 if (isset($priorityArray[$option['id']])) {
                                     $option['priority'] = $priorityArray[$option['id']];
                                 }
                                 $sortArray[] = $option['priority'];
                                 break;
                             case 'alpha':
                             default:
                                 $sortArray[] = $option['name'];
                                 break;
                         }
                         unset($option);
                     }
                     array_multisort($sortArray, $sortOrder, $sortType, $currentOptions);
                     $idArray = array();
                     foreach ($currentOptions as $option) {
                         $idArray[] = $option['id'];
                     }
                     $content['options'] = $currentOptions;
                 } else {
                     eZDebug::writeError("Unknown sort value. Please use the form type_order (ex. alpha_asc)", "SckEnhancedSelectionType");
                 }
             }
             break;
         default:
             eZDebug::writeError("Unknown class HTTP action: {$action}", "SckEnhancedSelectionType");
     }
     $classAttribute->setContent($content);
     $classAttribute->store();
     $http->setPostVariable($idArrayName, $idArray);
 }
开发者ID:netgen,项目名称:enhancedselection2,代码行数:101,代码来源:sckenhancedselectiontype.php


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