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


PHP IEM::requestGetPost方法代码示例

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


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

示例1: Admin_Action_SaveResponse


//.........这里部分代码省略.........
         if ($errors) {
             echo '<pre style="border: 1px solid red";><b style="color:RED;">YUDI_DEBUG:' . __FILE__ . ' ON LINE: ' . __LINE__ . '</b><br />';
             print_r($widgetErrors);
             echo '</pre>';
             die;
             // set the widget errors so we can retrieve them for the user
             IEM::sessionSet('survey.addon.widgetErrors', $widgetErrors);
             IEM::sessionSet('MessageText', GetLang('Addon_Surveys_saveResponseMessageError'));
             IEM::sessionSet('MessageType', MSG_ERROR);
         } else {
             // isntantiate a new response object
             $response_api = $this->getSpecificApi('responses');
             $response_api->Load($responseId);
             // delete the values in this response, since they will be added back in
             $response_api->deleteValues();
             // if the response was saved, then associate values to the response
             if ($response_api->Save()) {
                 $responseValue = $this->getSpecificApi('responsesvalue');
                 // foreach of the posted widgets, check to see if it belongs in this form and save it if it does
                 foreach ($postWidgets as $postWidgetId => $postWidget) {
                     // iterate through each field and enter it in the feedback
                     foreach ($postWidget['field'] as $field) {
                         if (!isset($field['value'])) {
                             continue;
                         }
                         // foreign key for the response id
                         $responseValue->surveys_response_id = $responseId;
                         // set the widget id foreign key; widgets can have multiple field values and
                         // should be treated as such
                         $responseValue->surveys_widgets_id = $postWidgetId;
                         // set the value of the feedback; this should be a single value since widgets
                         // can have multiple feed back values
                         if ($field['value'] == '__other__') {
                             $responseValue->value = $field['other'];
                             $responseValue->is_othervalue = 1;
                         } else {
                             $responseValue->file_value = "";
                             if (substr($field['value'], 0, 5) == "file_") {
                                 $value = str_replace("file_", "", $field['value']);
                                 $responseValue->file_value = md5($value);
                             }
                             $responseValue->value = $field['value'];
                         }
                         // save it
                         $responseValue->Save();
                     }
                 }
                 // perform file uploading
                 if (isset($_FILES['widget']['name'])) {
                     $files = $_FILES['widget']['name'];
                     foreach ($files as $widgetId => $widget) {
                         foreach ($widget as $widgetKey => $fields) {
                             foreach ($fields as $fieldId => $field) {
                                 // gather file information
                                 $name = $_FILES['widget']['name'][$widgetId]['field'][$fieldId]['value'];
                                 $type = $_FILES['widget']['type'][$widgetId]['field'][$fieldId]['value'];
                                 $tmpName = $_FILES['widget']['tmp_name'][$widgetId]['field'][$fieldId]['value'];
                                 $error = $_FILES['widget']['error'][$widgetId]['field'][$fieldId]['value'];
                                 $size = $_FILES['widget']['size'][$widgetId]['field'][$fieldId]['value'];
                                 // if the upload was successful to the temporary folder, move it
                                 if ($error == UPLOAD_ERR_OK) {
                                     $curDir = TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'surveys';
                                     $upBaseDir = $curDir . DIRECTORY_SEPARATOR . $surveyId;
                                     $upDir = $upBaseDir . DIRECTORY_SEPARATOR . $response_api->GetId();
                                     // if the main survey folder is not yet created then create it
                                     if (!is_dir($curDir)) {
                                         mkdir($curDir, 0755);
                                     }
                                     // if the base upload directory doesn't exist create it
                                     if (!is_dir($upBaseDir)) {
                                         mkdir($upBaseDir, 0755);
                                     }
                                     // if the upload directory doesn't exist create it
                                     if (!is_dir($upDir)) {
                                         mkdir($upDir, 0755);
                                     }
                                     // upload the file
                                     move_uploaded_file($tmpName, $upDir . DIRECTORY_SEPARATOR . $name);
                                 }
                             }
                         }
                     }
                 }
                 IEM::sessionSet('MessageText', GetLang('Addon_Surveys_saveResponseMessageSuccess'));
                 IEM::sessionSet('MessageType', SS_FLASH_MSG_SUCCESS);
             }
         }
     }
     // if view is set, then go to the view page for this response
     if (!$errors && IEM::requestGetPOST('view')) {
         if (IEM::requestGetPost('viewNext')) {
             $responseId = IEM::requestGetPost('viewNext');
         }
         header('Location: index.php?Page=Addons&Addon=surveys&Action=viewresponses&surveyId=' . $surveyId . '&responseId=' . $responseId);
         exit;
     }
     // redirect back to the edit page
     header('Location: index.php?Page=Addons&Addon=surveys&Action=editresponse&surveyId=' . $surveyId . '&responseId=' . $responseId);
     exit;
 }
开发者ID:solsticehc,项目名称:solsticehc,代码行数:101,代码来源:surveys.php


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