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


PHP BOL_QuestionService::findSectionBySectionName方法代码示例

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


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

示例1: ajaxResponder

 public function ajaxResponder()
 {
     if (!OW::getAuthorization()->isUserAuthorized(OW::getUser()->getId(), 'admin') || empty($_POST["command"]) || !OW::getRequest()->isAjax()) {
         throw new Redirect404Exception();
     }
     $command = (string) $_POST["command"];
     switch ($command) {
         case 'deleteQuestion':
             $questionId = (int) $_POST['questionId'];
             $question = $this->questionService->findQuestionById($questionId);
             if (empty($question)) {
                 echo json_encode(array('result' => false));
                 exit;
             }
             $parent = null;
             if (!empty($question->parent)) {
                 $parent = $this->questionService->findQuestionByName($question->parent);
             }
             if ($question->base == 1 || !$question->removable || !empty($parent)) {
                 echo json_encode(array('result' => false));
                 exit;
             }
             $childList = $this->questionService->findQuestionChildren($question->name);
             $deleteList = array();
             $deleteQuestionNameList = array();
             foreach ($childList as $child) {
                 $deleteList[] = $child->id;
                 $deleteQuestionNameList[$child->name] = $child->name;
             }
             if (!empty($deleteList)) {
                 $this->questionService->deleteQuestion($deleteList);
             }
             if ($this->questionService->deleteQuestion(array((int) $_POST['questionId']))) {
                 echo json_encode(array('result' => "success", 'message' => OW::getLanguage()->text('admin', 'questions_question_was_deleted'), 'deleteList' => $deleteQuestionNameList));
                 exit;
             }
             echo json_encode(array('result' => false));
             exit;
             break;
         case 'findNearestSection':
             $sectionName = $_POST['sectionName'];
             if (!empty($sectionName)) {
                 $section = $this->questionService->findSectionBySectionName($sectionName);
                 if (empty($section)) {
                     echo json_encode(array('result' => false));
                     exit;
                 }
                 $nearSection = $this->questionService->findNearestSection($section);
                 if (empty($nearSection)) {
                     echo json_encode(array('result' => false));
                     exit;
                 }
                 echo json_encode(array('result' => "success", 'message' => OW::getLanguage()->text('admin', 'questions_delete_section_confirmation_with_move_questions', array('sectionName' => BOL_QuestionService::getInstance()->getSectionLang($nearSection->name)))));
                 exit;
             }
             echo json_encode(array('result' => false));
             exit;
             break;
         case 'deleteSection':
             if (!empty($_POST['sectionName']) && mb_strlen($_POST['sectionName']) > 0) {
                 /*@var $nearSection BOL_QuestionSection*/
                 $nearSection = $this->questionService->findSectionBySectionName($_POST['sectionName']);
                 $moveQuestionsToSection = null;
                 if (!empty($nearSection) && $nearSection->isDeletable && $this->questionService->deleteSection(htmlspecialchars($_POST['sectionName']), $moveQuestionsToSection)) {
                     $result = array('result' => "success", 'message' => OW::getLanguage()->text('admin', 'questions_section_was_deleted'));
                     if (!empty($moveQuestionsToSection)) {
                         $result['moveTo'] = $moveQuestionsToSection->name;
                     }
                     echo json_encode($result);
                     exit;
                 }
             }
             echo json_encode(array('result' => "false"));
             exit;
             break;
         case 'DeleteQuestionValue':
             $result = false;
             $questionId = htmlspecialchars($_POST["questionId"]);
             $question = $this->questionService->findQuestionById($questionId);
             $value = (int) $_POST["value"];
             if (empty($question) || empty($value) && $value !== 0) {
                 echo json_encode(array('result' => $result));
                 return;
             }
             if ($this->questionService->deleteQuestionValue($question->name, $value)) {
                 $result = true;
             }
             echo json_encode(array('result' => $result));
             break;
         case 'deleteAccountType':
             if (!empty($_POST['accountType']) && mb_strlen($_POST['accountType']) > 0) {
                 $accountTypes = $this->questionService->findAllAccountTypes();
                 $accountTypeList = array();
                 foreach ($accountTypes as $key => $account) {
                     if ($account->name != $_POST['accountType']) {
                         $accountTypeList[$account->name] = $account->name;
                     }
                 }
                 if (empty($accountTypeList)) {
                     echo json_encode(array('result' => "false", 'message' => OW::getLanguage()->text('admin', 'questions_cant_delete_last_account_type')));
//.........这里部分代码省略.........
开发者ID:ZyXelP,项目名称:oxwall,代码行数:101,代码来源:questions.php

示例2: edit


//.........这里部分代码省略.........
     $this->addForm($editForm);
     if (OW_Request::getInstance()->isPost()) {
         if ((isset($_POST['qst_submit_and_add']) || isset($_POST['qst_submit'])) && $editForm->isValid($_POST)) {
             OW::getSession()->delete(self::EDIT_QUESTION_SESSION_VAR);
             $updated = false;
             $data = $editForm->getValues();
             $elements = $editForm->getElements();
             foreach ($elements as $element) {
                 if (!$element->getAttribute('disabled')) {
                     switch ($element->getName()) {
                         case 'qst_required':
                             $editQuestion->required = isset($_POST['qst_required']) ? 1 : 0;
                             break;
                         case 'qst_on_sign_up':
                             $editQuestion->onJoin = isset($_POST['qst_on_sign_up']) ? 1 : 0;
                             break;
                         case 'qst_on_edit':
                             $editQuestion->onEdit = isset($_POST['qst_on_edit']) ? 1 : 0;
                             break;
                         case 'qst_on_search':
                             $editQuestion->onSearch = isset($_POST['qst_on_search']) ? 1 : 0;
                             break;
                         case 'qst_on_view':
                             $editQuestion->onView = isset($_POST['qst_on_view']) ? 1 : 0;
                             break;
                         case 'qst_answer_type':
                             $editQuestion->presentation = htmlspecialchars($data['qst_answer_type']);
                             break;
                         case 'qst_column_count':
                             $editQuestion->columnCount = htmlspecialchars($data['qst_column_count']);
                             break;
                         case 'qst_section':
                             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);
开发者ID:vazahat,项目名称:dudex,代码行数:67,代码来源:questions.php


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