/** * Init user form */ function initForm($a_mode) { global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser; $settings = $ilSetting->getAll(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); if ($a_mode == "create") { $this->form_gui->setTitle($lng->txt("usr_new")); } else { $this->form_gui->setTitle($lng->txt("usr_edit")); } // login data $sec_l = new ilFormSectionHeaderGUI(); $sec_l->setTitle($lng->txt("login_data")); $this->form_gui->addItem($sec_l); // authentication mode include_once './Services/Authentication/classes/class.ilAuthUtils.php'; $active_auth_modes = ilAuthUtils::_getActiveAuthModes(); $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode"); $option = array(); foreach ($active_auth_modes as $auth_name => $auth_key) { if ($auth_name == 'default') { $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")"; } else { $name = $this->lng->txt('auth_' . $auth_name); } $option[$auth_name] = $name; } $am->setOptions($option); $this->form_gui->addItem($am); if ($a_mode == "edit") { $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id"); $id->setValue($this->object->getId()); $this->form_gui->addItem($id); } // login $lo = new ilUserLoginInputGUI($lng->txt("login"), "login"); $lo->setRequired(true); if ($a_mode == "edit") { $lo->setCurrentUserId($this->object->getId()); try { include_once 'Services/Calendar/classes/class.ilDate.php'; $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId()); $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0])); } catch (ilUserException $e) { } } $this->form_gui->addItem($lo); $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd"); $pw->setSize(32); $pw->setMaxLength(32); $pw->setValidateAuthPost("auth_mode"); if ($a_mode == "create") { $pw->setRequiredOnAuth(true); } $pw->setInfo(ilUtil::getPasswordRequirementsInfo()); $this->form_gui->addItem($pw); // @todo: invisible/hidden passwords // external account include_once './Services/Authentication/classes/class.ilAuthUtils.php'; if (ilAuthUtils::_isExternalAccountEnabled()) { $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account"); $ext->setSize(40); $ext->setMaxLength(250); $ext->setInfo($lng->txt("user_ext_account_desc")); $this->form_gui->addItem($ext); } // login data $sec_si = new ilFormSectionHeaderGUI(); $sec_si->setTitle($this->lng->txt("system_information")); $this->form_gui->addItem($sec_si); // create date, approve date, agreement date, last login if ($a_mode == "edit") { $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner"); foreach ($sia as $a) { $siai = new ilNonEditableValueGUI($lng->txt($a), $a); $this->form_gui->addItem($siai); } } // active $ac = new ilCheckboxInputGUI($lng->txt("active"), "active"); $ac->setChecked(true); $this->form_gui->addItem($ac); // access @todo: get fields right (names change) $lng->loadLanguageModule('crs'); // access $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); $radg->setValue(1); $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0); $radg->addOption($op2); // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); // $ac->setChecked(true); // $ac->setOptionTitle($lng->txt("crs_unlimited")); // access.from $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from"); $acfrom->setShowTime(true); // $ac->addSubItem($acfrom); $op2->addSubItem($acfrom); // access.to $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until"); $acto->setShowTime(true); // $ac->addSubItem($acto); $op2->addSubItem($acto); // $this->form_gui->addItem($ac); $this->form_gui->addItem($radg); require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (ilDiskQuotaActivationChecker::_isActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("repository_disk_quota")); $this->form_gui->addItem($quota_head); // disk quota $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota"); $disk_quota->setSize(10); $disk_quota->setMaxLength(11); $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId()); if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } } $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); // disk usage $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if ($du_info['last_update'] === null) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short')); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info['details'] as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME)); $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); // date when the last disk quota reminder was sent to the user if (true || $dq_info['last_reminder']) { $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder"); $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))); $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc")); $this->form_gui->addItem($reminder); } } } if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("personal_workspace_disk_quota")); $this->form_gui->addItem($quota_head); // personal workspace disk quota $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota"); $wsp_disk_quota->setSize(10); $wsp_disk_quota->setMaxLength(11); $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($wsp_disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId()); if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_wsp_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } } $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); } // disk usage include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if (!sizeof($du_info)) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId()))); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); } // personal data if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) { $sec_pd = new ilFormSectionHeaderGUI(); $sec_pd->setTitle($this->lng->txt("personal_data")); $this->form_gui->addItem($sec_pd); } // gender if ($this->isSettingChangeable('gender')) { $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender"); $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]); $female = new ilRadioOption($lng->txt("gender_f"), "f"); $gndr->addOption($female); $male = new ilRadioOption($lng->txt("gender_m"), "m"); $gndr->addOption($male); $this->form_gui->addItem($gndr); } // firstname, lastname, title $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]); foreach ($fields as $field => $req) { if ($this->isSettingChangeable($field)) { $inp = new ilTextInputGUI($lng->txt($field), $field); $inp->setSize(32); $inp->setMaxLength(32); $inp->setRequired($req); $this->form_gui->addItem($inp); } } // personal image if ($this->isSettingChangeable('upload')) { $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); if ($a_mode == "edit" || $a_mode == "upload") { $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true)); } $this->form_gui->addItem($pi); } if ($this->isSettingChangeable('birthday')) { $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday'); $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]); $birthday->setShowEmpty(true); $birthday->setStartYear(1900); $this->form_gui->addItem($birthday); } // institution, department, street, city, zip code, country, phone office // phone home, phone mobile, fax, e-mail $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30)); $counter = 0; foreach ($fields as $field) { if (!$counter++ and $this->isSettingChangeable($field[0])) { // contact data $sec_cd = new ilFormSectionHeaderGUI(); $sec_cd->setTitle($this->lng->txt("contact_data")); $this->form_gui->addItem($sec_cd); } if ($this->isSettingChangeable($field[0])) { if ($field[0] != "sel_country") { $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]); $inp->setSize($field[1]); $inp->setMaxLength($field[2]); $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($inp); } else { // country selection include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]); $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($cs); } } } // email if ($this->isSettingChangeable('email')) { $em = new ilEMailInputGUI($lng->txt("email"), "email"); $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]); $this->form_gui->addItem($em); } // interests/hobbies if ($this->isSettingChangeable('hobby')) { $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby"); $hob->setRows(3); $hob->setCols(40); $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]); $this->form_gui->addItem($hob); } // referral comment if ($this->isSettingChangeable('referral_comment')) { $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment"); $rc->setRows(3); $rc->setCols(40); $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]); $this->form_gui->addItem($rc); } // interests $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("interests")); $this->form_gui->addItem($sh); $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking"); foreach ($multi_fields as $multi_field) { if ($this->isSettingChangeable($multi_field)) { // see ilUserProfile $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field); $ti->setMulti(true); $ti->setMaxLength(40); $ti->setSize(40); $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]); $this->form_gui->addItem($ti); } } // instant messengers if ($this->isSettingChangeable('instant_messengers')) { $sec_im = new ilFormSectionHeaderGUI(); $sec_im->setTitle($this->lng->txt("instant_messengers")); $this->form_gui->addItem($sec_im); } // icq, yahoo, msn, aim, skype $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip"); foreach ($fields as $field) { if ($this->isSettingChangeable('instant_messengers')) { $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field); $im->setSize(40); $im->setMaxLength(40); $this->form_gui->addItem($im); } } // other information if ($this->isSettingChangeable('user_profile_other')) { $sec_oi = new ilFormSectionHeaderGUI(); $sec_oi->setTitle($this->lng->txt("user_profile_other")); $this->form_gui->addItem($sec_oi); } // matriculation number if ($this->isSettingChangeable('matriculation')) { $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]); $this->form_gui->addItem($mr); } // delicious if ($this->isSettingChangeable('delicious')) { $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]); $this->form_gui->addItem($mr); } // client IP $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip"); $ip->setSize(40); $ip->setMaxLength(255); $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>"); $this->form_gui->addItem($ip); // additional user defined fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields = ilUserDefinedFields::_getInstance(); if ($this->usrf_ref_id == USER_FOLDER_ID) { $all_defs = $user_defined_fields->getDefinitions(); } else { $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions(); } foreach ($all_defs as $field_id => $definition) { if ($definition['field_type'] == UDF_TYPE_TEXT) { $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setSize(40); $udf->setMaxLength(255); } else { if ($definition['field_type'] == UDF_TYPE_WYSIWYG) { $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setUseRte(true); } else { $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values'])); } } $udf->setRequired($definition['required']); $this->form_gui->addItem($udf); } // settings if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) { $sec_st = new ilFormSectionHeaderGUI(); $sec_st->setTitle($this->lng->txt("settings")); $this->form_gui->addItem($sec_st); } // role if ($a_mode == "create") { $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role'); $role->setRequired(true); $role->setValue($this->default_role); $role->setOptions($this->selectable_roles); $this->form_gui->addItem($role); } // language if ($this->isSettingChangeable('language')) { $lang = new ilSelectInputGUI($lng->txt("language"), 'language'); $languages = $lng->getInstalledLanguages(); $lng->loadLanguageModule("meta"); $options = array(); foreach ($languages as $l) { $options[$l] = $lng->txt("meta_l_" . $l); } $lang->setOptions($options); $lang->setValue($ilSetting->get("language")); $this->form_gui->addItem($lang); } // skin/style if ($this->isSettingChangeable('skin_style')) { $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style'); $templates = $styleDefinition->getAllTemplates(); include_once "./Services/Style/classes/class.ilObjStyleSettings.php"; $options = array(); if (count($templates) > 0 && is_array($templates)) { foreach ($templates as $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"]; } } } $sk->setOptions($options); $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style")); $this->form_gui->addItem($sk); } // hits per page if ($this->isSettingChangeable('hits_per_page')) { $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page'); $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit")); $hpp->setOptions($options); $hpp->setValue($ilSetting->get("hits_per_page")); $this->form_gui->addItem($hpp); // users online $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online'); $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n")); $uo->setOptions($options); $uo->setValue($ilSetting->get("show_users_online")); $this->form_gui->addItem($uo); } // hide online status if ($this->isSettingChangeable('hide_own_online_status')) { $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status"); $this->form_gui->addItem($os); } if ((int) $ilSetting->get('session_reminder_enabled')) { $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled'); $cb->setValue(1); $this->form_gui->addItem($cb); } // Options if ($this->isSettingChangeable('send_mail')) { $sec_op = new ilFormSectionHeaderGUI(); $sec_op->setTitle($this->lng->txt("options")); $this->form_gui->addItem($sec_op); } // send email $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail'); $se->setInfo($lng->txt('inform_user_mail_info')); $se->setValue('y'); $se->setChecked($ilUser->getPref('send_info_mails') == 'y'); $this->form_gui->addItem($se); // ignore required fields $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf'); $irf->setInfo($lng->txt('ignore_required_fields_info')); $irf->setValue(1); $this->form_gui->addItem($irf); // @todo: handle all required fields // command buttons if ($a_mode == "create" || $a_mode == "save") { $this->form_gui->addCommandButton("save", $lng->txt("save")); } if ($a_mode == "edit" || $a_mode == "update") { $this->form_gui->addCommandButton("update", $lng->txt("save")); } $this->form_gui->addCommandButton("cancel", $lng->txt("cancel")); }
/** * FORM NewsItem: Init form. * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) */ public function initFormNewsItem($a_mode) { global $lng, $ilTabs; $ilTabs->clearTargets(); //$this->setTabs(); $lng->loadLanguageModule("news"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); // Property Title $text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title"); $text_input->setInfo(""); $text_input->setRequired(true); $text_input->setMaxLength(200); $this->form_gui->addItem($text_input); // Property Content $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content"); $text_area->setInfo(""); $text_area->setRequired(false); $this->form_gui->addItem($text_area); // Property Visibility $radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue("users"); $this->form_gui->addItem($radio_group); // Property ContentLong $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long"); $text_area->setInfo($lng->txt("news_news_item_content_long_info")); $text_area->setRequired(false); $text_area->setCols("40"); $text_area->setRows("8"); $text_area->setUseRte(true); $this->form_gui->addItem($text_area); // save and cancel commands if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) { $this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel")); } else { $this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel")); } $this->form_gui->setTitle($lng->txt("news_news_item_head")); $this->form_gui->setFormAction($this->ctrl->getFormAction($this)); $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_news.png")); $news_set = new ilSetting("news"); if (!$news_set->get("enable_rss_for_internal")) { $this->form_gui->removeItemByPostVar("news_visibility"); } else { $nv = $this->form_gui->getItemByPostVar("news_visibility"); if (is_object($nv)) { $nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"])); } } }
/** * Init login form */ protected function initLoginForm() { global $rbacsystem, $lng, $ilSetting; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveLoginInfo')); $this->form->setTableWidth('80%'); $this->form->setTitle($this->lng->txt('login_information')); $this->form->addCommandButton('saveLoginInfo', $this->lng->txt('save')); include_once 'Services/LDAP/classes/class.ilLDAPServer.php'; include_once 'Services/Radius/classes/class.ilRadiusSettings.php'; $rad_settings = ilRadiusSettings::_getInstance(); if ($ldap_id = ilLDAPServer::_getFirstActiveServer() or $rad_settings->isActive()) { $select = new ilSelectInputGUI($this->lng->txt('default_auth_mode'), 'default_auth_mode'); $select->setValue($ilSetting->get('default_auth_mode', AUTH_LOCAL)); $select->setInfo($this->lng->txt('default_auth_mode_info')); $options[AUTH_LOCAL] = $this->lng->txt('auth_local'); if ($ldap_id) { $options[AUTH_LDAP] = $this->lng->txt('auth_ldap'); } if ($rad_settings->isActive()) { $options[AUTH_RADIUS] = $this->lng->txt('auth_radius'); } $select->setOptions($options); $this->form->addItem($select); } if (!is_object($this->loginSettings)) { $this->loginSettings = new ilSetting("login_settings"); } $login_settings = $this->loginSettings->getAll(); $languages = $lng->getInstalledLanguages(); $def_language = $lng->getDefaultLanguage(); foreach ($this->setDefLangFirst($def_language, $languages) as $lang_key) { $add = ""; if ($lang_key == $def_language) { $add = " (" . $lng->txt("default") . ")"; } $textarea = new ilTextAreaInputGUI($lng->txt("meta_l_" . $lang_key) . $add, 'login_message_' . $lang_key); $textarea->setRows(10); $textarea->setValue($login_settings["login_message_" . $lang_key]); $textarea->setUseRte(true); $textarea->setRteTagSet("extended"); $this->form->addItem($textarea); unset($login_settings["login_message_" . $lang_key]); } foreach ($login_settings as $key => $message) { $lang_key = substr($key, strrpos($key, "_") + 1, strlen($key) - strrpos($key, "_")); $textarea = new ilTextAreaInputGUI($lng->txt("meta_l_" . $lang_key) . $add, 'login_message_' . $lang_key); $textarea->setRows(10); $textarea->setValue($message); $textarea->setUseRte(true); $textarea->setRteTagSet("extended"); if (!in_array($lang_key, $languages)) { $textarea->setAlert($lng->txt("not_installed")); } $this->form->addItem($textarea); } }
/** * initEditCustomForm * * @param string $a_mode */ public function initForm($a_mode = "create") { global $ilCtrl, $ilErr, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $item = new ilTextInputGUI($lng->txt('title'), 'title'); $item->setRequired(true); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_visible'), 'is_visible'); $this->form->addItem($item); $item = new ilTextAreaInputGUI($lng->txt('additional_info'), 'description'); $item->setUseRte(true); // $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings'); $item->setRteTagSet('mini'); $this->form->addItem($item); $section = new ilFormSectionHeaderGUI(); $section->setTitle($lng->txt('dcl_permissions_form')); $this->form->addItem($section); $item = new ilCustomInputGUI(); $item->setHtml($lng->txt('dcl_table_info')); $item->setTitle($lng->txt('dcl_table_info_title')); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_add_perm'), 'add_perm'); // $item->setInfo($lng->txt("dcl_add_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_perm'), 'edit_perm'); // $item->setInfo($lng->txt("dcl_edit_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_delete_perm'), 'delete_perm'); // $item->setInfo($lng->txt("dcl_delete_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_by_owner'), 'edit_by_owner'); // $item->setInfo($lng->txt("dcl_edit_by_owner_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_export_enabled'), 'export_enabled'); $this->form->addItem($item); $item = new ilCheckboxInputGUI($lng->txt('dcl_limited'), 'limited'); $sitem1 = new ilDateTimeInputGUI($lng->txt('dcl_limit_start'), 'limit_start'); $sitem2 = new ilDateTimeInputGUI($lng->txt('dcl_limit_end'), 'limit_end'); // $item->setInfo($lng->txt("dcl_limited_info")); $item->addSubItem($sitem1); $item->addSubItem($sitem2); $this->form->addItem($item); if ($a_mode == "edit") { $this->form->addCommandButton('update', $lng->txt('dcl_table_' . $a_mode)); } else { $this->form->addCommandButton('save', $lng->txt('dcl_table_' . $a_mode)); } $this->form->addCommandButton('cancel', $lng->txt('cancel')); $this->form->setFormAction($ilCtrl->getFormAction($this, $a_mode)); if ($a_mode == "edit") { $this->form->setTitle($lng->txt('dcl_edit_table')); } else { $this->form->setTitle($lng->txt('dcl_new_table')); } }
/** * Allows to add suggested solutions for questions * * @access public */ public function suggestedsolution() { global $ilUser; global $ilAccess; if ($_POST["deleteSuggestedSolution"] == 1) { $this->object->deleteSuggestedSolutions(); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "suggestedsolution"); } $save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE; $output = ""; $solution_array = $this->object->getSuggestedSolution(0); $options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText")); if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) { $solution_array = array("type" => "file"); } elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) { $solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE)); } if ($save && strlen($_POST["filename"])) { $solution_array["value"]["filename"] = $_POST["filename"]; } if ($save && strlen($_POST["solutiontext"])) { $solution_array["value"] = $_POST["solutiontext"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if (count($solution_array)) { $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("solution_hint")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("suggestedsolutiondisplay"); // suggested solution output include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php"; $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype"); $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool"); if (strlen($solution_array["internal_link"])) { $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]); $template->setCurrentBlock("preview"); $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution")); $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> "); $template->parseCurrentBlock(); } elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) { $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"]; $template->setCurrentBlock("preview"); $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution")); $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> "); $template->parseCurrentBlock(); } $template->setVariable("TEXT_TYPE", $this->lng->txt("type")); $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]); $title->setHtml($template->get()); $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution"); $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution")); $title->addSubItem($deletesolution); $form->addItem($title); if (strcmp($solution_array["type"], "file") == 0) { // file $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file"); $file->setRequired(TRUE); $file->enableFileNameSelection("filename"); //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf")); if ($_FILES["file"]["tmp_name"] && $file->checkInput()) { if (!file_exists($this->object->getSuggestedSolutionPath())) { ilUtil::makeDirParents($this->object->getSuggestedSolutionPath()); } $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]); if ($res) { ilUtil::renameExecutables($this->object->getSuggestedSolutionPath()); // remove an old file download if (is_array($solution_array["value"])) { @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]); } $file->setValue($_FILES["file"]["name"]); $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"])); $originalexists = $this->object->_questionExistsInPool($this->object->original_id); if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { return $this->originalSyncForm("suggestedsolution"); } else { ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE); $this->ctrl->redirect($this, "suggestedsolution"); } } else { // BH: $res as info string? wtf? it holds a bool or something else!!? ilUtil::sendInfo($res); } } else { if (is_array($solution_array["value"])) { $file->setValue($solution_array["value"]["name"]); $file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]); } } $form->addItem($file); $hidden = new ilHiddenInputGUI("solutiontype"); $hidden->setValue("file"); $form->addItem($hidden); } else { if (strcmp($solution_array["type"], "text") == 0) { $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext"); $question->setValue($this->object->prepareTextareaOutput($solution_array["value"])); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); $question->addPlugin("latex"); $question->addButton("latex"); $question->setRTESupport($this->object->getId(), "qpl", "assessment"); $hidden = new ilHiddenInputGUI("solutiontype"); $hidden->setValue("text"); $form->addItem($hidden); $form->addItem($question); } } if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) { $form->addCommandButton("suggestedsolution", $this->lng->txt("save")); } if ($save) { if ($form->checkInput()) { switch ($solution_array["type"]) { case "file": $this->object->saveSuggestedSolution("file", "", 0, array("name" => $solution_array["value"]["name"], "type" => $solution_array["value"]["type"], "size" => $solution_array["value"]["size"], "filename" => $_POST["filename"])); break; case "text": $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]); break; } $originalexists = $this->object->_questionExistsInPool($this->object->original_id); if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { return $this->originalSyncForm("suggestedsolution"); } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "suggestedsolution"); } } } $output = $form->getHTML(); } $savechange = strcmp($this->ctrl->getCmd(), "saveSuggestedSolution") == 0 ? TRUE : FALSE; $changeoutput = ""; if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) { $formchange = new ilPropertyFormGUI(); $formchange->setFormAction($this->ctrl->getFormAction($this)); $formchange->setTitle(count($solution_array) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution")); $formchange->setMultipart(FALSE); $formchange->setTableWidth("100%"); $formchange->setId("suggestedsolution"); $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype"); foreach ($options as $opt_value => $opt_caption) { $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value)); } if (count($solution_array)) { $solutiontype->setValue($solution_array["type"]); } $solutiontype->setRequired(TRUE); $formchange->addItem($solutiontype); $formchange->addCommandButton("saveSuggestedSolution", $this->lng->txt("select")); if ($savechange) { $formchange->checkInput(); } $changeoutput = $formchange->getHTML(); } $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output); }
/** * builds and returns a form property gui object with the given label and postvar * that is addable to property forms * depending on the given flag "asNonEditable" it returns a ... * - non editable gui * - textarea input gui * * @final * @access protected * @param string $label * @param string $postVar * @param boolean $asNonEditable * @return ilTextAreaInputGUI|ilNonEditableValueGUI $formProperty */ protected final function buildFeedbackContentFormProperty($label, $postVar, $asNonEditable) { if ($asNonEditable) { require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php'; $property = new ilNonEditableValueGUI($label, $postVar, true); } else { require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php'; require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php'; $property = new ilTextAreaInputGUI($label, $postVar); $property->setRequired(false); $property->setRows(10); $property->setCols(80); if (!$this->questionOBJ->getPreventRteUsage()) { $property->setUseRte(true); $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $property->addPlugin("latex"); $property->addButton("latex"); $property->addButton("pastelatex"); } $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment"); } return $property; }
private function buildForm() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save")); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($this->testOBJ->participantDataExist()) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->testOBJ->getAnonymity()); $form->addItem($anonymity); // test mode (question set type) $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type'); $questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc")); $questSetType->addOption($questSetTypeFixed); $questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc")); $questSetType->addOption($questSetTypeRandom); $questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc")); $questSetType->addOption($questSetTypeContinues); $questSetType->setValue($this->testOBJ->getQuestionSetType()); if ($this->testOBJ->participantDataExist()) { $questSetType->setDisabled(true); } $form->addItem($questSetType); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->testOBJ->getPoolUsage()); $form->addItem($pool_usage); // enable_archiving $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving'); $enable_archiving->setValue(1); $enable_archiving->setChecked($this->testOBJ->getEnableArchiving()); $form->addItem($enable_archiving); // activation/availability (no template support yet) include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->testOBJ->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setChecked($this->testOBJ->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $this->tpl->addJavaScript('./Services/Form/js/date_duration.js'); include_once "Services/Form/classes/class.ilDateDurationInputGUI.php"; $dur = new ilDateDurationInputGUI("", "access_period"); $dur->setShowTime(true); $date = $this->testOBJ->getActivationStartingTime(); $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setStartText($this->lng->txt('rep_activation_limited_start')); $date = $this->testOBJ->getActivationEndingTime(); $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setEndText($this->lng->txt('rep_activation_limited_end')); $opt->addSubItem($dur); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->testOBJ->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$this->settingsTemplate || $this->formShowBeginningEndingInformation($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->testOBJ->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->testOBJ->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); // examview $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview'); $enable_examview->setValue(1); $enable_examview->setChecked($this->testOBJ->getEnableExamview()); $enable_examview->setInfo($this->lng->txt("enable_examview_desc")); $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html'); $show_examview_html->setValue(1); $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml()); $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html")); $show_examview_html->setInfo($this->lng->txt("show_examview_html_desc")); $enable_examview->addSubItem($show_examview_html); $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf'); $show_examview_pdf->setValue(1); $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf()); $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf")); $show_examview_pdf->setInfo($this->lng->txt("show_examview_pdf_desc")); $enable_examview->addSubItem($show_examview_pdf); $form->addItem($enable_examview); if (!$this->settingsTemplate || $this->formShowSessionSection($this->settingsTemplate->getSettings())) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->testOBJ->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); $total = $this->testOBJ->evalTotalPersons(); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->testOBJ->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_starting_time')) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->testOBJ->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->testOBJ->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); if ($this->testOBJ->participantDataExist()) { $enablestartingtime->setDisabled(true); $startingtime->setDisabled(true); } // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_ending_time')) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->testOBJ->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->testOBJ->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->testOBJ->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$this->settingsTemplate || $this->formShowPresentationSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->testOBJ->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->testOBJ->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // selector for unicode characters global $ilSetting; if ($ilSetting->get('char_selector_availability') > 0) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability()); $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition()); $char_selector->addFormProperties($form); $char_selector->setFormValues($form); } // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->testOBJ->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$this->settingsTemplate || $this->formShowSequenceSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->testOBJ->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->testOBJ->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->testOBJ->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->testOBJ->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->testOBJ->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->testOBJ->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->testOBJ->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->testOBJ->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$this->settingsTemplate || $this->formShowNotificationSection($this->settingsTemplate->getSettings())) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->testOBJ->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->testOBJ->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->testOBJ->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->testOBJ->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->testOBJ->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->testOBJ->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->testOBJ->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum()); $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$this->settingsTemplate || $this->formShowTestExecutionSection($this->settingsTemplate->getSettings())) { $testExecution = new ilFormSectionHeaderGUI(); $testExecution->setTitle($this->lng->txt("tst_test_execution")); $form->addItem($testExecution); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt('examid_in_kiosk'), 'examid_in_kiosk')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } if ($this->testOBJ->getExamidInKiosk()) { array_push($values, 'examid_in_kiosk'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $redirection_mode = $this->testOBJ->getRedirectionMode(); $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled'); $rm_enabled->setChecked($redirection_mode == '0' ? false : true); $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_mode'); $always = new ilRadioOption($this->lng->txt('tst_results_access_always'), REDIRECT_ALWAYS); $radio_rm->addOption($always); $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK); $radio_rm->addOption($kiosk); $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS); $rm_enabled->addSubItem($radio_rm); $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url'); $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl()); $redirection_url->setRequired(true); $rm_enabled->addSubItem($redirection_url); $form->addItem($rm_enabled); // Sign submission $sign_submission = $this->testOBJ->getSignSubmission(); $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission'); $sign_submission_enabled->setChecked($sign_submission); $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info')); $form->addItem($sign_submission_enabled); if (!$this->settingsTemplate || $this->formShowParticipantSection($this->settingsTemplate->getSettings())) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->testOBJ->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->testOBJ->getAllowedUsers() ? $this->testOBJ->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->testOBJ->getAllowedUsersTimeGap() ? $this->testOBJ->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->testOBJ); $ecs->addSettingsToForm($form, 'tst'); // remove items when using template if ($this->settingsTemplate) { foreach ($this->settingsTemplate->getSettings() as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }
public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form) { // cloze text $cloze_text = new ilTextAreaInputGUI($this->lng->txt("cloze_text"), 'cloze_text'); $cloze_text->setRequired(true); $cloze_text->setValue($this->applyIndizesToGapText($this->object->getClozeText())); $cloze_text->setInfo($this->lng->txt("close_text_hint")); $cloze_text->setRows(10); $cloze_text->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) { $cloze_text->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $cloze_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $cloze_text->addPlugin("latex"); $cloze_text->addButton("latex"); $cloze_text->addButton("pastelatex"); } } else { $cloze_text->setUseRte(TRUE); $cloze_text->setRteTags(self::getSelfAssessmentTags()); $cloze_text->setUseTagsForRteOnly(false); } $cloze_text->setRTESupport($this->object->getId(), "qpl", "assessment"); $form->addItem($cloze_text); $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool"); $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap')); $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps')); $tpl->parseCurrentBlock(); $button = new ilCustomInputGUI(' ', ''); $button->setHtml($tpl->get()); $form->addItem($button); // text rating if (!$this->object->getSelfAssessmentEditingMode()) { $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "textgap_rating"); $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"), "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"), "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"), "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"), "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"), "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")); $textrating->setOptions($text_options); $textrating->setValue($this->object->getTextgapRating()); $form->addItem($textrating); // text field length $fixedTextLength = new ilNumberInputGUI($this->lng->txt("cloze_fixed_textlength"), "fixedTextLength"); $ftl = $this->object->getFixedTextLength(); $fixedTextLength->setValue($ftl > 0 ? $ftl : ''); $fixedTextLength->setMinValue(0); $fixedTextLength->setSize(3); $fixedTextLength->setMaxLength(6); $fixedTextLength->setInfo($this->lng->txt('cloze_fixed_textlength_description')); $fixedTextLength->setRequired(false); $form->addItem($fixedTextLength); // identical scoring $identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring"); $identical_scoring->setValue(1); $identical_scoring->setChecked($this->object->getIdenticalScoring()); $identical_scoring->setInfo($this->lng->txt('identical_scoring_desc')); $identical_scoring->setRequired(FALSE); $form->addItem($identical_scoring); } return $form; }
/** * initEditCustomForm * * @param string $a_mode */ public function initForm($a_mode = "create") { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $item = new ilTextInputGUI($this->lng->txt('title'), 'title'); $item->setRequired(true); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_visible'), 'is_visible'); $this->form->addItem($item); // Show default order field and direction only in edit mode, because table id is not yet given and there are no fields to select if ($a_mode != 'create') { $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field'), 'default_sort_field'); $fields = $this->table->getVisibleFields(); $options = array(0 => $this->lng->txt('dcl_please_select')); foreach ($fields as $field) { $options[$field->getId()] = $field->getTitle(); } $item->setOptions($options); $this->form->addItem($item); $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field_order'), 'default_sort_field_order'); $options = array('asc' => $this->lng->txt('dcl_asc'), 'desc' => $this->lng->txt('dcl_desc')); $item->setOptions($options); $this->form->addItem($item); } $item = new ilTextAreaInputGUI($this->lng->txt('additional_info'), 'description'); $item->setUseRte(true); // $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings'); $item->setRteTagSet('mini'); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_public_comments'), 'public_comments'); $this->form->addItem($item); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('dcl_permissions_form')); $this->form->addItem($section); $item = new ilCustomInputGUI(); $item->setHtml($this->lng->txt('dcl_table_info')); $item->setTitle($this->lng->txt('dcl_table_info_title')); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_add_perm'), 'add_perm'); // $item->setInfo($this->lng->txt("dcl_add_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_perm'), 'edit_perm'); // $item->setInfo($this->lng->txt("dcl_edit_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_delete_perm'), 'delete_perm'); // $item->setInfo($this->lng->txt("dcl_delete_perm_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_by_owner'), 'edit_by_owner'); // $item->setInfo($this->lng->txt("dcl_edit_by_owner_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_view_own_records_perm'), 'view_own_records_perm'); // $item->setInfo($this->lng->txt("dcl_edit_by_owner_info")); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_export_enabled'), 'export_enabled'); $this->form->addItem($item); $item = new ilCheckboxInputGUI($this->lng->txt('dcl_limited'), 'limited'); $sitem1 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_start'), 'limit_start'); $sitem1->setShowTime(true); $sitem2 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_end'), 'limit_end'); $sitem2->setShowTime(true); // $item->setInfo($this->lng->txt("dcl_limited_info")); $item->addSubItem($sitem1); $item->addSubItem($sitem2); $this->form->addItem($item); if ($a_mode == "edit") { $this->form->addCommandButton('update', $this->lng->txt('dcl_table_' . $a_mode)); } else { $this->form->addCommandButton('save', $this->lng->txt('dcl_table_' . $a_mode)); } $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); $this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode)); if ($a_mode == "edit") { $this->form->setTitle($this->lng->txt('dcl_edit_table')); } else { $this->form->setTitle($this->lng->txt('dcl_new_table')); } }
/** * @param ilPropertyFormGUI $form */ private function addTestFinishProperties(ilPropertyFormGUI $form) { $testFinishHeader = new ilFormSectionHeaderGUI(); $testFinishHeader->setTitle($this->lng->txt("tst_final_information")); $form->addItem($testFinishHeader); // examview $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview'); $enable_examview->setValue(1); $enable_examview->setChecked($this->testOBJ->getEnableExamview()); $enable_examview->setInfo($this->lng->txt("enable_examview_desc")); $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html'); $show_examview_html->setValue(1); $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml()); $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html")); $enable_examview->addSubItem($show_examview_html); $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf'); $show_examview_pdf->setValue(1); $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf()); $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf")); $enable_examview->addSubItem($show_examview_pdf); $form->addItem($enable_examview); // show final statement $showfinal = new ilCheckboxInputGUI($this->lng->txt("final_statement"), "showfinalstatement"); $showfinal->setChecked($this->testOBJ->getShowFinalStatement()); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $form->addItem($showfinal); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setRequired(true); $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement(), false, true)); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $finalstatement->setRteTagSet('full'); $showfinal->addSubItem($finalstatement); $redirection_mode = $this->testOBJ->getRedirectionMode(); $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled'); $rm_enabled->setInfo($this->lng->txt('redirect_after_finishing_tst_desc')); $rm_enabled->setChecked($redirection_mode == '0' ? false : true); $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_rule'), 'redirection_mode'); $always = new ilRadioOption($this->lng->txt('redirect_always'), REDIRECT_ALWAYS); $radio_rm->addOption($always); $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK); $radio_rm->addOption($kiosk); $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS); $rm_enabled->addSubItem($radio_rm); $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url'); $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl()); $redirection_url->setRequired(true); $rm_enabled->addSubItem($redirection_url); $form->addItem($rm_enabled); // Sign submission $sign_submission = $this->testOBJ->getSignSubmission(); $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission'); $sign_submission_enabled->setChecked($sign_submission); $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info')); $form->addItem($sign_submission_enabled); // mail notification $mailnotification = new ilCheckboxInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->setInfo($this->lng->txt("tst_finish_notification_desc")); $mailnotification->setChecked($this->testOBJ->getMailNotification() > 0); $form->addItem($mailnotification); $mailnotificationContent = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification_content"), "mailnotification_content"); $mailnotificationContent->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotificationContent->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotificationContent->setValue($this->testOBJ->getMailNotification() ? $this->testOBJ->getMailNotification() : 1); $mailnotificationContent->setRequired(true); $mailnotification->addSubItem($mailnotificationContent); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->testOBJ->getMailNotificationType()); $mailnotification->addSubItem($mailnottype); }
/** * Creates the output of the feedback page for a single choice question * * @access public */ function feedback($checkonly = false) { $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('feedback_answers')); $form->setTableWidth("100%"); $form->setId("feedback"); $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete"); $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1))); $complete->setRequired(falsse); $complete->setRows(10); $complete->setCols(80); $complete->setUseRte(true); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $complete->addPlugin("latex"); $complete->addButton("latex"); $complete->addButton("pastelatex"); $complete->setRTESupport($this->object->getId(), "qpl", "assessment"); $form->addItem($complete); $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete"); $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0))); $incomplete->setRequired(false); $incomplete->setRows(10); $incomplete->setCols(80); $incomplete->setUseRte(true); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $incomplete->addPlugin("latex"); $incomplete->addButton("latex"); $incomplete->addButton("pastelatex"); $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment"); $form->addItem($incomplete); if (!$this->getSelfAssessmentEditingMode()) { foreach ($this->object->answers as $index => $answer) { $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($answer->getAnswertext(), true), "feedback_answer_{$index}"); $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSyntaxTree($index))); $answerobj->setRequired(false); $answerobj->setRows(10); $answerobj->setCols(80); $answerobj->setUseRte(true); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $answerobj->addPlugin("latex"); $answerobj->addButton("latex"); $answerobj->addButton("pastelatex"); $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment"); $form->addItem($answerobj); } } $form->addCommandButton("saveFeedback", $this->lng->txt("save")); 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 (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * FORM NewsItem: Init form. * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) */ public function initFormNewsItem($a_mode) { global $lng; $lng->loadLanguageModule("news"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); // Property Title $text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title"); $text_input->setInfo(""); $text_input->setRequired(true); $text_input->setMaxLength(200); $this->form_gui->addItem($text_input); // Property Content $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content"); $text_area->setInfo(""); $text_area->setRequired(false); $this->form_gui->addItem($text_area); // Property Visibility $radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue("users"); $this->form_gui->addItem($radio_group); // Property ContentLong $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long"); $text_area->setInfo($lng->txt("news_news_item_content_long_info")); $text_area->setRequired(false); $text_area->setCols("40"); $text_area->setRows("8"); $text_area->setUseRte(true); $this->form_gui->addItem($text_area); // save and cancel commands if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) { $this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel")); } else { $this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel")); } $this->form_gui->setTitle($lng->txt("news_news_item_head")); $this->form_gui->setFormAction($this->ctrl->getFormAction($this)); $this->prepareFormNewsItem($this->form_gui); }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("multiplechoice"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setValue($this->object->label); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setValue($this->object->getDescription()); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7"); $form->addItem($question); // subtype $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type"); $subtype->setRequired(true); $subtype->setValue($this->object->getSubtype()); $form->addItem($subtype); // #10652 $opt = new ilRadioOption($this->lng->txt('non_ratio'), 3, $this->lng->txt("metric_subtype_description_interval")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3"); if ($this->object->getSubtype() == 3) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3"); if ($this->object->getSubtype() == 3) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), 4, $this->lng->txt("metric_subtype_description_rationonabsolute")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4"); if ($this->object->getSubtype() == 4) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $minimum->setMinValue(0); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4"); if ($this->object->getSubtype() == 4) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), 5, $this->lng->txt("metric_subtype_description_ratioabsolute")); $subtype->addOption($opt); // minimum value $minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5"); if ($this->object->getSubtype() == 5) { $minimum->setValue($this->object->getMinimum()); } $minimum->setRequired(false); $minimum->setSize(6); $minimum->setMinValue(0); $minimum->setDecimals(0); $opt->addSubItem($minimum); // maximum value $maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5"); $maximum->setDecimals(0); if ($this->object->getSubtype() == 5) { $maximum->setValue($this->object->getMaximum()); } $maximum->setRequired(false); $maximum->setSize(6); $opt->addSubItem($maximum); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * Display and fill the properties form of the test * * @access public */ function propertiesObject($checkonly = FALSE) { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } // using template? $template_settings = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } $save = strcmp($this->ctrl->getCmd(), "saveProperties") == 0 ? TRUE : FALSE; $total = $this->object->evalTotalPersons(); $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$template || $template && $this->formShowGeneralSection($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($total) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->object->getAnonymity()); $form->addItem($anonymity); // random selection of questions $random = new ilCheckboxInputGUI($this->lng->txt("tst_random_selection"), "random_test"); $random->setValue(1); if ($total) { $random->setDisabled(true); } $random->setChecked($this->object->isRandomTest()); $info = $this->lng->txt("tst_random_test_description"); if ($this->object->hasQuestionsWithoutQuestionpool()) { $info .= $this->lng->txt("tst_random_test_description_warning"); } $random->setInfo($info); $form->addItem($random); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->object->getPoolUsage()); $form->addItem($pool_usage); // activation/availability (no template support yet) include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setChecked($this->object->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->object->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $date = $this->object->getActivationStartingTime(); $start = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_start'), 'act_starting_time'); #$start->setMode(ilDateTimeInputGUI::MODE_INPUT); $start->setShowTime(true); $start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($start); $date = $this->object->getActivationEndingTime(); $end = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_end'), 'act_ending_time'); #$end->setMode(ilDateTimeInputGUI::MODE_INPUT); $end->setShowTime(true); $end->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($end); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$template || $template && $this->formShowBeginningEndingInformation($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->object->getId(), "tst", 'assessment', null, false, '3.4.7'); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->object->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->object->getId(), "tst", "assessment", null, false, '3.4.7'); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->object->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); if (!$template || $template && $this->formShowSessionSection($template_settings)) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->object->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_processing_time'] && $template_settings['chb_processing_time']['value']) { $processing->setChecked(true); } else { $processing->setChecked($this->object->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->object->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->object->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_starting_time'] && $template_settings['chb_starting_time']['value']) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->object->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->object->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->object->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); if ($total) { $enablestartingtime->setDisabled(true); } if ($total) { $startingtime->setDisabled(true); } $form->addItem($enablestartingtime); // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_ending_time'] && $template_settings['chb_ending_time']['value']) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->object->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->object->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->object->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->object->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$template || $template && $this->formShowPresentationSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->object->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->object->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->object->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->object->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->object->getAutosaveIval()); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$template || $template && $this->formShowSequenceSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->object->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->object->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->object->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->object->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->object->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->object->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->object->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$template || $template && $this->formShowNotificationSection($template_settings)) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->object->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->object->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->object->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->object->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->object->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->object->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->object->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->object->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->object->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->object->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->object->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->object->getHighscoreTopNum()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$template || $template && $this->formShowKioskSection($template_settings)) { // kiosk mode properties $kioskheader = new ilFormSectionHeaderGUI(); $kioskheader->setTitle($this->lng->txt("kiosk")); $form->addItem($kioskheader); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->object->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->object->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->object->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); if (!$template || $template && $this->formShowParticipantSection($template_settings)) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->object->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->object->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->object->getAllowedUsers() ? $this->object->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->object->getAllowedUsersTimeGap() ? $this->object->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->object); $ecs->addSettingsToForm($form, 'tst'); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $form->addCommandButton("saveProperties", $this->lng->txt("save")); } // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } $errors = false; if ($save) { $errors = !$form->checkInput(); $form->setValuesByPost(); if ($online->getChecked() && !$this->object->isComplete()) { $online->setAlert($this->lng->txt("cannot_switch_to_online_no_questions_andor_no_mark_steps")); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); $errors = true; } if ($errors) { $checkonly = false; } } if (!$checkonly) { // using template? $message = ""; if ($template) { global $tpl; $link = $this->ctrl->getLinkTarget($this, "confirmResetTemplate"); $link = "<a href=\"" . $link . "\">" . $this->lng->txt("test_using_template_link") . "</a>"; $message = "<div style=\"margin-top:10px\">" . $tpl->getMessageHTML(sprintf($this->lng->txt("test_using_template"), $template->getTitle(), $link), "info") . "</div>"; } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML() . $message); } return $errors; }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("multiplechoice"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setValue($this->object->label); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setValue($this->object->getDescription()); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7"); $form->addItem($question); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); // orientation $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation"); $orientation->setRequired(false); $orientation->setValue($this->object->getOrientation()); $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0)); $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1)); $form->addItem($orientation); // minimum answers $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers"); $minanswers->setValue(1); $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option")); $minanswers->setChecked($this->object->use_min_answers); $minanswers->setRequired(FALSE); $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers"); $nranswers->setSize(5); $nranswers->setDecimals(0); $nranswers->setRequired(false); $nranswers->setMinValue(1); $nranswers->setValue($this->object->nr_min_answers); $minanswers->addSubItem($nranswers); $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers"); $nrmaxanswers->setSize(5); $nrmaxanswers->setDecimals(0); $nrmaxanswers->setRequired(false); $nrmaxanswers->setMinValue(1); $nrmaxanswers->setValue($this->object->nr_max_answers); $minanswers->addSubItem($nrmaxanswers); $form->addItem($minanswers); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(false); $answers->setAllowMove(true); $answers->setShowWizard(false); $answers->setShowSavePhrase(false); $answers->setUseOtherAnswer(true); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer')); if (!$this->object->getCategories()->getCategoryCount()) { $this->object->getCategories()->addCategory(""); } $answers->setValues($this->object->getCategories()); $answers->setDisabledScale(false); $form->addItem($answers); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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 ($nranswers->getValue() > $answers->getCategoryCount()) { $nrmaxanswers->setAlert($this->lng->txt('err_minvalueganswers')); if (!$errors) { ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $errors = true; } if ($nrmaxanswers->getValue() > 0 && ($nrmaxanswers->getValue() > $answers->getCategoryCount() || $nrmaxanswers->getValue() < $nranswers->getValue())) { $nrmaxanswers->setAlert($this->lng->txt('err_maxvaluegeminvalue')); if (!$errors) { ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $errors = true; } if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * add the properties of a question part to the form * * @param object form object to extend * @param object question part object * @param integer counter of the question part */ private function initPartProperties($form, $part_obj = null, $counter = "1") { // Use a dummy part object for a new booking definition if (!isset($part_obj)) { $part_obj = new assAccountingQuestionPart($this->object); } // Part identifier (is 0 for a new part) $item = new ilHiddenInputGUI("parts[]"); $item->setValue($part_obj->getPartId()); $form->addItem($item); // Title $item = new ilFormSectionHeaderGUI(); $item->setTitle($this->plugin->txt('accounting_table') . ' ' . $counter); $form->addItem($item); // Position $item = new ilNumberInputGUI($this->plugin->txt('position'), 'position_' . $part_obj->getPartId()); $item->setSize(2); $item->setDecimals(1); $item->SetInfo($this->plugin->txt('position_info')); if ($part_obj->getPartId()) { $item->setValue(sprintf("%01.1f", $part_obj->getPosition())); } $form->addItem($item); // Text $item = new ilTextAreaInputGUI($this->plugin->txt("question_part"), 'text_' . $part_obj->getPartId()); $item->setValue($this->object->prepareTextareaOutput($part_obj->getText())); $item->setRows(10); $item->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { $item->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $item->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $item->addPlugin("latex"); $item->addButton("latex"); $item->addButton("pastelatex"); $item->setRTESupport($this->object->getId(), "qpl", "assessment"); } else { $item->setRteTags(self::getSelfAssessmentTags()); $item->setUseTagsForRteOnly(false); } $form->addItem($item); // Booking XML definition $item = new ilCustomInputGUI($this->plugin->txt('booking_xml')); $item->setInfo($this->plugin->txt('booking_xml_info')); $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html'); $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($part_obj->getBookingXML())); $tpl->setVariable("NAME", 'booking_xml_' . $part_obj->getPartId()); $item->setHTML($tpl->get()); // Booking file $subitem = new ilFileInputGUI($this->plugin->txt('booking_file'), "booking_file_" . $part_obj->getPartId()); $subitem->setSuffixes(array('xml')); $item->addSubItem($subitem); // Download button if (strlen($part_obj->getBookingXML())) { $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html'); $this->ctrl->setParameter($this, 'xmltype', 'booking'); $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId()); $tpl->setCurrentBlock('button'); $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml')); $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_booking_xml')); $tpl->ParseCurrentBlock(); $subitem = new ilcustomInputGUI(''); $subitem->setHTML($tpl->get()); $item->addSubItem($subitem); } $form->addItem($item); // Delete Button if ($part_obj->getPartId()) { $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html'); $tpl->setCurrentBlock('button'); $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId()); $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'deletePart')); $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('delete_accounting_table')); $tpl->ParseCurrentBlock(); $item = new ilcustomInputGUI(); $item->setHTML($tpl->get()); $form->addItem($item); } }
protected function initEditForm() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "save")); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); // $form->setId("essay"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey"); $form->addItem($question); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $this->addFieldsToEditForm($form); $this->addCommandButtons($form); // values $title->setValue($this->object->getTitle()); $label->setValue($this->object->label); $author->setValue($this->object->getAuthor()); $description->setValue($this->object->getDescription()); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $shuffle->setChecked($this->object->getObligatory()); return $form; }
private function initTopicCreateForm() { /** * @var $ilUser ilObjUser * @var $rbacsystem ilRbacSystem * @var $ilias ILIAS * @var $ilSetting ilSetting */ global $ilUser, $rbacsystem, $ilias, $ilSetting; $this->create_topic_form_gui = new ilPropertyFormGUI(); $this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread')); $this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg')); $this->create_topic_form_gui->setTableWidth('100%'); // form action $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread')); if ($this->objProperties->isAnonymized() == 1) { $alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias'); $alias_gui->setInfo($this->lng->txt('forums_use_alias')); $alias_gui->setMaxLength(255); $alias_gui->setSize(50); $this->create_topic_form_gui->addItem($alias_gui); } else { $alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias'); $alias_gui->setValue($ilUser->getLogin()); $this->create_topic_form_gui->addItem($alias_gui); } // topic $subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject'); $subject_gui->setMaxLength(255); $subject_gui->setSize(50); $subject_gui->setRequired(true); $this->create_topic_form_gui->addItem($subject_gui); // message $post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message'); $post_gui->setCols(50); $post_gui->setRows(15); $post_gui->setRequired(true); $post_gui->setUseRte(true); $post_gui->addPlugin('latex'); $post_gui->addButton('latex'); $post_gui->addButton('pastelatex'); $post_gui->addPlugin('ilfrmquote'); //$post_gui->addPlugin('code'); $post_gui->removePlugin('advlink'); $post_gui->usePurifier(true); $post_gui->setRTERootBlockElement(''); $post_gui->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7'); $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect')); // purifier require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php'; $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post')); $this->create_topic_form_gui->addItem($post_gui); // file $fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile'); $fi->setFilenames(array(0 => '')); $this->create_topic_form_gui->addItem($fi); include_once 'Services/Mail/classes/class.ilMail.php'; $umail = new ilMail($ilUser->getId()); // catch hack attempts if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$this->objProperties->isAnonymized()) { // direct notification $dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify'); $dir_notification_gui->setInfo($this->lng->txt('forum_notify_me_directly')); $dir_notification_gui->setValue(1); $this->create_topic_form_gui->addItem($dir_notification_gui); if ($ilias->getSetting('forum_notification') != 0) { // gen. notification $gen_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_general_notification'), 'notify_posts'); $gen_notification_gui->setInfo($this->lng->txt('forum_notify_me_generally')); $gen_notification_gui->setValue(1); $this->create_topic_form_gui->addItem($gen_notification_gui); } } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) { require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code'); $captcha->setRequired(true); $this->create_topic_form_gui->addItem($captcha); } $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create')); $this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel')); }
/** * Shows the certificate editor for ILIAS tests */ public function certificateEditor() { global $ilAccess; $form_fields = array(); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $form_fields = $this->getFormFieldsFromPOST(); } else { $form_fields = $this->getFormFieldsFromFO(); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("certificate_edit")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("certificate"); $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active"); $active->setChecked($form_fields["active"]); $form->addItem($active); $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import"); $import->setRequired(FALSE); $import->setSuffixes(array("zip")); // handle the certificate import if (strlen($_FILES["certificate_import"]["tmp_name"])) { if ($import->checkInput()) { $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]); if ($result == FALSE) { $import->setAlert($this->lng->txt("certificate_error_import")); } else { $this->ctrl->redirect($this, "certificateEditor"); } } } $form->addItem($import); $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat"); $pageformats = $this->object->getPageFormats(); $pageformat->setValue($form_fields["pageformat"]); foreach ($pageformats as $format) { $option = new ilRadioOption($format["name"], $format["value"]); if (strcmp($format["value"], "custom") == 0) { $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight"); $pageheight->setValue($form_fields["pageheight"]); $pageheight->setSize(6); $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pageheight->setInfo($this->lng->txt("certificate_unit_description")); $pageheight->setRequired(true); $option->addSubitem($pageheight); $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth"); $pagewidth->setValue($form_fields["pagewidth"]); $pagewidth->setSize(6); $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pagewidth->setInfo($this->lng->txt("certificate_unit_description")); $pagewidth->setRequired(true); $option->addSubitem($pagewidth); } $pageformat->addOption($option); } $pageformat->setRequired(true); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $pageformat->checkInput(); } $form->addItem($pageformat); $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background"); $bgimage->setRequired(FALSE); $bgimage->setUseCache(false); if (count($_POST)) { // handle the background upload if (strlen($_FILES["background"]["tmp_name"])) { if ($bgimage->checkInput()) { $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]); if ($result == FALSE) { $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage")); } } } } if (!$this->object->hasBackgroundImage()) { include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php"; if (ilObjCertificateSettingsAccess::hasBackgroundImage()) { $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb()); } } else { $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb()); } $form->addItem($bgimage); $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top"); $padding_top->setRequired(TRUE); $padding_top->setValue($form_fields["padding_top"]); $padding_top->setSize(6); $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $padding_top->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $padding_top->checkInput(); } $form->addItem($padding_top); $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body"); $rect->setRequired(TRUE); $rect->setUseUnits(TRUE); $rect->setTop($form_fields["margin_body_top"]); $rect->setBottom($form_fields["margin_body_bottom"]); $rect->setLeft($form_fields["margin_body_left"]); $rect->setRight($form_fields["margin_body_right"]); $rect->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $rect->checkInput(); } $form->addItem($rect); $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text"); $certificate->removePlugin('ilimgupload'); $certificate->setValue($form_fields["certificate_text"]); $certificate->setRequired(TRUE); $certificate->setRows(20); $certificate->setCols(80); // fraunhpatch start $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate"); foreach (ilCertificate::getCustomCertificateFields() as $f) { $common_desc_tpl->setCurrentBlock("cert_field"); $common_desc_tpl->setVariable("PH", $f["ph"]); $common_desc_tpl->setVariable("PH_TXT", $f["name"]); $common_desc_tpl->parseCurrentBlock(); } $common_desc = $common_desc_tpl->get(); // fraunhpatch start $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc); $certificate->setUseRte(TRUE, '3.4.7'); $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul"); $certificate->setRteTags($tags); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $certificate->checkInput(); } $form->addItem($certificate); $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { if ($this->object->isComplete() || $this->object->hasBackgroundImage()) { $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview")); $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export")); $form->addCommandButton("certificateDelete", $this->lng->txt("delete")); } $form->addCommandButton("certificateSave", $this->lng->txt("save")); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { if ($_POST["background_delete"]) { $this->object->deleteBackgroundImage(); } if ($form->checkInput()) { try { $xslfo = $this->object->processXHTML2FO($form_fields); $this->object->getAdapter()->saveFormFields($form_fields); $this->object->saveCertificate($xslfo); $this->object->writeActive($form_fields["active"]); ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE); $this->ctrl->redirect($this, "certificateEditor"); } catch (Exception $e) { ilUtil::sendFailure($e->getMessage()); } } } }
/** * add type specific input fields to a form * * @param object form, property or radio option * @param array (assoc) input values * @param string configuration level ("type" or "object") * @param string parent field value * @param string parent option value * @param int maximum recursion depth */ function addFormElements($a_object, $a_values = array(), $a_level = "object", $a_parentfield = '', $a_parentvalue = '', $a_maxdepth = "3") { // recursion end if ($a_maxdepth == 0) { return; } foreach ($this->getInputFields($a_level, $a_parentfield, $a_parentvalue) as $field) { $value = $a_values['field_' . $field->field_name]; $value = $value ? $value : $field->default; switch ($field->field_type) { case self::FIELDTYPE_HEADER: $item = new ilFormSectionHeaderGUI(); $item->setTitle($field->title); break; case self::FIELDTYPE_DESCRIPTION: $item = new ilCustomInputGUI($field->title); $item->setHtml(nl2br($field->description)); break; case self::FIELDTYPE_TEXT: $item = new ilTextInputGUI($field->title, 'field_' . $field->field_name); $item->setInfo($field->description); $item->setRequired($field->required ? true : false); $item->setSize($field->size); $item->setValue($value); break; case self::FIELDTYPE_TEXTAREA: $item = new ilTextAreaInputGUI($field->title, 'field_' . $field->field_name); $item->setInfo($field->description); $item->setRequired($field->required ? true : false); $item->setUseRte($field->richtext ? true : false); $item->setRows($field->rows); $item->setCols($field->cols); $item->setValue($value); break; case self::FIELDTYPE_PASSWORD: $item = new ilPasswordInputGUI($field->title, 'field_' . $field->field_name); $item->setInfo($field->description); $item->setRequired($field->required ? true : false); $item->setValue($value); break; case self::FIELDTYPE_CHECKBOX: $item = new ilCheckboxInputGUI($field->title, 'field_' . $field->field_name); $item->setInfo($field->description); if ($value) { $item->setChecked(true); } break; case self::FIELDTYPE_RADIO: $item = new ilRadioGroupInputGUI($field->title, 'field_' . $field->field_name); $item->setInfo($field->description); $item->setValue($value); foreach ($field->options as $option) { $ropt = new ilRadioOption($option->title, $option->value); $ropt->setInfo($option->description); // add the sub items to the option $item->addOption($ropt); $this->addFormElements($ropt, $a_values, $a_level, $field->field_name, $option->value, $a_maxdepth - 1); } break; default: continue 2; } // add the item to the form or to the parent item if (is_a($a_object, 'ilPropertyFormGUI')) { $a_object->addItem($item); } else { $a_object->addSubItem($item); } // add the sub items to the item if (is_a($item, 'ilSubEnabledFormPropertyGUI')) { $this->addFormElements($item, $a_level, $a_values, $field->field_name, '', $a_maxdepth - 1); } } }
/** * Creates the output of the feedback page for a single choice question * * @access public */ function feedback($checkonly = false) { $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('feedback_answers')); $form->setTableWidth("98%"); $form->setId("feedback"); $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete"); $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1))); $complete->setRequired(false); $complete->setRows(10); $complete->setCols(80); if (!$this->getPreventRteUsage()) { $complete->setUseRte(true); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $complete->addPlugin("latex"); $complete->addButton("latex"); $complete->addButton("pastelatex"); $complete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7'); $form->addItem($complete); $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete"); $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0))); $incomplete->setRequired(false); $incomplete->setRows(10); $incomplete->setCols(80); if (!$this->getPreventRteUsage()) { $incomplete->setUseRte(true); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $incomplete->addPlugin("latex"); $incomplete->addButton("latex"); $incomplete->addButton("pastelatex"); $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7'); $form->addItem($incomplete); if (!$this->getSelfAssessmentEditingMode()) { foreach ($this->object->getErrorData() as $index => $answer) { $caption = $ordinal = $index + 1; $caption .= '. <br />"' . $answer->text_wrong . '" => '; $caption .= '"' . $answer->text_correct . '"'; $caption .= '</i>'; $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption, true), "feedback_answer_{$index}"); $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index))); $answerobj->setRequired(false); $answerobj->setRows(10); $answerobj->setCols(80); $answerobj->setUseRte(true); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $answerobj->addPlugin("latex"); $answerobj->addButton("latex"); $answerobj->addButton("pastelatex"); $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7'); $form->addItem($answerobj); } } global $ilAccess; if ($ilAccess->checkAccess("write", "", $_GET['ref_id']) || $this->getSelfAssessmentEditingMode()) { $form->addCommandButton("saveFeedback", $this->lng->txt("save")); } 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 (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
function addBasicQuestionFormProperties($form) { // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); if (!$this->object->getSelfAssessmentEditingMode()) { // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "comment"); $description->setValue($this->object->getComment()); $description->setRequired(FALSE); $form->addItem($description); } else { // author as hidden field $hi = new ilHiddenInputGUI("author"); $author = ilUtil::prepareFormOutput($this->object->getAuthor()); if (trim($author) == "") { $author = "-"; } $hi->setValue($author); $form->addItem($hi); } // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) { $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "qpl", "assessment"); } } else { $question->setRteTags(self::getSelfAssessmentTags()); $question->setUseTagsForRteOnly(false); } $form->addItem($question); $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool"); $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap')); $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps')); $tpl->parseCurrentBlock(); $button = new ilCustomInputGUI(' ', ''); $button->setHtml($tpl->get()); $form->addItem($button); if (!$this->object->getSelfAssessmentEditingMode()) { // duration $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated"); $duration->setShowHours(TRUE); $duration->setShowMinutes(TRUE); $duration->setShowSeconds(TRUE); $ewt = $this->object->getEstimatedWorkingTime(); $duration->setHours($ewt["h"]); $duration->setMinutes($ewt["m"]); $duration->setSeconds($ewt["s"]); $duration->setRequired(FALSE); $form->addItem($duration); } else { // number of tries if (strlen($this->object->getNrOfTries())) { $nr_tries = $this->object->getNrOfTries(); } else { $nr_tries = $this->object->getDefaultNrOfTries(); } /*if ($nr_tries <= 0) { $nr_tries = 1; }*/ if ($nr_tries < 0) { $nr_tries = 0; } $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries"); $ni->setValue($nr_tries); //$ni->setMinValue(1); $ni->setMinValue(0); $ni->setSize(5); $ni->setMaxLength(5); $ni->setRequired(true); $form->addItem($ni); } }
/** * Init survey settings form * * @return ilPropertyFormGUI */ function initPropertiesForm() { $template_settings = $hide_rte_switch = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("survey_properties"); // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("settings")); $form->addItem($header); // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "svy"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // pool usage $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool"); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1); $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info")); $pool_usage->addOption($opt); $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0); $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info")); $pool_usage->addOption($opt); $pool_usage->setValue($this->object->getPoolUsage()); $form->addItem($pool_usage); // 360°: appraisees if ($this->object->get360Mode()) { $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval"); $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info")); $self_eval->setChecked($this->object->get360SelfEvaluation()); $form->addItem($self_eval); $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate"); $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info")); $self_rate->setChecked($this->object->get360SelfRaters()); $form->addItem($self_rate); $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr"); $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info")); $self_appr->setChecked($this->object->get360SelfAppraisee()); $form->addItem($self_appr); } // activation include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info); $online->setChecked($this->object->isOnline()); $form->addItem($online); $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type'); // $act_type->setInfo($this->lng->txt('svy_availability_until_info')); $act_type->setChecked($this->object->isActivationLimited()); $this->tpl->addJavaScript('./Services/Form/js/date_duration.js'); include_once "Services/Form/classes/class.ilDateDurationInputGUI.php"; $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period"); $dur->setShowTime(true); $date = $this->object->getActivationStartDate(); $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setStartText($this->lng->txt('rep_activation_limited_start')); $date = $this->object->getActivationEndDate(); $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setEndText($this->lng->txt('rep_activation_limited_end')); $act_type->addSubItem($dur); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity'); $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $act_type->addSubItem($visible); $form->addItem($act_type); // before start $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_before_start')); $form->addItem($section); // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->setInfo($this->lng->txt("survey_introduction_info")); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->addButton("pastelatex"); $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch); $form->addItem($intro); // access $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_access')); $form->addItem($section); // enable start date $start = $this->object->getStartDate(); $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date"); $enablestartingtime->setValue(1); // $enablestartingtime->setOptionTitle($this->lng->txt("enabled")); $enablestartingtime->setChecked($start); // start date $startingtime = new ilDateTimeInputGUI('', 'start_date'); $startingtime->setShowTime(true); if ($start) { $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); // enable end date $end = $this->object->getEndDate(); $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date"); $enableendingtime->setValue(1); // $enableendingtime->setOptionTitle($this->lng->txt("enabled")); $enableendingtime->setChecked($end); // end date $endingtime = new ilDateTimeInputGUI('', 'end_date'); $endingtime->setShowTime(true); if ($end) { $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // anonymization if (!$this->object->get360Mode()) { $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes"); $codes->setInfo($this->lng->txt("survey_access_codes_info")); $codes->setChecked(!$this->object->isAccessibleWithoutCode()); $form->addItem($codes); if ($this->object->_hasDatasets($this->object->getSurveyId())) { $codes->setDisabled(true); } } // question behaviour $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour')); $form->addItem($section); // show question titles $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles"); $show_question_titles->setValue(1); $show_question_titles->setChecked($this->object->getShowQuestionTitles()); $form->addItem($show_question_titles); // finishing $info = new ilFormSectionHeaderGUI(); $info->setTitle($this->lng->txt("svy_settings_section_finishing")); $form->addItem($info); $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own"); $view_own->setInfo($this->lng->txt("svy_results_view_own_info")); $view_own->setChecked($this->object->hasViewOwnResults()); $form->addItem($view_own); $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own"); $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info")); $mail_own->setChecked($this->object->hasMailOwnResults()); $form->addItem($mail_own); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->addButton("pastelatex"); $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch); $form->addItem($finalstatement); // mail notification $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification"); // $mailnotification->setOptionTitle($this->lng->txt("activate")); $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info")); // #11762 $mailnotification->setValue(1); $mailnotification->setChecked($this->object->getMailNotification()); // addresses $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses"); $mailaddresses->setValue($this->object->getMailAddresses()); $mailaddresses->setSize(80); $mailaddresses->setInfo($this->lng->txt('mailaddresses_info')); $mailaddresses->setRequired(true); // participant data $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata"); $participantdata->setValue($this->object->getMailParticipantData()); $participantdata->setRows(6); $participantdata->setCols(80); $participantdata->setUseRte(false); $participantdata->setInfo($this->lng->txt("mailparticipantdata_info")); // #12755 - because of privacy concerns we restrict user data to a minimum $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login"); $txt = array(); foreach ($placeholders as $placeholder => $caption) { $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption); } $txt = implode("<br />", $txt); $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true); $participantdatainfo->setValue($txt); $mailnotification->addSubItem($mailaddresses); $mailnotification->addSubItem($participantdata); $mailnotification->addSubItem($participantdatainfo); $form->addItem($mailnotification); // tutor notification - currently not available for 360° if (!$this->object->get360Mode()) { // parent course? global $tree; $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp"); if (!$has_parent) { $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs"); } $num_inv = sizeof($this->object->getInvitedUsers()); // notification $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut"); $tut->setChecked($this->object->getTutorNotificationStatus()); $form->addItem($tut); $tut_logins = array(); $tuts = $this->object->getTutorNotificationRecipients(); if ($tuts) { foreach ($tuts as $tut_id) { $tmp = ilObjUser::_lookupName($tut_id); if ($tmp["login"]) { $tut_logins[] = $tmp["login"]; } } } $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids"); $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true)); $tut_ids->setRequired(true); $tut_ids->setMulti(true); $tut_ids->setMultiValues($tut_logins); $tut_ids->setValue(array_shift($tut_logins)); $tut->addSubItem($tut_ids); $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp"); $tut_grp->setRequired(true); $tut_grp->setValue($this->object->getTutorNotificationTarget()); $tut->addSubItem($tut_grp); $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE); if (!$has_parent) { $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive")); } $tut_grp->addOption($tut_grp_crs); $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS); $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv)); $tut_grp->addOption($tut_grp_inv); } // reminders // reminder - currently not available for 360° if (!$this->object->get360Mode()) { $info = new ilFormSectionHeaderGUI(); $info->setTitle($this->lng->txt("svy_settings_section_reminders")); $form->addItem($info); $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd"); $rmd->setChecked($this->object->getReminderStatus()); $form->addItem($rmd); $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start"); $rmd_start->setRequired(true); $start = $this->object->getReminderStart(); if ($start) { $rmd_start->setDate($start); } $rmd->addSubItem($rmd_start); $end = $this->object->getReminderEnd(); $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end"); $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end); if ($end) { $rmd_end->setDate($end); } $rmd->addSubItem($rmd_end); $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq"); $rmd_freq->setRequired(true); $rmd_freq->setSize(3); $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days")); $rmd_freq->setValue($this->object->getReminderFrequency()); $rmd_freq->setMinValue(1); $rmd->addSubItem($rmd_freq); $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp"); $rmd_grp->setRequired(true); $rmd_grp->setValue($this->object->getReminderTarget()); $rmd->addSubItem($rmd_grp); $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE); if (!$has_parent) { $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive")); } $rmd_grp->addOption($rmd_grp_crs); $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS); $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv)); $rmd_grp->addOption($rmd_grp_inv); } // results $results = new ilFormSectionHeaderGUI(); $results->setTitle($this->lng->txt("results")); $form->addItem($results); // evaluation access if (!$this->object->get360Mode()) { $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access"); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_off_info")); $evaluation_access->addOption($option); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_all_info")); $evaluation_access->addOption($option); $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, ''); $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info")); $evaluation_access->addOption($option); $evaluation_access->setValue($this->object->getEvaluationAccess()); $form->addItem($evaluation_access); $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options"); $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers"); $option->setInfo($this->lng->txt("survey_results_personalized_info")); $anonymization_options->addOption($option); $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon"); $option->setInfo($this->lng->txt("survey_results_anonymized_info")); $anonymization_options->addOption($option); $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers"); $form->addItem($anonymization_options); if ($this->object->_hasDatasets($this->object->getSurveyId())) { $anonymization_options->setDisabled(true); } } else { $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res"); $ts_results->setValue($this->object->get360Results()); $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE); $option->setInfo($this->lng->txt("survey_360_results_none_info")); $ts_results->addOption($option); $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN); $option->setInfo($this->lng->txt("survey_360_results_own_info")); $ts_results->addOption($option); $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL); $option->setInfo($this->lng->txt("survey_360_results_all_info")); $ts_results->addOption($option); $form->addItem($ts_results); } // competence service activation for 360 mode include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php"; $skmg_set = new ilSkillManagementSettings(); if ($this->object->get360Mode() && $skmg_set->isActivated()) { $other = new ilFormSectionHeaderGUI(); $other->setTitle($this->lng->txt("other")); $form->addItem($other); $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service"); $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info")); $skill_service->setChecked($this->object->get360SkillService()); $form->addItem($skill_service); } $form->addCommandButton("saveProperties", $this->lng->txt("save")); // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("multiplechoice"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setValue($this->object->label); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setValue($this->object->getDescription()); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7"); $form->addItem($question); // subtype $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type"); $subtype->setRequired(false); $subtype->setValue($this->object->getSubtype()); $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr"); foreach ($subtypes as $idx => $st) { $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx)); } $form->addItem($subtype); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_appearance")); $form->addItem($header); // column separators $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators"); $column_separators->setValue(1); $column_separators->setInfo($this->lng->txt("matrix_column_separators_description")); $column_separators->setChecked($this->object->getColumnSeparators()); $column_separators->setRequired(false); $form->addItem($column_separators); // row separators $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators"); $row_separators->setValue(1); $row_separators->setInfo($this->lng->txt("matrix_row_separators_description")); $row_separators->setChecked($this->object->getRowSeparators()); $row_separators->setRequired(false); $form->addItem($row_separators); // neutral column separators $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator"); $neutral_column_separator->setValue(1); $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description")); $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator()); $neutral_column_separator->setRequired(false); $form->addItem($neutral_column_separator); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_columns")); $form->addItem($header); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $columns = new ilCategoryWizardInputGUI("", "columns"); $columns->setRequired(false); $columns->setAllowMove(true); $columns->setShowWizard(true); $columns->setShowNeutralCategory(true); $columns->setDisabledScale(false); $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer')); $columns->setCategoryText($this->lng->txt('matrix_standard_answers')); $columns->setShowSavePhrase(true); if (!$this->object->getColumnCount()) { $this->object->columns->addCategory(""); } $columns->setValues($this->object->getColumns()); $form->addItem($columns); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_column_settings")); $form->addItem($header); // bipolar adjectives $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives")); $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description")); // left pole $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1"); $bipolar1->setValue($this->object->getBipolarAdjective(0)); $bipolar1->setRequired(false); $bipolar->addSubItem($bipolar1); // right pole $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2"); $bipolar2->setValue($this->object->getBipolarAdjective(1)); $bipolar2->setRequired(false); $bipolar->addSubItem($bipolar2); $form->addItem($bipolar); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("matrix_rows")); $form->addItem($header); // matrix rows include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php"; $rows = new ilMatrixRowWizardInputGUI("", "rows"); $rows->setRequired(false); $rows->setAllowMove(true); $rows->setLabelText($this->lng->txt('label')); $rows->setUseOtherAnswer(true); if ($this->object->getRowCount() == 0) { $this->object->getRows()->addCategory(""); } $rows->setValues($this->object->getRows()); $form->addItem($rows); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) { $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("ADM_CONTENT", $form->getHTML()); } return $errors; }
/** * builds the questions hints form * * @access private * @global ilCtrl $ilCtrl * @global ilLanguage $lng * @return ilPropertyFormGUI $form */ private function buildForm(ilAssQuestionHint $questionHint = null) { global $ilCtrl, $lng; require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php'; require_once 'Services/Form/classes/class.ilNumberInputGUI.php'; require_once 'Services/Form/classes/class.ilHiddenInputGUI.php'; $form = new ilPropertyFormGUI(); $form->setTableWidth('100%'); if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { // form input: hint text $areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text'); $areaInp->setRequired(true); $areaInp->setRows(10); $areaInp->setCols(80); if (!$this->questionOBJ->getPreventRteUsage()) { $areaInp->setUseRte(true); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $areaInp->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment'); $areaInp->addPlugin("latex"); $areaInp->addButton("latex"); $areaInp->addButton("pastelatex"); $form->addItem($areaInp); } // form input: hint points $numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points'); $numInp->allowDecimals(true); $numInp->setRequired(true); $numInp->setSize(3); $form->addItem($numInp); if ($questionHint instanceof ilAssQuestionHint) { // build form title for an existing hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_edit'), $questionHint->getIndex(), $this->questionOBJ->getTitle())); // hidden input: hint id $hiddenInp = new ilHiddenInputGUI('hint_id'); $form->addItem($hiddenInp); // init values require_once 'Services/Utilities/classes/class.ilUtil.php'; if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { $areaInp->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true)); } $numInp->setValue($questionHint->getPoints()); $hiddenInp->setValue($questionHint->getId()); } else { // build form title for a new hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_create'), $this->questionOBJ->getTitle())); } if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) { if ($questionHint instanceof ilAssQuestionHint) { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points'); } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page'); } } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save'); } $form->setFormAction($ilCtrl->getFormAction($this)); $form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel')); $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel); return $form; }
/** * Initializes SmiliesEditForm and returns it. * * @global ilCtrl2 $ilCtrl * @global ilLanguage $lng * @return ilPropertyFormGUI */ public function initSmiliesEditForm($form_data) { global $ilCtrl, $lng; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setValuesByArray($form_data); $table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : ""; $ilCtrl->saveParameter($this->gui, 'smiley_id'); $this->form_gui->setFormAction($ilCtrl->getFormAction($this->gui, 'smiley-updateSmiliesObject') . $table_nav); $sec_l = new ilFormSectionHeaderGUI(); $sec_l->setTitle($lng->txt('chatroom_edit_smiley')); $this->form_gui->addItem($sec_l); include_once "Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php"; $inp = new ilChatroomSmiliesCurrentSmileyFormElement($lng->txt('chatroom_current_smiley_image_path'), 'chatroom_current_smiley_image_path'); $inp->setValue($form_data['chatroom_current_smiley_image_path']); $this->form_gui->addItem($inp); $inp = new ilImageFileInputGUI($lng->txt('chatroom_image_path'), 'chatroom_image_path'); $inp->setRequired(false); $inp->setInfo($lng->txt('chatroom_smiley_image_only_if_changed')); $this->form_gui->addItem($inp); $inp = new ilTextAreaInputGUI($lng->txt('chatroom_smiley_keywords'), 'chatroom_smiley_keywords'); $inp->setValue($form_data['chatroom_smiley_keywords']); $inp->setUseRte(false); $inp->setRequired(true); $inp->setInfo($lng->txt('chatroom_smiley_keywords_one_per_line_note')); $this->form_gui->addItem($inp); $inp = new ilHiddenInputGUI('chatroom_smiley_id'); $this->form_gui->addItem($inp); $this->form_gui->addCommandButton('smiley-updateSmiliesObject', $lng->txt('submit')); $this->form_gui->addCommandButton('smiley', $lng->txt('cancel')); return $this->form_gui; }
public function StatutoryRegulationsObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'saveStatutoryRegulations')); $form->setTitle($this->lng->txt('statutory_regulations')); $form->setTableWidth('100%'); // message $post_gui = new ilTextAreaInputGUI($this->lng->txt('content'), 'statutory_regulations'); $post_gui->setCols(50); $post_gui->setRows(15); $post_gui->setUseRte(true); $post_gui->addPlugin('latex'); $post_gui->addButton('latex'); $post_gui->addButton('pastelatex'); $post_gui->addPlugin('ilimgupload'); $post_gui->addButton('ilimgupload'); $post_gui->removePlugin('advlink'); $post_gui->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN); $post_gui->removePlugin('image'); $post_gui->usePurifier(true); $post_gui->setRTERootBlockElement(''); $post_gui->setRTESupport(ilObject::_lookupObjId($this->ref_id), 'pays~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7'); $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect', 'image')); // purifier require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php'; require_once 'Services/RTE/classes/class.ilRTE.php'; $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post')); $post_gui->setValue(ilRTE::_replaceMediaObjectImageSrc($this->genSetData->get('statutory_regulations'), 1)); $form->addItem($post_gui); // show staturaltyio regulations in shoppingcart $cb_showShoppingCart = new ilCheckboxInputGUI($this->lng->txt('show_sr_shoppingcart'), 'show_sr_shoppingcart'); $cb_showShoppingCart->setInfo($this->lng->txt('show_sr_shoppingcart_info')); $cb_showShoppingCart->setValue(1); $cb_showShoppingCart->setChecked($this->genSetData->get('show_sr_shoppingcart')); $form->addItem($cb_showShoppingCart); // attach staturaltyio regulations at invoice $cb_attachInvoice = new ilCheckboxInputGUI($this->lng->txt('attach_sr_invoice'), 'attach_sr_invoice'); $cb_attachInvoice->setInfo($this->lng->txt('attach_sr_invoice_info')); $cb_attachInvoice->setValue(1); $cb_attachInvoice->setChecked($this->genSetData->get('attach_sr_invoice')); $form->addItem($cb_attachInvoice); $form->addCommandButton('saveStatutoryRegulations', $this->lng->txt('save')); $this->tpl->setVariable('FORM', $form->getHTML()); }
protected function initHeadingForm($a_question_id = null) { $survey_questions = $this->object->getSurveyQuestions(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "")); // heading $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading"); $heading->setRows(10); $heading->setCols(80); $heading->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN); $heading->setRTESupport($this->object->getId(), "svy", "survey"); $heading->setRequired(true); $form->addItem($heading); $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore"); $options = array(); foreach ($survey_questions as $key => $value) { $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\""; } $insertbefore->setOptions($options); $insertbefore->setRequired(true); $form->addItem($insertbefore); $form->addCommandButton("saveHeading", $this->lng->txt("save")); $form->addCommandButton("questions", $this->lng->txt("cancel")); if ($a_question_id) { $form->setTitle($this->lng->txt("edit_heading")); $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"])); $insertbefore->setValue($a_question_id); $insertbefore->setDisabled(true); } else { $form->setTitle($this->lng->txt("add_heading")); } return $form; }
/** * Init assignment form. * * @param int $a_mode "create"/"edit" */ public function initAssignmentForm($a_mode = "create") { global $lng, $ilCtrl, $ilSetting; // init form $lng->loadLanguageModule("form"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setTableWidth("600px"); if ($a_mode == "edit") { $this->form->setTitle($lng->txt("exc_edit_assignment")); } else { $this->form->setTitle($lng->txt("exc_new_assignment")); } $this->form->setFormAction($ilCtrl->getFormAction($this)); // type include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $types = array(ilExAssignment::TYPE_UPLOAD => $this->lng->txt("exc_type_upload"), ilExAssignment::TYPE_UPLOAD_TEAM => $this->lng->txt("exc_type_upload_team"), ilExAssignment::TYPE_TEXT => $this->lng->txt("exc_type_text")); if (!$ilSetting->get('disable_wsp_blogs')) { $types[ilExAssignment::TYPE_BLOG] = $this->lng->txt("exc_type_blog"); } if ($ilSetting->get('user_portfolios')) { $types[ilExAssignment::TYPE_PORTFOLIO] = $this->lng->txt("exc_type_portfolio"); } if (sizeof($types) > 1) { $ty = new ilSelectInputGUI($this->lng->txt("exc_assignment_type"), "type"); $ty->setOptions($types); $ty->setRequired(true); } else { $ty = new ilHiddenInputGUI("type"); $ty->setValue(ilExAssignment::TYPE_UPLOAD); } $this->form->addItem($ty); // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setMaxLength(200); $ti->setRequired(true); $this->form->addItem($ti); // start time y/n $cb = new ilCheckboxInputGUI($this->lng->txt("exc_start_time"), "start_time_cb"); $this->form->addItem($cb); // start time $edit_date = new ilDateTimeInputGUI("", "start_time"); $edit_date->setShowTime(true); $cb->addSubItem($edit_date); // deadline y/n $dcb = new ilCheckboxInputGUI($this->lng->txt("exc_deadline"), "deadline_cb"); $dcb->setChecked(true); $this->form->addItem($dcb); // Deadline $edit_date = new ilDateTimeInputGUI($lng->txt(""), "deadline"); $edit_date->setShowTime(true); $dcb->addSubItem($edit_date); // mandatory $cb = new ilCheckboxInputGUI($this->lng->txt("exc_mandatory"), "mandatory"); $cb->setInfo($this->lng->txt("exc_mandatory_info")); $cb->setChecked(true); $this->form->addItem($cb); // Work Instructions $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction"); $desc_input->setRows(20); $desc_input->setUseRte(true); $desc_input->setRteTagSet("mini"); $this->form->addItem($desc_input); // files if ($a_mode == "create") { $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files'); $files->setFilenames(array(0 => '')); $this->form->addItem($files); } // peer review $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer"); $peer->setInfo($this->lng->txt("exc_peer_review_ass_setting_info")); $this->form->addItem($peer); if ($a_mode == "create") { $peer->setInfo($lng->txt("exc_peer_review_info")); } $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min"); $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); $peer_min->setRequired(true); $peer_min->setValue(5); $peer_min->setSize(3); $peer_min->setValue(2); $peer->addSubItem($peer_min); $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl"); $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info")); $peer_dl->enableDateActivation("", "peer_dl_tgl"); $peer_dl->setShowTime(true); $peer->addSubItem($peer_dl); $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file"); $peer_file->setInfo($lng->txt("exc_peer_review_file_info")); $peer->addSubItem($peer_file); $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl"); $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info")); $peer->addSubItem($peer_prsl); if ($a_mode != "create" && $this->ass && $this->ass->getDeadline() && $this->ass->getDeadline() < time()) { $peer_prsl->setDisabled(true); } // global feedback $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb"); $this->form->addItem($fb); $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file"); // $fb_file->setRequired(true); $fb_file->setALlowDeletion(true); $fb->addSubItem($fb_file); $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date"); $fb_date->setRequired(true); $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE)); $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION)); $fb->addSubItem($fb_date); $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron"); $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info")); $fb->addSubItem($fb_cron); // save and cancel commands if ($a_mode == "create") { $this->form->addCommandButton("saveAssignment", $lng->txt("save")); $this->form->addCommandButton("listAssignments", $lng->txt("cancel")); } else { $this->form->addCommandButton("updateAssignment", $lng->txt("save")); $this->form->addCommandButton("listAssignments", $lng->txt("cancel")); } }
/** * Creates an output of the edit form for the question */ public function editQuestion() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt($this->getQuestionType())); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("essay"); // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); // label $label = new ilTextInputGUI($this->lng->txt("label"), "label"); $label->setValue($this->object->label); $label->setInfo($this->lng->txt("label_info")); $label->setRequired(false); $form->addItem($label); // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "description"); $description->setValue($this->object->getDescription()); $description->setRequired(FALSE); $form->addItem($description); // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7"); $form->addItem($question); // maximum number of characters $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars"); $maxchars->setRequired(false); $maxchars->setSize(5); if ($this->object->getMaxChars() > 0) { $maxchars->setValue($this->object->getMaxChars()); } $maxchars->setDecimals(0); $form->addItem($maxchars); // textwidth $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth"); $textwidth->setRequired(true); $textwidth->setSize(3); $textwidth->setValue($this->object->getTextWidth()); $textwidth->setDecimals(0); $textwidth->setMinValue(10); $form->addItem($textwidth); // textheight $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight"); $textheight->setRequired(true); $textheight->setSize(3); $textheight->setValue($this->object->getTextHeight()); $textheight->setDecimals(0); $textheight->setMinValue(1); $form->addItem($textheight); // obligatory $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getObligatory()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); $this->addCommandButtons($form); $errors = false; if ($this->isSaveCommand()) { $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("ADM_CONTENT", $form->getHTML()); } return $errors; }