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


PHP BOL_QuestionService::findQuestionsValuesByQuestionNameList方法代码示例

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


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

示例1: accountTypes

 public function accountTypes($params = array())
 {
     $serviceLang = BOL_LanguageService::getInstance();
     $language = OW::getLanguage();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     // -- Get all section, questions and question values --
     $questions = $this->questionService->findAllQuestionsBySectionForAccountType('all');
     $section = null;
     $questionBySectionList = array();
     $sectionDeleteUrlList = array();
     $parentList = array();
     $questionNameList = array();
     $questionList = array();
     $deleteEditButtonsContent = array();
     $previewQuestionValuesContent = array();
     $accountTypesCheckboxContent = array();
     $sectionsNameList = array_keys($questions);
     $sectionDtoList = BOL_QuestionService::getInstance()->findSectionBySectionNameList($sectionsNameList);
     foreach ($questions as $section => $list) {
         $sectionDeleteUrlList[$section] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteSection', array("sectionName" => $section));
         $questionBySectionList[$section] = array();
         foreach ($list as $question) {
             $questionList[$question['name']] = $question;
             //$question['questionEditUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $question['id']));
             //$question['questionDeleteUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteQuestion', array("questionId" => $question['id']));
             if (!empty($question['parent'])) {
                 $parent = $this->questionService->findQuestionByName($question['parent']);
                 if (!empty($parent)) {
                     $question['parentUrl'] = 'javascript://';
                     $question['parentLabel'] = $this->questionService->getQuestionLang($parent->name);
                     $question['parentId'] = $parent->id;
                     $parentList[$question['parent']][] = array('name' => $question['name'], 'editUrl' => 'javascript://');
                 } else {
                     $question['parent'] = '';
                 }
             }
             $questionBySectionList[$section][] = $question;
             $questionNameList[] = $question['name'];
             $event = new OW_Event('admin.questions.get_edit_delete_question_buttons_content', array('question' => $question), null);
             OW::getEventManager()->trigger($event);
             $data = $event->getData();
             $deleteEditButtonsContent[$question['name']] = $data;
             $event = new OW_Event('admin.questions.get_preview_question_values_content', array('question' => $question), null);
             OW::getEventManager()->trigger($event);
             $data = $event->getData();
             $previewQuestionValuesContent[$question['name']] = $data;
             $event = new OW_Event('admin.questions.get_account_types_checkbox_content', array('question' => $question), null);
             OW::getEventManager()->trigger($event);
             $data = $event->getData();
             $accountTypesCheckboxContent[$question['name']] = $data;
         }
     }
     $questionDtoList = BOL_QuestionService::getInstance()->findQuestionByNameList($questionNameList);
     foreach ($questionList as $sort => $question) {
         if (empty($question['name'])) {
             continue;
         }
         $text = $language->text('admin', 'questions_delete_question_confirmation');
         if (array_key_exists($question['name'], $parentList)) {
             $questionStringList = array();
             foreach ($parentList[$question['name']] as $child) {
                 $questionStringList[] = BOL_QuestionService::getInstance()->getQuestionLang($child['name']);
             }
             $text = $language->text('admin', 'questions_delete_question_parent_confirmation', array('questions' => implode(', ', $questionStringList)));
         }
         $text = json_encode($text);
         OW::getDocument()->addOnloadScript("OW.registerLanguageKey('admin', 'questions_delete_question_confirmation_" . (int) $question['id'] . "', {$text});");
         // ------------------------------------------------------------
         $disableActionList = $this->questionService->getQuestionDisableActionList($questionDtoList[$question['name']]);
         $questionList[$sort] = array_merge($questionList[$sort], $disableActionList);
         // ------------------------------------------------------------
     }
     $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $accountTypeDtoList = $this->questionService->findAllAccountTypes();
     $accountTypeList = array();
     $valueLabels = array();
     foreach ($questionValues as $name => $value) {
         if (empty($valueLabels[$name])) {
             $valueLabels[$name] = array();
         }
         /* @var $value BOL_QuestionValue */
         foreach ($value['values'] as $item) {
             $valueLabels[$item->questionName][$item->value] = BOL_QuestionService::getInstance()->getQuestionValueLang($item->questionName, $item->value);
         }
     }
     foreach ($accountTypeDtoList as $dto) {
         $accountTypeList[$dto->name] = $dto->name;
     }
     $accountTypesToQuestionsDtoList = $this->getAccountTypesToQuestionsList();
     $this->assign('questionList', $questionList);
     $this->assign('td_width', (int) (375 / (count($accountTypeDtoList) + 1)));
     $this->assign('div_width', (int) (375 / (count($accountTypeDtoList) + 1)) - 18);
     $this->assign('accountTypeDtoList', $accountTypeDtoList);
     $this->assign('accountTypesCount', count($accountTypeDtoList) + 1);
     $this->assign('tableColumnCount', count($accountTypeDtoList) + 5);
     $this->assign('accountTypesToQuestionsDtoList', $accountTypesToQuestionsDtoList);
     $this->assign('questionsBySections', $questionBySectionList);
     $this->assign('questionValues', $questionValues);
     $this->assign('valueLabels', $valueLabels);
     $this->assign('sectionDeleteUrlList', $sectionDeleteUrlList);
//.........这里部分代码省略.........
开发者ID:ZyXelP,项目名称:oxwall,代码行数:101,代码来源:questions.php

示例2: index


//.........这里部分代码省略.........
     }
     $accountsKeys = array_keys($accounts);
     $accountType = !isset($accountType) || !in_array($accountType, $accountsKeys) ? $accountsKeys[0] : $accountType;
     // -- Select account type form --
     $accountTypeSelectForm = new Form('qst_account_type_select_form');
     $accountTypeSelectForm->setMethod(Form::METHOD_GET);
     $qstAccountType = new Selectbox('accountType');
     $qstAccountType->addAttribute('id', 'qst_account_type_select');
     $qstAccountType->setLabel($language->text('admin', 'questions_account_type_label'));
     $qstAccountType->setOptions($accounts);
     $qstAccountType->setValue($accountType);
     $qstAccountType->setHasInvitation(false);
     $accountTypeSelectForm->addElement($qstAccountType);
     $this->addForm($accountTypeSelectForm);
     $script = '
                     $("#qst_account_type_select").change( function(){
                             $(this).parents("form:eq(0)").submit();
                     } );
                 ';
     OW::getDocument()->addOnloadScript($script);
     $this->assign('accountTypes', $accountTypes);
     $this->assign('editAccountTypeUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'editAccountType'));
     $addSectionForm = new Form('qst_add_section_form');
     $qstSectionName = new TextField('section_name');
     $qstSectionName->addAttribute('class', 'ow_text');
     $qstSectionName->addAttribute('style', 'width: auto;');
     $qstSectionName->setRequired();
     $qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
     $addSectionForm->addElement($qstSectionName);
     if (OW::getRequest()->isPost() && isset($_POST['section_name'])) {
         if ($addSectionForm->isValid($_POST)) {
             $data = $addSectionForm->getValues();
             $questionSection = new BOL_QuestionSection();
             $questionSection->name = md5(uniqid());
             $questionSection->sortOrder = $this->questionService->findLastSectionOrder() + 1;
             $this->questionService->saveOrUpdateSection($questionSection);
             $this->questionService->updateQuestionsEditStamp();
             $serviceLang->addValue($currentLanguageId, 'base', 'questions_section_' . $questionSection->name . '_label', htmlspecialchars($data['section_name']));
             if (OW::getDbo()->getAffectedRows() > 0) {
                 OW::getFeedback()->info($language->text('admin', 'questions_section_was_added'));
             }
             $this->redirect(OW::getRequest()->getRequestUri());
         }
     }
     $this->addForm($addSectionForm);
     // -- Get all section, questions and question values --
     $questions = $this->questionService->findAllQuestionsWithSectionForAccountType($accountType);
     $section = null;
     $questionArray = array();
     $questionNameList = array();
     $sectionDeleteUrlList = array();
     $parentList = array();
     foreach ($questions as $sort => $question) {
         if ($section !== $question['sectionName']) {
             $section = $question['sectionName'];
             $sectionDeleteUrlList[$section] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteSection', array("sectionName" => $section));
             $questionArray[$section] = array();
         }
         if (isset($questions[$sort]['id'])) {
             $questionArray[$section][$sort] = $questions[$sort];
             $questionArray[$section][$sort]['questionEditUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $questions[$sort]['id']));
             $questionArray[$section][$sort]['questionDeleteUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteQuestion', array("questionId" => $questions[$sort]['id']));
             if (!empty($question['parent'])) {
                 $parent = $this->questionService->findQuestionByName($question['parent']);
                 if (!empty($parent)) {
                     $questionArray[$section][$sort]['parentUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $parent->id));
                     $questionArray[$section][$sort]['parentLabel'] = $this->questionService->getQuestionLang($parent->name);
                     $parentList[$question['parent']][] = array('name' => $question['name'], 'editUrl' => $questionArray[$section][$sort]['questionEditUrl']);
                 } else {
                     $questionArray[$section][$sort]['parent'] = '';
                 }
             }
             $questionNameList[] = $questions[$sort]['name'];
         }
     }
     foreach ($questions as $sort => $question) {
         $text = $language->text('admin', 'questions_delete_question_confirmation');
         if (array_key_exists($question['name'], $parentList)) {
             $questionStringList = array();
             foreach ($parentList[$question['name']] as $child) {
                 $questionStringList[] = BOL_QuestionService::getInstance()->getQuestionLang($child['name']);
             }
             $text = $language->text('admin', 'questions_delete_question_parent_confirmation', array('questions' => implode(', ', $questionStringList)));
         }
         $text = json_encode($text);
         OW::getDocument()->addOnloadScript("OW.registerLanguageKey('admin', 'questions_delete_question_confirmation_" . (int) $question['id'] . "', {$text});");
     }
     $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $this->assign('questionsBySections', $questionArray);
     $this->assign('questionValues', $questionValues);
     $this->assign('sectionDeleteUrlList', $sectionDeleteUrlList);
     $language->addKeyForJs('admin', 'questions_delete_section_confirmation');
     $script = ' window.indexQuest = new indexQuestions( ' . json_encode(array('questionAddUrl' => OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "add"), 'ajaxResponderUrl' => $this->ajaxResponderUrl)) . ' )';
     //' . json_encode( array( 'questionEditUrl' => $questionEditUrl ) ) . ' ); ';
     OW::getDocument()->addOnloadScript($script);
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "questions.js");
     $baseJsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
     OW::getDocument()->addScript($baseJsDir . "jquery-ui.min.js");
 }
开发者ID:vazahat,项目名称:dudex,代码行数:101,代码来源:questions.php


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