function initAddCodesForm() { global $ilCtrl, $lng; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes')); $this->form_gui->setTitle($lng->txt('user_account_codes_edit_header')); $count = new ilNumberInputGUI($lng->txt('user_account_codes_number'), 'acc_codes_number'); $count->setSize(4); $count->setMaxLength(4); $count->setMinValue(1); $count->setMaxValue(1000); $count->setRequired(true); $this->form_gui->addItem($count); $valid = new ilRadioGroupInputGUI($lng->txt('user_account_code_valid_until'), 'valid_type'); $valid->setRequired(true); $unl = new ilRadioOption($lng->txt('user_account_code_valid_until_unlimited'), 'valid_unlimited'); $valid->addOption($unl); $st = new ilRadioOption($lng->txt('user_account_code_valid_until_static'), 'valid_static'); $valid->addOption($st); $dt = new ilDateTimeInputGUI($lng->txt('date'), 'valid_date'); $dt->setRequired(true); $st->addSubItem($dt); $dyn = new ilRadioOption($lng->txt('user_account_code_valid_until_dynamic'), 'valid_dynamic'); $valid->addOption($dyn); $ds = new ilNumberInputGUI($lng->txt('days'), 'valid_days'); $ds->setSize(5); $ds->setRequired(true); $dyn->addSubItem($ds); $this->form_gui->addItem($valid); $this->form_gui->addCommandButton('createCodes', $lng->txt('create')); $this->form_gui->addCommandButton('listCodes', $lng->txt('cancel')); }
public function addCustomSettingsToForm(ilPropertyFormGUI $a_form) { global $lng, $ilSetting; $num_days = new ilNumberInputGUI($lng->txt('payment_notification_days'), 'payment_notification_days'); $num_days->setSize(3); $num_days->setMinValue(0); $num_days->setMaxValue(120); $num_days->setRequired(true); $num_days->setValue($ilSetting->get('payment_notification_days')); $num_days->setInfo($lng->txt('payment_notification_days_desc')); $a_form->addItem($num_days); }
public function addToForm() { $def = $this->getADT()->getCopyOfDefinition(); $number = new ilNumberInputGUI($this->getTitle(), $this->getElementId()); $number->setSize(10); $min = $def->getMin(); if ($min !== null) { $number->setMinValue($min); } $max = $def->getMax(); if ($max !== null) { $number->setMaxValue($max); $length = strlen($max); $number->setSize($length); $number->setMaxLength($length); } $this->addToParentElement($number); }
/** * @return ilPropertyFormGUI */ protected function getEctsForm() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'saveEctsForm')); $form->addCommandButton('saveEctsForm', $this->lng->txt('save')); $form->setTitle($this->lng->txt('ects_output_of_ects_grades')); $allow_ects_marks = new ilCheckboxInputGUI($this->lng->txt('ects_allow_ects_grades'), 'ectcs_status'); for ($i = ord('a'); $i <= ord('e'); $i++) { $mark = chr($i); $mark_step = new ilNumberInputGUI(chr($i - 32) . ' - ' . $this->lng->txt('ects_grade_' . $mark . '_short'), 'ects_grade_' . $mark); $mark_step->setSize(5); $mark_step->allowDecimals(true); $mark_step->setMinValue(0, true); $mark_step->setMaxValue(100, true); $mark_step->setSuffix($this->lng->txt('percentile')); $mark_step->setRequired(true); $allow_ects_marks->addSubItem($mark_step); } $use_ects_fx = new ilCheckboxInputGUI($this->lng->txt('use_ects_fx'), 'use_ects_fx'); $threshold = new ilNumberInputGUI($this->lng->txt('ects_fx_threshold'), 'ects_fx_threshold'); $threshold->setInfo($this->lng->txt('ects_fx_threshold_info')); $threshold->setSuffix($this->lng->txt('percentile')); $threshold->allowDecimals(true); $threshold->setSize(5); $threshold->setRequired(true); $use_ects_fx->addSubItem($threshold); $allow_ects_marks->addSubItem($use_ects_fx); $form->addItem($allow_ects_marks); return $form; }
public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form) { // maxsize $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize"); $maxsize->setValue($this->object->getMaxSize()); $maxsize->setInfo($this->lng->txt("maxsize_info")); $maxsize->setSize(10); $maxsize->setMinValue(0); $maxsize->setMaxValue($this->determineMaxFilesize()); $maxsize->setRequired(FALSE); $form->addItem($maxsize); // allowedextensions $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions"); $allowedextensions->setInfo($this->lng->txt("allowedextensions_info")); $allowedextensions->setValue($this->object->getAllowedExtensions()); $allowedextensions->setRequired(FALSE); $form->addItem($allowedextensions); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->allowDecimals(true); $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(false); $form->addItem($points); $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission'); $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info')); $subcompl->setValue(1); $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled()); $form->addItem($subcompl); return $form; }
/** * Init form table for new role assignments * * @param string mode edit | create * @param object object of ilLDAPRoleAsssignmentRule * @access protected * */ protected function initFormRoleAssignments($a_mode) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); switch ($a_mode) { case 'edit': $this->form->setTitle($this->lng->txt('ldap_edit_role_ass_rule')); $this->form->addCommandButton('updateRoleAssignment', $this->lng->txt('save')); $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel')); break; case 'create': $this->form->setTitle($this->lng->txt('ldap_add_role_ass_rule')); $this->form->addCommandButton('addRoleAssignment', $this->lng->txt('ldap_btn_add_role_ass')); $this->form->addCommandButton('roleAssignments', $this->lng->txt('cancel')); break; } // Role Selection $role = new ilRadioGroupInputGUI($this->lng->txt('ldap_ilias_role'), 'role_name'); $role->setRequired(true); $global = new ilRadioOption($this->lng->txt('ldap_global_role'), 0); $role->addOption($global); $role_select = new ilSelectInputGUI('', 'role_id'); $role_select->setOptions($this->prepareGlobalRoleSelection()); $global->addSubItem($role_select); $local = new ilRadioOption($this->lng->txt('ldap_local_role'), 1); $role->addOption($local); include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php'; $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject'); $role_search->setSize(40); $local->addSubItem($role_search); $role->setInfo($this->lng->txt('ldap_role_name_info')); $this->form->addItem($role); // Update options $update = new ilNonEditableValueGUI($this->lng->txt('ldap_update_roles'), 'update_roles'); $update->setValue($this->lng->txt('ldap_check_role_assignment')); $add = new ilCheckboxInputGUI('', 'add_missing'); $add->setOptionTitle($this->lng->txt('ldap_add_missing')); $update->addSubItem($add); $remove = new ilCheckboxInputGUI('', 'remove_deprecated'); $remove->setOptionTitle($this->lng->txt('ldap_remove_deprecated')); $update->addSubItem($remove); $this->form->addItem($update); // Assignment Type $group = new ilRadioGroupInputGUI($this->lng->txt('ldap_assignment_type'), 'type'); #$group->setValue($current_rule->getType()); $group->setRequired(true); // Option by group $radio_group = new ilRadioOption($this->lng->txt('ldap_role_by_group'), ilLDAPRoleAssignmentRule::TYPE_GROUP); $dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'), 'dn'); #$dn->setValue($current_rule->getDN()); $dn->setSize(32); $dn->setMaxLength(512); $dn->setInfo($this->lng->txt('ldap_role_grp_dn_info')); $radio_group->addSubItem($dn); $at = new ilTextInputGUI($this->lng->txt('ldap_role_grp_at'), 'at'); #$at->setValue($current_rule->getMemberAttribute()); $at->setSize(16); $at->setMaxLength(128); $radio_group->addSubItem($at); $isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_role_grp_isdn'), 'isdn'); #$isdn->setChecked($current_rule->isMemberAttributeDN()); $isdn->setInfo($this->lng->txt('ldap_group_member_info')); $radio_group->addSubItem($isdn); $radio_group->setInfo($this->lng->txt('ldap_role_grp_info')); $group->addOption($radio_group); // Option by Attribute $radio_attribute = new ilRadioOption($this->lng->txt('ldap_role_by_attribute'), ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE); $name = new ilTextInputGUI($this->lng->txt('ldap_role_at_name'), 'name'); #$name->setValue($current_rule->getAttributeName()); $name->setSize(32); $name->setMaxLength(128); #$name->setInfo($this->lng->txt('ldap_role_at_name_info')); $radio_attribute->addSubItem($name); // Radio Attribute $val = new ilTextInputGUI($this->lng->txt('ldap_role_at_value'), 'value'); #$val->setValue($current_rule->getAttributeValue()); $val->setSize(32); $val->setMaxLength(128); #$val->setInfo($this->lng->txt('ldap_role_at_value_info')); $radio_attribute->addSubItem($val); $radio_attribute->setInfo($this->lng->txt('ldap_role_at_info')); $group->addOption($radio_attribute); // Option by Plugin $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins(); $pl = new ilRadioOption($this->lng->txt('ldap_plugin'), 3); $pl->setInfo($this->lng->txt('ldap_plugin_info')); $pl->setDisabled(!$pl_active); $id = new ilNumberInputGUI($this->lng->txt('ldap_plugin_id'), 'plugin_id'); $id->setDisabled(!$pl_active); $id->setSize(3); $id->setMaxLength(3); $id->setMaxValue(999); $id->setMinValue(1); $pl->addSubItem($id); $group->addOption($pl); $this->form->addItem($group); }
/** * Show lucene settings form * @param * @return */ protected function initFormLuceneSettings() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/Search/classes/class.ilSearchSettings.php'; $this->settings = ilSearchSettings::getInstance(); $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'cancel')); $this->form->setTitle($this->lng->txt('lucene_settings_title')); $this->form->addCommandButton('saveLuceneSettings', $this->lng->txt('save')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); // Offline filter /* $offline = new ilCheckboxInputGUI($this->lng->txt('lucene_offline_filter_setting'),'offline_filter'); $offline->setInfo($this->lng->txt('lucene_offline_filter_setting_info')); $offline->setValue(1); $offline->setChecked($this->settings->isLuceneOfflineFilterEnabled()); $this->form->addItem($offline); */ // user search $us = new ilCheckboxInputGUI($this->lng->txt('search_user_search_form'), 'user_search_enabled'); $us->setInfo($this->lng->txt('search_user_search_info_form')); $us->setValue(1); $us->setChecked($this->settings->isLuceneUserSearchEnabled()); $this->form->addItem($us); // Item filter $if = new ilCheckboxInputGUI($this->lng->txt('search_mime_filter_form'), 'mime_enabled'); $if->setValue(1); $if->setChecked($this->settings->isLuceneMimeFilterEnabled()); $if->setInfo($this->lng->txt('search_item_filter_form_info')); $this->form->addItem($if); $mimes = $this->settings->getLuceneMimeFilter(); foreach (ilSearchSettings::getLuceneMimeFilterDefinitions() as $mime => $def) { $ch = new ilCheckboxInputGUI($this->lng->txt($def['trans']), 'mime[' . $mime . ']'); if (isset($mimes[$mime]) and $mimes[$mime]) { $ch->setChecked(true); } $ch->setValue(1); $if->addSubItem($ch); } $prefix = new ilCheckboxInputGUI($this->lng->txt('lucene_prefix_wildcard'), 'prefix'); $prefix->setValue(1); $prefix->setInfo($this->lng->txt('lucene_prefix_wildcard_info')); $prefix->setChecked($this->settings->isPrefixWildcardQueryEnabled()); $this->form->addItem($prefix); $numFrag = new ilNumberInputGUI($this->lng->txt('lucene_num_fragments'), 'fragmentCount'); $numFrag->setRequired(true); $numFrag->setSize(2); $numFrag->setMaxLength(2); $numFrag->setMinValue(1); $numFrag->setMaxValue(10); $numFrag->setInfo($this->lng->txt('lucene_num_frag_info')); $numFrag->setValue($this->settings->getFragmentCount()); $this->form->addItem($numFrag); $sizeFrag = new ilNumberInputGUI($this->lng->txt('lucene_size_fragments'), 'fragmentSize'); $sizeFrag->setRequired(true); $sizeFrag->setSize(2); $sizeFrag->setMaxLength(4); $sizeFrag->setMinValue(10); $sizeFrag->setMaxValue(1000); $sizeFrag->setInfo($this->lng->txt('lucene_size_frag_info')); $sizeFrag->setValue($this->settings->getFragmentSize()); $this->form->addItem($sizeFrag); $maxSub = new ilNumberInputGUI($this->lng->txt('lucene_max_sub'), 'maxSubitems'); $maxSub->setRequired(true); $maxSub->setSize(2); $maxSub->setMaxLength(2); $maxSub->setMinValue(1); $maxSub->setMaxValue(10); $maxSub->setInfo($this->lng->txt('lucene_max_sub_info')); $maxSub->setValue($this->settings->getMaxSubitems()); $this->form->addItem($maxSub); $relevance = new ilCheckboxInputGUI($this->lng->txt('lucene_relevance'), 'relevance'); $relevance->setOptionTitle($this->lng->txt('lucene_show_relevance')); $relevance->setInfo($this->lng->txt('lucene_show_relevance_info')); $relevance->setValue(1); $relevance->setChecked($this->settings->isRelevanceVisible()); $this->form->addItem($relevance); // begin-patch mime_filter $subrel = new ilCheckboxInputGUI('', 'subrelevance'); $subrel->setOptionTitle($this->lng->txt('lucene_show_sub_relevance')); $subrel->setValue(1); $subrel->setChecked($this->settings->isSubRelevanceVisible()); $relevance->addSubItem($subrel); // end-patch mime_filter $last_index = new ilDateTimeInputGUI($this->lng->txt('lucene_last_index_time'), 'last_index'); $last_index->setShowTime(true); $last_index->setDate($this->settings->getLastIndexTime()); $last_index->setInfo($this->lng->txt('lucene_last_index_time_info')); $this->form->addItem($last_index); return true; }
/** * Creates an output of the edit form for the question * * @access public */ public 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("assfileupload"); $this->addBasicQuestionFormProperties($form); // maxsize $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize"); $maxsize->setValue($this->object->getMaxSize()); $maxsize->setInfo($this->lng->txt("maxsize_info")); $maxsize->setSize(10); $maxsize->setMinValue(0); //mbecker: Quick fix for mantis bug 8595: Change size file $umf = get_cfg_var("upload_max_filesize"); // get the value for the maximal post data from the php.ini (if available) $pms = get_cfg_var("post_max_size"); //convert from short-string representation to "real" bytes $multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024); $umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if (count($umf_parts) == 2) { $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]]; } if (count($pms_parts) == 2) { $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]]; } // use the smaller one as limit $max_filesize = min($umf, $pms); if (!$max_filesize) { $max_filesize = max($umf, $pms); } $maxsize->setMaxValue($max_filesize); // end quick fix $maxsize->setRequired(FALSE); $form->addItem($maxsize); // allowedextensions $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions"); $allowedextensions->setInfo($this->lng->txt("allowedextensions_info")); $allowedextensions->setValue($this->object->getAllowedExtensions()); $allowedextensions->setRequired(FALSE); $form->addItem($allowedextensions); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(false); $form->addItem($points); $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission'); $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info')); $subcompl->setValue(1); $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled()); $form->addItem($subcompl); $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $form->setValuesByPost(); $errors = !$form->checkInput(); $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; }
protected function initFormRoleAssignment($a_mode = 'default') { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'cancel')); $this->form->setTitle($this->lng->txt('shib_role_ass_table')); if ($a_mode == 'default') { $this->form->setTitle($this->lng->txt('shib_role_ass_table')); $this->form->addCommandButton('addRoleAssignmentRule', $this->lng->txt('shib_new_rule')); $this->form->addCommandButton('settings', $this->lng->txt('cancel')); } else { $this->form->setTitle($this->lng->txt('shib_update_role_ass_table')); $this->form->addCommandButton('updateRoleAssignmentRule', $this->lng->txt('save')); $this->form->addCommandButton('roleAssignment', $this->lng->txt('cancel')); } // Role selection $role = new ilRadioGroupInputGUI($this->lng->txt('shib_role_name'), 'role_name'); $role->setRequired(true); $global = new ilRadioOption($this->lng->txt('shib_global_role'), 0); $role->addOption($global); $role_select = new ilSelectInputGUI('', 'role_id'); $role_select->setOptions($this->prepareRoleSelect()); $global->addSubItem($role_select); $local = new ilRadioOption($this->lng->txt('shib_local_role'), 1); $role->addOption($local); include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php'; $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject'); $role_search->setSize(40); $local->addSubItem($role_search); include_once './Services/AccessControl/classes/class.ilRoleAutoComplete.php'; $role->setInfo($this->lng->txt('shib_role_name_info')); $this->form->addItem($role); // Update options $update = new ilNonEditableValueGUI($this->lng->txt('shib_update_roles'), 'update_roles'); $update->setValue($this->lng->txt('shib_check_role_assignment')); $add = new ilCheckboxInputGUI('', 'add_missing'); $add->setOptionTitle($this->lng->txt('shib_add_missing')); $add->setValue(1); $update->addSubItem($add); $remove = new ilCheckboxInputGUI('', 'remove_deprecated'); $remove->setOptionTitle($this->lng->txt('shib_remove_deprecated')); $remove->setValue(1); $update->addSubItem($remove); $this->form->addItem($update); // Assignment type $kind = new ilRadioGroupInputGUI($this->lng->txt('shib_assignment_type'), 'kind'); $kind->setValue(1); $kind->setRequired(true); $attr = new ilRadioOption($this->lng->txt('shib_attribute'), 1); $attr->setInfo($this->lng->txt('shib_attr_info')); $name = new ilTextInputGUI($this->lng->txt('shib_attribute_name'), 'attr_name'); $name->setSize(32); $attr->addSubItem($name); $value = new ilTextInputGUI($this->lng->txt('shib_attribute_value'), 'attr_value'); $value->setSize(32); $attr->addSubItem($value); $kind->addOption($attr); $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins(); $pl = new ilRadioOption($this->lng->txt('shib_plugin'), 2); $pl->setInfo($this->lng->txt('shib_plugin_info')); $pl->setDisabled(!$pl_active); $id = new ilNumberInputGUI($this->lng->txt('shib_plugin_id'), 'plugin_id'); $id->setDisabled(!$pl_active); $id->setSize(3); $id->setMaxLength(3); $id->setMaxValue(999); $id->setMinValue(1); $pl->addSubItem($id); $kind->addOption($pl); $this->form->addItem($kind); }
protected function initBookingNumbersForm(array $a_objects_counter, $a_group_id) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking")); $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects")); $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info")); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $section = false; foreach ($a_objects_counter as $id => $counter) { $id = explode("_", $id); $book_id = $id[0] . "_" . $id[1] . "_" . $id[2] . "_" . $counter; $obj = new ilBookingObject($id[0]); if (!$section) { $section = new ilFormSectionHeaderGUI(); $section->setTitle($obj->getTitle()); $form->addItem($section); $section = true; } $period = ilDatePresentation::formatPeriod(new ilDateTime($id[1], IL_CAL_UNIX), new ilDateTime($id[2], IL_CAL_UNIX)); $nr_field = new ilNumberInputGUI($period, "conf_nr__" . $book_id); $nr_field->setValue(1); $nr_field->setSize(3); $nr_field->setMaxValue($counter); $nr_field->setMinValue(1); $nr_field->setRequired(true); $form->addItem($nr_field); } if ($a_group_id) { $grp = new ilHiddenInputGUI("grp_id"); $grp->setValue($a_group_id); $form->addItem($grp); } $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm")); $form->addCommandButton("render", $this->lng->txt("cancel")); return $form; }
/** * Init settings form. * * @param int $a_mode Edit Mode */ public function initSettingsForm($a_mode = "edit") { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // online $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online"); $cb->setValue("y"); $this->form->addItem($cb); // glossary mode $options = array("none" => $this->lng->txt("glo_mode_normal"), "level" => $this->lng->txt("glo_mode_level"), "subtree" => $this->lng->txt("glo_mode_subtree")); $si = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode"); $si->setOptions($options); $si->setInfo($lng->txt("glo_mode_desc")); $this->form->addItem($si); // presentation mode $radg = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode"); $radg->setValue("table"); $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info")); // short text length $ni = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length"); $ni->setMaxValue(3000); $ni->setMinValue(100); $ni->setMaxLength(4); $ni->setSize(4); $ni->setInfo($lng->txt("glo_text_snippet_length_info")); $ni->setValue(200); $op1->addSubItem($ni); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info")); $radg->addOption($op2); $this->form->addItem($radg); // show taxonomy include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId()); if (count($tax_ids) > 0) { $cb = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax"); $this->form->addItem($cb); } // downloads $cb = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads"); $cb->setValue("y"); $cb->setInfo($lng->txt("cont_downloads_desc")); $this->form->addItem($cb); // save and cancel commands $this->form->addCommandButton("saveProperties", $lng->txt("save")); $this->form->setTitle($lng->txt("cont_glo_properties")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
function initAddCodesForm() { global $rbacreview, $ilObjDataCache, $lng; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes')); $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header')); $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number'); $count->setSize(4); $count->setMaxLength(4); $count->setMinValue(1); $count->setMaxValue(1000); $count->setRequired(true); $this->form_gui->addItem($count); $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('registration_codes_roles_title')); $this->form_gui->addItem($sec); include_once './Services/AccessControl/classes/class.ilObjRole.php'; $options = array("" => $this->lng->txt('registration_codes_no_assigned_role')); foreach ($rbacreview->getGlobalRoles() as $role_id) { if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) { $options[$role_id] = $ilObjDataCache->lookupTitle($role_id); } } $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role"); $roles->setInfo($this->lng->txt("registration_codes_override_info")); $roles->setOptions($options); $this->form_gui->addItem($roles); $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local"); $local->setMulti(true); $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true)); $this->form_gui->addItem($local); $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('reg_access_limitations')); $this->form_gui->addItem($sec); $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit"); $limit->setInfo($this->lng->txt("registration_codes_override_info")); $this->form_gui->addItem($limit); $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none"); $limit->addOption($opt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited"); $limit->addOption($opt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute"); $limit->addOption($opt); $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date"); $dt->setRequired(true); $opt->addSubItem($dt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative"); $limit->addOption($opt); $days = new ilTextInputGUI("", "rel_date[d]"); $days->setSize(5); $days->setSuffix($this->lng->txt("days")); $mon = new ilTextInputGUI("", "rel_date[m]"); $mon->setSize(5); $mon->setSuffix($this->lng->txt("months")); $yr = new ilTextInputGUI("", "rel_date[y]"); $yr->setSize(5); $yr->setSuffix($this->lng->txt("years")); // custom input won't reload if (is_array($_POST["rel_date"])) { $days->setValue($_POST["rel_date"]["d"]); $mon->setValue($_POST["rel_date"]["m"]); $yr->setValue($_POST["rel_date"]["y"]); } $dur = new ilCustomInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target")); $dur->setRequired(true); $dur->setHTML($days->getToolbarHTML() . " " . $mon->getToolbarHTML() . " " . $yr->getToolbarHTML()); $opt->addSubItem($dur); $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create')); }
/** * Show obligatory form * @return ilPropertyFormGUI */ protected function showObligatoryForm($opt = array()) { if (!$opt) { $opt = ilConditionHandler::getOptionalConditionsOfTarget($this->getTargetRefId(), $this->getTargetId(), $this->getTargetType()); } $all = ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(), $this->getTargetId()); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this), 'listConditions'); $form->setTitle($this->lng->txt('precondition_obligatory_settings')); $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save')); $hide = new ilCheckboxInputGUI($this->lng->txt('rbac_precondition_hide'), 'hidden'); $hide->setChecked(ilConditionHandler::lookupHiddenStatusByTarget($this->getTargetRefId())); $hide->setValue(1); $hide->setInfo($this->lng->txt('rbac_precondition_hide_info')); $form->addItem($hide); $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode"); $form->addItem($mode); $mode->setValue($_REQUEST["list_mode"]); $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all"); $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info")); $mode->addOption($mall); $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset"); $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info")); $mode->addOption($msubset); $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required'); $obl->setInfo($this->lng->txt('precondition_num_optional_info')); if (count($opt)) { $obligatory = ilConditionHandler::calculateRequiredTriggers($this->getTargetRefId(), $this->getTargetId(), $this->getTargetType()); $min = count($all) - count($opt) + 1; $max = count($all) - 1; } else { $obligatory = $min = $max = 1; } $obl->setValue($obligatory); $obl->setRequired(true); $obl->setSize(1); $obl->setMinValue($min); $obl->setMaxValue($max); $msubset->addSubItem($obl); $old_mode = new ilHiddenInputGUI("old_list_mode"); $old_mode->setValue($_REQUEST["list_mode"]); $form->addItem($old_mode); return $form; }
protected function initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload = false) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking")); $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects")); $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info")); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $section = false; $min_date = null; foreach ($a_objects_counter as $id => $counter) { $id = explode("_", $id); $book_id = $id[0] . "_" . $id[1] . "_" . $id[2] . "_" . $counter; $obj = new ilBookingObject($id[0]); if (!$section) { $section = new ilFormSectionHeaderGUI(); $section->setTitle($obj->getTitle()); $form->addItem($section); $section = true; } $period = ilDatePresentation::formatPeriod(new ilDateTime($id[1], IL_CAL_UNIX), new ilDateTime($id[2], IL_CAL_UNIX)); $nr_field = new ilNumberInputGUI($period, "conf_nr__" . $book_id); $nr_field->setValue(1); $nr_field->setSize(3); $nr_field->setMaxValue($counter); $nr_field->setMinValue($counter ? 1 : 0); $nr_field->setRequired(true); $form->addItem($nr_field); if (!$min_date || $id[1] < $min_date) { $min_date = $id[1]; } } // recurrence $this->lng->loadLanguageModule("dateplaner"); $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm"); $rec_mode->setRequired(true); $rec_mode->setOptions(array("-1" => $this->lng->txt("cal_no_recurrence"), 1 => $this->lng->txt("cal_weekly"), 2 => $this->lng->txt("r_14"), 4 => $this->lng->txt("r_4_weeks"))); $form->addItem($rec_mode); $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece"); $rec_mode->addSubItem($rec_end); if (!$a_reload) { // show date only if active recurrence $rec_mode->setHideSubForm(true, '>= 1'); if ($min_date) { $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX)); } } else { // recurrence may not be changed on reload $rec_mode->setDisabled(true); $rec_end->setDisabled(true); } if ($a_group_id) { $grp = new ilHiddenInputGUI("grp_id"); $grp->setValue($a_group_id); $form->addItem($grp); } $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm")); $form->addCommandButton("render", $this->lng->txt("cancel")); return $form; }
/** * Init cas settings */ protected function initFormSettings() { $this->lng->loadLanguageModule('auth'); $this->lng->loadLanguageModule('radius'); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('auth_cas_auth')); $form->setDescription($this->lng->txt("auth_cas_auth_desc")); // Form checkbox $check = new ilCheckboxInputGUI($this->lng->txt("active"), 'active'); $check->setChecked($this->getSettings()->isActive() ? true : false); $check->setValue(1); $form->addItem($check); $text = new ilTextInputGUI($this->lng->txt('server'), 'server'); $text->setValue($this->getSettings()->getServer()); $text->setRequired(true); $text->setInfo($this->lng->txt('auth_cas_server_desc')); $text->setSize(64); $text->setMaxLength(255); $form->addItem($text); $port = new ilNumberInputGUI($this->lng->txt("port"), 'port'); $port->setValue($this->getSettings()->getPort()); $port->setRequired(true); $port->setMinValue(0); $port->setMaxValue(65535); $port->setSize(5); $port->setMaxLength(5); $port->setInfo($this->lng->txt('auth_cas_port_desc')); $form->addItem($port); $text = new ilTextInputGUI($this->lng->txt('uri'), 'uri'); $text->setValue($this->getSettings()->getUri()); $text->setRequired(true); $text->setInfo($this->lng->txt('auth_cas_uri_desc')); $text->setSize(64); $text->setMaxLength(255); $form->addItem($text); // User synchronization // 0: Disabled // 1: CAS // 2: LDAP $sync = new ilRadioGroupInputGUI($this->lng->txt('auth_sync'), 'sync'); $sync->setRequired(true); #$sync->setInfo($this->lng->txt('auth_radius_sync_info')); $form->addItem($sync); // Disabled $dis = new ilRadioOption($this->lng->txt('disabled'), self::SYNC_DISABLED, ''); #$dis->setInfo($this->lng->txt('auth_radius_sync_disabled_info')); $sync->addOption($dis); // CAS $rad = new ilRadioOption($this->lng->txt('auth_sync_cas'), self::SYNC_CAS, ''); $rad->setInfo($this->lng->txt('auth_sync_cas_info')); $sync->addOption($rad); $select = new ilSelectInputGUI($this->lng->txt('auth_user_default_role'), 'role'); $select->setOptions($this->prepareRoleSelection()); $select->setValue($this->getSettings()->getDefaultRole()); $rad->addSubItem($select); // LDAP include_once './Services/LDAP/classes/class.ilLDAPServer.php'; $server_ids = ilLDAPServer::getAvailableDataSources(AUTH_CAS); if (count($server_ids)) { $ldap = new ilRadioOption($this->lng->txt('auth_radius_ldap'), self::SYNC_LDAP, ''); $ldap->setInfo($this->lng->txt('auth_radius_ldap_info')); $sync->addOption($ldap); // TODO Handle more than one LDAP configuration } if (ilLDAPServer::isDataSourceActive(AUTH_CAS)) { $sync->setValue(self::SYNC_LDAP); } else { $sync->setValue($this->getSettings()->isUserCreationEnabled() ? ilCASSettings::SYNC_CAS : ilCASSettings::SYNC_DISABLED); } $instruction = new ilTextAreaInputGUI($this->lng->txt('auth_login_instructions'), 'instruction'); $instruction->setCols(80); $instruction->setRows(6); $instruction->setValue($this->getSettings()->getLoginInstruction()); $form->addItem($instruction); $create = new ilCheckboxInputGUI($this->lng->txt('auth_allow_local'), 'local'); $create->setInfo($this->lng->txt('auth_cas_allow_local_desc')); $create->setChecked($this->getSettings()->isLocalAuthenticationEnabled() ? true : false); $create->setValue(1); $form->addItem($create); $form->addCommandButton('save', $this->lng->txt('save')); return $form; }
/** * Show Privacy settings * * @access public */ public function showPrivacy() { $privacy = ilPrivacySettings::_getInstance(); $this->tabs_gui->setTabActive('show_privacy'); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('ps_privacy_protection')); include_once 'Services/Membership/classes/class.ilMemberAgreement.php'; if (ilMemberAgreement::_hasAgreements()) { $html = new ilNonEditableValueGUI(); $html->setValue($this->lng->txt('ps_warning_modify')); $form->addItem($html); } $value = array(); if ($privacy->enabledCourseExport()) { $value[] = "export_course"; } if ($privacy->enabledGroupExport()) { $value[] = "export_group"; } if ($privacy->courseConfirmationRequired()) { $value[] = "export_confirm_course"; } if ($privacy->groupConfirmationRequired()) { $value[] = "export_confirm_group"; } if ($privacy->enabledGroupAccessTimes()) { $value[] = "grp_access_times"; } if ($privacy->enabledCourseAccessTimes()) { $value[] = "crs_access_times"; } $group = new ilCheckboxGroupInputGUI($this->lng->txt('ps_profile_export'), 'profile_protection'); $group->setValue($value); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_export_course')); $check->setValue('export_course'); $group->addOption($check); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_export_groups')); $check->setValue('export_group'); $group->addOption($check); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_export_confirm')); $check->setValue('export_confirm_course'); $group->addOption($check); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_export_confirm_group')); $check->setValue('export_confirm_group'); $group->addOption($check); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_show_grp_access')); $check->setValue('grp_access_times'); $group->addOption($check); $check = new ilCheckboxOption(); $check->setTitle($this->lng->txt('ps_show_crs_access')); $check->setValue('crs_access_times'); $group->addOption($check); $form->addItem($group); $check = new ilCheckboxInputGui($this->lng->txt('enable_fora_statistics'), 'fora_statistics'); $check->setInfo($this->lng->txt('enable_fora_statistics_desc')); $check->setChecked($privacy->enabledForaStatistics()); $form->addItem($check); $check = new ilCheckboxInputGui($this->lng->txt('enable_anonymous_fora'), 'anonymous_fora'); $check->setInfo($this->lng->txt('enable_anonymous_fora_desc')); $check->setChecked($privacy->enabledAnonymousFora()); $form->addItem($check); $check = new ilCheckboxInputGui($this->lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd'); $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc')); $check->setChecked($privacy->enabledSahsProtocolData()); $form->addItem($check); $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('save_privacy', $this->lng->txt('save')); $this->tpl->setContent($form->getHTML()); }
/** * @param array $row */ public function fillRow(array $row) { $short_name = new ilTextInputGUI('', 'mark_short_' . $row['mark_id']); $short_name->setValue($row['mark_short']); $short_name->setDisabled(!$this->is_editable); $short_name->setSize(10); $official_name = new ilTextInputGUI('', 'mark_official_' . $row['mark_id']); $official_name->setSize(20); $official_name->setDisabled(!$this->object->canEditMarks()); $official_name->setValue($row['mark_official']); $percentage = new ilNumberInputGUI('', 'mark_percentage_' . $row['mark_id']); $percentage->allowDecimals(true); $percentage->setValue($row['mark_percentage']); $percentage->setSize(10); $percentage->setDisabled(!$this->is_editable); $percentage->setMinValue(0); $percentage->setMaxValue(100); $this->tpl->setVariable('VAL_MARK_ID', $row['mark_id']); $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'marks[]', $row['mark_id'], !$this->is_editable)); $this->tpl->setVariable('VAL_SHORT_NAME', $short_name->render()); $this->tpl->setVariable('VAL_OFFICIAL_NAME', $official_name->render()); $this->tpl->setVariable('VAL_PERCENTAGE', $percentage->render()); $this->tpl->setVariable('VAL_PASSED_CHECKBOX', ilUtil::formCheckbox((bool) $row['mark_passed'], 'passed_' . $row['mark_id'], '1', !$this->is_editable)); }
/** * Init settings form */ protected function initSettingsForm() { global $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($GLOBALS['lng']->txt('settings')); $form->addCommandButton('update', $GLOBALS['lng']->txt('save')); $form->addCommandButton('settings', $GLOBALS['lng']->txt('cancel')); // activation $active = new ilCheckboxInputGUI($GLOBALS['lng']->txt('fm_settings_active'), 'active'); $active->setInfo($GLOBALS['lng']->txt('fm_settings_active_info')); $active->setValue(1); $active->setChecked(ilFMSettings::getInstance()->isEnabled()); $form->addItem($active); // one frame $local = new ilCheckboxInputGUI($GLOBALS['lng']->txt('fm_settings_local'), 'local'); $local->setInfo($GLOBALS['lng']->txt('fm_settings_local_info')); $local->setValue(1); $local->setChecked(ilFMSettings::getInstance()->IsLocalFSEnabled()); $form->addItem($local); $fs = new ilNumberInputGUI($GLOBALS['lng']->txt('fm_settings_filesize'), 'filesize'); $fs->setSuffix('MiB'); $fs->setSize(3); $fs->setMaxLength(3); $fs->setMinValue(1); $fs->setMaxValue(999); $fs->setInfo($GLOBALS['lng']->txt('fm_settings_filesize_info')); $fs->setValue(ilFMSettings::getInstance()->getMaxFileSize()); $form->addItem($fs); return $form; }
/** * Add input elements to definition form * * @param ilPropertyFormGUI $a_form * @param bool $a_disabled */ public function addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled = false) { global $lng; $max = new ilNumberInputGUI($lng->txt("md_adv_text_max_length"), "max"); $max->setValue($this->getMaxLength()); $max->setSize(10); $max->setMinValue(1); $max->setMaxValue(4000); // DB limit $a_form->addItem($max); $multi = new ilCheckboxInputGUI($lng->txt("md_adv_text_multi"), "multi"); $multi->setValue(1); $multi->setChecked($this->isMulti()); $a_form->addItem($multi); if ($a_disabled) { $max->setDisabled(true); $multi->setDisabled(true); } }
protected function initSettingsForm() { global $rbacsystem; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('tracking_settings')); $activate = new ilCheckboxGroupInputGUI($this->lng->txt('activate_tracking')); $form->addItem($activate); // learning progress $lp = new ilCheckboxInputGUI($this->lng->txt('trac_learning_progress'), 'learning_progress_tracking'); if ($this->object->enabledLearningProgress()) { $lp->setChecked(true); } $activate->addSubItem($lp); // lp settings /* $desktop = new ilCheckboxInputGUI($this->lng->txt('trac_lp_on_personal_desktop'), 'lp_desktop'); $desktop->setInfo($this->lng->txt('trac_lp_on_personal_desktop_info')); $desktop->setChecked($this->object->hasLearningProgressDesktop()); $lp->addSubItem($desktop); */ $learner = new ilCheckboxInputGUI($this->lng->txt('trac_lp_learner_access'), 'lp_learner'); $learner->setInfo($this->lng->txt('trac_lp_learner_access_info')); $learner->setChecked($this->object->hasLearningProgressLearner()); $lp->addSubItem($learner); // extended data $extdata = new ilCheckboxGroupInputGUI($this->lng->txt('trac_learning_progress_settings_info'), 'lp_extdata'); $extdata->addOption(new ilCheckboxOption($this->lng->txt('trac_first_and_last_access'), 'lp_access')); $extdata->addOption(new ilCheckboxOption($this->lng->txt('trac_read_count'), 'lp_count')); $extdata->addOption(new ilCheckboxOption($this->lng->txt('trac_spent_seconds'), 'lp_spent')); $lp->addSubItem($extdata); $ext_value = array(); if ($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) { $ext_value[] = 'lp_access'; } if ($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) { $ext_value[] = 'lp_count'; } if ($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) { $ext_value[] = 'lp_spent'; } $extdata->setValue($ext_value); $listgui = new ilCheckboxInputGUI($this->lng->txt('trac_lp_list_gui'), 'lp_list'); $listgui->setInfo($this->lng->txt('trac_lp_list_gui_info')); $listgui->setChecked($this->object->hasLearningProgressListGUI()); $lp->addSubItem($listgui); /* => REPOSITORY // change event $event = new ilCheckboxInputGUI($this->lng->txt('trac_repository_changes'), 'change_event_tracking'); if($this->object->enabledChangeEventTracking()) { $event->setChecked(true); } $activate->addSubItem($event); */ // object statistics $objstat = new ilCheckboxInputGUI($this->lng->txt('trac_object_statistics'), 'object_statistics'); if ($this->object->enabledObjectStatistics()) { $objstat->setChecked(true); } $activate->addSubItem($objstat); // session statistics $sessstat = new ilCheckboxInputGUI($this->lng->txt('session_statistics'), 'session_statistics'); if ($this->object->enabledSessionStatistics()) { $sessstat->setChecked(true); } $activate->addSubItem($sessstat); // Anonymized $user = new ilCheckboxInputGUI($this->lng->txt('trac_anonymized'), 'user_related'); $user->setInfo($this->lng->txt('trac_anonymized_info')); $user->setChecked(!$this->object->enabledUserRelatedData()); $form->addItem($user); // Max time gap $valid = new ilNumberInputGUI($this->lng->txt('trac_valid_request'), 'valid_request'); $valid->setMaxLength(4); $valid->setSize(4); $valid->setSuffix($this->lng->txt('seconds')); $valid->setInfo($this->lng->txt('info_valid_request')); $valid->setValue($this->object->getValidTimeSpan()); $valid->setMinValue(1); $valid->setMaxValue(9999); $valid->setRequired(true); $form->addItem($valid); include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php"; ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_LP, $form, $this); // #12259 if ($rbacsystem->checkAccess("write", $this->object->getRefId())) { $form->addCommandButton('saveSettings', $this->lng->txt('save')); } else { $lp->setDisabled(true); $learner->setDisabled(true); $extdata->setDisabled(true); $listgui->setDisabled(true); $objstat->setDisabled(true); $user->setDisabled(true); $valid->setDisabled(true); } return $form; }
/** * Initializes the preview settings form. */ private function initPreviewSettingsForm() { global $ilCtrl, $lng; require_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("settings")); require_once "Services/Preview/classes/class.ilPreviewSettings.php"; // drag and drop file upload in repository $chk_prop = new ilCheckboxInputGUI($lng->txt("enable_preview"), "enable_preview"); $chk_prop->setValue('1'); $chk_prop->setChecked(ilPreviewSettings::isPreviewEnabled()); $chk_prop->setInfo($lng->txt('enable_preview_info')); $form->addItem($chk_prop); $num_prop = new ilNumberInputGUI($lng->txt("max_previews_per_object"), "max_previews_per_object"); $num_prop->setDecimals(0); $num_prop->setMinValue(1); $num_prop->setMinvalueShouldBeGreater(false); $num_prop->setMaxValue(ilPreviewSettings::MAX_PREVIEWS_MAX); $num_prop->setMaxvalueShouldBeLess(false); $num_prop->setMaxLength(5); $num_prop->setSize(10); $num_prop->setValue(ilPreviewSettings::getMaximumPreviews()); $num_prop->setInfo($lng->txt('max_previews_per_object_info')); $form->addItem($num_prop); // command buttons $form->addCommandButton('savePreviewSettings', $lng->txt('save')); $form->addCommandButton('view', $lng->txt('cancel')); return $form; }
protected function initEditCustomForm(ilPropertyFormGUI $a_form) { $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online"); $a_form->addItem($online); $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype"); $type->setRequired(true); $a_form->addItem($type); $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE); $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info")); $type->addOption($fixed); $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE); $none->setInfo($this->lng->txt("book_schedule_type_none_info")); $type->addOption($none); $slots = new ilNumberInputGUI($this->lng->txt("book_slots_no"), "slots"); $slots->setRequired(true); $slots->setSize(4); $slots->setMinValue(1); $slots->setMaxValue(24); $slots->setInfo($this->lng->txt("book_slots_no_info")); $fixed->addSubItem($slots); $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public"); $public->setInfo($this->lng->txt("book_public_log_info")); $a_form->addItem($public); }
/** * Init Settings Form */ function initSettingsForm() { global $tpl, $lng, $ilCtrl; $lng->loadLanguageModule("mcst"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setTitle($lng->txt("mcst_settings")); // Title $tit = new ilTextInputGUI($lng->txt("title"), "title"); $tit->setValue($this->object->getTitle()); $tit->setRequired(true); $this->form_gui->addItem($tit); // description $des = new ilTextAreaInputGUI($lng->txt("description"), "description"); $des->setValue($this->object->getLongDescription()); $this->form_gui->addItem($des); // Online $online = new ilCheckboxInputGUI($lng->txt("online"), "online"); $online->setChecked($this->object->getOnline()); $this->form_gui->addItem($online); // Sorting $sort = new ilRadioGroupInputGUI($lng->txt("mcst_ordering"), "order"); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_title"), ilObjMediaCast::ORDER_TITLE)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_asc"), ilObjMediaCast::ORDER_CREATION_DATE_ASC)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_desc"), ilObjMediaCast::ORDER_CREATION_DATE_DESC)); $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_manual"), ilObjMediaCast::ORDER_MANUAL)); $sort->setValue($this->object->getOrder()); $this->form_gui->addItem($sort); // view mode $options = array(ilObjMediaCast::VIEW_LIST => $lng->txt("mcst_list"), ilObjMediaCast::VIEW_GALLERY => $lng->txt("mcst_gallery")); $si = new ilSelectInputGUI($this->lng->txt("mcst_viewmode"), "viewmode"); $si->setOptions($options); $si->setValue($this->object->getViewMode()); $this->form_gui->addItem($si); // Downloadable $downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable"); $downloadable->setChecked($this->object->getDownloadable()); $downloadable->setInfo($lng->txt("mcst_downloadable_info")); $this->form_gui->addItem($downloadable); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); //Default Visibility if ($enable_internal_rss) { $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue($this->object->getDefaultAccess()); #$ch->addSubItem($radio_group); $this->form_gui->addItem($radio_group); //Extra Feed include_once "./Services/Block/classes/class.ilBlockSetting.php"; $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId()); $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed"); $ch->setInfo($lng->txt("news_public_feed_info")); $ch->setChecked($public_feed); $this->form_gui->addItem($ch); // keep minimal x number of items $ni = new ilNumberInputGUI($this->lng->txt("news_keep_minimal_x_items"), "keep_rss_min"); $ni->setMaxValue(100); $ni->setMinValue(0); $ni->setMaxLength(3); $ni->setSize(3); $ni->setInfo($this->lng->txt("news_keep_minimal_x_items_info") . " (" . ilNewsItem::_lookupRSSPeriod() . " " . (ilNewsItem::_lookupRSSPeriod() == 1 ? $lng->txt("day") : $lng->txt("days")) . ")"); $ni->setValue((int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->object->getId())); $ch->addSubItem($ni); // Include Files in Pubic Items $incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files"); $incl_files->setChecked($this->object->getPublicFiles()); $incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info")); #$ch->addSubItem($incl_files); $this->form_gui->addItem($incl_files); } // Form action and save button $this->form_gui->addCommandButton("saveSettings", $lng->txt("save")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings")); }
/** * Init settings form. * * @param int $a_mode Edit Mode */ public function initSettingsForm($a_mode = "edit") { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // title $title = new ilTextInputGUI($lng->txt("title"), "title"); $title->setRequired(true); $this->form->addItem($title); // description $desc = new ilTextAreaInputGUI($lng->txt("desc"), "description"); $this->form->addItem($desc); $lng->loadLanguageModule("rep"); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $this->form->addItem($section); // online $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online"); $online->setValue("y"); $online->setInfo($lng->txt("glo_online_info")); $this->form->addItem($online); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('glo_content_settings')); $this->form->addItem($section); // glossary mode $glo_mode = new ilRadioGroupInputGUI($lng->txt("glo_mode"), "glo_mode"); //$glo_mode->setInfo($lng->txt("glo_mode_desc")); $op1 = new ilRadioOption($lng->txt("glo_mode_normal"), "none", $lng->txt("glo_mode_normal_info")); $glo_mode->addOption($op1); $op2 = new ilRadioOption($lng->txt("glo_mode_level"), "level", $lng->txt("glo_mode_level_info")); $glo_mode->addOption($op2); $op3 = new ilRadioOption($lng->txt("glo_mode_subtree"), "subtree", $lng->txt("glo_mode_subtree_info")); $glo_mode->addOption($op3); $this->form->addItem($glo_mode); // glossary mode /*$options = array( "none"=>$this->lng->txt("glo_mode_normal"), "level"=>$this->lng->txt("glo_mode_level"), "subtree"=>$this->lng->txt("glo_mode_subtree") ); $glo_mode = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode"); $glo_mode->setOptions($options); $glo_mode->setInfo($lng->txt("glo_mode_desc")); $this->form->addItem($glo_mode);*/ $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('cont_presentation')); $this->form->addItem($section); // presentation mode $pres_mode = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode"); $pres_mode->setValue("table"); $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info")); // short text length $snl = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length"); $snl->setMaxValue(3000); $snl->setMinValue(100); $snl->setMaxLength(4); $snl->setSize(4); $snl->setInfo($lng->txt("glo_text_snippet_length_info")); $snl->setValue(200); $op1->addSubItem($snl); $pres_mode->addOption($op1); $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info")); $pres_mode->addOption($op2); $this->form->addItem($pres_mode); // show taxonomy include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId()); if (count($tax_ids) > 0) { $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax"); $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info")); $this->form->addItem($show_tax); } // downloads $down = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads"); $down->setValue("y"); $down->setInfo($lng->txt("cont_downloads_desc")); $this->form->addItem($down); if ($a_mode == "edit") { $title->setValue($this->object->getTitle()); $desc->setValue($this->object->getDescription()); $online->setChecked($this->object->getOnline()); $glo_mode->setValue($this->object->getVirtualMode()); $pres_mode->setValue($this->object->getPresentationMode()); $snl->setValue($this->object->getSnippetLength()); if (count($tax_ids) > 0) { $show_tax->setChecked($this->object->getShowTaxonomy()); } $down->setChecked($this->object->isActiveDownloads()); } // advanced metadata include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php'; $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION, 'glo', $this->object->getId(), "term"); $record_gui->setPropertyForm($this->form); $record_gui->parseRecordSelection($this->lng->txt("glo_add_term_properties")); // sort columns, if adv fields are given include_once "./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php"; $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId()); $cols = $adv_ap->getColumnOrder(); if (count($cols) > 1) { include_once './Modules/Glossary/classes/class.ilGloAdvColSortInputGUI.php'; $ti = new ilGloAdvColSortInputGUI($lng->txt("cont_col_ordering"), "field_order"); $this->form->addItem($ti); $ti->setValue($cols); } // save and cancel commands $this->form->addCommandButton("saveProperties", $lng->txt("save")); $this->form->setTitle($lng->txt("cont_glo_properties")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
/** * Init table template generation form */ function initTemplateGenerationForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setTitle($lng->txt("sty_generate_template")); // name $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name"); $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*\$/"); $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9"); $name_input->setRequired(true); $name_input->setSize(30); $name_input->setMaxLength(30); $this->form_gui->addItem($name_input); // basic layout $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout"); $options = array("coloredZebra" => $lng->txt("sty_table_template_colored_zebra"), "bwZebra" => $lng->txt("sty_table_template_bw_zebra"), "noZebra" => $lng->txt("sty_table_template_no_zebra")); $bl_input->setOptions($options); $this->form_gui->addItem($bl_input); // top bottom padding include_once "./Services/Style/classes/class.ilNumericStyleValueInputGUI.php"; $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding"); $num_input->setAllowPercentage(false); $num_input->setValue("3px"); $this->form_gui->addItem($num_input); // left right padding $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding"); $num_input->setAllowPercentage(false); $num_input->setValue("10px"); $this->form_gui->addItem($num_input); // base color $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color"); $cs = $this->object->getColors(); $options = array(); foreach ($cs as $c) { $options[$c["name"]] = $c["name"]; } $bc_input->setOptions($options); $this->form_gui->addItem($bc_input); // Lightness Settings $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0, "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75); foreach ($lss as $ls => $v) { $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_" . $ls), "lightness_" . $ls); $l_input->setMaxValue(100); $l_input->setMinValue(-100); $l_input->setValue($v); $l_input->setSize(4); $l_input->setMaxLength(4); $this->form_gui->addItem($l_input); } $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate")); $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); }
/** * 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)); }
protected function initJavaServerIniForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $GLOBALS['lng']->loadLanguageModule('search'); $this->form->setTitle($this->lng->txt('lucene_tbl_create_ini')); $this->form->setFormAction($this->ctrl->getFormAction($this, 'createJavaServerIni')); $this->form->addCommandButton('downloadJavaServerIni', $this->lng->txt('lucene_download_ini')); $this->form->addCommandButton('showJavaServer', $this->lng->txt('cancel')); // Host $ip = new ilTextInputGUI($this->lng->txt('lucene_host'), 'ho'); $ip->setInfo($this->lng->txt('lucene_host_info')); $ip->setMaxLength(128); $ip->setSize(32); $ip->setRequired(true); $this->form->addItem($ip); // Port $port = new ilNumberInputGUI($this->lng->txt('lucene_port'), 'po'); $port->setSize(5); $port->setMinValue(1); $port->setMaxValue(65535); $port->setRequired(true); $this->form->addItem($port); // Index Path $path = new ilTextInputGUI($this->lng->txt('lucene_index_path'), 'in'); $path->setSize(80); $path->setMaxLength(1024); $path->setInfo($this->lng->txt('lucene_index_path_info')); $path->setRequired(true); $this->form->addItem($path); // Logging $log = new ilTextInputGUI($this->lng->txt('lucene_log'), 'lo'); $log->setSize(80); $log->setMaxLength(1024); $log->setInfo($this->lng->txt('lucene_log_info')); $log->setRequired(true); $this->form->addItem($log); // Level $lev = new ilSelectInputGUI($this->lng->txt('lucene_level'), 'le'); $lev->setOptions(array('DEBUG' => 'DEBUG', 'INFO' => 'INFO', 'WARN' => 'WARN', 'ERROR' => 'ERROR', 'FATAL' => 'FATAL')); $lev->setValue('INFO'); $lev->setRequired(true); $this->form->addItem($lev); // CPU $cpu = new ilNumberInputGUI($this->lng->txt('lucene_cpu'), 'cp'); $cpu->setValue(1); $cpu->setSize(1); $cpu->setMaxLength(2); $cpu->setMinValue(1); $cpu->setRequired(true); $this->form->addItem($cpu); // Max file size $fs = new ilNumberInputGUI($this->lng->txt('lucene_max_fs'), 'fs'); $fs->setInfo($this->lng->txt('lucene_max_fs_info')); $fs->setValue(500); $fs->setSize(4); $fs->setMaxLength(4); $fs->setMinValue(1); $fs->setRequired(true); $this->form->addItem($fs); return true; }
/** * initEditCustomForm * * @param string $a_mode values: create | edit */ public function initForm($a_mode = "create") { global $ilCtrl, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); if ($a_mode == "edit") { $this->form->setTitle($lng->txt('dcl_edit_field')); $hidden_prop = new ilHiddenInputGUI("field_id"); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "update"); $this->form->addCommandButton('update', $lng->txt('dcl_update_field')); } else { $this->form->setTitle($lng->txt('dcl_new_field')); $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->field_obj->getTableId()); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "save"); $this->form->addCommandButton('save', $lng->txt('dcl_create_field')); } $this->form->addCommandButton('cancel', $lng->txt('cancel')); $text_prop = new ilTextInputGUI($lng->txt("title"), "title"); $text_prop->setRequired(true); $text_prop->setInfo(sprintf($lng->txt('fieldtitle_allow_chars'), ilDataCollectionField::_getTitleValidChars(false))); $text_prop->setValidationRegexp(ilDataCollectionField::_getTitleValidChars(true)); $this->form->addItem($text_prop); $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype'); foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) { $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']); foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) { //Type Reference: List Tabels if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) { $options = array(); // Get Tables require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php"; $tables = $this->parent_obj->getDataCollectionObject()->getTables(); foreach ($tables as $table) { foreach ($table->getRecordFields() as $field) { //referencing references may lead to endless loops. if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle(); } } } $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']); $table_selection->setOptions($options); //$table_selection->setValue($this->table_id); $opt->addSubItem($table_selection); } elseif ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST and $property['id'] == ilDataCollectionField::PROPERTYID_N_REFERENCE) { // Get Tables require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php"; $tables = $this->parent_obj->getDataCollectionObject()->getTables(); foreach ($tables as $table) { foreach ($table->getRecordFields() as $field) { //referencing references may lead to endless loops. if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST) { $options[$field->getId()] = $table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle(); } } } $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']); $table_selection->setOptions($options); $opt->addSubItem($table_selection); } elseif ($property['id'] == ilDataCollectionField::PROPERTYID_FORMULA_EXPRESSION) { $table = ilDataCollectionCache::getTableCache((int) $_GET['table_id']); $fields = array(); foreach ($table->getFieldsForFormula() as $f) { $placeholder = $f->isStandardField() ? $f->getId() : $f->getTitle(); $fields[] = '<a class="dclPropExpressionField" data-placeholder="' . $placeholder . '">' . $f->getTitle() . '</a>'; } $subitem = new ilTextAreaInputGUI($lng->txt('dcl_prop_expression'), 'prop_' . $property['id']); $operators = implode(', ', array_keys(ilDclExpressionParser::getOperators())); $functions = implode(', ', ilDclExpressionParser::getFunctions()); $subitem->setInfo(sprintf($lng->txt('dcl_prop_expression_info'), $operators, $functions, implode('<br>', $fields))); $opt->addSubItem($subitem); } elseif ($property['datatype_id'] == $datatype['id']) { //All other Types: List properties saved in propertie definition table if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) { $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); $opt->addSubItem($subitem); } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NUMBER) { $subitem = new ilNumberInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); // TODO: Nicer way to add additional info to fields (need changes in language-logic) /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') { $subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info')); }*/ $subitem->setSize(5); if ($property['title'] == 'length') { $subitem->setMaxValue(4000); $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info')); } $opt->addSubItem($subitem); } elseif ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_NON_EDITABLE_VALUE) { $subitem = new ilNonEditableValueGUI($lng->txt('dcl_' . $property['title'])); $subitem->setValue(implode(', ', ilDataCollectionDatatype::$mob_suffixes)); $opt->addSubItem($subitem); } else { $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); // TODO: Nicer way to add additional info to fields (need changes in language-logic) /*if($lng->txt('dcl_'.$property['title'].'_info') != '-dcl_'.$property['title'].'_info-') { $subitem->setInfo($lng->txt('dcl_'.$property['title'].'_info')); }*/ if ($property['title'] == 'regex') { $subitem->setInfo($lng->txt('dcl_' . $property['title'] . '_info')); } $opt->addSubItem($subitem); } } } $edit_datatype->addOption($opt); } $edit_datatype->setRequired(true); //you can't change type but we still need it in POST if ($a_mode == "edit") { $edit_datatype->setDisabled(true); } $this->form->addItem($edit_datatype); // Description $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description"); $this->form->addItem($text_prop); // Required $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required"); $this->form->addItem($cb); //Unique $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique"); $this->form->addItem($cb); }
public function generalSettingsObject() { global $rbacsystem, $ilSetting; /** * @var $this->object ilObject */ // MINIMUM ACCESS LEVEL = 'read' if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) { $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $genSet = ilPaymentSettings::_getInstance(); $genSetData = $genSet->getAll(); $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings')); $form->setTitle($this->lng->txt('pays_general_settings')); $form->addCommandButton('saveGeneralSettings', $this->lng->txt('save')); // enable webshop $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_enable_shop'), 'shop_enabled'); $formItem->setChecked((int) $genSetData['shop_enabled']); $formItem->setInfo($this->lng->txt('pay_enable_shop_info')); $form->addItem($formItem); $formItem = new ilTextInputGUI($this->lng->txt('pays_currency_unit'), 'currency_unit'); $formItem->setSize(5); $formItem->setValue($this->error != '' && isset($_POST['currency_unit']) ? ilUtil::prepareFormOutput($_POST['currency_unit'], true) : ilUtil::prepareFormOutput($genSetData['currency_unit'], true)); $formItem->setRequired(true); $form->addItem($formItem); $formItem = new ilTextAreaInputGUI($this->lng->txt('pays_address'), 'address'); $formItem->setRows(7); $formItem->setCols(35); $formItem->setRequired(true); $formItem->setValue($this->error != '' && isset($_POST['address']) ? ilUtil::prepareFormOutput($_POST['address'], true) : $genSetData['address']); $form->addItem($formItem); $formItem = new ilTextAreaInputGUI($this->lng->txt('pays_bank_data'), 'bank_data'); $formItem->setRows(7); $formItem->setCols(35); $formItem->setRequired(true); $formItem->setValue($this->error != '' && isset($_POST['bank_data']) ? ilUtil::prepareFormOutput($_POST['bank_data'], true) : $genSetData['bank_data']); $form->addItem($formItem); $formItem = new ilTextAreaInputGUI($this->lng->txt('pays_add_info'), 'add_info'); $formItem->setRows(7); $formItem->setCols(35); $formItem->setValue($this->error != '' && isset($_POST['add_info']) ? ilUtil::prepareFormOutput($_POST['add_info'], true) : $genSetData['add_info']); $form->addItem($formItem); $formItem = new ilTextInputGUI($this->lng->txt('pays_pdf_path'), 'pdf_path'); $formItem->setValue($this->error != "" && isset($_POST['pdf_path']) ? ilUtil::prepareFormOutput($_POST['pdf_path'], true) : ilUtil::prepareFormOutput($genSetData['pdf_path'], true)); $formItem->setRequired(true); $form->addItem($formItem); // max hits $formItem = new ilSelectInputGUI($this->lng->txt('pay_max_hits'), 'max_hits'); $formItem->setValue($genSetData['max_hits']); $options = array(); for ($i = 10; $i <= 100; $i += 10) { $options[$i] = $i; } $formItem->setOptions($options); $formItem->setInfo($this->lng->txt('pay_max_hits_info')); $form->addItem($formItem); // hide advanced search $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_hide_advanced_search'), 'hide_advanced_search'); $formItem->setChecked((int) $genSetData['hide_advanced_search']); $formItem->setInfo($this->lng->txt('pay_hide_advanced_search_info')); $form->addItem($formItem); // hide shop news $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_hide_news'), 'hide_news'); $formItem->setChecked((int) $genSetData['hide_news']); $formItem->setInfo($this->lng->txt('pay_hide_news_info')); $form->addItem($formItem); // Hide coupons $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_hide_coupons'), 'hide_coupons'); $formItem->setChecked((int) $genSetData['hide_coupons']); $formItem->setInfo($this->lng->txt('pay_hide_coupons')); $form->addItem($formItem); // hide shop news $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_hide_shop_info'), 'hide_shop_info'); $formItem->setChecked((int) $genSetData['hide_shop_info']); $formItem->setInfo($this->lng->txt('pay_hide_shop_info_info')); $form->addItem($formItem); // use shop specials $formItem = new ilCheckboxInputGUI($this->lng->txt('use_shop_specials'), 'use_shop_specials'); $formItem->setChecked((int) $genSetData['use_shop_specials']); $formItem->setInfo($this->lng->txt('use_shop_specials_info')); $form->addItem($formItem); // show general filter $formItem = new ilCheckboxInputGUI($this->lng->txt('show_general_filter'), 'show_general_filter'); $formItem->setChecked((int) $genSetData['show_general_filter']); $formItem->setInfo($this->lng->txt('show_general_filter_info')); $form->addItem($formItem); // show shop explorer $formItem = new ilCheckboxInputGUI($this->lng->txt('show_shop_explorer'), 'show_shop_explorer'); $formItem->setChecked((int) $genSetData['show_shop_explorer']); $formItem->setInfo($this->lng->txt('show_shop_explorer_info')); $form->addItem($formItem); /**/ // Enable payment notifications $payment_noti = new ilCheckboxInputGUI($this->lng->txt("payment_notification"), "payment_notification"); $payment_noti->setValue(1); $payment_noti->setChecked((int) $ilSetting->get('payment_notification', 0) == 1); $payment_noti->setInfo($this->lng->txt('payment_notification_desc')); $num_days = new ilNumberInputGUI($this->lng->txt('payment_notification_days'), 'payment_notification_days'); $num_days->setSize(3); $num_days->setMinValue(0); $num_days->setMaxValue(120); $num_days->setRequired(true); $num_days->setValue($ilSetting->get('payment_notification_days')); $num_days->setInfo($this->lng->txt('payment_notification_days_desc')); $payment_noti->addSubItem($num_days); $form->addItem($payment_noti); /**/ $this->tpl->setVariable('FORM', $form->getHTML()); return true; }
/** * 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; }