本文整理汇总了PHP中BOL_QuestionService::saveOrUpdateQuestionValue方法的典型用法代码示例。如果您正苦于以下问题:PHP BOL_QuestionService::saveOrUpdateQuestionValue方法的具体用法?PHP BOL_QuestionService::saveOrUpdateQuestionValue怎么用?PHP BOL_QuestionService::saveOrUpdateQuestionValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOL_QuestionService
的用法示例。
在下文中一共展示了BOL_QuestionService::saveOrUpdateQuestionValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
//.........这里部分代码省略.........
}
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'));
}
$editForm->setValues($_POST);
OW::getSession()->set(self::EDIT_QUESTION_SESSION_VAR, $_POST);
//OW::getFeedback()->error($language->text('admin', 'questions_question_was_not_updated_message'));
$this->redirect();
}
$types = array();
foreach ($this->questionService->getPresentations() as $presentation => $type) {
if ($type === 'select') {
$types[] = $presentation;
}
}
$questionLabel = $this->questionService->getQuestionLang($editQuestion->name);
$questionDescription = $this->questionService->getQuestionDescriptionLang($editQuestion->name);
$noValue = $language->text('admin', 'questions_empty_lang_value');
$questionLabel = mb_strlen(trim($questionLabel)) == 0 || $questionLabel == ' ' ? $noValue : $questionLabel;
$questionDescription = mb_strlen(trim($questionDescription)) == 0 || $questionDescription == ' ' ? $noValue : $questionDescription;
$this->assign('questionLabel', $questionLabel);
$this->assign('questionDescription', $questionDescription);
$language->addKeyForJs('admin', 'questions_empty_lang_value');
$language->addKeyForJs('admin', 'questions_edit_question_name_title');
$language->addKeyForJs('admin', 'questions_edit_question_description_title');
$language->addKeyForJs('admin', 'questions_edit_question_value_title');
$language->addKeyForJs('admin', 'questions_edit_delete_value_confirm_message');
$fields = array();
foreach ($editForm->getElements() as $element) {
if (!$element instanceof HiddenField) {
$fields[$element->getName()] = $element->getName();
}
}
$this->assign('formData', $fields);
$script = '
window.editQuestion = new editQuestion(' . json_encode(array('types' => $types, 'ajaxResponderUrl' => $this->ajaxResponderUrl)) . ');
';
OW::getDocument()->addOnloadScript($script);
$jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
$baseJsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
OW::getDocument()->addScript($jsDir . "questions.js");
OW::getDocument()->addScript($baseJsDir . "jquery-ui.min.js");
}