本文整理汇总了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;
示例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'));
}