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


PHP BOL_QuestionService::saveOrUpdateQuestion方法代码示例

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


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

示例1: ajaxResponder


//.........这里部分代码省略.........
                         if (!$disableActionList['disable_on_edit']) {
                             $questionDto->onEdit = $onEdit;
                         }
                         break;
                     case 'onSearch':
                         if (!$disableActionList['disable_on_search']) {
                             $questionDto->onSearch = $onSearch;
                         }
                         break;
                     case 'onView':
                         if (!$disableActionList['disable_on_view']) {
                             $questionDto->onView = $onView;
                         }
                         break;
                     default:
                         if (!$disableActionList['disable_required']) {
                             $questionDto->required = $required;
                         }
                         if (!$disableActionList['disable_on_join']) {
                             $questionDto->onJoin = $onJoin;
                         }
                         if (!$disableActionList['disable_on_edit']) {
                             $questionDto->onEdit = $onEdit;
                         }
                         if (!$disableActionList['disable_on_view']) {
                             $questionDto->onView = $onView;
                         }
                         if (!$disableActionList['disable_on_search']) {
                             $questionDto->onSearch = $onSearch;
                         }
                         break;
                 }
             }
             $this->questionService->saveOrUpdateQuestion($questionDto);
             echo json_encode(json_encode(array('result' => true)));
             break;
         case 'questionAccountTypes':
             $question = $_POST['question'];
             $data = $_POST['data'];
             if (empty($question) || empty($data)) {
                 echo json_encode(array('result' => false));
                 exit;
             }
             $questionDto = $this->questionService->findQuestionByName($question);
             if (!empty($questionDto)) {
                 $disableActionList = BOL_QuestionService::getInstance()->getQuestionDisableActionList($questionDto);
                 if (!$disableActionList['disable_account_type']) {
                     $add = array();
                     $delete = array();
                     foreach ($data as $accountType => $value) {
                         if ($value === "true") {
                             $add[] = $accountType;
                         } else {
                             $delete[] = $accountType;
                         }
                     }
                     if (!empty($delete)) {
                         BOL_QuestionService::getInstance()->deleteQuestionToAccountType($questionDto->name, $delete);
                     }
                     if (!empty($add)) {
                         BOL_QuestionService::getInstance()->addQuestionToAccountType($questionDto->name, $add);
                     }
                 }
             }
             echo json_encode(json_encode(array('result' => true)));
             break;
开发者ID:ZyXelP,项目名称:oxwall,代码行数:67,代码来源:questions.php

示例2: edit


//.........这里部分代码省略.........
                             if (!empty($data['qst_section'])) {
                                 $section = $this->questionService->findSectionBySectionName(htmlspecialchars(trim($data['qst_section'])));
                                 $sectionName = null;
                                 if (isset($section)) {
                                     $sectionName = $section->name;
                                 }
                                 if ($editQuestion->sectionName !== $sectionName) {
                                     $editQuestion->sectionName = $sectionName;
                                     $editQuestion->sortOrder = (int) BOL_QuestionService::getInstance()->findLastQuestionOrder($editQuestion->sectionName) + 1;
                                 }
                             }
                             break;
                         case 'qst_account_type':
                             if ($data['qst_account_type'] !== null) {
                                 $editQuestion->accountTypeName = htmlspecialchars(trim($data['qst_account_type']));
                                 if ($editQuestion->accountTypeName === BOL_QuestionService::ALL_ACCOUNT_TYPES) {
                                     $editQuestion->accountTypeName = null;
                                 }
                             }
                             break;
                     }
                 }
             }
             if (!$disableActionList['disable_display_config']) {
                 // save question configs
                 $configs = array();
                 foreach ($presentationConfigList as $config) {
                     if (isset($data[$config->name])) {
                         $configs[$config->name] = $data[$config->name];
                     }
                 }
                 $editQuestion->custom = json_encode($configs);
             }
             $this->questionService->saveOrUpdateQuestion($editQuestion);
             if (OW::getDbo()->getAffectedRows() > 0) {
                 $updated = true;
                 $list = $this->questionService->findQuestionChildren($editQuestion->name);
                 /* @var BOL_Question $child */
                 foreach ($list as $child) {
                     $child->columnCount = $editQuestion->columnCount;
                     $this->questionService->saveOrUpdateQuestion($child);
                 }
             }
             //update question values sort
             if (isset($_POST['question_values_order'])) {
                 $valuesOrder = json_decode($_POST['question_values_order'], true);
                 if (isset($valuesOrder) && count($valuesOrder) > 0 && is_array($valuesOrder)) {
                     foreach ($questionValues as $questionValue) {
                         if (isset($valuesOrder[$questionValue->value])) {
                             $questionValue->sortOrder = (int) $valuesOrder[$questionValue->value];
                         }
                         $this->questionService->saveOrUpdateQuestionValue($questionValue);
                         if (OW::getDbo()->getAffectedRows() > 0) {
                             $updated = true;
                         }
                     }
                 }
             }
             if ($updated) {
                 OW::getFeedback()->info($language->text('admin', 'questions_update_question_message'));
             } else {
                 OW::getFeedback()->info($language->text('admin', 'questions_question_was_not_updated_message'));
             }
             //exit;
             $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'index'));
         }
开发者ID:vazahat,项目名称:dudex,代码行数:67,代码来源:questions.php


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