/** * Init form settings */ protected function dInitFormTreeSettings(ilPropertyFormGUI $form = null) { include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php'; if ($form instanceof ilPropertyFormGUI) { return $form; } include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php'; $assignment = new ilECSNodeMappingAssignment($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], 0); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'dEditTree')); $form->setTitle($this->lng->txt('general_settings')); $form->addCommandButton('dUpdateTreeSettings', $this->lng->txt('save')); $form->addCommandButton('dTrees', $this->lng->txt('cancel')); $form->setTableWidth('30%'); // CMS id (readonly) include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php'; $cmsid = new ilNumberInputGUI($this->lng->txt('ecs_cms_id'), 'cmsid'); $cmsid->setValue(ilECSCmsData::lookupCmsId(ilECSCmsTree::lookupRootId((int) $_REQUEST['tid']))); $cmsid->setDisabled(true); $cmsid->setSize(7); $cmsid->setMaxLength(12); $form->addItem($cmsid); $mapping_status = ilECSMappingUtils::lookupMappingStatus($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid']); $mapping_advanced = $mapping_status != ilECSMappingUtils::MAPPED_MANUAL ? true : false; // Status (readonly) $status = new ilNonEditableValueGUI($this->lng->txt('status'), ''); $status->setValue(ilECSMappingUtils::mappingStatusToString($mapping_status)); $form->addItem($status); // title update $title = new ilCheckboxInputGUI($this->lng->txt('ecs_title_updates'), 'title'); $title->setValue(1); $title->setChecked($assignment->isTitleUpdateEnabled()); #$title->setInfo($this->lng->txt('ecs_title_update_info')); $form->addItem($title); $position = new ilCheckboxInputGUI($this->lng->txt('ecs_position_updates'), 'position'); $position->setDisabled(!$mapping_advanced); $position->setChecked($mapping_advanced && $assignment->isPositionUpdateEnabled()); $position->setValue(1); #$position->setInfo($this->lng->txt('ecs_position_update_info')); $form->addItem($position); $tree = new ilCheckboxInputGUI($this->lng->txt('ecs_tree_updates'), 'tree'); $tree->setDisabled(!$mapping_advanced); $tree->setChecked($mapping_advanced && $assignment->isTreeUpdateEnabled()); $tree->setValue(1); #$tree->setInfo($this->lng->txt('ecs_tree_update_info')); $form->addItem($tree); return $form; }
/** * Initialize properties form * * @param * @return */ function initPropertiesForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->setTitle($this->lng->txt("cont_lm_properties")); // SCORM-type $ne = new ilNonEditableValueGUI($this->lng->txt("type"), ""); $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID()))); $this->form->addItem($ne); // version $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), ""); $ne->setValue($this->object->getModuleVersion()); $this->form->addItem($ne); // online $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online"); $cb->setValue("y"); if ($this->object->getOnline()) { $cb->setChecked(true); } $this->form->addItem($cb); // offline Mode $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode"); $cb->setValue("y"); $cb->setChecked($this->object->getOfflineMode()); $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info")); $this->form->addItem($cb); // // presentation // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_presentation")); $this->form->addItem($sh); // display mode (open) $options = array("0" => $this->lng->txt("cont_open_normal"), "1" => $this->lng->txt("cont_open_iframe_max"), "2" => $this->lng->txt("cont_open_iframe_defined"), "5" => $this->lng->txt("cont_open_window_undefined"), "6" => $this->lng->txt("cont_open_window_defined")); $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode"); $si->setOptions($options); $si->setValue($this->object->getOpenMode()); $this->form->addItem($si); // width $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getWidth()); $this->form->addItem($ni); // height $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getHeight()); $this->form->addItem($ni); // disable top menu $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu"); $cb->setValue("y"); $cb->setChecked($this->object->getNoMenu()); $this->form->addItem($cb); // disable left-side navigation $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig"); $cb->setValue("y"); $cb->setChecked($this->object->getHideNavig()); $this->form->addItem($cb); // auto navigation to last visited item $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited"); $cb->setValue("y"); $cb->setChecked($this->object->getAuto_last_visited()); $cb->setInfo($this->lng->txt("cont_auto_last_visited_info")); $this->form->addItem($cb); // // scorm options // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_scorm_options")); $this->form->addItem($sh); // max attempts $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt"); $ni->setMaxLength(3); $ni->setSize(3); $ni->setValue($this->object->getMaxAttempt()); $this->form->addItem($ni); // lesson mode $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"), "browse" => $this->lng->txt("cont_sc_less_mode_browse")); $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode"); $si->setOptions($options); $si->setValue($this->object->getDefaultLessonMode()); $this->form->addItem($si); // credit mode $options = array("credit" => $this->lng->txt("cont_credit_on"), "no_credit" => $this->lng->txt("cont_credit_off")); $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode"); $si->setOptions($options); $si->setValue($this->object->getCreditMode()); $si->setInfo($this->lng->txt("cont_credit_mode_info")); $this->form->addItem($si); // set lesson mode review when completed $options = array("n" => $this->lng->txt("cont_sc_auto_review_no"), "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"), "p" => $this->lng->txt("cont_sc_auto_review_passed"), "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"), "c" => $this->lng->txt("cont_sc_auto_review_completed"), "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"), "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed")); $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review"); $si->setOptions($options); $si->setValue($this->object->getAutoReviewChar()); $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004")); $this->form->addItem($si); // // rte settings // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_rte_settings")); $this->form->addItem($sh); // unlimited session timeout $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session"); $cb->setValue("y"); $cb->setChecked($this->object->getSession()); $cb->setInfo($this->lng->txt("cont_sc_usession_info")); $this->form->addItem($cb); // sequencing $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing"); $cb->setValue("y"); $cb->setChecked($this->object->getSequencing()); $cb->setInfo($this->lng->txt("cont_sequencing_info")); $this->form->addItem($cb); // storage of interactions $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions"); $cb->setValue("y"); $cb->setChecked($this->object->getInteractions()); $this->form->addItem($cb); // objectives $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives"); $cb->setValue("y"); $cb->setChecked($this->object->getObjectives()); $this->form->addItem($cb); // comments $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments"); $cb->setValue("y"); $cb->setChecked($this->object->getComments()); $this->form->addItem($cb); // time from lms $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms"); $cb->setValue("y"); $cb->setChecked($this->object->getTime_from_lms()); $cb->setInfo($this->lng->txt("cont_time_from_lms_info")); $this->form->addItem($cb); // check values $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values"); $cb->setValue("y"); $cb->setChecked($this->object->getCheck_values()); $this->form->addItem($cb); // auto cmi.exit to suspend $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend"); $cb->setValue("y"); $cb->setChecked($this->object->getAutoSuspend()); $cb->setInfo($this->lng->txt("cont_auto_suspend_info")); $this->form->addItem($cb); // // debugging // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_debugging")); $this->form->addItem($sh); // test tool $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug"); $cb->setValue("y"); $cb->setChecked($this->object->getDebug()); if ($this->object->getDebugActivated() == false) { $cb->setDisabled(true); $cb->setInfo($this->lng->txt("cont_debug_deactivated")); } else { $cb->setInfo($this->lng->txt("cont_debug_deactivate")); } $this->form->addItem($cb); $this->form->addCommandButton("saveProperties", $lng->txt("save")); }
/** * Generate and always set the user agreement checkbox. * * @return \ilCheckboxInputGUI */ private function createUserAgreementCheckBox() { $agreement_id = $this->book->getRoomAgreementFileId(); $link = $this->getFileLinkForUserAgreementId($agreement_id); $title = $this->lng->txt("rep_robj_xrs_rooms_user_agreement_accept"); $checkbox_agreement = new ilCheckboxInputGUI($title, "accept_room_rules"); $checkbox_agreement->setRequired(true); $checkbox_agreement->setOptionTitle($link); $checkbox_agreement->setChecked(true); $checkbox_agreement->setValue(1); $checkbox_agreement->setDisabled(true); return $checkbox_agreement; }
/** * Show Privacy settings * * @access public */ public function showSecurity() { global $ilSetting, $ilUser, $rbacreview; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $security = ilSecuritySettings::_getInstance(); $this->tabs_gui->setTabActive('show_security'); $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('ps_security_protection')); // Form checkbox $check = new ilCheckboxInputGUI($this->lng->txt('ps_auto_https'), 'auto_https_detect_enabled'); $check->setOptionTitle($this->lng->txt('ps_auto_https_description')); $check->setChecked($security->isAutomaticHTTPSEnabled() ? 1 : 0); $check->setValue(1); $text = new ilTextInputGUI($this->lng->txt('ps_auto_https_header_name'), 'auto_https_detect_header_name'); $text->setValue($security->getAutomaticHTTPSHeaderName()); $text->setSize(24); $text->setMaxLength(64); $check->addSubItem($text); $text = new ilTextInputGUI($this->lng->txt('ps_auto_https_header_value'), 'auto_https_detect_header_value'); $text->setValue($security->getAutomaticHTTPSHeaderValue()); $text->setSize(24); $text->setMaxLength(64); $check->addSubItem($text); $form->addItem($check); $check2 = new ilCheckboxInputGUI($this->lng->txt('activate_https'), 'https_enabled'); $check2->setChecked($security->isHTTPSEnabled() ? 1 : 0); $check2->setValue(1); $form->addItem($check2); $radio_group = new ilRadioGroupInputGUI($this->lng->txt('ps_account_security_mode'), 'account_security_mode'); $radio_group->setValue($security->getAccountSecurityMode()); $radio_opt = new ilRadioOption($this->lng->txt('ps_account_security_mode_default'), ilSecuritySettings::ACCOUNT_SECURITY_MODE_DEFAULT); $radio_group->addOption($radio_opt); $radio_opt = new ilRadioOption($this->lng->txt('ps_account_security_mode_customized'), ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled'); $check->setChecked($security->isPasswordCharsAndNumbersEnabled() ? 1 : 0); //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled')); $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info')); $radio_opt->addSubItem($check); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled'); $check->setChecked($security->isPasswordSpecialCharsEnabled() ? 1 : 0); //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled')); $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info')); $radio_opt->addSubItem($check); $text = new ilTextInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length'); $text->setInfo($this->lng->txt('ps_password_min_length_info')); $text->setValue($security->getPasswordMinLength()); $text->setSize(1); $text->setMaxLength(2); $radio_opt->addSubItem($text); $text = new ilTextInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length'); $text->setInfo($this->lng->txt('ps_password_max_length_info')); $text->setValue($security->getPasswordMaxLength()); $text->setSize(2); $text->setMaxLength(3); $radio_opt->addSubItem($text); $text = new ilTextInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age'); $text->setInfo($this->lng->txt('ps_password_max_age_info')); $text->setValue($security->getPasswordMaxAge()); $text->setSize(2); $text->setMaxLength(3); $radio_opt->addSubItem($text); $text = new ilTextInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts'); $text->setInfo($this->lng->txt('ps_login_max_attempts_info')); $text->setValue($security->getLoginMaxAttempts()); $text->setSize(1); $text->setMaxLength(2); $radio_opt->addSubItem($text); $radio_group->addOption($radio_opt); $form->addItem($radio_group); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled'); $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info')); $check->setChecked($security->isPasswordChangeOnFirstLoginEnabled() ? 1 : 0); $form->addItem($check); // file suffix replacement $ti = new ilTextInputGUI($this->lng->txt("file_suffix_repl"), "suffix_repl_additional"); $ti->setMaxLength(200); $ti->setSize(40); $ti->setInfo($this->lng->txt("file_suffix_repl_info") . " " . SUFFIX_REPL_DEFAULT); $ti->setValue($ilSetting->get("suffix_repl_additional")); $form->addItem($ti); // prevent login from multiple pcs at the same time $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins'); $objCb->setChecked((int) $security->isPreventionOfSimultaneousLoginsEnabled()); $objCb->setValue(1); $objCb->setOptionTitle($this->lng->txt('ps_prevent_simultaneous_logins_info')); $form->addItem($objCb); // protected admin $admin = new ilCheckboxInputGUI($GLOBALS['lng']->txt('adm_adm_role_protect'), 'admin_role'); $admin->setDisabled(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)); $admin->setInfo($GLOBALS['lng']->txt('adm_adm_role_protect_info')); $admin->setChecked((int) $security->isAdminRoleProtected()); $admin->setValue(1); $form->addItem($admin); $form->addCommandButton('save_security', $this->lng->txt('save')); $this->tpl->setContent($form->getHTML()); }
/** * init form * * @access protected * @param string mode ('edit' | 'create') * @return */ protected function initForm($a_mode, $a_as_milestone = false, $a_edit_single_app = false) { global $ilUser, $tpl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $this->form = new ilPropertyFormGUI(); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDomEvent(); $resp_info = false; switch ($a_mode) { case 'create': $this->ctrl->saveParameter($this, array('seed', 'idate')); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($a_as_milestone) { $this->form->setTitle($this->lng->txt('cal_new_ms')); $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); } else { $this->form->setTitle($this->lng->txt('cal_new_app')); $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); } break; case 'edit': if ($a_as_milestone) { $this->form->setTitle($this->lng->txt('cal_edit_milestone')); } else { $this->form->setTitle($this->lng->txt('cal_edit_appointment')); } $this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate')); $this->form->setFormAction($this->ctrl->getFormAction($this)); $ass = new ilCalendarCategoryAssignments($this->app->getEntryId()); $cat = $ass->getFirstAssignment(); include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat); $type = ilObject::_lookupType($cat_info['obj_id']); if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) { $resp_info = true; $this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users')); } $this->form->addCommandButton('update', $this->lng->txt('save')); // $this->form->addCommandButton('askDelete',$this->lng->txt('delete')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); break; } // title $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->app->getTitle()); $title->setRequired(true); $title->setMaxLength(128); $title->setSize(32); $this->form->addItem($title); // calendar selection $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar'); if ($_POST['category']) { $calendar->setValue((int) $_POST['calendar']); $selected_calendar = (int) $_POST['calendar']; } else { if ($_GET['category_id']) { $calendar->setValue((int) $_GET['category_id']); $selected_calendar = (int) $_GET['category_id']; } elseif ($a_mode == 'edit') { $ass = new ilCalendarCategoryAssignments($this->app->getEntryId()); $cat = $ass->getFirstAssignment(); $calendar->setValue($cat); $selected_calendar = $cat; } elseif (isset($_GET['ref_id'])) { include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; $obj_cal = ilObject::_lookupObjId($_GET['ref_id']); $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal)); $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal); } } $calendar->setRequired(true); $cats = ilCalendarCategories::_getInstance($ilUser->getId()); $calendar->setOptions($cats->prepareCategoriesOfUserForSelection()); include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) { $notification_cals = $cats->getNotificationCalendars(); $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : ''; $calendar->addCustomAttribute("onchange=\"ilToggleNotification(new Array(" . $notification_cals . "));\""); } $this->form->addItem($calendar); if (!$a_as_milestone) { include_once './Services/Form/classes/class.ilDateDurationInputGUI.php'; $tpl->addJavaScript('./Services/Form/js/date_duration.js'); $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event'); $dur->setStartText($this->lng->txt('cal_start')); $dur->setEndText($this->lng->txt('cal_end')); $dur->enableToggleFullTime($this->lng->txt('cal_fullday_title'), $this->app->isFullday() ? true : false); $dur->setShowTime(true); $dur->setStart($this->app->getStart()); $dur->setEnd($this->app->getEnd()); $this->form->addItem($dur); // recurrence include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php'; $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence'); $rec->setRecurrence($this->rec); $this->form->addItem($rec); // location $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location'); $where->setValue($this->app->getLocation()); $where->setMaxLength(128); $where->setSize(32); $this->form->addItem($where); } else { $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event[start]'); $deadline->setDate($this->app->getStart()); $deadline->setShowTime(false); $deadline->setMinuteStepSize(5); $this->form->addItem($deadline); // completion $completion_vals = array(); for ($i = 0; $i <= 100; $i += 5) { $completion_vals[$i] = $i . " %"; } $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'), 'completion'); $compl->setOptions($completion_vals); $compl->setValue($this->app->getCompletion()); $this->form->addItem($compl); } $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $desc->setValue($this->app->getDescription()); $desc->setRows(5); $this->form->addItem($desc); if ($a_as_milestone && $a_mode == "edit" && $resp_info) { // users responsible $users = $this->app->readResponsibleUsers(); $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), $users); $delim = ""; foreach ($users as $r) { $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]"; $delim = "<br />"; } if (count($users) > 0) { $resp->setValue($value); } else { $resp->setValue("-"); } $this->form->addItem($resp); } if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) { $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu'); $notu->setInfo($this->lng->txt('cal_user_notification_info')); $notu->setSize(20); $notu->setMaxLength(64); $values = array(); foreach ($this->notification->getRecipients() as $rcp) { switch ($rcp['type']) { case ilCalendarUserNotification::TYPE_USER: $values[] = ilObjUser::_lookupLogin($rcp['usr_id']); break; case ilCalendarUserNotification::TYPE_EMAIL: $values[] = $rcp['email']; break; } } if (count($values)) { $notu->setValues($values); } else { $notu->setValues(array('')); } $this->form->addItem($notu); } // Notifications include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) { $selected_cal = new ilCalendarCategory($selected_calendar); $disabled = true; if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) { if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') { $disabled = false; } } $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js'); $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not'); $not->setInfo($this->lng->txt('cal_notification_info')); $not->setValue(1); $not->setChecked($this->app->isNotificationEnabled()); $not->setDisabled($disabled); $this->form->addItem($not); } }
/** * Creates an output of the edit form for the question * @param bool $checkonly * @return bool */ function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart(FALSE); $form->setTableWidth('100%'); $form->setId('assformulaquestion'); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // Add info text $question = $form->getItemByPostVar('question'); $question->setInfo($this->lng->txt('fq_question_desc')); $variables = $this->object->getVariables(); $categorized_units = $this->object->getUnitrepository()->getCategorizedUnits(); $result_units = $this->object->__get('resultunits'); $unit_options = array(); $category_name = ''; $new_category = false; foreach ((array) $categorized_units as $item) { /** * @var $item assFormulaQuestionUnitCategory|assFormulaQuestionUnit */ if ($item instanceof assFormulaQuestionUnitCategory) { if ($category_name != $item->getDisplayString()) { $new_category = true; $category_name = $item->getDisplayString(); } continue; } $unit_options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : ''); $new_category = false; } if (count($variables)) { uasort($variables, function (assFormulaQuestionVariable $v1, assFormulaQuestionVariable $v2) { $num_v1 = (int) substr($v1->getVariable(), 2); $num_v2 = (int) substr($v2->getVariable(), 2); if ($num_v1 > $num_v2) { return 1; } else { if ($num_v1 < $num_v2) { return -1; } } return 0; }); foreach ($variables as $variable) { /** * @var $variable assFormulaQuestionVariable */ $variable_header = new ilFormSectionHeaderGUI(); $variable_header->setTitle(sprintf($this->lng->txt('variable_x'), $variable->getVariable())); $range_min = new ilNumberInputGUI($this->lng->txt('range_min'), 'range_min_' . $variable->getVariable()); $range_min->allowDecimals(true); $range_min->setSize(3); $range_min->setRequired(true); $range_min->setValue($variable->getRangeMin()); $range_max = new ilNumberInputGUI($this->lng->txt('range_max'), 'range_max_' . $variable->getVariable()); $range_max->allowDecimals(true); $range_max->setSize(3); $range_max->setRequired(true); $range_max->setValue($variable->getRangeMax()); $units = new ilSelectInputGUI($this->lng->txt('unit'), 'unit_' . $variable->getVariable()); $units->setOptions(array(0 => $this->lng->txt('no_selection')) + $unit_options); if (is_object($variable->getUnit())) { $units->setValue($variable->getUnit()->getId()); } $precision = new ilNumberInputGUI($this->lng->txt('precision'), 'precision_' . $variable->getVariable()); $precision->setRequired(true); $precision->setSize(3); $precision->setMinValue(0); $precision->setValue($variable->getPrecision()); $precision->setInfo($this->lng->txt('fq_precision_info')); $intprecision = new ilNumberInputGUI($this->lng->txt('intprecision'), 'intprecision_' . $variable->getVariable()); $intprecision->setSize(3); $intprecision->setMinValue(1); $intprecision->setValue($variable->getIntprecision()); $intprecision->setInfo($this->lng->txt('intprecision_info')); $form->addItem($variable_header); $form->addItem($range_min); $form->addItem($range_max); $form->addItem($units); $form->addItem($precision); $form->addItem($intprecision); } } $results = $this->object->getResults(); if (count($results)) { require_once 'Services/Form/classes/class.ilMultiSelectInputGUI.php'; uasort($results, function (assFormulaQuestionResult $r1, assFormulaQuestionResult $r2) { $num_r1 = (int) substr($r1->getResult(), 2); $num_r2 = (int) substr($r2->getResult(), 2); if ($num_r1 > $num_r2) { return 1; } else { if ($num_r1 < $num_r2) { return -1; } } return 0; }); foreach ($results as $result) { /** * @var $result assFormulaQuestionResult */ $result_header = new ilFormSectionHeaderGUI(); $result_header->setTitle(sprintf($this->lng->txt('result_x'), $result->getResult())); $formula = new ilTextInputGUI($this->lng->txt('formula'), 'formula_' . $result->getResult()); $formula->setInfo($this->lng->txt('fq_formula_desc')); $formula->setRequired(true); $formula->setSize(50); $formula->setValue($result->getFormula()); $formula->setSuffix(' = ' . $result->getResult()); if (preg_match("/suggestrange_(.*)/", $this->ctrl->getCmd(), $matches) && strcmp($matches[1], $result->getResult()) == 0) { // suggest a range for the result if (strlen($result->substituteFormula($variables, $results))) { $result->suggestRange($variables, $results); } } $range_min = new ilNumberInputGUI($this->lng->txt('range_min'), 'range_min_' . $result->getResult()); $range_min->allowDecimals(true); $range_min->setSize(3); $range_min->setRequired(true); $range_min->setValue($result->getRangeMin()); $range_max = new ilNumberInputGUI($this->lng->txt('range_max'), 'range_max_' . $result->getResult()); $range_max->allowDecimals(true); $range_max->setSize(3); $range_max->setRequired(true); $range_max->setValue($result->getRangeMax()); $matches = array(); $precision = new ilNumberInputGUI($this->lng->txt('precision'), 'precision_' . $result->getResult()); $precision->setRequired(true); $precision->setSize(3); $precision->setMinValue(0); $precision->setInfo($this->lng->txt('fq_precision_info')); $precision->setValue($result->getPrecision()); $tolerance = new ilNumberInputGUI($this->lng->txt('tolerance'), 'tolerance_' . $result->getResult()); $tolerance->setSize(3); $tolerance->setMinValue(0); $tolerance->setMaxValue(100); $tolerance->allowDecimals(false); $tolerance->setInfo($this->lng->txt('tolerance_info')); $tolerance->setValue($result->getTolerance()); $suggest_range_button = new ilCustomInputGUI('', ''); $suggest_range_button->setHtml('<input type="submit" class="btn btn-default" name="cmd[suggestrange_' . $result->getResult() . ']" value="' . $this->lng->txt("suggest_range") . '" />'); $sel_result_units = new ilSelectInputGUI($this->lng->txt('unit'), 'unit_' . $result->getResult()); $sel_result_units->setOptions(array(0 => $this->lng->txt('no_selection')) + $unit_options); $sel_result_units->setInfo($this->lng->txt('result_unit_info')); if (is_object($result->getUnit())) { $sel_result_units->setValue($result->getUnit()->getId()); } $mc_result_units = new ilMultiSelectInputGUI($this->lng->txt('result_units'), 'units_' . $result->getResult()); $mc_result_units->setOptions($unit_options); $mc_result_units->setInfo($this->lng->txt('result_units_info')); $selectedvalues = array(); foreach ($unit_options as $unit_id => $txt) { if ($this->hasResultUnit($result, $unit_id, $result_units)) { $selectedvalues[] = $unit_id; } } $mc_result_units->setValue($selectedvalues); $result_type = new ilRadioGroupInputGUI($this->lng->txt('result_type_selection'), 'result_type_' . $result->getResult()); $result_type->setRequired(true); $no_type = new ilRadioOption($this->lng->txt('no_result_type'), 0); $no_type->setInfo($this->lng->txt('fq_no_restriction_info')); $result_dec = new ilRadioOption($this->lng->txt('result_dec'), 1); $result_dec->setInfo($this->lng->txt('result_dec_info')); $result_frac = new ilRadioOption($this->lng->txt('result_frac'), 2); $result_frac->setInfo($this->lng->txt('result_frac_info')); $result_co_frac = new ilRadioOption($this->lng->txt('result_co_frac'), 3); $result_co_frac->setInfo($this->lng->txt('result_co_frac_info')); $result_type->addOption($no_type); $result_type->addOption($result_dec); $result_type->addOption($result_frac); $result_type->addOption($result_co_frac); $result_type->setValue(strlen($result->getResultType()) ? $result->getResultType() : 0); $points = new ilNumberInputGUI($this->lng->txt('points'), 'points_' . $result->getResult()); $points->allowDecimals(true); $points->setRequired(true); $points->setSize(3); $points->setMinValue(0); $points->setValue(strlen($result->getPoints()) ? $result->getPoints() : 1); $rating_type = new ilCheckboxInputGUI($this->lng->txt('advanced_rating'), 'rating_advanced_' . $result->getResult()); $rating_type->setValue(1); $rating_type->setInfo($this->lng->txt('advanced_rating_info')); if (!$save) { $advanced_rating = $this->canUseAdvancedRating($result); if (!$advanced_rating) { $rating_type->setDisabled(true); $rating_type->setChecked(false); } else { $rating_type->setChecked(strlen($result->getRatingSimple()) && $result->getRatingSimple() ? false : true); } } $sign = new ilNumberInputGUI($this->lng->txt('rating_sign'), 'rating_sign_' . $result->getResult()); $sign->setRequired(true); $sign->setSize(3); $sign->setMinValue(0); $sign->setValue($result->getRatingSign()); $rating_type->addSubItem($sign); $value = new ilNumberInputGUI($this->lng->txt('rating_value'), 'rating_value_' . $result->getResult()); $value->setRequired(true); $value->setSize(3); $value->setMinValue(0); $value->setValue($result->getRatingValue()); $rating_type->addSubItem($value); $unit = new ilNumberInputGUI($this->lng->txt('rating_unit'), 'rating_unit_' . $result->getResult()); $unit->setRequired(true); $unit->setSize(3); $unit->setMinValue(0); $unit->setValue($result->getRatingUnit()); $rating_type->addSubItem($unit); $info_text = new ilNonEditableValueGUI($this->lng->txt('additional_rating_info')); $rating_type->addSubItem($info_text); $form->addItem($result_header); $form->addItem($formula); $form->addItem($range_min); $form->addItem($range_max); $form->addItem($suggest_range_button); $form->addItem($precision); $form->addItem($tolerance); $form->addItem($sel_result_units); $form->addItem($mc_result_units); $form->addItem($result_type); $form->addItem($points); $form->addItem($rating_type); } $defined_result_vars = array(); $quest_vars = array(); $defined_result_res = array(); $result_vars = array(); foreach ($variables as $key => $object) { $quest_vars[$key] = $key; } foreach ($results as $key => $object) { $result_vars[$key] = $key; } foreach ($results as $tmp_result) { /** * @var $tmp_result assFormulaQuestionResult */ $formula = $tmp_result->getFormula(); preg_match_all("/([\$][v][0-9]*)/", $formula, $form_vars); preg_match_all("/([\$][r][0-9]*)/", $formula, $form_res); foreach ($form_vars[0] as $res_var) { $defined_result_vars[$res_var] = $res_var; } foreach ($form_res[0] as $res_res) { $defined_result_res[$res_res] = $res_res; } } } $result_has_undefined_vars = array(); $question_has_unused_vars = array(); if (is_array($quest_vars) && count($quest_vars) > 0) { $result_has_undefined_vars = array_diff($defined_result_vars, $quest_vars); $question_has_unused_vars = array_diff($quest_vars, $defined_result_vars); } if (is_array($result_vars) && count($result_vars) > 0) { $result_has_undefined_res = array_diff($defined_result_res, $result_vars); } $error_message = ''; if (count($result_has_undefined_vars) > 0 || count($question_has_unused_vars) > 0) { if (count($result_has_undefined_vars) > 0) { $error_message .= $this->lng->txt("res_contains_undef_var") . '<br>'; } if (count($question_has_unused_vars) > 0) { $error_message .= $this->lng->txt("que_contains_unused_var") . '<br>'; } $checked = false; if ($save) { ilUtil::sendFailure($error_message); } } if (count($result_has_undefined_res) > 0) { $error_message .= $this->lng->txt("res_contains_undef_res") . '<br>'; $checked = false; } if ($save && !$checked) { ilUtil::sendFailure($error_message); } if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } $this->populateTaxonomyFormSection($form); $form->addCommandButton('parseQuestion', $this->lng->txt("parseQuestion")); $form->addCommandButton('saveReturnFQ', $this->lng->txt("save_return")); $form->addCommandButton('saveFQ', $this->lng->txt("save")); $errors = $checked; if ($save) { $found_vars = array(); $found_results = array(); foreach ((array) $_POST as $key => $value) { if (preg_match("/^unit_(\\\$v\\d+)\$/", $key, $matches)) { array_push($found_vars, $matches[1]); } if (preg_match("/^unit_(\\\$r\\d+)\$/", $key, $matches)) { array_push($found_results, $matches[1]); } } $form->setValuesByPost(); $errors = !$form->checkInput(); $custom_errors = false; if (count($variables)) { foreach ($variables as $variable) { /** * @var $variable assFormulaQuestionVariable */ $min_range = $form->getItemByPostVar('range_min_' . $variable->getVariable()); $max_range = $form->getItemByPostVar('range_max_' . $variable->getVariable()); if ($min_range->getValue() > $max_range->getValue()) { $min_range->setAlert($this->lng->txt('err_range')); $max_range->setAlert($this->lng->txt('err_range')); $custom_errors = true; } } } if (count($results)) { foreach ($results as $result) { /** * @var $result assFormulaQuestionResult */ $min_range = $form->getItemByPostVar('range_min_' . $result->getResult()); $max_range = $form->getItemByPostVar('range_max_' . $result->getResult()); if ($min_range->getValue() > $max_range->getValue()) { $min_range->setAlert($this->lng->txt('err_range')); $max_range->setAlert($this->lng->txt('err_range')); $custom_errors = true; } $formula = $form->getItemByPostVar('formula_' . $result->getResult()); if (strpos($formula->getValue(), $result->getResult()) !== FALSE) { $formula->setAlert($this->lng->txt('errRecursionInResult')); $custom_errors = true; } $result_unit = $form->getItemByPostVar('unit_' . $result->getResult()); $rating_advanced = $form->getItemByPostVar('rating_advanced_' . $result->getResult()); if ((int) $result_unit->getValue() <= 0 && $rating_advanced->getChecked()) { unset($_POST['rating_advanced_' . $result->getResult()]); $rating_advanced->setDisabled(true); $rating_advanced->setChecked(false); $rating_advanced->setAlert($this->lng->txt('err_rating_advanced_not_allowed')); $custom_errors = true; } else { if ($rating_advanced->getChecked()) { $rating_sign = $form->getItemByPostVar('rating_sign_' . $result->getResult()); $rating_value = $form->getItemByPostVar('rating_value_' . $result->getResult()); $rating_unit = $form->getItemByPostVar('rating_unit_' . $result->getResult()); $percentage = $rating_sign->getValue() + $rating_value->getValue() + $rating_unit->getValue(); if ($percentage != 100) { $rating_advanced->setAlert($this->lng->txt('err_wrong_rating_advanced')); $custom_errors = true; } } } preg_match_all("/([\$][v][0-9]*)/", $formula->getValue(), $form_vars); $result_has_undefined_vars = array_diff($form_vars[0], (array) $found_vars); if (count($result_has_undefined_vars)) { $errors = true; ilUtil::sendInfo($this->lng->txt('res_contains_undef_var')); } } } if ($custom_errors && !$errors) { $errors = true; ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable('QUESTION_DATA', $form->getHTML()); } return $errors; }
/** * Init general settings form. * */ public function initGeneralSettingsForm() { global $lng, $ilUser, $styleDefinition, $ilSetting; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // language if ($this->userSettingVisible("language")) { $languages = $this->lng->getInstalledLanguages(); $options = array(); foreach ($languages as $lang_key) { $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key); } $si = new ilSelectInputGUI($this->lng->txt("language"), "language"); $si->setOptions($options); $si->setValue($ilUser->getLanguage()); $si->setDisabled($ilSetting->get("usr_settings_disable_language")); $this->form->addItem($si); } // skin/style include_once "./Services/Style/classes/class.ilObjStyleSettings.php"; if ($this->userSettingVisible("skin_style")) { $templates = $styleDefinition->getAllTemplates(); if (is_array($templates)) { $si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style"); $options = array(); foreach ($templates as $template) { // get styles information of template $styleDef = new ilStyleDefinition($template["id"]); $styleDef->startParsing(); $styles = $styleDef->getStyles(); foreach ($styles as $style) { if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) { continue; } $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"]; } } $si->setOptions($options); $si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]); $si->setDisabled($ilSetting->get("usr_settings_disable_skin_style")); $this->form->addItem($si); } } // screen reader optimization if ($this->userSettingVisible("screen_reader_optimization")) { $cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization"); $cb->setChecked($ilUser->prefs["screen_reader_optimization"]); $cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization")); $cb->setInfo($this->lng->txt("user_screen_reader_optimization_info")); $this->form->addItem($cb); } // hits per page if ($this->userSettingVisible("hits_per_page")) { $si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page"); $hits_options = array(10, 15, 20, 30, 40, 50, 100, 9999); $options = array(); foreach ($hits_options as $hits_option) { $hstr = $hits_option == 9999 ? $this->lng->txt("no_limit") : $hits_option; $options[$hits_option] = $hstr; } $si->setOptions($options); $si->setValue($ilUser->prefs["hits_per_page"]); $si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page")); $this->form->addItem($si); } // Users Online if ($this->userSettingVisible("show_users_online")) { $si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online"); $options = array("y" => $this->lng->txt("users_online_show_y"), "associated" => $this->lng->txt("users_online_show_associated"), "n" => $this->lng->txt("users_online_show_n")); $si->setOptions($options); $si->setValue($ilUser->prefs["show_users_online"]); $si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online")); $this->form->addItem($si); } // Store last visited $lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited"); $options = array(0 => $this->lng->txt("user_lv_keep_entries"), 1 => $this->lng->txt("user_lv_keep_only_for_session"), 2 => $this->lng->txt("user_lv_do_not_store")); $lv->setOptions($options); $lv->setValue((int) $ilUser->prefs["store_last_visited"]); $this->form->addItem($lv); // hide_own_online_status if ($this->userSettingVisible("hide_own_online_status")) { $cb = new ilCheckboxInputGUI($this->lng->txt("hide_own_online_status"), "hide_own_online_status"); $cb->setChecked($ilUser->prefs["hide_own_online_status"] == "y"); $cb->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status")); $this->form->addItem($cb); } include_once 'Services/Authentication/classes/class.ilSessionReminder.php'; if (ilSessionReminder::isGloballyActivated()) { $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled'); $cb->setInfo($this->lng->txt('session_reminder_info')); $cb->setValue(1); $cb->setChecked((int) $ilUser->getPref('session_reminder_enabled')); $expires = ilSession::getSessionExpireValue(); $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time'); $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilFormat::_secondsToString($expires, true))); $min_value = ilSessionReminder::MIN_LEAD_TIME; $max_value = max($min_value, (int) $expires / 60 - 1); $current_user_value = $ilUser->getPref('session_reminder_lead_time'); if ($current_user_value < $min_value || $current_user_value > $max_value) { $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME; } $value = min(max($min_value, $current_user_value), $max_value); $lead_time_gui->setValue($value); $lead_time_gui->setSize(3); $lead_time_gui->setMinValue($min_value); $lead_time_gui->setMaxValue($max_value); $cb->addSubItem($lead_time_gui); $this->form->addItem($cb); } // calendar settings (copied here to be reachable when calendar is inactive) // they cannot be hidden/deactivated include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php'; include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; $lng->loadLanguageModule("dateplaner"); $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId()); $select = new ilSelectInputGUI($lng->txt('cal_user_timezone'), 'timezone'); $select->setOptions(ilCalendarUtil::_getShortTimeZoneList()); $select->setInfo($lng->txt('cal_timezone_info')); $select->setValue($user_settings->getTimeZone()); $this->form->addItem($select); $year = date("Y"); $select = new ilSelectInputGUI($lng->txt('cal_user_date_format'), 'date_format'); $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year)); $select->setInfo($lng->txt('cal_date_format_info')); $select->setValue($user_settings->getDateFormat()); $this->form->addItem($select); $select = new ilSelectInputGUI($lng->txt('cal_user_time_format'), 'time_format'); $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm')); $select->setInfo($lng->txt('cal_time_format_info')); $select->setValue($user_settings->getTimeFormat()); $this->form->addItem($select); // starting point include_once "Services/User/classes/class.ilUserUtil.php"; if (ilUserUtil::hasPersonalStartingPoint()) { $this->lng->loadLanguageModule("administration"); $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start"); $si->setRequired(true); $si->setInfo($this->lng->txt("adm_user_starting_point_info")); foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) { $si->addOption(new ilRadioOption($caption, $value)); } $si->setValue(ilUserUtil::getPersonalStartingPoint()); $this->form->addItem($si); // starting point: repository object $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ); $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id"); $repobj_id->setRequired(true); $repobj_id->setSize(5); if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) { $start_ref_id = ilUserUtil::getPersonalStartingObject(); $repobj_id->setValue($start_ref_id); if ($start_ref_id) { $start_obj_id = ilObject::_lookupObjId($start_ref_id); if ($start_obj_id) { $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id)); } } } $repobj->addSubItem($repobj_id); $si->addOption($repobj); } // 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->getConfig()->setAvailability($ilUser->getPref('char_selector_availability')); $char_selector->getConfig()->setDefinition($ilUser->getPref('char_selector_definition')); $char_selector->addFormProperties($this->form); $char_selector->setFormValues($this->form); } $this->form->addCommandButton("saveGeneralSettings", $lng->txt("save")); $this->form->setTitle($lng->txt("general_settings")); $this->form->setFormAction($this->ctrl->getFormAction($this)); }
/** * init form table 'substitutions' * * @access protected */ protected function initFormSubstitutions() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if (!($visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())) { return; } $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); #$this->form->setTableWidth('100%'); // substitution foreach ($visible_records as $obj_type => $records) { $perm = null; // :TODO: hardwird ? if (in_array($obj_type, array("crs", "cat"))) { $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION, $obj_type, array(ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS)); } include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php'; $sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type); // Show section $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('objs_' . $obj_type)); $this->form->addItem($section); $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_desc_show')); $check->setChecked($sub->isDescriptionEnabled() ? true : false); $this->form->addItem($check); if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION]) { $check->setDisabled(true); } $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_fields_show')); $check->setChecked($sub->enabledFieldNames() ? true : false); $this->form->addItem($check); if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES]) { $check->setDisabled(true); } #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type); #$area->setUseRte(true); #$area->setRteTagSet('standard'); #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString())); #$area->setRows(5); #$area->setCols(80); #$this->form->addItem($area); if ($perm) { $perm_pos = $perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS]; } $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($obj_type); $definitions = $sub->sortDefinitions($definitions); $counter = 1; foreach ($definitions as $def) { $definition_id = $def->getFieldId(); $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id); $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId()); $title = $def->getTitle() . ' (' . $title . ')'; $check = new ilCheckboxInputGUI($title, 'show[' . $obj_type . '][' . $definition_id . ']'); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_show')); $check->setChecked($sub->isSubstituted($definition_id)); if ($perm && !$perm["show"]) { $check->setDisabled(true); } $pos = new ilNumberInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']'); $pos->setSize(3); $pos->setMaxLength(4); $pos->allowDecimals(true); $pos->setValue(sprintf('%.1f', $counter++)); $check->addSubItem($pos); if ($perm && !$perm_pos) { $pos->setDisabled(true); } $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']'); $bold->setValue(1); $bold->setChecked($sub->isBold($definition_id)); $check->addSubItem($bold); if ($perm && !$perm["bold"]) { $bold->setDisabled(true); } $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']'); $bold->setValue(1); $bold->setChecked($sub->hasNewline($definition_id)); $check->addSubItem($bold); if ($perm && !$perm["newline"]) { $bold->setDisabled(true); } $this->form->addItem($check); } // placeholder /* $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders')); $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData'); foreach($records as $record) { foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition) { $tpl->setCurrentBlock('field'); $tpl->setVariable('FIELD_NAME',$definition->getTitle()); $tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'. '[/IF_F_'.$definition->getFieldId().']'); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('record'); $tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for')); $tpl->setVariable('TITLE',$record->getTitle()); $tpl->parseCurrentBlock(); } $custom->setHTML($tpl->get()); $this->form->addItem($custom); */ } $this->form->setTitle($this->lng->txt('md_adv_substitution_table')); $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save')); return true; }
private function addResultDetailsSettingsFormSection(ilPropertyFormGUI $form) { // HEADER: result settings $header_tr = new ilFormSectionHeaderGUI(); $header_tr->setTitle($this->lng->txt('tst_results_details_options')); $form->addItem($header_tr); // show solution details $showSolutionDetails = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_details'), 'solution_details'); $showSolutionDetails->setInfo($this->lng->txt('tst_show_solution_details_desc')); $showSolutionDetails->setChecked($this->testOBJ->getShowSolutionDetails()); $form->addItem($showSolutionDetails); // best solution in test results $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->setChecked((bool) $this->testOBJ->isBestSolutionPrintedWithResult()); $showSolutionDetails->addSubItem($results_print_best_solution); // show solution feedback ==> solution feedback in test results $showSolutionFeedbackOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_feedback'), 'solution_feedback'); $showSolutionFeedbackOption->setInfo($this->lng->txt('tst_show_solution_feedback_desc')); $showSolutionFeedbackOption->setChecked($this->testOBJ->getShowSolutionFeedback()); $form->addItem($showSolutionFeedbackOption); // show suggested solution $showSuggestedSolutionOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_suggested'), 'solution_suggested'); $showSuggestedSolutionOption->setInfo($this->lng->txt('tst_show_solution_suggested_desc')); $showSuggestedSolutionOption->setChecked($this->testOBJ->getShowSolutionSuggested()); $form->addItem($showSuggestedSolutionOption); // show solution printview ==> list of answers $showSolutionPrintview = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_printview'), 'solution_printview'); $showSolutionPrintview->setInfo($this->lng->txt('tst_show_solution_printview_desc')); $showSolutionPrintview->setChecked($this->testOBJ->getShowSolutionPrintview()); $form->addItem($showSolutionPrintview); // show best solution in list of answers $solutionCompareInput = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_compare'), 'solution_compare'); $solutionCompareInput->setChecked($this->testOBJ->getShowSolutionListComparison()); $showSolutionPrintview->addSubItem($solutionCompareInput); // solution answers only ==> printview of results (answers only) $solutionAnswersOnly = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_answers_only'), 'solution_answers_only'); $solutionAnswersOnly->setInfo($this->lng->txt('tst_show_solution_answers_only_desc')); $solutionAnswersOnly->setChecked($this->testOBJ->getShowSolutionAnswersOnly()); $showSolutionPrintview->addSubItem($solutionAnswersOnly); // high score $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->testOBJ->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_tables = new ilRadioGroupInputGUI($this->lng->txt('tst_highscore_mode'), 'highscore_mode'); $highscore_tables->setRequired(true); $highscore_tables->setValue($this->testOBJ->getHighscoreMode()); $highscore_table_own = new ilRadioOption($this->lng->txt('tst_highscore_own_table'), ilObjTest::HIGHSCORE_SHOW_OWN_TABLE); $highscore_table_own->setInfo($this->lng->txt('tst_highscore_own_table_description')); $highscore_tables->addOption($highscore_table_own); $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_top_table'), ilObjTest::HIGHSCORE_SHOW_TOP_TABLE); $highscore_table_other->setInfo($this->lng->txt('tst_highscore_top_table_description')); $highscore_tables->addOption($highscore_table_other); $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_all_tables'), ilObjTest::HIGHSCORE_SHOW_ALL_TABLES); $highscore_table_other->setInfo($this->lng->txt('tst_highscore_all_tables_description')); $highscore_tables->addOption($highscore_table_other); $highscore->addSubItem($highscore_tables); $highscore_top_num = new ilNumberInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setRequired(true); $highscore_top_num->setMinValue(1); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum(null)); $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->testOBJ->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->testOBJ->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); // show signature placeholder $showSignaturePlaceholder = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_signature'), 'solution_signature'); $showSignaturePlaceholder->setInfo($this->lng->txt('tst_show_solution_signature_desc')); $showSignaturePlaceholder->setChecked($this->testOBJ->getShowSolutionSignature()); if ($this->testOBJ->getAnonymity()) { $showSignaturePlaceholder->setDisabled(true); } $form->addItem($showSignaturePlaceholder); // show signature placeholder $showExamId = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_res'), 'examid_in_test_res'); $showExamId->setInfo($this->lng->txt('examid_in_test_res_desc')); $showExamId->setChecked($this->testOBJ->isShowExamIdInTestResultsEnabled()); $form->addItem($showExamId); // export settings $export_settings = new ilCheckboxInputGUI($this->lng->txt('tst_exp_sc_short'), 'exp_sc_short'); $export_settings->setInfo($this->lng->txt('tst_exp_sc_short_desc')); $export_settings->setChecked($this->testOBJ->getExportSettingsSingleChoiceShort()); $form->addItem($export_settings); }
/** * @param ilPropertyFormGUI $form */ private function addQuestionBehaviourProperties(ilPropertyFormGUI $form) { $fields = array('title_output', 'autosave', 'chb_shuffle_questions', 'chb_shuffle_questions', 'offer_hints', 'instant_feedback', 'obligations_enabled'); if ($this->isSectionHeaderRequired($fields) || $this->isCharSelectorPropertyRequired()) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->testOBJ->getTitleOutput()); $form->addItem($title_output); // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->testOBJ->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000); $autosave_interval->setSuffix($this->lng->txt('seconds')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->testOBJ->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // offer hints $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt('tst_setting_offer_hints_label'), 'offer_hints'); $checkBoxOfferHints->setChecked($this->testOBJ->isOfferingQuestionHintsEnabled()); $checkBoxOfferHints->setInfo($this->lng->txt('tst_setting_offer_hints_info')); if ($this->testOBJ->participantDataExist()) { $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_results'), 'instant_feedback_points', $this->lng->txt('tst_instant_feedback_results_desc'))); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt('tst_instant_feedback_answer_generic'), 'instant_feedback_generic', $this->lng->txt('tst_instant_feedback_answer_generic_desc'))); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt('tst_instant_feedback_answer_specific'), 'instant_feedback_specific', $this->lng->txt('tst_instant_feedback_answer_specific_desc'))); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt('tst_instant_feedback_solution'), 'instant_feedback_solution', $this->lng->txt('tst_instant_feedback_solution_desc'))); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt('tst_instant_feedback_fix_usr_answer'), 'instant_feedback_answer_fixation', $this->lng->txt('tst_instant_feedback_fix_usr_answer_desc'))); $values = array(); if ($this->testOBJ->getSpecificAnswerFeedback()) { array_push($values, 'instant_feedback_specific'); } if ($this->testOBJ->getGenericAnswerFeedback()) { array_push($values, 'instant_feedback_generic'); } if ($this->testOBJ->getAnswerFeedbackPoints()) { array_push($values, 'instant_feedback_points'); } if ($this->testOBJ->getInstantFeedbackSolution()) { array_push($values, 'instant_feedback_solution'); } if ($this->testOBJ->isInstantFeedbackAnswerFixationEnabled()) { array_push($values, 'instant_feedback_answer_fixation'); } $instant_feedback->setValue($values); $form->addItem($instant_feedback); // enable obligations $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt('tst_setting_enable_obligations_label'), 'obligations_enabled'); $checkBoxEnableObligations->setChecked($this->testOBJ->areObligationsEnabled()); $checkBoxEnableObligations->setInfo($this->lng->txt('tst_setting_enable_obligations_info')); if ($this->testOBJ->participantDataExist()) { $checkBoxEnableObligations->setDisabled(true); } $form->addItem($checkBoxEnableObligations); // selector for unicode characters if ($this->isCharSelectorPropertyRequired()) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability()); $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition()); $char_selector->addFormProperties($form); $char_selector->setFormValues($form); } }
/** * @param string $object_type */ private function initForumCreateForm($object_type) { $this->create_form_gui = new ilPropertyFormGUI(); $this->create_form_gui->setTableWidth('600px'); $this->create_form_gui->setTitle($this->lng->txt('frm_new')); $this->create_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg')); // form action $this->ctrl->setParameter($this, 'new_type', $object_type); $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this, 'save')); // title $title_gui = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title_gui->setSize(min(40, ilObject::TITLE_LENGTH)); $title_gui->setMaxLength(ilObject::TITLE_LENGTH); $this->create_form_gui->addItem($title_gui); // description $description_gui = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc'); $description_gui->setCols(40); $description_gui->setRows(2); $this->create_form_gui->addItem($description_gui); // view sorting threads $sorting_threads_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_sorting_threads'), 'thread_sorting'); $sort_dat = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('date'), 0); $sorting_threads_gui->addOption($sort_dat); $sort_man = new ilRadioOption($this->lng->txt('sorting_manual_sticky'), 1); $sorting_threads_gui->addOption($sort_man); $sorting_threads_gui->setInfo($this->lng->txt('sticky_threads_always_on_top')); $this->create_form_gui->addItem($sorting_threads_gui); // view $view_group_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'sort'); $view_hir = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('answers'), ilForumProperties::VIEW_TREE); $view_group_gui->addOption($view_hir); $view_dat = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('date'), ilForumProperties::VIEW_DATE); $view_group_gui->addOption($view_dat); $this->create_form_gui->addItem($view_group_gui); $view_direction_group_gui = new ilRadioGroupInputGUI('', 'default_view_sort_dir'); $view_desc = new ilRadioOption($this->lng->txt('frm_post_sort_desc'), ilForumProperties::VIEW_DATE_DESC); $view_direction_group_gui->addOption($view_desc); $view_asc = new ilRadioOption($this->lng->txt('frm_post_sort_asc'), ilForumProperties::VIEW_DATE_ASC); $view_direction_group_gui->addOption($view_asc); $view_dat->addSubItem($view_direction_group_gui); // anonymized or not $anonymize_gui = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized'); $anonymize_gui->setInfo($this->lng->txt('frm_anonymous_posting_desc')); $anonymize_gui->setValue(1); if ($this->ilias->getSetting('enable_anonymous_fora', false)) { $anonymize_gui->setDisabled(true); } $this->create_form_gui->addItem($anonymize_gui); // statistics enabled or not $statistics_gui = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled'); $statistics_gui->setInfo($this->lng->txt('frm_statistics_enabled_desc')); $statistics_gui->setValue(1); if (!$this->ilias->getSetting('enable_fora_statistics', false)) { $statistics_gui->setDisabled(true); } $this->create_form_gui->addItem($statistics_gui); $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation'); $cb_prop->setValue('1'); $cb_prop->setInfo($this->lng->txt('post_activation_desc')); $this->create_form_gui->addItem($cb_prop); $this->create_form_gui->addCommandButton('save', $this->lng->txt('save')); $this->create_form_gui->addCommandButton('cancel', $this->lng->txt('cancel')); }
/** * Display and fill the properties form of the test * * @access public */ function propertiesObject($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"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } $save = strcmp($this->ctrl->getCmd(), "saveProperties") == 0 ? TRUE : FALSE; $total = $this->object->evalTotalPersons(); $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$template || $template && $this->formShowGeneralSection($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "tst"); $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); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($total) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->object->getAnonymity()); $form->addItem($anonymity); // random selection of questions $random = new ilCheckboxInputGUI($this->lng->txt("tst_random_selection"), "random_test"); $random->setValue(1); if ($total) { $random->setDisabled(true); } $random->setChecked($this->object->isRandomTest()); $info = $this->lng->txt("tst_random_test_description"); if ($this->object->hasQuestionsWithoutQuestionpool()) { $info .= $this->lng->txt("tst_random_test_description_warning"); } $random->setInfo($info); $form->addItem($random); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->object->getPoolUsage()); $form->addItem($pool_usage); // activation/availability (no template support yet) 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->setChecked($this->object->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_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('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $date = $this->object->getActivationStartingTime(); $start = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_start'), 'act_starting_time'); #$start->setMode(ilDateTimeInputGUI::MODE_INPUT); $start->setShowTime(true); $start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($start); $date = $this->object->getActivationEndingTime(); $end = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_end'), 'act_ending_time'); #$end->setMode(ilDateTimeInputGUI::MODE_INPUT); $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'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$template || $template && $this->formShowBeginningEndingInformation($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->object->getId(), "tst", 'assessment', null, false, '3.4.7'); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->object->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->object->getId(), "tst", "assessment", null, false, '3.4.7'); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->object->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); if (!$template || $template && $this->formShowSessionSection($template_settings)) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->object->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_processing_time'] && $template_settings['chb_processing_time']['value']) { $processing->setChecked(true); } else { $processing->setChecked($this->object->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->object->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->object->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_starting_time'] && $template_settings['chb_starting_time']['value']) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->object->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->object->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->object->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); if ($total) { $enablestartingtime->setDisabled(true); } if ($total) { $startingtime->setDisabled(true); } $form->addItem($enablestartingtime); // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_ending_time'] && $template_settings['chb_ending_time']['value']) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->object->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->object->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->object->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->object->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$template || $template && $this->formShowPresentationSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->object->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->object->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->object->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->object->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->object->getAutosaveIval()); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$template || $template && $this->formShowSequenceSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->object->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->object->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->object->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->object->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->object->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->object->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->object->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$template || $template && $this->formShowNotificationSection($template_settings)) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->object->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->object->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->object->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->object->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->object->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->object->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->object->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->object->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->object->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->object->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->object->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->object->getHighscoreTopNum()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$template || $template && $this->formShowKioskSection($template_settings)) { // kiosk mode properties $kioskheader = new ilFormSectionHeaderGUI(); $kioskheader->setTitle($this->lng->txt("kiosk")); $form->addItem($kioskheader); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->object->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->object->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->object->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); if (!$template || $template && $this->formShowParticipantSection($template_settings)) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->object->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->object->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->object->getAllowedUsers() ? $this->object->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->object->getAllowedUsersTimeGap() ? $this->object->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->object); $ecs->addSettingsToForm($form, 'tst'); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $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); } } } $errors = false; if ($save) { $errors = !$form->checkInput(); $form->setValuesByPost(); if ($online->getChecked() && !$this->object->isComplete()) { $online->setAlert($this->lng->txt("cannot_switch_to_online_no_questions_andor_no_mark_steps")); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); $errors = true; } if ($errors) { $checkonly = false; } } if (!$checkonly) { // using template? $message = ""; if ($template) { global $tpl; $link = $this->ctrl->getLinkTarget($this, "confirmResetTemplate"); $link = "<a href=\"" . $link . "\">" . $this->lng->txt("test_using_template_link") . "</a>"; $message = "<div style=\"margin-top:10px\">" . $tpl->getMessageHTML(sprintf($this->lng->txt("test_using_template"), $template->getTitle(), $link), "info") . "</div>"; } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML() . $message); } return $errors; }
/** * 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; }
public function initIliasSettingsForm() { /** * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveIliasSettings')); $this->form->setTitle($this->getPluginObject()->txt('general_settings')); $this->form->addCommandButton('saveIliasSettings', $lng->txt('save')); $this->form->addCommandButton('cancelIliasSettings', $lng->txt('cancel')); $cb_group = new ilCheckboxGroupInputGUI($this->pluginObj->txt('object_creation_settings'), 'obj_creation_settings'); include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); if ($templates) { foreach ($templates as $item) { $cb_simple = new ilCheckboxOption($this->pluginObj->txt($item["title"]), $item["id"]); $cb_group->addOption($cb_simple); } } $cb_group->setInfo($this->pluginObj->txt('template_info')); $this->form->addItem($cb_group); $obj_title_suffix = new ilCheckboxInputGUI($this->pluginObj->txt('obj_title_suffix'), 'obj_title_suffix'); $obj_title_suffix->setInfo($this->pluginObj->txt('obj_title_suffix_info')); $this->form->addItem($obj_title_suffix); $crs_grp_trigger = new ilCheckboxInputGUI($this->pluginObj->txt('allow_crs_grp_trigger'), 'allow_crs_grp_trigger'); $crs_grp_trigger->setInfo($this->pluginObj->txt('allow_crs_grp_trigger_info')); $this->form->addItem($crs_grp_trigger); $show_free_slots = new ilCheckboxInputGUI($this->pluginObj->txt('show_free_slots'), 'show_free_slots'); $show_free_slots->setInfo($this->pluginObj->txt('show_free_slots_info')); $this->form->addItem($show_free_slots); $enable_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('enable_perm_room'), 'enable_perm_room'); $enable_perm_room->setInfo($this->pluginObj->txt('enable_perm_room_info')); $default_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('default_perm_room'), 'default_perm_room'); $default_perm_room->setInfo($this->pluginObj->txt('default_perm_room_info')); $enable_perm_room->addSubItem($default_perm_room); $this->form->addItem($enable_perm_room); $add_to_desktop = new ilCheckboxInputGUI($this->pluginObj->txt('add_to_desktop'), 'add_to_desktop'); $add_to_desktop->setInfo($this->pluginObj->txt('add_to_desktop_info')); $this->form->addItem($add_to_desktop); $content_file_types = new ilTextInputGUI($this->pluginObj->txt('content_file_types'), 'content_file_types'); $content_file_types->setRequired(true); $content_file_types->setInfo($this->pluginObj->txt('content_file_types_info')); $this->form->addItem($content_file_types); $user_folders = new ilCheckboxInputGUI($this->pluginObj->txt('use_user_folders'), 'use_user_folders'); $user_folders->setInfo($this->pluginObj->txt('use_user_folders_info')); if (ilAdobeConnectServer::getSetting('user_assignment_mode') == ilAdobeConnectServer::ASSIGN_USER_DFN_EMAIL) { $user_folders->setDisabled(true); } $this->form->addItem($user_folders); $xavc_options = array("host" => $this->pluginObj->txt("presenter"), "mini-host" => $this->pluginObj->txt("moderator"), "view" => $this->pluginObj->txt("participant"), "denied" => $this->pluginObj->txt('denied')); $mapping_crs = new ilNonEditableValueGUI($this->pluginObj->txt('default_crs_mapping'), 'default_crs_mapping'); // $crs_owner = new ilSelectInputGUI($lng->txt('owner'), 'crs_owner'); // $crs_owner->setOptions($xavc_options); // $mapping_crs->addSubItem($crs_owner); $crs_admin = new ilSelectInputGUI($lng->txt('il_crs_admin'), 'crs_admin'); $crs_admin->setOptions($xavc_options); $mapping_crs->addSubItem($crs_admin); $crs_tutor = new ilSelectInputGUI($lng->txt('il_crs_tutor'), 'crs_tutor'); $crs_tutor->setOptions($xavc_options); $mapping_crs->addSubItem($crs_tutor); $crs_member = new ilSelectInputGUI($lng->txt('il_crs_member'), 'crs_member'); $crs_member->setOptions($xavc_options); $mapping_crs->addSubItem($crs_member); $this->form->addItem($mapping_crs); $mapping_grp = new ilNonEditableValueGUI($this->pluginObj->txt('default_grp_mapping'), 'default_grp_mapping'); // $grp_owner = new ilSelectInputGUI($lng->txt('owner'), 'grp_owner'); // $grp_owner->setOptions($xavc_options); // $mapping_grp->addSubItem($grp_owner); $grp_admin = new ilSelectInputGUI($lng->txt('il_grp_admin'), 'grp_admin'); $grp_admin->setOptions($xavc_options); $mapping_grp->addSubItem($grp_admin); $grp_member = new ilSelectInputGUI($lng->txt('il_grp_member'), 'grp_member'); $grp_member->setOptions($xavc_options); $mapping_grp->addSubItem($grp_member); $this->form->addItem($mapping_grp); $ac_permissions = ilXAVCPermissions::getPermissionsArray(); //@todo nahmad: in Template auslagern! $tbl = "<table width='100%' >\n\t\t<tr>\n\t\t<td> </td> \n\t\t<td>" . $this->pluginObj->txt('presenter') . "</td>\n\t\t<td>" . $this->pluginObj->txt('moderator') . "</td>\n\t\t<td>" . $this->pluginObj->txt('participant') . "</td>\n\t\t<td>" . $this->pluginObj->txt('denied') . "</td>\n\t\t\n\t\t</tr>"; foreach ($ac_permissions as $ac_permission => $ac_roles) { $tbl .= "<tr> <td>" . $this->pluginObj->txt($ac_permission) . "</td>"; foreach ($ac_roles as $ac_role => $ac_access) { $tbl .= "<td>"; $tbl .= ilUtil::formCheckbox((bool) $ac_access, 'permissions[' . $ac_permission . '][' . $ac_role . ']', $ac_role, false); $tbl .= "</td>"; } $tbl .= "</tr>"; } $tbl .= "</table>"; $matrix = new ilCustomInputGUI($this->pluginObj->txt('ac_permissions'), ''); $matrix->setHtml($tbl); $this->form->addItem($matrix); }
private function buildForm() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save")); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst"); $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); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($this->testOBJ->participantDataExist()) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->testOBJ->getAnonymity()); $form->addItem($anonymity); // test mode (question set type) $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type'); $questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc")); $questSetType->addOption($questSetTypeFixed); $questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc")); $questSetType->addOption($questSetTypeRandom); $questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc")); $questSetType->addOption($questSetTypeContinues); $questSetType->setValue($this->testOBJ->getQuestionSetType()); if ($this->testOBJ->participantDataExist()) { $questSetType->setDisabled(true); } $form->addItem($questSetType); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->testOBJ->getPoolUsage()); $form->addItem($pool_usage); // enable_archiving $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving'); $enable_archiving->setValue(1); $enable_archiving->setChecked($this->testOBJ->getEnableArchiving()); $form->addItem($enable_archiving); // activation/availability (no template support yet) 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->testOBJ->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->setChecked($this->testOBJ->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $this->tpl->addJavaScript('./Services/Form/js/date_duration.js'); include_once "Services/Form/classes/class.ilDateDurationInputGUI.php"; $dur = new ilDateDurationInputGUI("", "access_period"); $dur->setShowTime(true); $date = $this->testOBJ->getActivationStartingTime(); $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setStartText($this->lng->txt('rep_activation_limited_start')); $date = $this->testOBJ->getActivationEndingTime(); $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setEndText($this->lng->txt('rep_activation_limited_end')); $opt->addSubItem($dur); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->testOBJ->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$this->settingsTemplate || $this->formShowBeginningEndingInformation($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->testOBJ->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->testOBJ->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); // examview $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview'); $enable_examview->setValue(1); $enable_examview->setChecked($this->testOBJ->getEnableExamview()); $enable_examview->setInfo($this->lng->txt("enable_examview_desc")); $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html'); $show_examview_html->setValue(1); $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml()); $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html")); $show_examview_html->setInfo($this->lng->txt("show_examview_html_desc")); $enable_examview->addSubItem($show_examview_html); $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf'); $show_examview_pdf->setValue(1); $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf()); $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf")); $show_examview_pdf->setInfo($this->lng->txt("show_examview_pdf_desc")); $enable_examview->addSubItem($show_examview_pdf); $form->addItem($enable_examview); if (!$this->settingsTemplate || $this->formShowSessionSection($this->settingsTemplate->getSettings())) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->testOBJ->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); $total = $this->testOBJ->evalTotalPersons(); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->testOBJ->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_starting_time')) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->testOBJ->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->testOBJ->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); if ($this->testOBJ->participantDataExist()) { $enablestartingtime->setDisabled(true); $startingtime->setDisabled(true); } // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_ending_time')) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->testOBJ->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->testOBJ->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->testOBJ->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$this->settingsTemplate || $this->formShowPresentationSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->testOBJ->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->testOBJ->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // 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_TEST); $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability()); $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition()); $char_selector->addFormProperties($form); $char_selector->setFormValues($form); } // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->testOBJ->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$this->settingsTemplate || $this->formShowSequenceSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->testOBJ->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->testOBJ->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->testOBJ->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->testOBJ->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->testOBJ->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->testOBJ->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->testOBJ->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->testOBJ->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$this->settingsTemplate || $this->formShowNotificationSection($this->settingsTemplate->getSettings())) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->testOBJ->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->testOBJ->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->testOBJ->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->testOBJ->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->testOBJ->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->testOBJ->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->testOBJ->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum()); $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$this->settingsTemplate || $this->formShowTestExecutionSection($this->settingsTemplate->getSettings())) { $testExecution = new ilFormSectionHeaderGUI(); $testExecution->setTitle($this->lng->txt("tst_test_execution")); $form->addItem($testExecution); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt('examid_in_kiosk'), 'examid_in_kiosk')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } if ($this->testOBJ->getExamidInKiosk()) { array_push($values, 'examid_in_kiosk'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $redirection_mode = $this->testOBJ->getRedirectionMode(); $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled'); $rm_enabled->setChecked($redirection_mode == '0' ? false : true); $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_mode'); $always = new ilRadioOption($this->lng->txt('tst_results_access_always'), REDIRECT_ALWAYS); $radio_rm->addOption($always); $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK); $radio_rm->addOption($kiosk); $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS); $rm_enabled->addSubItem($radio_rm); $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url'); $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl()); $redirection_url->setRequired(true); $rm_enabled->addSubItem($redirection_url); $form->addItem($rm_enabled); // Sign submission $sign_submission = $this->testOBJ->getSignSubmission(); $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission'); $sign_submission_enabled->setChecked($sign_submission); $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info')); $form->addItem($sign_submission_enabled); if (!$this->settingsTemplate || $this->formShowParticipantSection($this->settingsTemplate->getSettings())) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->testOBJ->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->testOBJ->getAllowedUsers() ? $this->testOBJ->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->testOBJ->getAllowedUsersTimeGap() ? $this->testOBJ->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->testOBJ); $ecs->addSettingsToForm($form, 'tst'); // remove items when using template if ($this->settingsTemplate) { foreach ($this->settingsTemplate->getSettings() as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }
/** * scorm module properties */ function properties() { global $rbacsystem, $tree, $tpl, $lng, $ilToolbar, $ilCtrl, $ilSetting, $ilTabs; $lng->loadLanguageModule("style"); ilObjSAHSLearningModuleGUI::setSettingsSubTabs(); $ilTabs->setSubTabActive('cont_settings'); // view $ilToolbar->addButton($this->lng->txt("view"), "ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->object->getRefID(), "_blank"); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->setTitle($this->lng->txt("cont_lm_properties")); // SCORM-type $ne = new ilNonEditableValueGUI($this->lng->txt("type"), ""); $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID()))); $this->form->addItem($ne); // version $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), ""); $ne->setValue($this->object->getModuleVersion()); $this->form->addItem($ne); // online $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online"); $cb->setValue("y"); if ($this->object->getOnline()) { $cb->setChecked(true); } $this->form->addItem($cb); // offline Mode $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode"); $cb->setValue("y"); $cb->setChecked($this->object->getOfflineMode()); include_once "./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php"; if ($this->object->getOfflineMode() == true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) { $cb->setDisabled(true); $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info")); } else { $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info")); } $this->form->addItem($cb); // // presentation // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_presentation")); $this->form->addItem($sh); // display mode (open) $options = array("0" => $this->lng->txt("cont_open_normal"), "1" => $this->lng->txt("cont_open_iframe_max"), "2" => $this->lng->txt("cont_open_iframe_defined"), "5" => $this->lng->txt("cont_open_window_undefined"), "6" => $this->lng->txt("cont_open_window_defined")); $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode"); $si->setOptions($options); $si->setValue($this->object->getOpenMode()); $this->form->addItem($si); // width $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getWidth()); $this->form->addItem($ni); // height $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getHeight()); $this->form->addItem($ni); // auto navigation to last visited item $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited"); $cb->setValue("y"); $cb->setChecked($this->object->getAuto_last_visited()); $cb->setInfo($this->lng->txt("cont_auto_last_visited_info")); $this->form->addItem($cb); // auto continue $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_auto_continue"), "auto_continue"); $cb->setValue("y"); $cb->setChecked($this->object->getAutoContinue()); $this->form->addItem($cb); // // scorm options // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_scorm_options")); $this->form->addItem($sh); // max attempts $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt"); $ni->setMaxLength(3); $ni->setSize(3); $ni->setValue($this->object->getMaxAttempt()); $this->form->addItem($ni); // lesson mode $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"), "browse" => $this->lng->txt("cont_sc_less_mode_browse")); $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode"); $si->setOptions($options); $si->setValue($this->object->getDefaultLessonMode()); $this->form->addItem($si); // credit mode $options = array("credit" => $this->lng->txt("cont_credit_on"), "no_credit" => $this->lng->txt("cont_credit_off")); $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode"); $si->setOptions($options); $si->setValue($this->object->getCreditMode()); $si->setInfo($this->lng->txt("cont_credit_mode_info")); $this->form->addItem($si); // set lesson mode review when completed $options = array("n" => $this->lng->txt("cont_sc_auto_review_no"), "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed")); $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review"); $si->setOptions($options); $si->setValue($this->object->getAutoReviewChar()); $si->setInfo($this->lng->txt("cont_sc_auto_review_info_12")); $this->form->addItem($si); // // rte settings // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_rte_settings")); $this->form->addItem($sh); // unlimited session timeout $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session"); $cb->setValue("y"); $cb->setChecked($this->object->getSession()); $cb->setInfo($this->lng->txt("cont_sc_usession_info")); $this->form->addItem($cb); // storage of interactions $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions"); $cb->setValue("y"); $cb->setChecked($this->object->getInteractions()); $this->form->addItem($cb); // objectives $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives"); $cb->setValue("y"); $cb->setChecked($this->object->getObjectives()); $this->form->addItem($cb); // time from lms $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms"); $cb->setValue("y"); $cb->setChecked($this->object->getTime_from_lms()); $cb->setInfo($this->lng->txt("cont_time_from_lms_info")); $this->form->addItem($cb); // check values $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values"); $cb->setValue("y"); $cb->setChecked($this->object->getCheck_values()); $this->form->addItem($cb); // api adapter name // $this->tpl->setVariable("TXT_API_ADAPTER", $this->lng->txt("cont_api_adapter")); // $this->tpl->setVariable("VAL_API_ADAPTER", $this->object->getAPIAdapterName()); // api functions prefix // $this->tpl->setVariable("TXT_API_PREFIX", $this->lng->txt("cont_api_func_prefix")); // $this->tpl->setVariable("VAL_API_PREFIX", $this->object->getAPIFunctionsPrefix()); // // debugging // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_debugging")); $this->form->addItem($sh); // test tool $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug"); $cb->setValue("y"); $cb->setChecked($this->object->getDebug()); if ($this->object->getDebugActivated() == false) { $cb->setDisabled(true); $cb->setInfo($this->lng->txt("cont_debug_deactivated")); } else { $cb->setInfo($this->lng->txt("cont_debug_deactivate")); } $this->form->addItem($cb); $this->form->addCommandButton("saveProperties", $lng->txt("save")); $tpl->setContent($this->form->getHTML()); }
/** * Edit settings. */ public function editWebDAVSettings() { global $rbacsystem, $ilErr, $ilTabs; global $tpl, $ilCtrl, $lng, $tree, $settings; $this->tabs_gui->setTabActive('webdav'); if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING); } require_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; require_once "./Services/Form/classes/class.ilCheckboxInputGUI.php"; require_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php"; require_once "./Services/Form/classes/class.ilRadioOption.php"; require_once "./Services/Form/classes/class.ilTextAreaInputGUI.php"; require_once "./Services/WebDAV/classes/class.ilDAVServer.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("settings")); // Enable webdav $ilDAVServer = ilDAVServer::getInstance(); $isPearAuthHTTPInstalled = @(include_once "Auth/HTTP.php"); $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_webdav"), "enable_webdav"); $cb_prop->setValue('1'); $cb_prop->setChecked($this->object->isWebdavEnabled() && $isPearAuthHTTPInstalled); $cb_prop->setDisabled(!$isPearAuthHTTPInstalled); $cb_prop->setInfo($isPearAuthHTTPInstalled ? sprintf($lng->txt('enable_webdav_info'), $ilDAVServer->getMountURI($tree->getRootId(), 0, null, null, true)) : $lng->txt('webdav_pear_auth_http_needed')); $form->addItem($cb_prop); // Webdav help text if ($isPearAuthHTTPInstalled) { $rgi_prop = new ilRadioGroupInputGUI($lng->txt('webfolder_instructions'), 'custom_webfolder_instructions_choice'); $rgi_prop->addOption(new ilRadioOption($lng->txt('use_default_instructions'), 'default')); $rgi_prop->addOption(new ilRadioOption($lng->txt('use_customized_instructions'), 'custom')); $rgi_prop->setValue($this->object->isCustomWebfolderInstructionsEnabled() ? 'custom' : 'default'); $rgi_prop->setDisabled(!$isPearAuthHTTPInstalled); $form->addItem($rgi_prop); $tai_prop = new ilTextAreaInputGUI('', 'custom_webfolder_instructions'); $tai_prop->setValue($this->object->getCustomWebfolderInstructions()); $tai_prop->setInfo($lng->txt("webfolder_instructions_info")); $tai_prop->setCols(80); $tai_prop->setRows(20); $tai_prop->setDisabled(!$isPearAuthHTTPInstalled); $form->addItem($tai_prop); } // command buttons $form->addCommandButton('saveWebDAVSettings', $lng->txt('save')); $form->addCommandButton('view', $lng->txt('cancel')); $tpl->setContent($form->getHTML()); }
protected function initSettingsForm() { global $rbacreview, $ilUser; $this->lng->loadLanguageModule('ps'); include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php'; $privacy = ilPrivacySettings::_getInstance(); $security = ilSecuritySettings::_getInstance(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings")); $form->setTitle($this->lng->txt('settings')); // protected admin $admin = new ilCheckboxInputGUI($GLOBALS['lng']->txt('adm_adm_role_protect'), 'admin_role'); $admin->setDisabled(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)); $admin->setInfo($this->lng->txt('adm_adm_role_protect_info')); $admin->setChecked((int) $security->isAdminRoleProtected()); $admin->setValue(1); $form->addItem($admin); $check = new ilCheckboxInputGui($this->lng->txt('rbac_log'), 'rbac_log'); $check->setInfo($this->lng->txt('rbac_log_info')); $check->setChecked($privacy->enabledRbacLog()); $form->addItem($check); $age = new ilNumberInputGUI($this->lng->txt('rbac_log_age'), 'rbac_log_age'); $age->setInfo($this->lng->txt('rbac_log_age_info')); $age->setValue($privacy->getRbacLogAge()); $age->setMinValue(1); $age->setMaxValue(24); $age->setSize(2); $age->setMaxLength(2); $check->addSubItem($age); $form->addCommandButton('saveSettings', $this->lng->txt('save')); return $form; }