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


PHP BOL_QuestionService::getQuestionLang方法代码示例

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


在下文中一共展示了BOL_QuestionService::getQuestionLang方法的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: edit

 public function edit($params)
 {
     if (!isset($params['questionId'])) {
         throw new Redirect404Exception();
     }
     $questionId = (int) @$params['questionId'];
     if (empty($questionId)) {
         throw new Redirect404Exception();
     }
     $this->addContentMenu();
     $this->contentMenu->getElement('qst_index')->setActive(true);
     $editQuestion = $this->questionService->findQuestionById($questionId);
     $parent = $editQuestion->parent;
     $parentIsset = false;
     if (!empty($parent)) {
         $parentDto = $this->questionService->findQuestionByName($parent);
         $parentIsset = !empty($parentDto) ? true : false;
         if ($parentIsset) {
             $this->assign('parentUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $parentDto->id)));
             $this->assign('parentLabel', $this->questionService->getQuestionLang($parentDto->name));
         }
     }
     $this->assign('parentIsset', $parentIsset);
     if ($editQuestion === null) {
         throw new Redirect404Exception();
     }
     $this->assign('question', $editQuestion);
     //$editQuestionToAccountType = $this->questionService->findAccountTypeByQuestionName( $editQuestion->name );
     // get available account types from DB
     /* @var BOL_QuestionService $this->questionService */
     $accountTypes = $this->questionService->findAllAccountTypes();
     $serviceLang = BOL_LanguageService::getInstance();
     $language = OW::getLanguage();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     $accounts = array(BOL_QuestionService::ALL_ACCOUNT_TYPES => $language->text('base', 'questions_account_type_all'));
     /* @var $value BOL_QuestionAccount */
     foreach ($accountTypes as $value) {
         $accounts[$value->name] = $language->text('base', 'questions_account_type_' . $value->name);
     }
     $sections = $this->questionService->findAllSections();
     // need to hide sections select box
     if (empty($section)) {
         $this->assign('no_sections', true);
     }
     $sectionsArray = array();
     /* @var $section BOL_QuestionSection */
     foreach ($sections as $section) {
         $sectionsArray[$section->name] = $language->text('base', 'questions_section_' . $section->name . '_label');
     }
     $presentations = array();
     $presentationsLabel = array();
     $presentationList = $this->questionService->getPresentations();
     if ($editQuestion->name != 'password') {
         unset($presentationList[BOL_QuestionService::QUESTION_PRESENTATION_PASSWORD]);
     }
     foreach ($presentationList as $presentationKey => $presentation) {
         if ($presentationList[$editQuestion->presentation] == $presentation) {
             $presentations[$presentationKey] = $presentationKey;
             //TODO add langs with presentation labels
             $presentationsLabel[$presentationKey] = $language->text('base', 'questions_question_presentation_' . $presentationKey . '_label');
         }
     }
     $presentation = $editQuestion->presentation;
     if (OW::getSession()->isKeySet(self::EDIT_QUESTION_SESSION_VAR)) {
         $session = OW::getSession()->get(self::EDIT_QUESTION_SESSION_VAR);
         if (isset($session['qst_answer_type']) && isset($presentations[$session['qst_answer_type']])) {
             $presentation = $presentations[$session['qst_answer_type']];
         }
     }
     if (isset($_POST['qst_answer_type']) && isset($presentations[$_POST['qst_answer_type']])) {
         $presentation = $presentations[$_POST['qst_answer_type']];
     }
     //$this->addForm(new LanguageValueEditForm( 'base', 'questions_question_' . ($editQuestion->id) . '_label', $this ) );
     //--  -------------------------------------
     //--  add question values form creating
     //--  -------------------------------------
     $questionValues = $this->questionService->findQuestionValues($editQuestion->name);
     $this->assign('questionValues', $questionValues);
     //add field values form
     $addQuestionValuesForm = new AddValuesForm($questionId);
     $addQuestionValuesForm->setAction($this->ajaxResponderUrl);
     $this->addForm($addQuestionValuesForm);
     //--  -------------------------------------
     //--  edit field form creating
     //--  -------------------------------------
     $editForm = new Form('qst_edit_form');
     $editForm->setId('qst_edit_form');
     $disableActionList = array('disable_account_type' => false, 'disable_answer_type' => false, 'disable_presentation' => false, 'disable_column_count' => false, 'disable_display_config' => false, 'disable_required' => false, 'disable_on_join' => false, 'disable_on_view' => false, 'disable_on_search' => false, 'disable_on_edit' => false);
     $event = new OW_Event('admin.disable_fields_on_edit_profile_question', array('questionDto' => $editQuestion), $disableActionList);
     OW::getEventManager()->trigger($event);
     $disableActionList = $event->getData();
     if (count($accountTypes) > 1) {
         $qstAccountType = new Selectbox('qst_account_type');
         $qstAccountType->setLabel($language->text('admin', 'questions_for_account_type_label'));
         $qstAccountType->setDescription($language->text('admin', 'questions_for_account_type_description'));
         $qstAccountType->setOptions($accounts);
         $qstAccountType->setValue(BOL_QuestionService::ALL_ACCOUNT_TYPES);
         $qstAccountType->setHasInvitation(false);
         if ($editQuestion->accountTypeName !== null) {
             $qstAccountType->setValue($editQuestion->accountTypeName);
//.........这里部分代码省略.........
开发者ID:vazahat,项目名称:dudex,代码行数:101,代码来源:questions.php


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