/** * Save general settings */ public function saveGeneralSettings() { global $tpl, $lng, $ilCtrl, $ilUser; $this->initGeneralSettingsForm(); if ($this->form->checkInput()) { if ($this->workWithUserSetting("skin_style")) { //set user skin and style if ($_POST["skin_style"] != "") { $sknst = explode(":", $_POST["skin_style"]); if ($ilUser->getPref("style") != $sknst[1] || $ilUser->getPref("skin") != $sknst[0]) { $ilUser->setPref("skin", $sknst[0]); $ilUser->setPref("style", $sknst[1]); } } } // language if ($this->workWithUserSetting("language")) { $ilUser->setLanguage($_POST["language"]); } // hits per page if ($this->workWithUserSetting("hits_per_page")) { if ($_POST["hits_per_page"] != "") { $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]); } } // set show users online if ($this->workWithUserSetting("show_users_online")) { $ilUser->setPref("show_users_online", $_POST["show_users_online"]); } // store last visited? global $ilNavigationHistory; $ilUser->setPref("store_last_visited", (int) $_POST["store_last_visited"]); if ((int) $_POST["store_last_visited"] > 0) { $ilNavigationHistory->deleteDBEntries(); if ((int) $_POST["store_last_visited"] == 2) { $ilNavigationHistory->deleteSessionEntries(); } } // set hide own online_status if ($this->workWithUserSetting("hide_own_online_status")) { if ($_POST["hide_own_online_status"] == 1) { $ilUser->setPref("hide_own_online_status", "y"); } else { $ilUser->setPref("hide_own_online_status", "n"); } } // set show users online if ($this->workWithUserSetting("screen_reader_optimization")) { $ilUser->setPref("screen_reader_optimization", $_POST["screen_reader_optimization"]); } // session reminder include_once 'Services/Authentication/classes/class.ilSessionReminder.php'; if (ilSessionReminder::isGloballyActivated()) { $ilUser->setPref('session_reminder_enabled', (int) $this->form->getInput('session_reminder_enabled')); $ilUser->setPref('session_reminder_lead_time', $this->form->getInput('session_reminder_lead_time')); } // starting point include_once "Services/User/classes/class.ilUserUtil.php"; if (ilUserUtil::hasPersonalStartingPoint()) { ilUserUtil::setPersonalStartingPoint($this->form->getInput('usr_start'), $this->form->getInput('usr_start_ref_id')); } // selector for unicode characters global $ilSetting; if ($ilSetting->get('char_selector_availability') > 0) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_USER); $char_selector->getFormValues($this->form); $ilUser->setPref('char_selector_availability', $char_selector->getConfig()->getAvailability()); $ilUser->setPref('char_selector_definition', $char_selector->getConfig()->getDefinition()); } $ilUser->update(); // calendar settings include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php'; $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId()); $user_settings->setTimeZone($this->form->getInput("timezone")); $user_settings->setDateFormat((int) $this->form->getInput("date_format")); $user_settings->setTimeFormat((int) $this->form->getInput("time_format")); $user_settings->save(); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "showGeneralSettings"); } $this->form->setValuesByPost(); $this->showGeneralSettings(true); }
private function performSaveForm(ilPropertyFormGUI $form) { include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj =& new ilMD($this->testOBJ->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); // title $md_section->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue())); $md_section->update(); // Description $md_desc_ids = $md_section->getDescriptionIds(); if ($md_desc_ids) { $md_desc = $md_section->getDescription(array_pop($md_desc_ids)); $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $md_desc->update(); } else { $md_desc = $md_section->addDescription(); $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $md_desc->save(); } $this->testOBJ->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue())); $this->testOBJ->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $this->testOBJ->update(); // pool usage setting if ($form->getItemByPostVar('use_pool') instanceof ilFormPropertyGUI) { $this->testOBJ->setPoolUsage($form->getItemByPostVar('use_pool')->getChecked()); } // Archiving $this->testOBJ->setEnableArchiving($form->getItemByPostVar('enable_archiving')->getChecked()); // Examview $this->testOBJ->setEnableExamview($form->getItemByPostVar('enable_examview')->getChecked()); $this->testOBJ->setShowExamviewHtml($form->getItemByPostVar('show_examview_html')->getChecked()); $this->testOBJ->setShowExamviewPdf($form->getItemByPostVar('show_examview_pdf')->getChecked()); // online status $this->testOBJ->setOnline($form->getItemByPostVar('online')->getChecked()); // activation if ($form->getItemByPostVar('activation_type')->getValue() == ilObjectActivation::TIMINGS_ACTIVATION) { $this->testOBJ->setActivationLimited(true); $this->testOBJ->setActivationVisibility($form->getItemByPostVar('activation_visibility')->getChecked()); $period = $form->getItemByPostVar("access_period"); $this->testOBJ->setActivationStartingTime($period->getStart()->get(IL_CAL_UNIX)); $this->testOBJ->setActivationEndingTime($period->getEnd()->get(IL_CAL_UNIX)); } else { $this->testOBJ->setActivationLimited(false); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $this->testOBJ->setIntroduction($form->getItemByPostVar('introduction')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->testOBJ->setShowInfo($form->getItemByPostVar('showinfo')->getChecked()); $this->testOBJ->setFinalStatement($form->getItemByPostVar('finalstatement')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->testOBJ->setShowFinalStatement($form->getItemByPostVar('showfinalstatement')->getChecked()); if ($form->getItemByPostVar('chb_postpone') instanceof ilFormPropertyGUI) { $this->testOBJ->setSequenceSettings($form->getItemByPostVar('chb_postpone')->getChecked()); } $this->testOBJ->setShuffleQuestions($form->getItemByPostVar('chb_shuffle_questions')->getChecked()); $this->testOBJ->setListOfQuestions($form->getItemByPostVar('list_of_questions')->getChecked()); $listOfQuestionsOptions = $form->getItemByPostVar('list_of_questions_options')->getValue(); if (is_array($listOfQuestionsOptions)) { $this->testOBJ->setListOfQuestionsStart(in_array('chb_list_of_questions_start', $listOfQuestionsOptions)); $this->testOBJ->setListOfQuestionsEnd(in_array('chb_list_of_questions_end', $listOfQuestionsOptions)); $this->testOBJ->setListOfQuestionsDescription(in_array('chb_list_of_questions_with_description', $listOfQuestionsOptions)); } else { $this->testOBJ->setListOfQuestionsStart(0); $this->testOBJ->setListOfQuestionsEnd(0); $this->testOBJ->setListOfQuestionsDescription(0); } if ($form->getItemByPostVar('mailnotification') instanceof ilFormPropertyGUI) { $this->testOBJ->setMailNotification($form->getItemByPostVar('mailnotification')->getValue()); } if ($form->getItemByPostVar('mailnottype') instanceof ilFormPropertyGUI) { $this->testOBJ->setMailNotificationType($form->getItemByPostVar('mailnottype')->getChecked()); } if ($form->getItemByPostVar('chb_show_marker') instanceof ilFormPropertyGUI) { $this->testOBJ->setShowMarker($form->getItemByPostVar('chb_show_marker')->getChecked()); } if ($form->getItemByPostVar('chb_show_cancel') instanceof ilFormPropertyGUI) { $this->testOBJ->setShowCancel($form->getItemByPostVar('chb_show_cancel')->getChecked()); } if ($form->getItemByPostVar('kiosk') instanceof ilFormPropertyGUI) { $this->testOBJ->setKioskMode($form->getItemByPostVar('kiosk')->getChecked()); $kioskOptions = $form->getItemByPostVar('kiosk_options')->getValue(); if (is_array($kioskOptions)) { $this->testOBJ->setShowKioskModeTitle(in_array('kiosk_title', $kioskOptions)); $this->testOBJ->setShowKioskModeParticipant(in_array('kiosk_participant', $kioskOptions)); $this->testOBJ->setExamidInKiosk(in_array('examid_in_kiosk', $_POST["kiosk_options"])); } } // redirect after test if ($form->getItemByPostVar('redirection_enabled')->getChecked()) { $this->testOBJ->setRedirectionMode($form->getItemByPostVar('redirection_mode')->getValue()); } else { $this->testOBJ->setRedirectionMode(REDIRECT_NONE); } if (strlen($form->getItemByPostVar('redirection_url')->getValue())) { $this->testOBJ->setRedirectionUrl($form->getItemByPostVar('redirection_url')->getValue()); } else { $this->testOBJ->setRedirectionUrl(null); } if ($form->getItemByPostVar('sign_submission')->getChecked()) { $this->testOBJ->setSignSubmission(true); } else { $this->testOBJ->setSignSubmission(false); } $this->testOBJ->setEnableProcessingTime($form->getItemByPostVar('chb_processing_time')->getChecked()); if ($this->testOBJ->getEnableProcessingTime()) { $processingTime = $form->getItemByPostVar('processing_time'); $this->testOBJ->setProcessingTime(sprintf("%02d:%02d:%02d", $processingTime->getHours(), $processingTime->getMinutes(), $processingTime->getSeconds())); } else { $this->testOBJ->setProcessingTime(''); } $this->testOBJ->setResetProcessingTime($form->getItemByPostVar('chb_reset_processing_time')->getChecked()); if ($form->getItemByPostVar('chb_starting_time')->getChecked()) { $startingTimeSetting = $form->getItemByPostVar('starting_time'); $this->testOBJ->setStartingTime(ilFormat::dateDB2timestamp($startingTimeSetting->getDate()->get(IL_CAL_DATETIME))); } else { $this->testOBJ->setStartingTime(''); } if ($form->getItemByPostVar('chb_ending_time')->getChecked()) { $endingTimeSetting = $form->getItemByPostVar('ending_time'); $this->testOBJ->setEndingTime(ilFormat::dateDB2timestamp($endingTimeSetting->getDate()->get(IL_CAL_DATETIME))); } else { $this->testOBJ->setEndingTime(''); } if ($form->getItemByPostVar('forcejs') instanceof ilFormPropertyGUI) { $this->testOBJ->setForceJS($form->getItemByPostVar('forcejs')->getChecked()); } if ($form->getItemByPostVar('title_output') instanceof ilFormPropertyGUI) { $this->testOBJ->setTitleOutput($form->getItemByPostVar('title_output')->getValue()); } if ($form->getItemByPostVar('password') instanceof ilFormPropertyGUI) { $this->testOBJ->setPassword($form->getItemByPostVar('password')->getValue()); } if ($form->getItemByPostVar('allowedUsers') instanceof ilFormPropertyGUI) { $this->testOBJ->setAllowedUsers($form->getItemByPostVar('allowedUsers')->getValue()); } if ($form->getItemByPostVar('allowedUsersTimeGap') instanceof ilFormPropertyGUI) { $this->testOBJ->setAllowedUsersTimeGap($form->getItemByPostVar('allowedUsersTimeGap')->getValue()); } // Selector for uicode characters global $ilSetting; if ($ilSetting->get('char_selector_availability') > 0) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->addFormProperties($form); $char_selector->getFormValues($form); $this->testOBJ->setCharSelectorAvailability($char_selector->getConfig()->getAvailability()); $this->testOBJ->setCharSelectorDefinition($char_selector->getConfig()->getDefinition()); } $this->testOBJ->setAutosave($form->getItemByPostVar('autosave')->getChecked()); $this->testOBJ->setAutosaveIval($form->getItemByPostVar('autosave_ival')->getValue() * 1000); $this->testOBJ->setUsePreviousAnswers($form->getItemByPostVar('chb_use_previous_answers')->getChecked()); // highscore settings $this->testOBJ->setHighscoreEnabled((bool) $form->getItemByPostVar('highscore_enabled')->getChecked()); $this->testOBJ->setHighscoreAnon((bool) $form->getItemByPostVar('highscore_anon')->getChecked()); $this->testOBJ->setHighscoreAchievedTS((bool) $form->getItemByPostVar('highscore_achieved_ts')->getChecked()); $this->testOBJ->setHighscoreScore((bool) $form->getItemByPostVar('highscore_score')->getChecked()); $this->testOBJ->setHighscorePercentage((bool) $form->getItemByPostVar('highscore_percentage')->getChecked()); $this->testOBJ->setHighscoreHints((bool) $form->getItemByPostVar('highscore_hints')->getChecked()); $this->testOBJ->setHighscoreWTime((bool) $form->getItemByPostVar('highscore_wtime')->getChecked()); $this->testOBJ->setHighscoreOwnTable((bool) $form->getItemByPostVar('highscore_own_table')->getChecked()); $this->testOBJ->setHighscoreTopTable((bool) $form->getItemByPostVar('highscore_top_table')->getChecked()); $this->testOBJ->setHighscoreTopNum((int) $form->getItemByPostVar('highscore_top_num')->getValue()); if (!$this->testOBJ->participantDataExist()) { // question set type if ($form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI) { $this->testOBJ->setQuestionSetType($form->getItemByPostVar('question_set_type')->getValue()); } // anonymity setting $this->testOBJ->setAnonymity($form->getItemByPostVar('anonymity')->getValue()); // nr of tries (max passes) $this->testOBJ->setNrOfTries($form->getItemByPostVar('nr_of_tries')->getValue()); // fixed participants setting if ($form->getItemByPostVar('fixedparticipants') instanceof ilFormPropertyGUI) { $this->testOBJ->setFixedParticipants($form->getItemByPostVar('fixedparticipants')->getChecked()); } } // store settings to db $this->testOBJ->saveToDb(true); // Update ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->testOBJ); $ecs->handleSettingsUpdate(); }
/** * @param ilPropertyFormGUI $form */ private function saveQuestionBehaviourProperties(ilPropertyFormGUI $form) { if ($form->getItemByPostVar('title_output') instanceof ilFormPropertyGUI) { $this->testOBJ->setTitleOutput($form->getItemByPostVar('title_output')->getValue()); } $this->testOBJ->setAutosave($form->getItemByPostVar('autosave')->getChecked()); $this->testOBJ->setAutosaveIval($form->getItemByPostVar('autosave_ival')->getValue() * 1000); $this->testOBJ->setShuffleQuestions($form->getItemByPostVar('chb_shuffle_questions')->getChecked()); if (!$this->testOBJ->participantDataExist() && $this->formPropertyExists($form, 'offer_hints')) { $this->testOBJ->setOfferingQuestionHintsEnabled($form->getItemByPostVar('offer_hints')->getChecked()); } if ($this->formPropertyExists($form, 'instant_feedback')) { $this->testOBJ->setScoringFeedbackOptionsByArray($form->getItemByPostVar('instant_feedback')->getValue()); } if (!$this->testOBJ->participantDataExist() && $this->formPropertyExists($form, 'obligations_enabled')) { $this->testOBJ->setObligationsEnabled($form->getItemByPostVar('obligations_enabled')->getChecked()); } if ($this->isCharSelectorPropertyRequired()) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->addFormProperties($form); $char_selector->getFormValues($form); $this->testOBJ->setCharSelectorAvailability($char_selector->getConfig()->getAvailability()); $this->testOBJ->setCharSelectorDefinition($char_selector->getConfig()->getDefinition()); } }