/** * Apply settings template * * @param int $template_id */ function applySettingsTemplate($template_id) { if (!$template_id) { return; } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template_id); $template_settings = $template->getSettings(); if ($template_settings) { if ($template_settings["show_question_titles"] !== NULL) { if ($template_settings["show_question_titles"]["value"]) { $this->setShowQuestionTitles(true); } else { $this->setShowQuestionTitles(false); } } if ($template_settings["use_pool"] !== NULL) { if ($template_settings["use_pool"]["value"]) { $this->setPoolUsage(true); } else { $this->setPoolUsage(false); } } if ($template_settings["anonymization_options"]["value"]) { $anon_map = array('personalized' => self::ANONYMIZE_OFF, 'anonymize_with_code' => self::ANONYMIZE_ON, 'anonymize_without_code' => self::ANONYMIZE_FREEACCESS); $this->setAnonymize($anon_map[$template_settings["anonymization_options"]["value"]]); } /* other settings: not needed here * - enabled_end_date * - enabled_start_date * - rte_switch */ } $this->setTemplate($template_id); $this->saveToDb(); }
/** * Init survey settings form * * @return ilPropertyFormGUI */ function initPropertiesForm() { $template_settings = $hide_rte_switch = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("survey_properties"); // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("settings")); $form->addItem($header); // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "svy"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // pool usage $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool"); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1); $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info")); $pool_usage->addOption($opt); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0); $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info")); $pool_usage->addOption($opt); $pool_usage->setValue($this->object->getPoolUsage()); $form->addItem($pool_usage); // 360°: appraisees if ($this->object->get360Mode()) { $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval"); $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info")); $self_eval->setChecked($this->object->get360SelfEvaluation()); $form->addItem($self_eval); $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate"); $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info")); $self_rate->setChecked($this->object->get360SelfRaters()); $form->addItem($self_rate); $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr"); $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info")); $self_appr->setChecked($this->object->get360SelfAppraisee()); $form->addItem($self_appr); } // activation include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info); $online->setChecked($this->object->isOnline()); $form->addItem($online); $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type'); // $act_type->setInfo($this->lng->txt('svy_availability_until_info')); $act_type->setChecked($this->object->isActivationLimited()); $this->tpl->addJavaScript('./Services/Form/js/date_duration.js'); include_once "Services/Form/classes/class.ilDateDurationInputGUI.php"; $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period"); $dur->setShowTime(true); $date = $this->object->getActivationStartDate(); $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setStartText($this->lng->txt('rep_activation_limited_start')); $date = $this->object->getActivationEndDate(); $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setEndText($this->lng->txt('rep_activation_limited_end')); $act_type->addSubItem($dur); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity'); $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $act_type->addSubItem($visible); $form->addItem($act_type); // before start $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_before_start')); $form->addItem($section); // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->setInfo($this->lng->txt("survey_introduction_info")); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->addButton("pastelatex"); $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch); $form->addItem($intro); // access $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_access')); $form->addItem($section); // enable start date $start = $this->object->getStartDate(); $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date"); $enablestartingtime->setValue(1); // $enablestartingtime->setOptionTitle($this->lng->txt("enabled")); $enablestartingtime->setChecked($start); // start date $startingtime = new ilDateTimeInputGUI('', 'start_date'); $startingtime->setShowTime(true); if ($start) { $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); // enable end date $end = $this->object->getEndDate(); $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date"); $enableendingtime->setValue(1); // $enableendingtime->setOptionTitle($this->lng->txt("enabled")); $enableendingtime->setChecked($end); // end date $endingtime = new ilDateTimeInputGUI('', 'end_date'); $endingtime->setShowTime(true); if ($end) { $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // anonymization if (!$this->object->get360Mode()) { $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes"); $codes->setInfo($this->lng->txt("survey_access_codes_info")); $codes->setChecked(!$this->object->isAccessibleWithoutCode()); $form->addItem($codes); if ($this->object->_hasDatasets($this->object->getSurveyId())) { $codes->setDisabled(true); } } // question behaviour $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour')); $form->addItem($section); // show question titles $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles"); $show_question_titles->setValue(1); $show_question_titles->setChecked($this->object->getShowQuestionTitles()); $form->addItem($show_question_titles); // finishing $info = new ilFormSectionHeaderGUI(); $info->setTitle($this->lng->txt("svy_settings_section_finishing")); $form->addItem($info); $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own"); $view_own->setInfo($this->lng->txt("svy_results_view_own_info")); $view_own->setChecked($this->object->hasViewOwnResults()); $form->addItem($view_own); $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own"); $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info")); $mail_own->setChecked($this->object->hasMailOwnResults()); $form->addItem($mail_own); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->addButton("pastelatex"); $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch); $form->addItem($finalstatement); // mail notification $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification"); // $mailnotification->setOptionTitle($this->lng->txt("activate")); $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info")); // #11762 $mailnotification->setValue(1); $mailnotification->setChecked($this->object->getMailNotification()); // addresses $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses"); $mailaddresses->setValue($this->object->getMailAddresses()); $mailaddresses->setSize(80); $mailaddresses->setInfo($this->lng->txt('mailaddresses_info')); $mailaddresses->setRequired(true); // participant data $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata"); $participantdata->setValue($this->object->getMailParticipantData()); $participantdata->setRows(6); $participantdata->setCols(80); $participantdata->setUseRte(false); $participantdata->setInfo($this->lng->txt("mailparticipantdata_info")); // #12755 - because of privacy concerns we restrict user data to a minimum $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login"); $txt = array(); foreach ($placeholders as $placeholder => $caption) { $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption); } $txt = implode("<br />", $txt); $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true); $participantdatainfo->setValue($txt); $mailnotification->addSubItem($mailaddresses); $mailnotification->addSubItem($participantdata); $mailnotification->addSubItem($participantdatainfo); $form->addItem($mailnotification); // tutor notification - currently not available for 360° if (!$this->object->get360Mode()) { // parent course? global $tree; $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp"); if (!$has_parent) { $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs"); } $num_inv = sizeof($this->object->getInvitedUsers()); // notification $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut"); $tut->setChecked($this->object->getTutorNotificationStatus()); $form->addItem($tut); $tut_logins = array(); $tuts = $this->object->getTutorNotificationRecipients(); if ($tuts) { foreach ($tuts as $tut_id) { $tmp = ilObjUser::_lookupName($tut_id); if ($tmp["login"]) { $tut_logins[] = $tmp["login"]; } } } $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids"); $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true)); $tut_ids->setRequired(true); $tut_ids->setMulti(true); $tut_ids->setMultiValues($tut_logins); $tut_ids->setValue(array_shift($tut_logins)); $tut->addSubItem($tut_ids); $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp"); $tut_grp->setRequired(true); $tut_grp->setValue($this->object->getTutorNotificationTarget()); $tut->addSubItem($tut_grp); $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE); if (!$has_parent) { $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive")); } $tut_grp->addOption($tut_grp_crs); $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS); $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv)); $tut_grp->addOption($tut_grp_inv); } // reminders // reminder - currently not available for 360° if (!$this->object->get360Mode()) { $info = new ilFormSectionHeaderGUI(); $info->setTitle($this->lng->txt("svy_settings_section_reminders")); $form->addItem($info); $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd"); $rmd->setChecked($this->object->getReminderStatus()); $form->addItem($rmd); $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start"); $rmd_start->setRequired(true); $start = $this->object->getReminderStart(); if ($start) { $rmd_start->setDate($start); } $rmd->addSubItem($rmd_start); $end = $this->object->getReminderEnd(); $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end"); $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end); if ($end) { $rmd_end->setDate($end); } $rmd->addSubItem($rmd_end); $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq"); $rmd_freq->setRequired(true); $rmd_freq->setSize(3); $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days")); $rmd_freq->setValue($this->object->getReminderFrequency()); $rmd_freq->setMinValue(1); $rmd->addSubItem($rmd_freq); $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp"); $rmd_grp->setRequired(true); $rmd_grp->setValue($this->object->getReminderTarget()); $rmd->addSubItem($rmd_grp); $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE); if (!$has_parent) { $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive")); } $rmd_grp->addOption($rmd_grp_crs); $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS); $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv)); $rmd_grp->addOption($rmd_grp_inv); } // results $results = new ilFormSectionHeaderGUI(); $results->setTitle($this->lng->txt("results")); $form->addItem($results); // evaluation access if (!$this->object->get360Mode()) { $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access"); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_off_info")); $evaluation_access->addOption($option); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_all_info")); $evaluation_access->addOption($option); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info")); $evaluation_access->addOption($option); $evaluation_access->setValue($this->object->getEvaluationAccess()); $form->addItem($evaluation_access); $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options"); $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers"); $option->setInfo($this->lng->txt("survey_results_personalized_info")); $anonymization_options->addOption($option); $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon"); $option->setInfo($this->lng->txt("survey_results_anonymized_info")); $anonymization_options->addOption($option); $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers"); $form->addItem($anonymization_options); if ($this->object->_hasDatasets($this->object->getSurveyId())) { $anonymization_options->setDisabled(true); } } else { $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res"); $ts_results->setValue($this->object->get360Results()); $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE); $option->setInfo($this->lng->txt("survey_360_results_none_info")); $ts_results->addOption($option); $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN); $option->setInfo($this->lng->txt("survey_360_results_own_info")); $ts_results->addOption($option); $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL); $option->setInfo($this->lng->txt("survey_360_results_all_info")); $ts_results->addOption($option); $form->addItem($ts_results); } // competence service activation for 360 mode include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php"; $skmg_set = new ilSkillManagementSettings(); if ($this->object->get360Mode() && $skmg_set->isActivated()) { $other = new ilFormSectionHeaderGUI(); $other->setTitle($this->lng->txt("other")); $form->addItem($other); $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service"); $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info")); $skill_service->setChecked($this->object->get360SkillService()); $form->addItem($skill_service); } $form->addCommandButton("saveProperties", $this->lng->txt("save")); // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }
/** * Create plugin specific data * @access public */ public function doCreate() { /** * @var $ilCtrl ilCtrl */ global $ilCtrl; $cmdClass = $ilCtrl->getCmdClass(); if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) { $tpl_id = (int) $_POST['tpl_id']; } else { throw new ilException('no_template_id_given'); } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); foreach ($templates as $template) { if ((int) $template['id'] == $tpl_id) { $template_settings = array(); if ($template['id']) { $objTemplate = new ilSettingsTemplate($template['id']); $template_settings = $objTemplate->getSettings(); } } } // reuse existing ac-room if (isset($_POST['creation_type']) && $_POST['creation_type'] == 'existing_vc' && $template_settings['reuse_existing_rooms']['hide'] == '0') { // 1. the sco-id will be assigned to this new ilias object $sco_id = (int) $_POST['available_rooms']; try { $this->useExistingVC($this->getId(), $sco_id); } catch (ilException $e) { $this->creationRollback(); throw new ilException($this->txt($e->getMessage())); } return; } if (strlen($_POST['instructions']) > 0) { $post_instructions = (string) $_POST['instructions']; } else { if (strlen($_POST['instructions_2']) > 0) { $post_instructions = (string) $_POST['instructions_2']; } else { if (strlen($_POST['instructions_3']) > 0) { $post_instructions = (string) $_POST['instructions_3']; } } } if (strlen($_POST['contact_info']) > 0) { $post_contact = (string) $_POST['contact_info']; } else { if (strlen($_POST['contact_info_2']) > 0) { $post_contact = (string) $_POST['contact_info_2']; } else { if (strlen($_POST['contact_info_3']) > 0) { $post_contact = (string) $_POST['contact_info_3']; } } } $this->setInstructions($post_instructions); $this->setContactInfo($post_contact); if (isset($_POST['time_type_selection']) && $_POST['time_type_selection'] == 'permanent_room') { $this->setPermanentRoom(1); } else { if (!isset($_POST['time_type_selection']) && ilAdobeConnectServer::getSetting('default_perm_room') == 1) { $this->setPermanentRoom(1); } else { $this->setPermanentRoom(0); } } if (isset($_POST['access_level'])) { $this->setPermission($_POST['access_level']); } else { $this->setPermission(ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED); } $this->pluginObj->includeClass('class.ilXAVCPermissions.php'); $this->setReadContents(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_CONTENTS, 'view')); $this->setReadRecords(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_RECORDS, 'view')); $this->externalLogin = $this->checkExternalUser(); $folder_id = $this->getFolderIdByLogin($this->externalLogin); $this->setFolderId($folder_id); if ($cmdClass == 'ilobjectcopygui') { $now = new ilDateTime(time(), IL_CAL_UNIX); $this->start_date = new ilDateTime($now->getUnixTime() - 7200, IL_CAL_UNIX); $this->duration = array('hours' => 1, 'minutes' => 0); $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId()); return; } try { if (isset($_POST['start_date']) && $template_settings['start_date']['hide'] == '0') { //start_date $this->start_date = new ilDateTime($_POST['start_date']['date'] . ' ' . $_POST['start_date']['time'], IL_CAL_DATETIME); } else { $this->start_date = new ilDateTime(time() + 120, IL_CAL_UNIX); } // duration if (isset($_POST['duration']['hh']) && isset($_POST['duration']['mm']) && ($_POST['duration']['hh'] > 0 || $_POST['duration']['mm'] > 0) && $template_settings['duration']['hide'] == '0') { $this->duration = array('hours' => $_POST['duration']['hh'], 'minutes' => $_POST['duration']['mm']); } else { $this->duration = array('hours' => (int) $template_settings['duration']['value'], 'minutes' => 0); } //end_date $this->end_date = $this->getEnddate(); $concurrent_vc = count($this->checkConcurrentMeetingDates()); $max_rep_obj_vc = ilAdobeConnectServer::getSetting('ac_interface_objects'); if ((int) $max_rep_obj_vc > 0 && $concurrent_vc >= $max_rep_obj_vc) { throw new ilException('xavc_reached_number_of_connections'); } $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId()); } catch (ilException $e) { $this->creationRollback(); throw new ilException($this->txt($e->getMessage())); } }
/** * save object * @access public */ function afterSave(ilObject $a_new_object) { $tstdef = $this->getDidacticTemplateVar("tstdef"); if ($tstdef) { $testDefaultsId = $tstdef; $testDefaults = ilObjTest::_getTestDefaults($testDefaultsId); $a_new_object->applyDefaults($testDefaults); } $template_id = $this->getDidacticTemplateVar("tsttpl"); if ($template_id) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); if ($template_settings) { $this->applyTemplate($template_settings, $a_new_object); } $a_new_object->setTemplate($template_id); } $a_new_object->saveToDb(); // always send a message ilUtil::sendSuccess($this->lng->txt("object_added"), true); $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId()); $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI'); }
/** * Save object * @access public */ public function save() { /** * @var $rbacsystem $rbacsystem * @var $lng $lng * @var $objDefinition ilObjectDefinition */ global $rbacsystem, $objDefinition, $lng; $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"]; // create permission is already checked in createObject. This check here is done to prevent hacking attempts if (!$rbacsystem->checkAccess("create", (int) $_GET["ref_id"], $new_type)) { $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE); } $this->ctrl->setParameter($this, "new_type", $new_type); if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) { $tpl_id = (int) $_POST['tpl_id']; } else { $this->ilias->raiseError($this->lng->txt("no_template_id_given"), $this->ilias->error_obj->MESSAGE); } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); foreach ($templates as $template) { if ($template['id'] == $tpl_id) { $form = $this->initCreateForm($template); $selected_template = $template; $template_settings = array(); if ($template['id']) { $objTemplate = new ilSettingsTemplate($template['id']); $template_settings = $objTemplate->getSettings(); } } } if ($form->checkInput()) { if ($form->getInput('creation_type') == 'existing_vc' && $template_settings['reuse_existing_rooms']['hide'] == '0') { try { $location = $objDefinition->getLocation($new_type); $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $xavc_login = $ilAdobeConnectUser->getXAVCLogin(); $folder_id = $ilAdobeConnectUser->ensureUserFolderExistance($xavc_login); $sco_ids = ilObjAdobeConnect::getScosByFolderId($folder_id); $title = $sco_ids[$form->getInput('available_rooms')]['sco_name']; $description = $sco_ids[$form->getInput('available_rooms')]['description']; // create and insert object in objecttree $class_name = "ilObj" . $objDefinition->getClassName($new_type); include_once $location . "/class." . $class_name . ".php"; /** @var $newObj ilObjAdobeConnect */ $newObj = new $class_name(); $newObj->setType($new_type); $newObj->setTitle(ilUtil::stripSlashes($title)); $newObj->setDescription(ilUtil::stripSlashes($description)); $newObj->create(); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $this->afterSave($newObj); return; } catch (Exception $e) { ilUtil::sendFailure($e->getMessage(), true); } } else { global $ilUser; $owner = $ilUser->getId(); if (strlen($form->getInput('owner')) > 1) { if (ilObjUser::_lookupId($form->getInput('owner')) > 0) { $owner = ilObjUser::_lookupId($form->getInput('owner')); } else { ilUtil::sendFailure($this->lng->txt('user_not_found')); $owner = 0; } } if ($template_settings['duration']['hide'] == '1') { $durationValid = true; } else { if ($form->getInput('time_type_selection') == 'permanent_room' && ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $duration['hh'] = 2; $duration['mm'] = 0; } else { $duration = $form->getInput("duration"); } if ($duration['hh'] * 60 + $duration['mm'] < 10) { $form->getItemByPostVar('duration')->setAlert($this->pluginObj->txt('min_duration_error')); $durationValid = false; } else { $durationValid = true; } } if ($template_settings['start_date']['hide'] == '1') { $time_mismatch = false; } else { if ($durationValid) { require_once dirname(__FILE__) . '/class.ilAdobeConnectServer.php'; $serverConfig = ilAdobeConnectServer::_getInstance(); $minTime = new ilDateTime(time() + $serverConfig->getScheduleLeadTime() * 60 * 60, IL_CAL_UNIX); $newStartDate = $form->getItemByPostVar("start_date")->getDate(); $time_mismatch = false; if (ilDateTime::_before($newStartDate, $minTime) && $form->getInput('time_type_selection') != 'permanent_room') { ilUtil::sendFailure(sprintf($this->pluginObj->txt('xavc_lead_time_mismatch_create'), ilDatePresentation::formatDate($minTime)), true); $time_mismatch = true; } } } if (!$time_mismatch && $owner > 0) { try { if ($durationValid) { $location = $objDefinition->getLocation($new_type); // create and insert object in objecttree $class_name = "ilObj" . $objDefinition->getClassName($new_type); include_once $location . "/class." . $class_name . ".php"; /** @var $newObj ilObjAdobeConnect */ $newObj = new $class_name(); $newObj->setType($new_type); $newObj->setTitle(ilUtil::stripSlashes($_POST["title"])); $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"])); $newObj->setOwner($owner); $newObj->create(); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $this->afterSave($newObj); return; } } catch (Exception $e) { ilUtil::sendFailure($e->getMessage(), true); } } } $form->setValuesByPost(); if (ilAdobeConnectServer::getSetting('show_free_slots')) { $this->showCreationForm($form); } else { $this->tpl->setContent($form->getHtml()); } } else { $form->setValuesByPost(); $this->tpl->setContent($form->getHTML()); return; } }
/** * Apply auto generated setttings template * @param ilObjTest $tst */ protected function applySettingsTemplate(ilObjTest $tst) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php'; $tpl_id = 0; foreach (ilSettingsTemplate::getAllSettingsTemplates('tst', true) as $nr => $template) { switch ($this->getTestType()) { case self::TEST_TYPE_IT: if ($template['title'] == self::SETTINGS_TEMPLATE_IT) { $tpl_id = $template['id']; } break; case self::TEST_TYPE_QT: if ($template['title'] == self::SETTINGS_TEMPLATE_QT) { $tpl_id = $template['id']; } break; } if ($tpl_id) { break; } } if (!$tpl_id) { return false; } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php'; $template = new ilSettingsTemplate($tpl_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); if ($template_settings) { include_once './Modules/Test/classes/class.ilObjTestGUI.php'; $tst_gui = new ilObjTestGUI(); $tst_gui->applyTemplate($template_settings, $tst); } $tst->setTemplate($tpl_id); return true; }
/** * Save the form input of the properties form * * @access public */ function savePropertiesObject() { if (!array_key_exists("tst_properties_confirmation", $_POST)) { $hasErrors = $this->propertiesObject(true); } else { $hasErrors = false; } if (!$hasErrors) { $template_settings = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); } include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj =& new ilMD($this->object->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); // title $md_section->setTitle(ilUtil::stripSlashes($_POST['title'])); $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($_POST['description'])); $md_desc->update(); } else { $md_desc = $md_section->addDescription(); $md_desc->setDescription(ilUtil::stripSlashes($_POST['description'])); $md_desc->save(); } $this->object->setTitle(ilUtil::stripSlashes($_POST['title'])); $this->object->setDescription(ilUtil::stripSlashes($_POST['description'])); $this->object->update(); $total = $this->object->evalTotalPersons(); $randomtest_switch = false; // Check the values the user entered in the form if (!$total) { if (!strlen($_POST["random_test"])) { $random_test = 0; } else { $random_test = $_POST["random_test"]; } if (!array_key_exists("tst_properties_confirmation", $_POST)) { if (!$random_test && $this->object->areRandomTestQuestionpoolsConfigured()) { // user tries to change from a random test with existing random question pools to a non random test $this->confirmChangeProperties(self::SWITCH_RANDOM_TEST_SETTING_TO_DISABLED); return; } elseif ($random_test && $this->object->doesNonRandomTestQuestionsExist()) { // user tries to change from a non random test with existing questions to a random test $this->confirmChangeProperties(self::SWITCH_RANDOM_TEST_SETTING_TO_ENABLED); return; } } } else { $random_test = $this->object->isRandomTest(); } // buffer online status sent by form in local variable and store // it to model after the following if block, because the new status // gets reset when random test setting is switched $online = $_POST["online"]; $randomtest_switch = $this->isRandomTestSettingSwitched($random_test); if (!$total) { if ($randomtest_switch && $this->object->isOnline() && $online) { // reset online status that is stored to model later on // due to fact that the random test setting has been changed $online = false; $info = $this->lng->txt("tst_set_offline_due_to_switched_random_test_setting"); ilUtil::sendInfo($info, true); } $this->object->setAnonymity($_POST["anonymity"]); $this->object->setRandomTest($random_test); $this->object->setNrOfTries($_POST["nr_of_tries"]); } // store effective online status to model $this->object->setOnline($online); // activation if ($_POST["activation_type"] == ilObjectActivation::TIMINGS_ACTIVATION) { $this->object->setActivationLimited(true); $this->object->setActivationVisibility($_POST["activation_visibility"]); $date = new ilDateTime($_POST['act_starting_time']['date'] . ' ' . $_POST['act_starting_time']['time'], IL_CAL_DATETIME); $this->object->setActivationStartingTime($date->get(IL_CAL_UNIX)); $date = new ilDateTime($_POST['act_ending_time']['date'] . ' ' . $_POST['act_ending_time']['time'], IL_CAL_DATETIME); $this->object->setActivationEndingTime($date->get(IL_CAL_UNIX)); } else { $this->object->setActivationLimited(false); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $this->object->setIntroduction($_POST["introduction"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->object->setShowInfo($_POST["showinfo"] ? 1 : 0); $this->object->setFinalStatement($_POST["finalstatement"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->object->setShowFinalStatement($_POST["showfinalstatement"] ? 1 : 0); $this->object->setSequenceSettings($_POST["chb_postpone"] ? 1 : 0); $this->object->setShuffleQuestions($_POST["chb_shuffle_questions"] ? 1 : 0); $this->object->setListOfQuestions($_POST["list_of_questions"]); if (is_array($_POST["list_of_questions_options"])) { $this->object->setListOfQuestionsStart(in_array('chb_list_of_questions_start', $_POST["list_of_questions_options"]) ? 1 : 0); $this->object->setListOfQuestionsEnd(in_array('chb_list_of_questions_end', $_POST["list_of_questions_options"]) ? 1 : 0); $this->object->setListOfQuestionsDescription(in_array('chb_list_of_questions_with_description', $_POST["list_of_questions_options"]) ? 1 : 0); } else { $this->object->setListOfQuestionsStart(0); $this->object->setListOfQuestionsEnd(0); $this->object->setListOfQuestionsDescription(0); } $this->object->setMailNotification($_POST["mailnotification"]); $this->object->setMailNotificationType($_POST["mailnottype"]); $this->object->setShowMarker($_POST["chb_show_marker"] ? 1 : 0); $this->object->setShowCancel($_POST["chb_show_cancel"] ? 1 : 0); $this->object->setKioskMode($_POST["kiosk"] ? 1 : 0); $this->object->setShowKioskModeTitle(is_array($_POST["kiosk_options"]) && in_array('kiosk_title', $_POST["kiosk_options"]) ? 1 : 0); $this->object->setShowKioskModeParticipant(is_array($_POST["kiosk_options"]) && in_array('kiosk_participant', $_POST["kiosk_options"]) ? 1 : 0); $this->object->setEnableProcessingTime($_POST["chb_processing_time"] ? 1 : 0); if ($this->object->getEnableProcessingTime()) { $this->object->setProcessingTime(sprintf("%02d:%02d:%02d", $_POST["processing_time"]["hh"], $_POST["processing_time"]["mm"], $_POST["processing_time"]["ss"])); } else { $this->object->setProcessingTime(''); } $this->object->setResetProcessingTime($_POST["chb_reset_processing_time"] ? 1 : 0); if ($_POST['chb_starting_time']) { $this->object->setStartingTime(ilFormat::dateDB2timestamp($_POST['starting_time']['date'] . ' ' . $_POST['starting_time']['time'])); } else { $this->object->setStartingTime(''); } if ($_POST['chb_ending_time']) { $this->object->setEndingTime(ilFormat::dateDB2timestamp($_POST['ending_time']['date'] . ' ' . $_POST['ending_time']['time'])); } else { $this->object->setEndingTime(''); } $this->object->setUsePreviousAnswers($_POST["chb_use_previous_answers"] ? 1 : 0); $this->object->setForceJS($_POST["forcejs"] ? 1 : 0); $this->object->setTitleOutput($_POST["title_output"]); $this->object->setPassword($_POST["password"]); $this->object->setAllowedUsers($_POST["allowedUsers"]); $this->object->setAllowedUsersTimeGap($_POST["allowedUsersTimeGap"]); $this->object->setAutosave($_POST['autosave']); $this->object->setAutosaveIval($_POST['autosave_ival']); if ($this->object->isRandomTest()) { $this->object->setUsePreviousAnswers(0); } $invited_users = $this->object->getInvitedUsers(); if (!($total && count($invited_users) == 0)) { $fixed_participants = 0; if (array_key_exists("fixedparticipants", $_POST)) { if ($_POST["fixedparticipants"]) { $fixed_participants = 1; } } $this->object->setFixedParticipants($fixed_participants); if (!$fixed_participants) { $invited_users = $this->object->getInvitedUsers(); foreach ($invited_users as $user_object) { $this->object->disinviteUser($user_object["usr_id"]); } } } $this->object->setHighscoreEnabled((bool) $_POST['highscore_enabled']); $this->object->setHighscoreAnon((bool) $_POST['highscore_anon']); $this->object->setHighscoreAchievedTS((bool) $_POST['highscore_achieved_ts']); $this->object->setHighscoreScore((bool) $_POST['highscore_score']); $this->object->setHighscorePercentage((bool) $_POST['highscore_percentage']); $this->object->setHighscoreHints((bool) $_POST['highscore_hints']); $this->object->setHighscoreWTime((bool) $_POST['highscore_wtime']); $this->object->setHighscoreOwnTable((bool) $_POST['highscore_own_table']); $this->object->setHighscoreTopTable((bool) $_POST['highscore_top_table']); $this->object->setHighscoreTopNum((int) $_POST['highscore_top_num']); //$this->object->setExpressModeQuestionPoolAllowed($_POST['express_allow_question_pool']); $this->object->setEnabledViewMode($_POST['enabled_view_mode']); $this->object->setPoolUsage($_POST['use_pool']); $this->object->saveToDb(true); // Update ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->object); $ecs->handleSettingsUpdate(); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); if ($randomtest_switch) { if ($this->object->isRandomTest()) { $this->object->removeNonRandomTestData(); } else { $this->object->removeRandomTestData(); } } $this->ctrl->redirect($this, 'properties'); } }
/** * Display and fill the scoring settings form of the test * * @access public */ function scoringObject($checkonly = FALSE) { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } // using template? $template_settings = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once "Modules/Test/classes/class.ilObjAssessmentFolderGUI.php"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); } $save = strcmp($this->ctrl->getCmd(), "saveScoring") == 0 ? TRUE : FALSE; $total = $this->object->evalTotalPersons(); $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); // Determine settings availability $setting_available = true; // In general, the scoring settings are available. if ($total != 0) { $setting_available = false; // Unless there are results from users. } if ($this->object->getScoreReporting() == 4) { $setting_available = true; // But if the results are not public since they will never be } if ($this->object->getScoreReporting() == 3 && $this->object->getReportingDate() > time()) { $setting_available = true; // or the presentation date is not reached, then we can still edit them. } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("test_properties_scoring"); // scoring properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("test_scoring")); $form->addItem($header); // scoring system $count_system = new ilRadioGroupInputGUI($this->lng->txt("tst_text_count_system"), "count_system"); $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_partial_solutions"), 0, '')); $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_correct_solutions"), 1, '')); $count_system->setValue($this->object->getCountSystem()); $count_system->setInfo($this->lng->txt("tst_count_system_description")); $count_system->setDisabled(!$setting_available); $form->addItem($count_system); // mc questions $mc_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_score_mcmr_questions"), "mc_scoring"); $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"), 0, '')); $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_use_scoring_system"), 1, '')); $mc_scoring->setValue($this->object->getMCScoring()); $mc_scoring->setInfo($this->lng->txt("tst_score_mcmr_questions_description")); $mc_scoring->setDisabled(!$setting_available); $form->addItem($mc_scoring); // score cutting $score_cutting = new ilRadioGroupInputGUI($this->lng->txt("tst_score_cutting"), "score_cutting"); $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_question"), 0, '')); $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_test"), 1, '')); $score_cutting->setValue($this->object->getScoreCutting()); $score_cutting->setInfo($this->lng->txt("tst_score_cutting_description")); $score_cutting->setDisabled(!$setting_available); $form->addItem($score_cutting); // pass scoring $pass_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_scoring"), "pass_scoring"); $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_last_pass"), 0, '')); $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_best_pass"), 1, '')); $pass_scoring->setValue($this->object->getPassScoring()); $pass_scoring->setInfo($this->lng->txt("tst_pass_scoring_description")); $pass_scoring->setDisabled(!$setting_available); $form->addItem($pass_scoring); // test presentation $header_tp = new ilFormSectionHeaderGUI(); $header_tp->setTitle($this->lng->txt("test_presentation")); $form->addItem($header_tp); // enable obligations $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt("tst_setting_enable_obligations_label"), "obligations_enabled"); $checkBoxEnableObligations->setChecked($this->object->areObligationsEnabled()); $checkBoxEnableObligations->setInfo($this->lng->txt("tst_setting_enable_obligations_info")); if ($total) { $checkBoxEnableObligations->setDisabled(true); } $form->addItem($checkBoxEnableObligations); // offer hints $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt("tst_setting_offer_hints_label"), "offer_hints"); $checkBoxOfferHints->setChecked($this->object->isOfferingQuestionHintsEnabled()); $checkBoxOfferHints->setInfo($this->lng->txt("tst_setting_offer_hints_info")); if ($total) { $checkBoxOfferHints->setDisabled(true); } $form->addItem($checkBoxOfferHints); // instant feedback $instant_feedback = new ilCheckboxGroupInputGUI($this->lng->txt("tst_instant_feedback"), "instant_feedback"); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_specific"), 'instant_feedback_specific', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_generic"), 'instant_feedback_generic', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_results"), 'instant_feedback_points', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_solution"), 'instant_feedback_solution', '')); $values = array(); if ($this->object->getSpecificAnswerFeedback()) { array_push($values, 'instant_feedback_specific'); } if ($this->object->getGenericAnswerFeedback()) { array_push($values, 'instant_feedback_generic'); } if ($this->object->getAnswerFeedbackPoints()) { array_push($values, 'instant_feedback_points'); } if ($this->object->getInstantFeedbackSolution()) { array_push($values, 'instant_feedback_solution'); } $instant_feedback->setValue($values); $instant_feedback->setInfo($this->lng->txt("tst_instant_feedback_description")); $form->addItem($instant_feedback); // scoring properties $header_tr = new ilFormSectionHeaderGUI(); $header_tr->setTitle($this->lng->txt("test_results")); $form->addItem($header_tr); // access to test results $results_access = new ilRadioGroupInputGUI($this->lng->txt("tst_results_access"), "results_access"); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_always"), 2, '')); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_finished"), 1, '')); $results_access_date_limitation = new ilRadioOption($this->lng->txt("tst_results_access_date"), 3, ''); $results_access->addOption($results_access_date_limitation); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_never"), 4, '')); $results_access->setValue($this->object->getScoreReporting()); $results_access->setInfo($this->lng->txt("tst_results_access_description")); // access date $reporting_date = new ilDateTimeInputGUI('', 'reporting_date'); $reporting_date->setShowDate(true); $reporting_date->setShowTime(true); if (strlen($this->object->getReportingDate())) { $reporting_date->setDate(new ilDateTime($this->object->getReportingDate(), IL_CAL_TIMESTAMP)); } else { $reporting_date->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $results_access_date_limitation->addSubItem($reporting_date); $form->addItem($results_access); $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt("tst_results_print_best_solution"), "print_bs_with_res"); $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info')); $results_print_best_solution->setValue(1); $results_print_best_solution->setChecked((bool) $this->object->isBestSolutionPrintedWithResult()); $form->addItem($results_print_best_solution); // results presentation $results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt("tst_results_presentation"), "results_presentation"); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_pass_details"), 'pass_details', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_details"), 'solution_details', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_printview"), 'solution_printview', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_compare"), 'solution_compare', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_feedback"), 'solution_feedback', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_answers_only"), 'solution_answers_only', '')); $signatureOption = new ilCheckboxOption($this->lng->txt("tst_show_solution_signature"), 'solution_signature', ''); $results_presentation->addOption($signatureOption); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_suggested"), 'solution_suggested', '')); $values = array(); if ($this->object->getShowPassDetails()) { array_push($values, 'pass_details'); } if ($this->object->getShowSolutionDetails()) { array_push($values, 'solution_details'); } if ($this->object->getShowSolutionPrintview()) { array_push($values, 'solution_printview'); } if ($this->object->getShowSolutionFeedback()) { array_push($values, 'solution_feedback'); } if ($this->object->getShowSolutionAnswersOnly()) { array_push($values, 'solution_answers_only'); } if ($this->object->getShowSolutionSignature()) { array_push($values, 'solution_signature'); } if ($this->object->getShowSolutionSuggested()) { array_push($values, 'solution_suggested'); } if ($this->object->getShowSolutionListComparison()) { array_push($values, 'solution_compare'); } $results_presentation->setValue($values); $results_presentation->setInfo($this->lng->txt("tst_results_presentation_description")); if ($this->object->getAnonymity()) { $signatureOption->setDisabled(true); } $form->addItem($results_presentation); // misc properties $header_misc = new ilFormSectionHeaderGUI(); $header_misc->setTitle($this->lng->txt("misc")); $form->addItem($header_misc); // deletion of test results $passDeletion = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_deletion"), "pass_deletion_allowed"); $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_not_allowed"), 0, '')); $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_allowed"), 1, '')); $passDeletion->setValue($this->object->isPassDeletionAllowed()); $form->addItem($passDeletion); // export settings $export_settings = new ilCheckboxGroupInputGUI($this->lng->txt("tst_export_settings"), "export_settings"); $export_settings->addOption(new ilCheckboxOption($this->lng->txt("tst_exp_sc_short"), 'exp_sc_short', '')); $values = array(); if ($this->object->getExportSettingsSingleChoiceShort()) { array_push($values, 'exp_sc_short'); } $export_settings->setValue($values); $form->addItem($export_settings); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total == 0) { $form->addCommandButton("saveScoring", $this->lng->txt("save")); } if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total != 0) { $form->addCommandButton("confirmScoring", $this->lng->txt("save")); } // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } $errors = false; if ($save) { $errors = !$form->checkInput(); $form->setValuesByPost(); if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * Init survey settings form * * @return ilPropertyFormGUI */ function initPropertiesForm() { $template_settings = $hide_rte_switch = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("survey_properties"); // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("settings")); $form->addItem($header); // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "svy"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // anonymization $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_auth_mode"), "anonymization_options"); $hasDatasets = $this->object->_hasDatasets($this->object->getSurveyId()); if ($hasDatasets) { $anonymization_options->setDisabled(true); } $anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_personalized"), 'personalized', '')); $anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_without_code"), 'anonymize_without_code', '')); $anonymization_options->addOption(new ilCheckboxOption($this->lng->txt("anonymize_with_code"), 'anonymize_with_code', '')); if (!$this->object->getAnonymize()) { $anonymization_options->setValue('personalized'); } else { $anonymization_options->setValue($this->object->isAccessibleWithoutCode() ? 'anonymize_without_code' : 'anonymize_with_code'); } $anonymization_options->setInfo($this->lng->txt("anonymize_survey_description")); $form->addItem($anonymization_options); // pool usage $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool"); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1); $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info")); $pool_usage->addOption($opt); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0); $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info")); $pool_usage->addOption($opt); $pool_usage->setValue($this->object->getPoolUsage()); $form->addItem($pool_usage); // activation include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info); $online->setChecked($this->object->isOnline()); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'access_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->object->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('svy_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('svy_availability_until_info')); $date = $this->object->getActivationStartDate(); $start = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_start'), 'access_begin'); $start->setShowTime(true); $start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($start); $date = $this->object->getActivationEndDate(); $end = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_end'), 'access_end'); $end->setShowTime(true); $end->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($end); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity'); $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); // enable start date $start = $this->object->getStartDate(); $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date"); $enablestartingtime->setValue(1); // $enablestartingtime->setOptionTitle($this->lng->txt("enabled")); $enablestartingtime->setChecked($start); // start date $startingtime = new ilDateTimeInputGUI('', 'start_date'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if ($start) { $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); // enable end date $end = $this->object->getEndDate(); $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date"); $enableendingtime->setValue(1); // $enableendingtime->setOptionTitle($this->lng->txt("enabled")); $enableendingtime->setChecked($end); // end date $endingtime = new ilDateTimeInputGUI('', 'end_date'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if ($end) { $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // presentation properties $info = new ilFormSectionHeaderGUI(); $info->setTitle($this->lng->txt("svy_presentation_properties")); $form->addItem($info); // show question titles $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles"); $show_question_titles->setValue(1); $show_question_titles->setChecked($this->object->getShowQuestionTitles()); $form->addItem($show_question_titles); // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->setInfo($this->lng->txt("survey_introduction_info")); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->addButton("pastelatex"); $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch, "3.4.7"); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->addButton("pastelatex"); $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch, "3.4.7"); $form->addItem($finalstatement); // results properties $results = new ilFormSectionHeaderGUI(); $results->setTitle($this->lng->txt("results")); $form->addItem($results); // evaluation access $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access"); $evaluation_access->setInfo($this->lng->txt('evaluation_access_description')); $evaluation_access->addOption(new ilCheckboxOption($this->lng->txt("evaluation_access_off"), EVALUATION_ACCESS_OFF, '')); $evaluation_access->addOption(new ilCheckboxOption($this->lng->txt("evaluation_access_all"), EVALUATION_ACCESS_ALL, '')); $evaluation_access->addOption(new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), EVALUATION_ACCESS_PARTICIPANTS, '')); $evaluation_access->setValue($this->object->getEvaluationAccess()); $form->addItem($evaluation_access); // mail notification $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification"); // $mailnotification->setOptionTitle($this->lng->txt("activate")); $mailnotification->setValue(1); $mailnotification->setChecked($this->object->getMailNotification()); // addresses $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses"); $mailaddresses->setValue($this->object->getMailAddresses()); $mailaddresses->setSize(80); $mailaddresses->setInfo($this->lng->txt('mailaddresses_info')); $mailaddresses->setRequired(true); // participant data $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata"); $participantdata->setValue($this->object->getMailParticipantData()); $participantdata->setRows(6); $participantdata->setCols(80); $participantdata->setUseRte(false); $participantdata->setInfo($this->lng->txt('mailparticipantdata_info')); $mailnotification->addSubItem($mailaddresses); $mailnotification->addSubItem($participantdata); $form->addItem($mailnotification); $form->addCommandButton("saveProperties", $this->lng->txt("save")); // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }