/** * Init form. * * @param int $a_mode Edit Mode */ public function initCreateFolder() { global $ilCtrl, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setId("cld_create_folder"); $name = new ilTextInputGUI($lng->txt("cld_folder_name"), "folder_name"); $name->setRequired(true); $this->form->addItem($name); // folder id $id = new ilHiddenInputGUI("parent_folder_id"); $id->setValue($_POST["id"]); $this->form->addItem($id); $this->form->addCommandButton("createFolder", $lng->txt("cld_create_folder")); $this->form->addCommandButton("cancel", $lng->txt("cancel")); $this->form->setTitle($lng->txt("cld_create_folder")); $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->setTarget("cld_blank_target"); }
/** * Build property form * @param string $a_mode * @param int $id * @return object */ function initForm($a_mode = "create", $id = NULL) { global $lng, $ilCtrl, $ilObjDataCache; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form_gui = new ilPropertyFormGUI(); $title = new ilTextInputGUI($lng->txt("title"), "title"); $title->setRequired(true); $title->setSize(40); $title->setMaxLength(120); $form_gui->addItem($title); $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc"); $desc->setCols(70); $desc->setRows(15); $form_gui->addItem($desc); $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file"); $file->setALlowDeletion(true); $form_gui->addItem($file); $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items"); $nr->setRequired(true); $nr->setSize(3); $nr->setMaxLength(3); $form_gui->addItem($nr); if ($this->pool_has_schedule) { $options = array(); include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php'; foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) { $options[$schedule["booking_schedule_id"]] = $schedule["title"]; } $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule"); $schedule->setRequired(true); $schedule->setOptions($options); $form_gui->addItem($schedule); } $post = new ilFormSectionHeaderGUI(); $post->setTitle($lng->txt("book_post_booking_information")); $form_gui->addItem($post); $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text"); $pdesc->setCols(70); $pdesc->setRows(15); $form_gui->addItem($pdesc); $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file"); $pfile->setALlowDeletion(true); $form_gui->addItem($pfile); if ($a_mode == "edit") { $form_gui->setTitle($lng->txt("book_edit_object")); $item = new ilHiddenInputGUI('object_id'); $item->setValue($id); $form_gui->addItem($item); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $obj = new ilBookingObject($id); $title->setValue($obj->getTitle()); $desc->setValue($obj->getDescription()); $nr->setValue($obj->getNrOfItems()); $pdesc->setValue($obj->getPostText()); $file->setValue($obj->getFile()); $pfile->setValue($obj->getPostFile()); if (isset($schedule)) { $schedule->setValue($obj->getScheduleId()); } $form_gui->addCommandButton("update", $lng->txt("save")); } else { $form_gui->setTitle($lng->txt("book_add_object")); $form_gui->addCommandButton("save", $lng->txt("save")); $form_gui->addCommandButton("render", $lng->txt("cancel")); } $form_gui->setFormAction($ilCtrl->getFormAction($this)); return $form_gui; }
/** * 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")); } }
/** * Insert new question form */ function insert($a_mode = "create") { global $ilUser, $lng, $ilCtrl; $this->setInsertTabs("new_question"); $this->displayValidationError(); // get all question types (@todo: we have to check, whether they are // suitable for self assessment or not) include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $all_types = ilObjQuestionPool::_getSelfAssessmentQuestionTypes(); $options = array(); $all_types = ilUtil::sortArray($all_types, "order", "asc", true, true); foreach ($all_types as $k => $v) { $options[$v["type_tag"]] = $k; } // new table form (input of rows and columns) include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); $this->form_gui->setTitle($lng->txt("cont_ed_insert_pcqst")); // Select Question Type $qtype_input = new ilSelectInputGUI($lng->txt("cont_question_type"), "q_type"); $qtype_input->setOptions($options); $qtype_input->setRequired(true); $this->form_gui->addItem($qtype_input); // additional content editor // assessment include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php"; if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) { $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode"); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT)); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT)); $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $this->form_gui->addItem($ri, true); } else { $hi = new ilHiddenInputGUI("question_content_editing_type"); $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $this->form_gui->addItem($hi, true); } // Select Question Pool /* include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"); $qpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, false, true, false, "write"); if (count($qpools) > 0) { $pool_options = array(); foreach ($qpools as $key => $value) { $pool_options[$key] = $value["title"]; } $pool_input = new ilSelectInputGUI($lng->txt("cont_question_pool"), "qpool_ref_id"); $pool_input->setOptions($pool_options); $pool_input->setRequired(true); $this->form_gui->addItem($pool_input); } else { $pool_input = new ilTextInputGUI($lng->txt("cont_question_pool"), "qpool_title"); $pool_input->setRequired(true); $this->form_gui->addItem($pool_input); } */ if ($a_mode == "edit_empty") { $this->form_gui->addCommandButton("edit", $lng->txt("save")); } else { $this->form_gui->addCommandButton("create_pcqst", $lng->txt("save")); $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel")); } $this->tpl->setContent($this->form_gui->getHTML()); }
public function editPriceObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id']; $price = ilPaymentPrices::_getPrice($price_id); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false); if ($tmp_obj) { $form->setTitle($tmp_obj->getTitle()); } else { $form->setTitle($this->lng->txt('object_not_found')); } //price_type $radio_group = new ilRadioGroupInputGUI('', 'price_type'); $radio_group->setTitle($this->lng->txt('duration')); $radio_group->setRequired(true); $radio_group->setValue($price['price_type']); $radio_group->setPostVar('price_type'); $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH); // duration month $oDuration = new ilNumberInputGUI(); $oDuration->setTitle($this->lng->txt('paya_months')); $oDuration->setSize('20%'); $oDuration->setValue($price['duration']); $oDuration->setPostVar('duration_month'); $radio_option_1->addSubItem($oDuration); $radio_group->addOption($radio_option_1); $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE); // duration_date from $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setTitle($this->lng->txt('cal_from')); $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE)); $o_date_from->setPostVar('duration_date_from'); $radio_option_3->addSubItem($o_date_from); // duration_date until $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setTitle($this->lng->txt('cal_until')); $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE)); $o_date_until->setPostVar('duration_date_until'); $radio_option_3->addSubItem($o_date_until); $radio_group->addOption($radio_option_3); $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION); $radio_group->addOption($radio_option_2); $form->addItem($radio_group); // description $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $oDescription->setRows(4); $oDescription->setCols(35); $oDescription->setValue($price['description']); $form->addItem($oDescription); // price $oPrice = new ilNumberInputGUI(); $oPrice->setTitle($this->lng->txt('price_a')); $oPrice->setSize('20%'); $oPrice->setRequired(true); $oPrice->setValue($price['price']); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $oPrice->setInfo($genSet->get('currency_unit')); $oPrice->setPostVar('price'); $oPrice->allowDecimals(true); $form->addItem($oPrice); //extension $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension'); $oExtension->setChecked($price['extension']); $form->addItem($oExtension); $o_hidden_1 = new ilHiddenInputGUI('pobject_id'); $o_hidden_1->setValue((int) $_GET['pobject_id']); $o_hidden_1->setPostVar('pobject_id'); $o_hidden_2 = new ilHiddenInputGUI('price_id'); $o_hidden_2->setValue((int) $_GET['price_id']); $o_hidden_2->setPostVar('price_id'); $form->addItem($o_hidden_1); $form->addItem($o_hidden_2); $form->addCommandButton('updatePrice', $this->lng->txt('save')); $form->addCommandButton('editPrices', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $form->getHTML()); }
/** * Init set page layout form. */ public function initSetPageLayoutForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); if (is_array($_POST["id"])) { foreach ($_POST["id"] as $id) { $hi = new ilHiddenInputGUI("id[]"); $hi->setValue($id); $this->form->addItem($hi); } } $layout = self::getLayoutOption($lng->txt("cont_layout"), "layout", $this->object->getLayout()); $this->form->addItem($layout); $this->form->addCommandButton("savePageLayout", $lng->txt("save")); $this->form->addCommandButton("pages", $lng->txt("cancel")); $this->form->setTitle($lng->txt("cont_set_layout")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
/** * Get confirmation screen HTML. * * @return string HTML code. */ public final function getHTML() { global $lng; ilUtil::sendQuestion($this->getHeaderText()); include_once "./Services/Utilities/classes/class.ilConfirmationTableGUI.php"; // delete/handle items if (count($this->item) > 0) { $ctab = new ilConfirmationTableGUI($this->use_images); $ctab->setData($this->item); // other buttons foreach ($this->buttons as $b) { $ctab->addCommandButton($b["cmd"], $b["txt"]); } $ctab->addCommandButton($this->confirm_cmd, $this->confirm_txt); $ctab->addCommandButton($this->cancel_cmd, $this->cancel_txt); $ctab->setFormAction($this->getFormAction()); foreach ($this->hidden_item as $hidden_item) { $ctab->addHiddenInput($hidden_item["var"], $hidden_item["value"]); } if ($this->form_name) { $ctab->setFormName($this->form_name); } return $ctab->getHTML(); } else { $tb = new ilToolbarGUI(); $tb->setPreventDoubleSubmission(true); $tb->setFormAction($this->getFormAction()); if ($this->hidden_item) { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; foreach ($this->hidden_item as $hidden_item) { $hiddenInput = new ilHiddenInputGUI($hidden_item['var']); $hiddenInput->setValue($hidden_item['value']); $tb->addInputItem($hiddenInput); } } require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php'; $confirm = ilSubmitButton::getInstance(); $confirm->setCommand($this->confirm_cmd); $confirm->setCaption($this->confirm_txt, false); $cancel = ilSubmitButton::getInstance(); $cancel->setCommand($this->cancel_cmd); $cancel->setCaption($this->cancel_txt, false); $tb->addButtonInstance($confirm); $tb->addButtonInstance($cancel); return $tb->getHTML(); } }
/** * Init map creation/update form */ function initCharacteristicForm($a_target, $a_types) { global $ilCtrl, $lng; // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setTitle($this->lng->txt("cont_choose_characteristic")); if ($a_types["par"] == "par") { $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_text"), "char_par"); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $options = ilPCParagraphGUI::_getCharacteristics($this->page_gui->getStyleId()); $select_prop->setOptions($options); $this->form->addItem($select_prop); } if ($a_types["sec"] == "sec") { $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_section"), "char_sec"); include_once "./Services/COPage/classes/class.ilPCSectionGUI.php"; $options = ilPCSectionGUI::_getCharacteristics($this->page_gui->getStyleId()); $select_prop->setOptions($options); $this->form->addItem($select_prop); } foreach ($a_target as $t) { $hidden = new ilHiddenInputGUI("target[]"); $hidden->setValue($t); $this->form->addItem($hidden); } $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->addCommandButton("assignCharacteristic", $lng->txt("save")); $this->form->addCommandButton("showPage", $lng->txt("cancel")); }
/** * Init edit form * * @param int $a_mode Edit Mode */ public function initEditForm($a_mode = "edit") { global $lng, $ilCtrl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); if ($a_mode != "add_file") { // title $ti = new ilTextInputGUI($lng->txt("title"), "flst_title"); $ti->setMaxLength(80); $ti->setSize(40); $form->addItem($ti); // language require_once "Services/MetaData/classes/class.ilMDLanguageItem.php"; $lang = ilMDLanguageItem::_getLanguages(); $si = new ilSelectInputGUI($lng->txt("language"), "flst_language"); $si->setOptions($lang); $form->addItem($si); } if (in_array($a_mode, array("create", "add_file"))) { // file $fi = new ilFileInputGUI($lng->txt("file"), "file"); $fi->setRequired(true); $form->addItem($fi); } else { if (in_array($a_mode, array("select_file"))) { // file $ne = new ilNonEditableValueGUI($lng->txt("file"), ""); if (isset($_GET["file_ref_id"])) { include_once "./Modules/File/classes/class.ilObjFile.php"; $file_obj = new ilObjFile((int) $_GET["file_ref_id"]); if (is_object($file_obj)) { // ref id as hidden input $hi = new ilHiddenInputGUI("file_ref_id"); $hi->setValue((int) $_GET["file_ref_id"]); $form->addItem($hi); $ne->setValue($file_obj->getTitle()); } } else { if (isset($_GET["fl_wsp_id"])) { // we need the object id for the instance include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $node = $tree->getNodeData((int) $_GET["fl_wsp_id"]); include_once "./Modules/File/classes/class.ilObjFile.php"; $file_obj = new ilObjFile($node["obj_id"], false); if (is_object($file_obj)) { // ref id as hidden input $hi = new ilHiddenInputGUI("file_ref_id"); $hi->setValue("wsp_" . (int) $node["obj_id"]); $form->addItem($hi); $ne->setValue($file_obj->getTitle()); } $this->tpl->parseCurrentBlock(); } } $form->addItem($ne); } } switch ($a_mode) { case "edit": $ti->setValue($this->content_obj->getListTitle()); $si->setValue($this->content_obj->getLanguage()); $form->addCommandButton("saveProperties", $lng->txt("save")); $form->addCommandButton("cancelUpdate", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_edit_file_list_properties")); break; case "create": case "select_file": if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") { $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]]; } else { $s_lang = $ilUser->getLanguage(); } $si->setValue($s_lang); $form->addCommandButton("create_flst", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_insert_file_list")); break; case "add_file": $form->addCommandButton("insertNewFileItem", $lng->txt("save")); $form->addCommandButton("editFiles", $lng->txt("cancel")); $form->setTitle($lng->txt("cont_insert_file_item")); break; } $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
/** * init Form */ public function initForm() { $this->form = new ilPropertyFormGUI(); $prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl'; // Used by datacolleciton.js to select input elements $this->form->setId($prefix . $this->table_id . $this->record_id); $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->table_id); $this->form->addItem($hidden_prop); if ($this->record_id) { $hidden_prop = new ilHiddenInputGUI("record_id"); $hidden_prop->setValue($this->record_id); $this->form->addItem($hidden_prop); } $this->ctrl->setParameter($this, "record_id", $this->record_id); $this->form->setFormAction($this->ctrl->getFormAction($this)); $allFields = $this->table->getRecordFields(); $inline_css = ''; foreach ($allFields as $field) { $item = ilDataCollectionDatatype::getInputField($field); if ($item === NULL) { continue; // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input } if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $fieldref = $field->getFieldRef(); $reffield = ilDataCollectionCache::getFieldCache($fieldref); $options = array(); if (!$field->isNRef()) { $options[""] = $this->lng->txt('dcl_please_select'); } $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId()); foreach ($reftable->getRecords() as $record) { // If the referenced field is MOB or FILE, we display the filename in the dropdown switch ($reffield->getDatatypeId()) { case ilDataCollectionDatatype::INPUTFORMAT_FILE: $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $file_obj->getFileName(); break; case ilDataCollectionDatatype::INPUTFORMAT_MOB: $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $media_obj->getTitle(); break; case ilDataCollectionDatatype::INPUTFORMAT_DATETIME: $options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref); break; default: $options[$record->getId()] = $record->getRecordFieldValue($fieldref); break; } } asort($options); $item->setOptions($options); if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { // FSX use this to apply to MultiSelectInputGUI // if (!$field->isNRef()) { // addCustomAttribute only defined for single selects if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) { $item->addCustomAttribute('data-ref="1"'); $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"'); $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"'); } // } } if ($item instanceof ilMultiSelectInputGUI) { $item->setWidth(400); $item->setHeight(100); $inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} '; } } if ($this->record_id) { $record = ilDataCollectionCache::getRecordCache($this->record_id); } $item->setRequired($field->getRequired()); //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it. if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) { if ($this->record_id and $record->getId()) { $field_value = $record->getRecordFieldValue($field->getId()); if ($field_value) { $item->setRequired(false); } } // If this is an ajax request to return the form, input files are currently not supported if ($this->ctrl->isAsynch()) { $item->setDisabled(true); } } if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) { $item->setDisabled(true); } $this->form->addItem($item); } $this->tpl->addInlineCss($inline_css); // Add possibility to change the owner in edit mode if ($this->record_id) { $ownerField = $this->table->getField('owner'); $inputfield = ilDataCollectionDatatype::getInputField($ownerField); $this->form->addItem($inputfield); } // save and cancel commands if ($this->record_id) { $this->form->setTitle($this->lng->txt("dcl_update_record")); $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record")); if (!$this->ctrl->isAsynch()) { $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } } else { $this->form->setTitle($this->lng->txt("dcl_add_new_record")); $this->form->addCommandButton("save", $this->lng->txt("save")); if (!$this->ctrl->isAsynch()) { $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel")); } } $this->ctrl->setParameter($this, "table_id", $this->table_id); $this->ctrl->setParameter($this, "record_id", $this->record_id); }
public function addQuestion() { global $lng, $ilCtrl, $tpl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $ilCtrl->setParameter($this, 'qtype', $_REQUEST['qtype']); $form = new ilPropertyFormGUI(); $ilCtrl->setParameter($this, 'test_express_mode', 1); $form->setFormAction($ilCtrl->getFormAction($this, "handleToolbarCommand")); $form->setTitle($lng->txt("ass_create_question")); include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php'; $pool = new ilObjQuestionPool(); $questionTypes = $pool->getQuestionTypes(false, true); $options = array(); // question type foreach ($questionTypes as $label => $data) { $options[$data['question_type_id']] = $label; } include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype"); $si->setOptions($options); $form->addItem($si, true); // position $questions = $this->test_object->getQuestionTitlesAndIndexes(); if ($questions) { $si = new ilSelectInputGUI($lng->txt("position"), "position"); $options = array('0' => $lng->txt('first')); foreach ($questions as $key => $title) { $options[$key] = $lng->txt('behind') . ' ' . $title . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']'; } $si->setOptions($options); $si->setValue($_REQUEST['q_id']); $form->addItem($si, true); } // content editing mode if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) { $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode"); $ri->addOption(new ilRadioOption($lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT)); $ri->addOption(new ilRadioOption($lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT)); $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $form->addItem($ri, true); } else { $hi = new ilHiddenInputGUI("question_content_editing_type"); $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $form->addItem($hi, true); } if ($this->test_object->getPoolUsage()) { // use pool $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage"); $usage->setRequired(true); $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1); $usage->addOption($no_pool); $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3); $usage->addOption($existing_pool); $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2); $usage->addOption($new_pool); $form->addItem($usage); $usage->setValue(1); $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(FALSE, FALSE, TRUE, FALSE, FALSE, "write"); $pools_data = array(); foreach ($questionpools as $key => $p) { $pools_data[$key] = $p['title']; } $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl"); $pools->setOptions($pools_data); $existing_pool->addSubItem($pools); $name = new ilTextInputGUI($this->lng->txt("name"), "txt_qpl"); $name->setSize(50); $name->setMaxLength(50); $new_pool->addSubItem($name); } $form->addCommandButton("handleToolbarCommand", $lng->txt("submit")); $form->addCommandButton("questions", $lng->txt("cancel")); return $tpl->setContent($form->getHTML()); }
/** * Render item */ function render() { global $lng, $ilCtrl; // parse settings $has_int = $has_ext = $has_radio = false; switch ($this->getAllowedLinkTypes()) { case self::EXT: $has_ext = true; break; case self::INT: $has_int = true; break; case self::BOTH: $has_int = true; $has_ext = true; $has_radio = true; break; } // external if ($has_ext) { $title = $has_radio ? $lng->txt("url") : ""; // external $ti = new ilTextInputGUI($title, $this->getPostVar()); $ti->setMaxLength(200); $ti->setSize(50); } // internal if ($has_int) { $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->getPostVar()); $link = array(get_class($this->getParent()), "ilformpropertydispatchgui", get_class($this), "ilinternallinkgui"); $link = $ilCtrl->getLinkTargetByClass($link, "", false, true, false); $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", ""); $no_disp_class = strpos($this->getValue(), "|") ? "" : " ilNoDisplay"; $itpl = new ilTemplate('tpl.prop_link.html', true, true, 'Services/Form'); $itpl->setVariable("VAL_ID", $this->getPostVar()); $itpl->setVariable("URL_EDIT", $link); $itpl->setVariable("TXT_EDIT", $lng->txt("form_get_link")); $itpl->setVariable("CSS_REMOVE", $no_disp_class); $itpl->setVariable("TXT_REMOVE", $lng->txt("remove")); $ne = new ilNonEditableValueGUI($lng->txt("object"), $this->getPostVar() . "_val", true); // hidden field for selected value $hidden_type = new ilHiddenInputGUI($this->getPostVar() . "_ajax_type"); $hidden_id = new ilHiddenInputGUI($this->getPostVar() . "_ajax_id"); $hidden_target = new ilHiddenInputGUI($this->getPostVar() . "_ajax_target"); } // mode if ($has_radio) { $ext = new ilRadioOption($lng->txt("form_link_external"), "ext"); $ext->addSubItem($ti); $int = new ilRadioOption($lng->txt("form_link_internal"), "int"); $int->addSubItem($ne); $mode = new ilRadioGroupInputGUI("", $this->getPostVar() . "_mode"); $mode->addOption($ext); $mode->addOption($int); } else { $mode = new ilHiddenInputGUI($this->getPostVar() . "_mode"); if ($has_int) { $mode->setValue("int"); } else { $mode->setValue("ext"); } } // value $value = $this->getValue(); if ($value) { if ($has_int && strpos($value, "|")) { $mode->setValue("int"); $value_trans = self::getTranslatedValue($value); $value = explode("|", $value); $hidden_type->setValue($value[0]); $hidden_id->setValue($value[1]); $hidden_target->setValue($value[2]); $itpl->setVariable("VAL_OBJECT_TYPE", $value_trans["type"]); $itpl->setVariable("VAL_OBJECT_NAME", $value_trans["name"]); } else { if ($has_ext) { $mode->setValue("ext"); $ti->setValue($value); } } } // #10185 - default for external urls if ($has_ext && !$ti->getValue()) { $ti->setValue("http://"); } $ne->setValue($itpl->get()); // to html if ($has_radio) { $html = $mode->render(); } else { $html = $mode->getToolbarHTML(); if ($has_ext) { $html .= $ti->getToolbarHTML(); } else { $html .= $ne->render() . '<div class="help-block">' . $ne->getInfo() . '</div>'; } } // js for internal link if ($has_int) { include_once "./Services/Link/classes/class.ilInternalLinkGUI.php"; $html .= $hidden_type->getToolbarHTML() . $hidden_id->getToolbarHTML() . $hidden_target->getToolbarHTML(); } return $html; }
/** * Init blog posting form * * @param int $a_blog_id * @param bool $a_insert * @return ilPropertyFormGUI */ protected function initPostingForm($a_blog_id, $a_insert = false) { global $ilCtrl, $ilUser; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_blog")); } else { $form->setTitle($this->lng->txt("cont_update_blog")); } $options = array(); include_once "Modules/Blog/classes/class.ilBlogPosting.php"; $postings = ilBlogPosting::getAllPostings($a_blog_id); if ($postings) { foreach ($postings as $post) { // could be posting from someone else if ($post["author"] == $ilUser->getId()) { $date = new ilDateTime($post["date"], IL_CAL_DATETIME); $title = $post["title"] . " - " . ilDatePresentation::formatDate($date); $cbox = new ilCheckboxInputGUI($title, "posting"); $cbox->setValue($post["id"]); $options[] = $cbox; } } } asort($options); $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting"); $obj->setRequired(true); $obj->setOptions($options); $form->addItem($obj); $blog_id = new ilHiddenInputGUI("blog_id"); $blog_id->setValue($a_blog_id); $form->addItem($blog_id); if ($a_insert) { $form->addCommandButton("create_blog", $this->lng->txt("save")); $form->addCommandButton("cancelCreate", $this->lng->txt("cancel")); } else { $obj->setValue($this->content_obj->getPostings()); $form->addCommandButton("update", $this->lng->txt("save")); $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } return $form; }
/** * Move current page */ protected function movePageFormObject() { global $lng, $ilCtrl, $tpl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "movePage")); $form->setTitle($lng->txt("test_move_page")); $old_pos = new ilHiddenInputGUI("q_id"); $old_pos->setValue($_REQUEST['q_id']); $form->addItem($old_pos); $questions = $this->object->getQuestionTitlesAndIndexes(); if (!is_array($questions)) { $questions = array(); } foreach ($questions as $k => $q) { if ($k == $_REQUEST['q_id']) { unset($questions[$k]); continue; } $questions[$k] = $lng->txt('behind') . ' ' . $q; } #$questions['0'] = $lng->txt('first'); $options = array(0 => $lng->txt('first')); foreach ($questions as $k => $q) { $options[$k] = $q . ' [' . $this->lng->txt('question_id_short') . ': ' . $k . ']'; } $pos = new ilSelectInputGUI($lng->txt("position"), "position_after"); $pos->setOptions($options); $form->addItem($pos); $form->addCommandButton("movePage", $lng->txt("submit")); $form->addCommandButton("showPage", $lng->txt("cancel")); return $tpl->setContent($form->getHTML()); }
/** * Add standard fields to form */ function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL) { global $ilSetting, $lng, $rbacreview, $ilias; // custom registration settings if (self::$mode == self::MODE_REGISTRATION) { include_once 'Services/Registration/classes/class.ilRegistrationSettings.php'; $registration_settings = new ilRegistrationSettings(); self::$user_field["username"]["group"] = "login_data"; self::$user_field["password"]["group"] = "login_data"; self::$user_field["language"]["default"] = $lng->lang_key; // different position for role $roles = self::$user_field["roles"]; unset(self::$user_field["roles"]); self::$user_field["roles"] = $roles; self::$user_field["roles"]["group"] = "settings"; } $fields = $this->getStandardFields(); $current_group = ""; $custom_fields_done = false; foreach ($fields as $f => $p) { // next group? -> diplay subheader if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) { if (is_array($custom_fields) && !$custom_fields_done) { // should be appended to "other" or at least before "settings" if ($current_group == "other" || $p["group"] == "settings") { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } $custom_fields_done = true; } } $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt($p["group"])); $a_form->addItem($sh); $current_group = $p["group"]; } $m = ""; if (isset($p["method"])) { $m = $p["method"]; } $lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f; switch ($p["input"]) { case "login": if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) { $val = new ilTextInputGUI($lng->txt('username'), 'username'); if ($a_user) { $val->setValue($a_user->getLogin()); } $val->setMaxLength(32); $val->setSize(40); $val->setRequired(true); } else { // user account name $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un'); if ($a_user) { $val->setValue($a_user->getLogin()); } } $a_form->addItem($val); break; case "text": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ti); } break; case "sel_country": if (ilUserProfile::userSettingVisible($f)) { include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ci->setValue($a_user->{$m}()); } $ci->setRequired($ilSetting->get("require_" . $f)); if (!$ci->getRequired() || $ci->getValue()) { $ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ci); } break; case "birthday": if (ilUserProfile::userSettingVisible($f)) { $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_" . $f); include_once "./Services/Calendar/classes/class.ilDateTime.php"; $date = null; if ($a_user && strlen($a_user->{$m}())) { $date = new ilDateTime($a_user->{$m}(), IL_CAL_DATE); $bi->setDate($date); } $bi->setShowEmpty(true); $bi->setStartYear(1900); $bi->setRequired($ilSetting->get("require_" . $f)); if (!$bi->getRequired() || $date) { $bi->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($bi); } break; case "radio": if (ilUserProfile::userSettingVisible($f)) { $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $rg->setValue($a_user->{$m}()); } foreach ($p["values"] as $k => $v) { $op = new ilRadioOption($lng->txt($v), $k); $rg->addOption($op); } $rg->setRequired($ilSetting->get("require_" . $f)); if (!$rg->getRequired() || $rg->getValue()) { $rg->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($rg); } break; case "picture": if (ilUserProfile::userSettingVisible("upload") && $a_user) { $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); $ii->setDisabled($ilSetting->get("usr_settings_disable_upload")); $upload = $a_form->getFileUpload("userfile"); if ($upload["name"]) { $ii->setPending($upload["name"]); } else { $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true, true); if ($im != "") { $ii->setImage($im); $ii->setAlt($lng->txt("personal_picture")); } } // ilinc link as info if (ilUserProfile::userSettingVisible("upload") and $ilSetting->get("ilinc_active")) { include_once './Modules/ILinc/classes/class.ilObjiLincUser.php'; $ilinc_user = new ilObjiLincUser($a_user); if ($ilinc_user->id) { include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php'; $ilincAPI = new ilnetucateXMLAPI(); $ilincAPI->uploadPicture($ilinc_user); $response = $ilincAPI->sendRequest("uploadPicture"); // return URL to user's personal page $url = trim($response->data['url']['cdata']); $desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>'; $ii->setInfo($desc); } } $a_form->addItem($ii); } break; case "roles": if (self::$mode == self::MODE_DESKTOP) { if (ilUserProfile::userSettingVisible("roles")) { $global_roles = $rbacreview->getGlobalRoles(); foreach ($global_roles as $role_id) { if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) { $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id); $role_names .= $roleObj->getTitle() . ", "; unset($roleObj); } } $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr"); $dr->setValue(substr($role_names, 0, -2)); $a_form->addItem($dr); } } else { if (self::$mode == self::MODE_REGISTRATION) { if ($registration_settings->roleSelectionEnabled()) { include_once "./Services/AccessControl/classes/class.ilObjRole.php"; $options = array(); foreach (ilObjRole::_lookupRegisterAllowed() as $role) { $options[$role["id"]] = $role["title"]; } // registration form validation will take care of missing field / value if ($options) { if (sizeof($options) > 1) { $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f); $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } } else { $ta = new ilHiddenInputGUI("usr_" . $f); $ta->setValue(array_shift(array_keys($options))); } $a_form->addItem($ta); } } } } break; case "email": if (ilUserProfile::userSettingVisible($f)) { $em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $em->setValue($a_user->{$m}()); } $em->setRequired($ilSetting->get("require_" . $f)); if (!$em->getRequired() || $em->getValue()) { $em->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if (self::MODE_REGISTRATION == self::$mode) { $em->setRetype(true); } $a_form->addItem($em); } break; case "textarea": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $ta->setRows($p["rows"]); $ta->setCols($p["cols"]); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "messenger": if (ilUserProfile::userSettingVisible("instant_messengers")) { $im_arr = $p["types"]; foreach ($im_arr as $im_name) { $im = new ilTextInputGUI($lng->txt("im_" . $im_name), "usr_im_" . $im_name); if ($a_user) { $im->setValue($a_user->getInstantMessengerId($im_name)); } $im->setMaxLength($p["maxlength"]); $im->setSize($p["size"]); $im->setRequired($ilSetting->get("require_" . "instant_messengers")); if (!$im->getRequired() || $im->getValue()) { $im->setDisabled($ilSetting->get("usr_settings_disable_" . "instant_messengers")); } $a_form->addItem($im); } } break; case "password": if (self::$mode == self::MODE_REGISTRATION) { if (!$registration_settings->passwordGenerationEnabled()) { $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_" . $f); $ta->setRequired(true); // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f)); } else { $ta = new ilNonEditableValueGUI($lng->txt($lv)); $ta->setValue($lng->txt("reg_passwd_via_mail")); } $a_form->addItem($ta); } break; case "language": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilSelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $options = array(); $lng->loadLanguageModule("meta"); foreach ($lng->getInstalledLanguages() as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } asort($options); // #9728 $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "multitext": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); $ti->setMulti(true); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if ($this->ajax_href) { // add field to ajax call $ti->setDataSource($this->ajax_href . "&f=" . $f); } $a_form->addItem($ti); } break; } } // append custom fields as "other" if (is_array($custom_fields) && !$custom_fields_done) { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } } }
/** * init mapping form * * @param int $a_server_id * @return ilPropertyFormGUI $form * * @access protected */ protected function initMappingsForm($a_server_id, $mapping_type) { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php'; $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id); $form = new ilPropertyFormGUI(); if ($mapping_type == self::MAPPING_IMPORT) { $form->setTitle($this->lng->txt('ecs_mapping_tbl')); $form->addCommandButton('saveImportMappings', $this->lng->txt('save')); $form->addCommandButton('importMappings', $this->lng->txt('cancel')); } else { $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl')); $form->addCommandButton('saveExportMappings', $this->lng->txt('save')); $form->addCommandButton('exportMappings', $this->lng->txt('cancel')); } $form->setFormAction($this->ctrl->getFormAction($this, 'saveMappings')); if ($mapping_type == self::MAPPING_IMPORT) { $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs')); $form->addItem($assignments); } include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php'; $fields = ilAdvancedMDFieldDefinition::_getActiveDefinitionsByObjType('crs'); $options = $this->prepareFieldSelection($fields); // get all optional ecourse fields include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php'; $optional = ilECSUtils::_getOptionalECourseFields(); foreach ($optional as $field_name) { if ($mapping_type == self::MAPPING_IMPORT) { $select = new ilSelectInputGUI($this->lng->txt('ecs_field_' . $field_name), 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_IMPORT_CRS . '][' . $field_name . ']'); $select->setValue($mapping_settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_CRS, $field_name)); $select->setOptions($options); $assignments->addSubItem($select); } else { $select = new ilSelectInputGUI($this->lng->txt('ecs_field_' . $field_name), 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_EXPORT . '][' . $field_name . ']'); $select->setValue($mapping_settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, $field_name)); $select->setOptions($options); $form->addItem($select); } } $server = new ilHiddenInputGUI('ecs_mapping_server'); $server->setValue($a_server_id); $form->addItem($server); // Remote courses // no remote course settings for export if ($mapping_type == self::MAPPING_EXPORT) { return $form; } $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs')); $form->addItem($rcrs); include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php'; $fields = ilAdvancedMDFieldDefinition::_getActiveDefinitionsByObjType('rcrs'); $options = $this->prepareFieldSelection($fields); // get all optional econtent fields include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php'; $optional = ilECSUtils::_getOptionalEContentFields(); foreach ($optional as $field_name) { $select = new ilSelectInputGUI($this->lng->txt('ecs_field_' . $field_name), 'mapping[' . ilECSDataMappingSetting::MAPPING_IMPORT_RCRS . '][' . $field_name . ']'); $select->setValue($mapping_settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, $field_name)); $select->setOptions($options); $rcrs->addSubItem($select); } return $form; }
/** * 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); }
/** * Init tag style editing form * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) */ public function initCharacteristicForm($a_mode) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); // title $txt_input = new ilRegExpInputGUI($lng->txt("title"), "new_characteristic"); $txt_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*\$/"); $txt_input->setNoMatchMessage($lng->txt("sty_msg_characteristic_must_only_include") . " A-Z, a-z, 1-9"); $txt_input->setRequired(true); $this->form_gui->addItem($txt_input); // type $all_super_types = ilObjStyleSheet::_getStyleSuperTypes(); $types = $all_super_types[$this->super_type]; $exp_types = array(); foreach ($types as $t) { if (ilObjStyleSheet::_isExpandable($t)) { $exp_types[$t] = $lng->txt("sty_type_" . $t); } } if (count($exp_types) > 1) { $type_input = new ilSelectInputGUI($lng->txt("sty_type"), "type"); $type_input->setOptions($exp_types); $type_input->setValue(key($exp_types)); $this->form_gui->addItem($type_input); } else { if (count($exp_types) == 1) { $hid_input = new ilHiddenInputGUI("type"); $hid_input->setValue(key($exp_types)); $this->form_gui->addItem($hid_input); } } $this->form_gui->setTitle($lng->txt("sty_add_characteristic")); $this->form_gui->addCommandButton("saveCharacteristic", $lng->txt("save")); $this->form_gui->addCommandButton("edit", $lng->txt("cancel")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); }
protected function initAccessRestrictionForm($a_from_search = false) { $user_ids = $this->getActionUserIds(); if (!$user_ids) { ilUtil::sendFailure($this->lng->txt('select_one')); return $this->viewObject(); } include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt("time_limit_add_time_limit_for_selected")); $form->setFormAction($this->ctrl->getFormAction($this, "confirmaccessRestrict")); $from = new ilDateTimeInputGUI($this->lng->txt("access_from"), "from"); $from->setShowTime(true); $from->setRequired(true); $form->addItem($from); $to = new ilDateTimeInputGUI($this->lng->txt("access_until"), "to"); $to->setRequired(true); $to->setShowTime(true); $form->addItem($to); $form->addCommandButton("confirmaccessRestrict", $this->lng->txt("confirm")); $form->addCommandButton("view", $this->lng->txt("cancel")); foreach ($user_ids as $user_id) { $ufield = new ilHiddenInputGUI("id[]"); $ufield->setValue($user_id); $form->addItem($ufield); } // return to search? if ($a_from_search || $_POST["frsrch"]) { $field = new ilHiddenInputGUI("frsrch"); $field->setValue(1); $form->addItem($field); } return $form; }
private function createRoomIdHiddenInputField() { $hidden_room_id = new ilHiddenInputGUI("room_id"); $hidden_room_id->setValue($this->room_id); $hidden_room_id->setRequired(true); return $hidden_room_id; }
/** * Creates an output of the edit form for the question * * @access public */ function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $orderingtype = array_key_exists('ordering_type', $_POST) ? $_POST['ordering_type'] : $this->object->getOrderingType(); if (strcmp($this->ctrl->getCmd(), 'changeToText') == 0) { $orderingtype = OQ_TERMS; } if (strcmp($this->ctrl->getCmd(), 'changeToPictures') == 0) { $orderingtype = OQ_PICTURES; } $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE); $form->setTableWidth("100%"); $form->setId("ordering"); // Edit mode $hidden = new ilHiddenInputGUI("ordering_type"); $hidden->setValue($orderingtype); $form->addItem($hidden); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); if (!$this->getSelfAssessmentEditingMode()) { $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height"); $element_height->setValue($this->object->getElementHeight()); $element_height->setRequired(false); $element_height->setMaxLength(6); $element_height->setMinValue(20); $element_height->setSize(6); $element_height->setInfo($this->lng->txt("element_height_info")); $form->addItem($element_height); } if ($orderingtype == OQ_PICTURES) { $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry"); $geometry->setValue($this->object->getThumbGeometry()); $geometry->setRequired(true); $geometry->setMaxLength(6); $geometry->setMinValue(20); $geometry->setSize(6); $geometry->setInfo($this->lng->txt("thumb_geometry_info")); $form->addItem($geometry); } if (count($this->object->getAnswers()) == 0) { $this->object->addAnswer(); } // Answers if ($orderingtype == OQ_PICTURES) { include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php"; $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setQuestionObject($this->object); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } $answers->setValues($answervalues); $form->addItem($answers); } else { $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } ksort($answervalues); $answers->setValues($answervalues); $form->addItem($answers); } // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); if (true || !$this->getSelfAssessmentEditingMode()) { if ($orderingtype == OQ_PICTURES) { $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); } else { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); } } $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $form->setValuesByPost(); $errors = !$form->checkInput(); $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("QUESTION_DATA", $form->getHTML()); } return $errors; }
/** * Init the mapping form */ protected function cInitMappingForm($current_node, $current_attribute) { include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php'; $attributes_obj = ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid()); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTableWidth("100%"); $this->ctrl->setParameter($this, 'ecs_ca', $current_attribute); $form->setFormAction($this->ctrl->getFormAction($this)); $this->ctrl->setParameter($this, 'ecs_ca', ''); $form->setTitle($this->lng->txt('ecs_cmap_mapping_form_title') . ' ' . ilObject::_lookupTitle(ilObject::_lookupObjId($current_node))); // Iterate through all current attributes $attributes = $attributes_obj->getAttributeSequence($current_attribute); foreach ($attributes as $att_name) { include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseMappingRule.php'; $rule = ilECSCourseMappingRule::getInstanceByAttribute($this->getServer()->getServerId(), $this->getMid(), $current_node, $att_name); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('ecs_cmap_att_' . $att_name)); // Filter $form->addItem($section); $isfilter = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_filter'), $att_name . '_is_filter'); $isfilter->setValue($rule->isFilterEnabled() ? 1 : 0); $all_values = new ilRadioOption($this->lng->txt('ecs_cmap_form_all_values'), 0); $isfilter->addOption($all_values); $use_filter = new ilRadioOption($this->lng->txt('ecs_cmap_form_filter_by_values'), 1); $filter = new ilTextInputGUI('', $att_name . '_filter'); $filter->setInfo($this->lng->txt('ecs_cmap_form_filter_info')); $filter->setSize(50); $filter->setMaxLength(512); $filter->setRequired(true); $filter->setValue($rule->getFilter()); $use_filter->addSubItem($filter); $isfilter->addOption($use_filter); $form->addItem($isfilter); // Create subdirs $subdirs = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_form_create_subdirs'), $att_name . '_subdirs'); $subdirs->setChecked($rule->isSubdirCreationEnabled()); $subdirs->setValue(1); // Subdir types (disabled in spec) /* $subdir_type = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_subdir_type'), $att_name.'_subdir_type'); $subdir_type->setValue($rule->getSubDirectoryType()); $value = new ilRadioOption($this->lng->txt('ecs_cmap_form_subdir_value'), ilECSCourseMappingRule::SUBDIR_VALUE); $subdir_type->addOption($value); $name = new ilRadioOption($this->lng->txt('ecs_cmap_form_subdir_name'), ilECSCourseMappingRule::SUBDIR_ATTRIBUTE_NAME); $subdir_type->addOption($name); $subdirs->addSubItem($subdir_type); */ $form->addItem($subdirs); // Directory relations /* $upper_attributes = ilECSCourseAttributes::getInstance( $this->getServer()->getServerId(), $this->getMid())->getUpperAttributes($att_name); if($upper_attributes) { $dir_relation = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_dir_relation'),$att_name.'_dir_relation'); $current_dir = new ilRadioOption($this->lng->txt('ecs_cmap_form_current_dir'),''); $dir_relation->addOption($current_dir); } foreach($upper_attributes as $subdir_name) { $subdir = new ilRadioOption($this->lng->txt('ecs_cmap_att_'.$subdir_name),$subdir_name); $dir_relation->addOption($subdir); } if($upper_attributes) { $dir_relation->setValue((string) $rule->getDirectory()); $form->addItem($dir_relation); } */ } // add list of attributes $hidden_atts = new ilHiddenInputGUI('attributes'); $hidden_atts->setValue(implode(',', $attributes)); $form->addItem($hidden_atts); if ($current_attribute) { $form->addCommandButton('cSaveOverview', $this->lng->txt('save')); } if ($attributes_obj->getNextAttributeName($current_attribute)) { $form->addCommandButton('cAddAttribute', $this->lng->txt('ecs_cmap_add_attribute_btn')); } if ($attributes_obj->getPreviousAttributeName($current_attribute)) { $form->addCommandButton('cDeleteAttribute', $this->lng->txt('ecs_cmap_delete_attribute_btn')); } if (ilECSCourseMappingRule::hasRules($this->getServer()->getServerId(), $this->getMid(), $current_node)) { $form->addCommandButton('cDeleteRulesOfNode', $this->lng->txt('ecs_cmap_delete_rule')); } #$form->addCommandButton('cInitOverview', $this->lng->txt('cancel')); $form->setShowTopButtons(false); return $form; }
/** * Build property form * @param string $a_mode * @param int $id * @return object */ function initForm($a_mode = "create", $id = NULL) { global $lng, $ilCtrl; $lng->loadLanguageModule("dateplaner"); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form_gui = new ilPropertyFormGUI(); $title = new ilTextInputGUI($lng->txt("title"), "title"); $title->setRequired(true); $title->setSize(40); $title->setMaxLength(120); $form_gui->addItem($title); /* $type = new ilRadioGroupInputGUI($lng->txt("book_schedule_type"), "type"); $type->setRequired(true); $form_gui->addItem($type); $fix = new ilRadioOption($lng->txt("book_schedule_type_fix"), "fix"); $fix->setInfo($lng->txt("book_schedule_type_fix_info")); $type->addOption($fix); $flex = new ilRadioOption($lng->txt("book_schedule_type_flexible"), "flexible"); $flex->setInfo($lng->txt("book_schedule_type_flexible_info")); $type->addOption($flex); $raster = new ilNumberInputGUI($lng->txt("book_schedule_raster"), "raster"); $raster->setRequired(true); $raster->setInfo($lng->txt("book_schedule_raster_info")); $raster->setMinValue(1); $raster->setSize(3); $raster->setMaxLength(3); $raster->setSuffix($lng->txt("book_minutes")); $flex->addSubItem($raster); $rent_min = new ilNumberInputGUI($lng->txt("book_schedule_rent_min"), "rent_min"); $rent_min->setInfo($lng->txt("book_schedule_rent_info")); $rent_min->setMinValue(1); $rent_min->setSize(3); $rent_min->setMaxLength(3); $flex->addSubItem($rent_min); $rent_max = new ilNumberInputGUI($lng->txt("book_schedule_rent_max"), "rent_max"); $rent_max->setInfo($lng->txt("book_schedule_rent_info")); $rent_max->setMinValue(1); $rent_max->setSize(3); $rent_max->setMaxLength(3); $flex->addSubItem($rent_max); $break = new ilNumberInputGUI($lng->txt("book_schedule_break"), "break"); $break->setInfo($lng->txt("book_schedule_break_info")); $break->setMinValue(1); $break->setSize(3); $break->setMaxLength(3); $flex->addSubItem($break); */ include_once "Modules/BookingManager/classes/class.ilScheduleInputGUI.php"; $definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days"); $definition->setInfo($lng->txt("book_schedule_days_info")); $definition->setRequired(true); $form_gui->addItem($definition); $deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline"); $deadline->setInfo($lng->txt("book_deadline_info")); $deadline->setSuffix($lng->txt("book_hours")); $deadline->setMinValue(0); $deadline->setSize(3); $deadline->setMaxLength(3); $form_gui->addItem($deadline); if ($a_mode == "edit") { $form_gui->setTitle($lng->txt("book_edit_schedule")); $item = new ilHiddenInputGUI('schedule_id'); $item->setValue($id); $form_gui->addItem($item); include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php'; $schedule = new ilBookingSchedule($id); $title->setValue($schedule->getTitle()); $deadline->setValue($schedule->getDeadline()); /* if($schedule->getRaster()) { $type->setValue("flexible"); $raster->setValue($schedule->getRaster()); $rent_min->setValue($schedule->getMinRental()); $rent_max->setValue($schedule->getMaxRental()); $break->setValue($schedule->getAutoBreak()); } else { $type->setValue("fix"); } */ $definition->setValue($schedule->getDefinitionBySlots()); $form_gui->addCommandButton("update", $lng->txt("save")); } else { $form_gui->setTitle($lng->txt("book_add_schedule")); $form_gui->addCommandButton("save", $lng->txt("save")); $form_gui->addCommandButton("render", $lng->txt("cancel")); } $form_gui->setFormAction($ilCtrl->getFormAction($this)); return $form_gui; }
/** * init Form * * @param string $a_mode values: create | edit */ public function initForm() { global $lng, $ilCtrl; //table_id $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->table_id); $this->form->addItem($hidden_prop); $ilCtrl->setParameter($this, "record_id", $this->record_id); $this->form->setFormAction($ilCtrl->getFormAction($this)); $allFields = $this->table->getRecordFields(); foreach ($allFields as $field) { $item = ilDataCollectionDatatype::getInputField($field); if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $fieldref = $field->getFieldRef(); $reffield = ilDataCollectionCache::getFieldCache($fieldref); $options = array(); if (!$field->isNRef()) { $options[""] = '--'; } $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId()); foreach ($reftable->getRecords() as $record) { // If the referenced field is MOB or FILE, we display the filename in the dropdown if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) { $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $file_obj->getFileName(); } else { if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) { $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $media_obj->getTitle(); } else { $options[$record->getId()] = $record->getRecordFieldValue($fieldref); } } } $item->setOptions($options); } if ($this->record_id) { $record = ilDataCollectionCache::getRecordCache($this->record_id); } $item->setRequired($field->getRequired()); //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it. if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB && ($this->record_id && $record->getId() != 0 && ($record->getRecordFieldValue($field->getId()) != "-" || $record->getRecordFieldValue($field->getId()) != ""))) { $item->setRequired(false); } if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) { $item->setDisabled(true); } $this->form->addItem($item); } // Add possibility to change the owner in edit mode if ($this->record_id) { $ownerField = $this->table->getField('owner'); $inputfield = ilDataCollectionDatatype::getInputField($ownerField); $this->form->addItem($inputfield); } // save and cancel commands if (isset($this->record_id)) { $this->form->setTitle($lng->txt("dcl_update_record")); $this->form->addCommandButton("save", $lng->txt("dcl_update_record")); $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } else { $this->form->setTitle($lng->txt("dcl_add_new_record")); $this->form->addCommandButton("save", $lng->txt("save")); $this->form->addCommandButton("cancelSave", $lng->txt("cancel")); } $ilCtrl->setParameter($this, "table_id", $this->table_id); $ilCtrl->setParameter($this, "record_id", $this->record_id); }
/** * initEditCustomForm * * @param string $a_mode values: create | edit */ public function initForm($a_mode = "create") { global $ilCtrl, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); if ($a_mode == "edit") { $this->form->setTitle($lng->txt('dcl_edit_field')); $hidden_prop = new ilHiddenInputGUI("field_id"); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "update"); $this->form->addCommandButton('update', $lng->txt('dcl_update_field')); } else { $this->form->setTitle($lng->txt('dcl_new_field')); $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->field_obj->getTableId()); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "save"); $this->form->addCommandButton('save', $lng->txt('dcl_create_field')); } $this->form->addCommandButton('cancel', $lng->txt('cancel')); $text_prop = new ilTextInputGUI($lng->txt("title"), "title"); $text_prop->setRequired(true); $text_prop->setValidationRegexp("/^[a-zA-Z\\d -.,äöüÄÖÜàéèÀÉÈç¢]*\$/i"); $this->form->addItem($text_prop); $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype'); foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) { $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']); foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) { //Type Reference: List Tabels if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) { // Get Tables require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php"; $tables = $this->parent_obj->getDataCollectionObject()->getTables(); foreach ($tables as $table) { foreach ($table->getRecordFields() as $field) { //referencing references may lead to endless loops. if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $options[$field->getId()] = $table->getTitle() . "->" . $field->getTitle(); } } } $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']); $table_selection->setOptions($options); //$table_selection->setValue($this->table_id); $opt->addSubItem($table_selection); } elseif ($property['datatype_id'] == $datatype['id']) { if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) { $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); $opt->addSubItem($subitem); } else { $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); $opt->addSubItem($subitem); } } } $edit_datatype->addOption($opt); } $edit_datatype->setRequired(true); //you can't change type but we still need it in POST if ($a_mode == "edit") { $edit_datatype->setDisabled(true); } $this->form->addItem($edit_datatype); // Description $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description"); $this->form->addItem($text_prop); // Required $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required"); $this->form->addItem($cb); //Unique $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique"); $this->form->addItem($cb); }
private function buildCreateQuestionForm() { global $ilUser; // form require_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('ass_create_question')); $form->setFormAction($this->ctrl->getFormAction($this)); // question type $options = array(); foreach ($this->object->getQuestionTypes(false, true) as $translation => $data) { $options[$data['type_tag']] = $translation; } require_once "Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types'); $si->setOptions($options); //$si->setValue($ilUser->getPref("tst_lastquestiontype")); $form->addItem($si); // content editing mode if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) { $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode"); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT)); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT)); $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $form->addItem($ri, true); } else { $hi = new ilHiddenInputGUI("question_content_editing_type"); $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $form->addItem($hi, true); } // commands $form->addCommandButton('createQuestion', $this->lng->txt('create')); $form->addCommandButton('questions', $this->lng->txt('cancel')); return $form; }
/** * Render toolbar form * * @param array $a_pages */ protected function renderToolbar($a_pages) { global $ilToolbar, $ilCtrl, $lng, $ilUser; if (!$this->has_datasets) { $ilToolbar->addButton($lng->txt("survey_add_new_question"), $ilCtrl->getLinkTarget($this, "addQuestionToolbarForm")); if ($this->object->isPoolActive()) { $ilToolbar->addSeparator(); $last_on_page = 0; if ($a_pages) { $last_on_page = $a_pages[$this->current_page - 1]; $last_on_page = array_pop($last_on_page); $last_on_page = $last_on_page["question_id"]; } $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page); $ilCtrl->setParameter($this->editor_gui, "pgov_pos", $last_on_page . "c"); $cmd = $ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0 ? 'browseForQuestions' : 'browseForQuestionblocks'; $ilToolbar->addButton($lng->txt("browse_for_questions"), $ilCtrl->getLinkTarget($this->editor_gui, $cmd)); $ilCtrl->setParameter($this->editor_gui, "pgov", ""); $ilCtrl->setParameter($this->editor_gui, "pgov_pos", ""); } if ($a_pages) { $ilToolbar->addSeparator(); } } // parse data for pages drop-down if ($a_pages) { // previous/next $ilCtrl->setParameter($this, "pg", $this->current_page - 1); $ilToolbar->addLink($lng->txt("survey_prev_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_previous_page); $ilCtrl->setParameter($this, "pg", $this->current_page + 1); $ilToolbar->addLink($lng->txt("survey_next_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_next_page); $ilCtrl->setParameter($this, "pg", $this->current_page); foreach ($a_pages as $idx => $questions) { $page = $questions; $page = array_shift($page); if ($page["questionblock_id"]) { $pages_drop[$idx + 1] = $page["questionblock_title"]; if (sizeof($questions) > 1) { foreach ($questions as $question) { $pages_drop[$idx + 1 . "__" . $question["question_id"]] = "- " . $question["title"]; } } } else { $pages_drop[$idx + 1] = strip_tags($page["title"]); } } } // jump to page if (sizeof($pages_drop) > 1) { $ilToolbar->addSeparator(); $ilToolbar->setFormAction($ilCtrl->getFormAction($this)); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $si = new ilSelectInputGUI($lng->txt("survey_jump_to"), "jump"); $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\""); $si->setOptions($pages_drop); $si->setValue($this->current_page); $ilToolbar->addInputItem($si, true); // we need this to have to right cmd $cmd = new ilHiddenInputGUI("cmd[renderPage]"); $cmd->setValue("1"); $ilToolbar->addInputItem($cmd); if (!$this->has_datasets) { $ilToolbar->addSeparator(); $ilCtrl->setParameter($this, "csum", md5(print_r($a_pages[$this->current_page - 1], true))); $ilToolbar->addButton($lng->txt("survey_delete_page"), $ilCtrl->getLinkTarget($this, "deleteBlock")); $ilCtrl->setParameter($this, "csum", ""); $ilToolbar->addSeparator(); $ilToolbar->addButton($lng->txt("survey_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm")); } } }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // shuffle $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } if (!$this->object->getSelfAssessmentEditingMode()) { $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline; // Answer types $types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types"); $types->setRequired(false); $types->setValue($isSingleline ? 0 : 1); $types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline'))); $form->addItem($types); } if ($isSingleline) { // thumb size $thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size"); $thumb_size->setMinValue(20); $thumb_size->setDecimals(0); $thumb_size->setSize(6); $thumb_size->setInfo($this->lng->txt('thumb_size_info')); $thumb_size->setValue($this->object->getThumbSize()); $thumb_size->setRequired(false); $form->addItem($thumb_size); return $isSingleline; } return $isSingleline; }
/** * Edit multiple sequence items */ public function edit() { global $ilTabs; if (!isset($_REQUEST['apps'])) { ilUtil::sendFailure($this->lng->txt('select_one')); return $this->appointmentList(); } $this->initFormSequence(self::MODE_MULTI); if ($_REQUEST['apps'] && !is_array($_REQUEST['apps'])) { $_REQUEST['apps'] = explode(';', $_REQUEST['apps']); } $hidden = new ilHiddenInputGUI('apps'); $hidden->setValue(implode(';', $_REQUEST['apps'])); $this->form->addItem($hidden); include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; $first = $_REQUEST['apps']; $first = array_shift($_REQUEST['apps']); $entry = new ilCalendarEntry($first); $this->form->getItemByPostVar('ti')->setValue($entry->getTitle()); $this->form->getItemByPostVar('lo')->setValue($entry->getLocation()); $this->form->getItemByPostVar('de')->setValue($entry->getDescription()); include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $booking = new ilBookingEntry($entry->getContextId()); $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings()); $ref_ids = array(); foreach ($booking->getTargetObjIds() as $obj_id) { $refs = ilObject::_getAllReferences($obj_id); $ref_ids[] = end($refs); } $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids)); $deadline = $booking->getDeadlineHours(); $this->form->getItemByPostVar('dead')->setDays(floor($deadline / 24)); $this->form->getItemByPostVar('dead')->setHours($deadline % 24); if ($booking->getBookingGroup()) { $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup()); } $this->tpl->setContent($this->form->getHTML()); }
/** * @param $question_id * @param $question_pool_id * * @return ilPropertyFormGUI */ protected function buildAdjustQuestionForm($question_id, $question_pool_id) { require_once './Services/Form/classes/class.ilPropertyFormGUI.php'; require_once './Modules/TestQuestionPool/classes/class.assQuestion.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("adjustment"); /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */ $question = assQuestion::instantiateQuestionGUI($question_id); $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>'); $hidden_question_id = new ilHiddenInputGUI('q_id'); $hidden_question_id->setValue($question_id); $form->addItem($hidden_question_id); $hidden_qpl_id = new ilHiddenInputGUI('qpl_id'); $hidden_qpl_id->setValue($question_pool_id); $form->addItem($hidden_qpl_id); $this->populateScoringAdjustments($question, $form); $manscoring_section = new ilFormSectionHeaderGUI(); $manscoring_section->setTitle($this->lng->txt('manscoring')); $form->addItem($manscoring_section); $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring'); $manscoring_preservation->setChecked(true); $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info')); $form->addItem($manscoring_preservation); $form->addCommandButton("savescoringfortest", $this->lng->txt("save")); $participants = $this->object->getParticipants(); $active_ids = array_keys($participants); $results = array(); foreach ($active_ids as $active_id) { $passes[] = $this->object->_getPass($active_id); foreach ($passes as $key => $pass) { for ($i = 0; $i <= $pass; $i++) { $results[] = $question->object->getSolutionValues($active_id, $i); } } } $relevant_answers = array(); foreach ($results as $result) { foreach ($result as $answer) { if ($answer['question_fi'] == $question->object->getId()) { $relevant_answers[] = $answer; } } } $answers_view = $question->getAggregatedAnswersView($relevant_answers); include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test'); $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ'); $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close')))); $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview')); $container->setVariable('TXT_CLOSE', $this->lng->txt('close')); $container->setVariable('ANSWER_OVERVIEW', $answers_view); $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ'); $custom_input->setHtml($container->get()); $form->addItem($custom_input); return $form; }