protected function save($a_return = false, $a_sync = false) { global $ilUser; if ($this->saveForm()) { // #13784 if ($a_return && !SurveyQuestion::_isComplete($this->object->getId())) { ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question")); return $this->editQuestion(); } $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType()); $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType()); $originalexists = $this->object->_questionExists($this->object->original_id); $this->ctrl->setParameter($this, "q_id", $this->object->getId()); include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; // pool question? if ($a_sync) { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, 'copySyncForm'); } else { // form: update original pool question, too? if ($originalexists && SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { if ($a_return) { $this->ctrl->setParameter($this, 'rtrn', 1); } $this->ctrl->redirect($this, 'originalSyncForm'); } } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->redirectAfterSaving($a_return); } }
/** * save question */ function save($a_return = false, $a_sync = false) { global $ilUser; $old_id = $_GET["q_id"]; $result = $this->writePostData(); if ($result == 0) { $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType()); $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType()); $this->object->saveToDb(); $originalexists = $this->object->_questionExists($this->object->original_id); $this->ctrl->setParameter($this, "q_id", $this->object->getId()); include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; // pool question? if ($a_sync) { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, 'copySyncForm'); } else { // form: update original pool question, too? if ($_GET["calling_survey"] && $originalexists && SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { if ($a_return) { $this->ctrl->setParameter($this, 'rtrn', 1); } $this->ctrl->redirect($this, 'originalSyncForm'); } } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->redirectAfterSaving($a_return); } }