/** * @param ilObjBibliographic $bibl_obj * @return void * */ public function showDetails(ilObjBibliographic $bibl_obj) { global $tpl, $ilTabs, $ilCtrl, $lng; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $ilTabs->clearTargets(); $ilTabs->setBackTarget("back", $ilCtrl->getLinkTarget($this, 'showContent')); $form->setTitle($lng->txt('detail_view')); $entry = new ilBibliographicEntry($bibl_obj->getFiletype(), $_GET['entryId']); $attributes = $entry->getAttributes(); //translate array key in order to sort by those keys foreach ($attributes as $key => $attribute) { //Check if there is a specific language entry if ($lng->exists($key)) { $strDescTranslated = $lng->txt($key); } else { $arrKey = explode("_", $key); $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]); } unset($attributes[$key]); $attributes[$strDescTranslated] = $attribute; } // sort attributes alphabetically by their array-key ksort($attributes, SORT_STRING); // render attributes to html foreach ($attributes as $key => $attribute) { $ci = new ilCustomInputGUI($key); $ci->setHtml($attribute); $form->addItem($ci); } // set content and title $tpl->setContent($form->getHTML()); //Permanent Link $tpl->setPermanentLink("bibl", $bibl_obj->getRefId(), "_" . $_GET['entryId']); }
/** * Creates an output of the edit form for the question * @access public */ function editQuestion() { global $ilDB, $tpl; $plugin = $this->object->getPlugin(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("assJSMEQuestion"); // Basiseingabefelder: title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // points $points = new ilNumberInputGUI($plugin->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(10); $points->setMinValue(0.0); $form->addItem($points); // optionString for the JSME-Applet include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $optionString = new ilTextInputGUI($plugin->txt("optionString"), "optionString"); $optionString->setValue($this->object->getOptionString()); $form->addItem($optionString); // JSME-Applet for sampleSolution include_once "./Services/Form/classes/class.ilCustomInputGUI.php"; $sampleSolution = new ilCustomInputGUI($plugin->txt("sampleSolution"), "sampleSolution"); $template = $this->getJsmeOutputTemplate("", $this->object->getOptionString(), $this->object->getSampleSolution()); $sampleSolution->setHtml($template->get()); $form->addItem($sampleSolution); $form->addCommandButton('save', $plugin->txt("save")); $this->tpl->setVariable("QUESTION_DATA", $form->getHTML()); }
/** * Init form * * @return ilPropertyFormGUI */ public function initForm() { global $lng, $ilCtrl; /** @var $ilCtrl ilCtrl */ $ilCtrl = $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $item = new ilCustomInputGUI(); $item->setHtml($lng->txt('dcl_file_format_description')); $item->setTitle("Info"); $form->addItem($item); $file = new ilFileInputGUI($lng->txt("import_file"), "import_file"); $file->setRequired(true); $form->addItem($file); $cb = new ilCheckboxInputGUI($lng->txt("dcl_simulate_import"), "simulate"); $cb->setInfo($lng->txt("dcl_simulate_info")); $form->addItem($cb); $form->addCommandButton("importExcel", $lng->txt("save")); return $form; }
/** * 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')); } }
protected static function parseFieldDefinition($a_type, ilPropertyFormGUI $a_form, ilObjectGUI $a_gui, $a_data) { global $lng, $rbacsystem, $ilCtrl; if (!is_array($a_data)) { return; } foreach ($a_data as $area_caption => $fields) { if (is_numeric($area_caption) || !trim($area_caption)) { $area_caption = "obj_" . $a_type; } if (is_array($fields) && sizeof($fields) == 2) { $cmd = $fields[0]; $fields = $fields[1]; if (is_array($fields)) { $ftpl = new ilTemplate("tpl.external_settings.html", true, true, "Services/Administration"); $stack = array(); foreach ($fields as $field_caption_id => $field_value) { $field_type = $subitems = null; if (is_array($field_value)) { $field_type = $field_value[1]; $subitems = $field_value[2]; $field_value = $field_value[0]; } if (self::parseFieldValue($field_type, $field_value)) { $ftpl->setCurrentBlock("value_bl"); $ftpl->setVariable("VALUE", $field_value); $ftpl->parseCurrentBlock(); } if (is_array($subitems)) { $ftpl->setCurrentBlock("subitem_bl"); foreach ($subitems as $sub_caption_id => $sub_value) { $sub_type = null; if (is_array($sub_value)) { $sub_type = $sub_value[1]; $sub_value = $sub_value[0]; } self::parseFieldValue($sub_type, $sub_value); $ftpl->setVariable("SUBKEY", $lng->txt($sub_caption_id)); $ftpl->setVariable("SUBVALUE", $sub_value); $ftpl->parseCurrentBlock(); } } $ftpl->setCurrentBlock("row_bl"); $ftpl->setVariable("KEY", $lng->txt($field_caption_id)); $ftpl->parseCurrentBlock(); } if ($rbacsystem->checkAccess("visible,read", $a_gui->object->getRefId())) { if (!$cmd) { $cmd = "view"; } $ilCtrl->setParameter($a_gui, "ref_id", $a_gui->object->getRefId()); $ftpl->setCurrentBlock("edit_bl"); $ftpl->setVariable("URL_EDIT", $ilCtrl->getLinkTargetByClass(array("ilAdministrationGUI", get_class($a_gui)), $cmd)); $ftpl->setVariable("TXT_EDIT", $lng->txt("adm_external_setting_edit")); $ftpl->parseCurrentBlock(); } $ext = new ilCustomInputGUI($lng->txt($area_caption)); $ext->setHtml($ftpl->get()); $a_form->addItem($ext); } } } }
/** * Show membership limitations * * @access protected * @return */ protected function fillMembershipLimitation() { global $ilAccess, $ilCtrl; include_once 'Modules/Course/classes/class.ilObjCourseGrouping.php'; if (!($items = ilObjCourseGrouping::_getGroupingItems($this->container))) { return true; } $mem = new ilCustomInputGUI($this->lng->txt('groupings')); $tpl = new ilTemplate('tpl.membership_limitation_form.html', true, true, 'Services/Membership'); $tpl->setVariable('LIMIT_INTRO', $this->lng->txt($this->type . '_grp_info_reg')); foreach ($items as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $type = ilObject::_lookupType($obj_id); $title = ilObject::_lookupTitle($obj_id); if ($ilAccess->checkAccess('visible', '', $ref_id, $type)) { include_once './Services/Link/classes/class.ilLink.php'; $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id); $tpl->setVariable('LINK_ITEM', $ilCtrl->getLinkTargetByClass("ilrepositorygui", "")); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]); $tpl->setVariable('ITEM_LINKED_TITLE', $title); } else { $tpl->setVariable('ITEM_TITLE'); } $tpl->setCurrentBlock('items'); $tpl->setVariable('TYPE_ICON', ilObject::_getIcon($obj_id, tiny, $type)); $tpl->setVariable('ALT_ICON', $this->lng->txt('obj_' . $type)); $tpl->parseCurrentBlock(); } $mem->setHtml($tpl->get()); if (!ilObjCourseGrouping::_checkGroupingDependencies($this->container)) { $mem->setAlert($this->container->getMessage()); $this->enableRegistration(false); } $this->form->addItem($mem); }
/** * Init server info form. * * @param int $a_mode Edit Mode */ public function initServerInfoForm() { global $lng, $ilClientIniFile, $ilSetting; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // installation name $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), ""); $ne->setValue($ilClientIniFile->readVariable("client", "name")); $ne->setInfo($ilClientIniFile->readVariable("client", "description")); $this->form->addItem($ne); // client id $ne = new ilNonEditableValueGUI($lng->txt("client_id"), ""); $ne->setValue(CLIENT_ID); $this->form->addItem($ne); // installation id $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), ""); $ne->setValue($ilSetting->get("inst_id")); $this->form->addItem($ne); // database version $ne = new ilNonEditableValueGUI($lng->txt("db_version"), ""); $ne->setValue($ilSetting->get("db_version")); include_once "./Services/Database/classes/class.ilDBUpdate.php"; $this->form->addItem($ne); // ilias version $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), ""); $ne->setValue($ilSetting->get("ilias_version")); $this->form->addItem($ne); // version controll information, object can be created by factory in later revisions (if we support git etc.) require_once 'Services/Administration/classes/class.ilSubversionInformation.php'; $vc = new ilSubversionInformation(); $revision_info = $vc->getInformationAsHtml(); if ($revision_info) { $ne = new ilCustomInputGUI($lng->txt('vc_information'), ''); $ne->setHtml($revision_info); $this->form->addItem($ne); } // host $ne = new ilNonEditableValueGUI($lng->txt("host"), ""); $ne->setValue($_SERVER["SERVER_NAME"]); $this->form->addItem($ne); // ip & port $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), ""); $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]); $this->form->addItem($ne); // server $ne = new ilNonEditableValueGUI($lng->txt("server_software"), ""); $ne->setValue($_SERVER["SERVER_SOFTWARE"]); $this->form->addItem($ne); // http path $ne = new ilNonEditableValueGUI($lng->txt("http_path"), ""); $ne->setValue(ILIAS_HTTP_PATH); $this->form->addItem($ne); // absolute path $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), ""); $ne->setValue(ILIAS_ABSOLUTE_PATH); $this->form->addItem($ne); $not_set = $lng->txt("path_not_set"); // convert $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), ""); $ne->setValue(PATH_TO_CONVERT ? PATH_TO_CONVERT : $not_set); $this->form->addItem($ne); // zip $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), ""); $ne->setValue(PATH_TO_ZIP ? PATH_TO_ZIP : $not_set); $this->form->addItem($ne); // unzip $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), ""); $ne->setValue(PATH_TO_UNZIP ? PATH_TO_UNZIP : $not_set); $this->form->addItem($ne); // java $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), ""); $ne->setValue(PATH_TO_JAVA ? PATH_TO_JAVA : $not_set); $this->form->addItem($ne); // htmldoc $ne = new ilNonEditableValueGUI($lng->txt("path_to_htmldoc"), ""); $ne->setValue(PATH_TO_HTMLDOC ? PATH_TO_HTMLDOC : $not_set); $this->form->addItem($ne); // mkisofs $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), ""); $ne->setValue(PATH_TO_MKISOFS ? PATH_TO_MKISOFS : $not_set); $this->form->addItem($ne); // latex $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), ""); $ne->setValue(URL_TO_LATEX ? URL_TO_LATEX : $not_set); $this->form->addItem($ne); $this->form->setTitle($lng->txt("server_data")); $this->form->setFormAction($this->ctrl->getFormAction($this)); }
/** * {@inheritdoc} */ public function buildForm(ilPropertyFormGUI $form) { /** * @var $lng ilLanguage */ global $lng; $header = new ilFormSectionHeaderGUI(); $header->setTitle($lng->txt('passwd_encoder_' . $this->getName())); $form->addItem($header); $salt = new ilCustomInputGUI($lng->txt('passwd_encoder_bcrypt_client_salt'), 'bcrypt_salt'); $info = array($lng->txt('passwd_encoder_client_bcrypt_salt_info')); if (!$this->isBcryptSupported()) { $info[] = sprintf($lng->txt('passwd_encoder_client_bcrypt_salt_info_php537'), PHP_VERSION); } if (1 == count($info)) { $salt->setInfo(current($info)); } else { $salt->setInfo('<ul><li>' . implode('</li><li>', $info) . '</li></ul>'); } $salt->setHtml($this->getClientSaltLocation()); $form->addItem($salt); }
/** * @return string */ public function getHTML() { global $tpl, $ilTabs, $ilCtrl, $lng, $ilHelp; /** * @var $ilHelp ilHelpGUI */ $ilHelp->setScreenIdComponent('bibl'); $form = new ilPropertyFormGUI(); $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, 'showContent')); $form->setTitle($lng->txt('detail_view')); // add link button if a link is defined in the settings $set = new ilSetting("bibl"); $link = $set->get(strtolower($this->bibl_obj->getFiletype())); if (!empty($link)) { $form->addCommandButton('autoLink', 'Link'); } $attributes = $this->entry->getAttributes(); //translate array key in order to sort by those keys foreach ($attributes as $key => $attribute) { //Check if there is a specific language entry if ($lng->exists($key)) { $strDescTranslated = $lng->txt($key); } else { $arrKey = explode("_", $key); $is_standard_field = false; switch ($arrKey[0]) { case 'bib': $is_standard_field = ilBibTex::isStandardField($arrKey[2]); break; case 'ris': $is_standard_field = ilRis::isStandardField($arrKey[2]); break; } // var_dump($is_standard_field); // FSX if ($is_standard_field) { $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]); } else { $strDescTranslated = $arrKey[2]; } } unset($attributes[$key]); $attributes[$strDescTranslated] = $attribute; } // sort attributes alphabetically by their array-key ksort($attributes, SORT_STRING); // render attributes to html foreach ($attributes as $key => $attribute) { $ci = new ilCustomInputGUI($key); $ci->setHtml($attribute); $form->addItem($ci); } // generate/render links to libraries $settings = ilBibliographicSetting::getAll(); foreach ($settings as $set) { $ci = new ilCustomInputGUI($set->getName()); $ci->setHtml($set->getButton($this->bibl_obj, $this->entry)); $form->addItem($ci); } $tpl->setPermanentLink("bibl", $this->bibl_obj->getRefId(), "_" . $_GET[ilObjBibliographicGUI::P_ENTRY_ID]); // set content and title return $form->getHTML(); //Permanent Link }
/** * init limit form * * @access protected * @param string mode selfAssessment or final * @return */ protected function initFormLimits($a_mode) { if (!is_object($this->form)) { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); } $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTableWidth('100%'); $this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.png'), $this->lng->txt('crs_objective')); switch ($a_mode) { case 'selfAssessment': $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit')); $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next')); $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back')); $tests = $this->objectives_qst_obj->getSelfAssessmentTests(); $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints(); break; case 'final': $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit')); $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next')); $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back')); $tests = $this->objectives_qst_obj->getFinalTests(); $max_points = $this->objectives_qst_obj->getFinalTestPoints(); break; } $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), ''); $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course'); $limit = 0; foreach ($tests as $test) { $limit = $test['limit']; foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) { $tpl->setCurrentBlock('qst'); $tpl->setVariable('QST_TITLE', $question['title']); if (strlen($question['description'])) { $tpl->setVariable('QST_DESCRIPTION', $question['description']); } $tpl->setVariable('QST_POINTS', $question['points'] . ' ' . $this->lng->txt('crs_objective_points')); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('tst'); $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id'])); if ($desc = ilObject::_lookupDescription($test['obj_id'])) { $tpl->setVariable('TST_DESC', $desc); } $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny')); $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst')); $tpl->parseCurrentBlock(); } $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points')); $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points')); $tpl->setVariable('POINTS', $max_points); $over->setHtml($tpl->get()); $this->form->addItem($over); $req = new ilTextInputGUI($this->lng->txt('crs_obj_required_points'), 'limit'); $req->setValue($limit); $req->setMaxLength(5); $req->setSize(3); $req->setRequired(true); switch ($a_mode) { case 'selfAssessment': $req->setInfo($this->lng->txt('crs_obj_initial_req_info')); break; case 'final': $req->setInfo($this->lng->txt('crs_obj_final_req_info')); break; } $this->form->addItem($req); }
function initForm() { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save')); $this->form_gui->setTitle($this->lng->txt('reg_settings_header')); $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type'); $reg_type->addOption(new ilRadioOption($this->lng->txt('reg_disabled'), IL_REG_DISABLED)); $option = new ilRadioOption($this->lng->txt('reg_direct'), IL_REG_DIRECT); $option->setInfo($this->lng->txt('reg_direct_info')); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_DIRECT); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_approve'), IL_REG_APPROVE); $option->setInfo($this->lng->txt('reg_approve_info')); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_APPROVE); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_type_confirmation'), IL_REG_ACTIVATION); $option->setInfo($this->lng->txt('reg_type_confirmation_info')); $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time'); $lt->setSize(5); $lt->setMaxLength(5); $lt->setMinValue(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE); $lt->setRequired(true); $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info')); $lt->setSuffix($this->lng->txt('seconds')); $option->addSubItem($lt); $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_ACTIVATION); $cd->setInfo($this->lng->txt('reg_allow_codes_info')); $option->addSubItem($cd); $reg_type->addOption($option); $option = new ilRadioOption($this->lng->txt('registration_reg_type_codes'), IL_REG_CODES); $option->setInfo($this->lng->txt('registration_reg_type_codes_info')); $reg_type->addOption($option); $this->form_gui->addItem($reg_type); $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd'); $pwd_gen->setValue(1); $pwd_gen->setInfo($this->lng->txt('reg_info_pwd')); $this->form_gui->addItem($pwd_gen); require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym'); $cap->setInfo($this->lng->txt('adm_captcha_anonymous_reg')); $cap->setValue(1); if (!ilCaptchaUtil::checkFreetype()) { $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage()); } $this->form_gui->addItem($cap); $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver'); $approver->setSize(32); $approver->setMaxLength(50); $approver->setInfo($this->lng->txt('reg_notification_info')); $this->form_gui->addItem($approver); $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type'); $option = new ilRadioOption($this->lng->txt('reg_fixed'), IL_REG_ROLES_FIXED); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editRoles'); $list->setHtml($this->__parseRoleList($this->__prepareRoleList(), $edit)); $option->addSubItem($list); $roles->addOption($option); $option = new ilRadioOption($this->lng->txt('reg_email'), IL_REG_ROLES_EMAIL); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments'); $list->setHtml($this->__parseRoleList($this->__prepareAutomaticRoleList(), $edit)); $option->addSubItem($list); $roles->addOption($option); $roles->setInfo($this->lng->txt('registration_codes_override_global_info')); $this->form_gui->addItem($roles); $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation'); $limit->setValue(1); $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles')); $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations'); $list->setHtml($this->__parseRoleList($this->__prepareAccessLimitationRoleList(), $edit)); $list->setInfo($this->lng->txt('registration_codes_override_global_info')); $limit->addSubItem($list); $this->form_gui->addItem($limit); $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains'); $domains->setInfo($this->lng->txt('reg_allowed_domains_info')); $this->form_gui->addItem($domains); $this->form_gui->addCommandButton('save', $this->lng->txt('save')); }
public function initIliasSettingsForm() { /** * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveIliasSettings')); $this->form->setTitle($this->getPluginObject()->txt('general_settings')); $this->form->addCommandButton('saveIliasSettings', $lng->txt('save')); $this->form->addCommandButton('cancelIliasSettings', $lng->txt('cancel')); $cb_group = new ilCheckboxGroupInputGUI($this->pluginObj->txt('object_creation_settings'), 'obj_creation_settings'); include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); if ($templates) { foreach ($templates as $item) { $cb_simple = new ilCheckboxOption($this->pluginObj->txt($item["title"]), $item["id"]); $cb_group->addOption($cb_simple); } } $cb_group->setInfo($this->pluginObj->txt('template_info')); $this->form->addItem($cb_group); $obj_title_suffix = new ilCheckboxInputGUI($this->pluginObj->txt('obj_title_suffix'), 'obj_title_suffix'); $obj_title_suffix->setInfo($this->pluginObj->txt('obj_title_suffix_info')); $this->form->addItem($obj_title_suffix); $crs_grp_trigger = new ilCheckboxInputGUI($this->pluginObj->txt('allow_crs_grp_trigger'), 'allow_crs_grp_trigger'); $crs_grp_trigger->setInfo($this->pluginObj->txt('allow_crs_grp_trigger_info')); $this->form->addItem($crs_grp_trigger); $show_free_slots = new ilCheckboxInputGUI($this->pluginObj->txt('show_free_slots'), 'show_free_slots'); $show_free_slots->setInfo($this->pluginObj->txt('show_free_slots_info')); $this->form->addItem($show_free_slots); $enable_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('enable_perm_room'), 'enable_perm_room'); $enable_perm_room->setInfo($this->pluginObj->txt('enable_perm_room_info')); $default_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('default_perm_room'), 'default_perm_room'); $default_perm_room->setInfo($this->pluginObj->txt('default_perm_room_info')); $enable_perm_room->addSubItem($default_perm_room); $this->form->addItem($enable_perm_room); $add_to_desktop = new ilCheckboxInputGUI($this->pluginObj->txt('add_to_desktop'), 'add_to_desktop'); $add_to_desktop->setInfo($this->pluginObj->txt('add_to_desktop_info')); $this->form->addItem($add_to_desktop); $content_file_types = new ilTextInputGUI($this->pluginObj->txt('content_file_types'), 'content_file_types'); $content_file_types->setRequired(true); $content_file_types->setInfo($this->pluginObj->txt('content_file_types_info')); $this->form->addItem($content_file_types); $user_folders = new ilCheckboxInputGUI($this->pluginObj->txt('use_user_folders'), 'use_user_folders'); $user_folders->setInfo($this->pluginObj->txt('use_user_folders_info')); if (ilAdobeConnectServer::getSetting('user_assignment_mode') == ilAdobeConnectServer::ASSIGN_USER_DFN_EMAIL) { $user_folders->setDisabled(true); } $this->form->addItem($user_folders); $xavc_options = array("host" => $this->pluginObj->txt("presenter"), "mini-host" => $this->pluginObj->txt("moderator"), "view" => $this->pluginObj->txt("participant"), "denied" => $this->pluginObj->txt('denied')); $mapping_crs = new ilNonEditableValueGUI($this->pluginObj->txt('default_crs_mapping'), 'default_crs_mapping'); // $crs_owner = new ilSelectInputGUI($lng->txt('owner'), 'crs_owner'); // $crs_owner->setOptions($xavc_options); // $mapping_crs->addSubItem($crs_owner); $crs_admin = new ilSelectInputGUI($lng->txt('il_crs_admin'), 'crs_admin'); $crs_admin->setOptions($xavc_options); $mapping_crs->addSubItem($crs_admin); $crs_tutor = new ilSelectInputGUI($lng->txt('il_crs_tutor'), 'crs_tutor'); $crs_tutor->setOptions($xavc_options); $mapping_crs->addSubItem($crs_tutor); $crs_member = new ilSelectInputGUI($lng->txt('il_crs_member'), 'crs_member'); $crs_member->setOptions($xavc_options); $mapping_crs->addSubItem($crs_member); $this->form->addItem($mapping_crs); $mapping_grp = new ilNonEditableValueGUI($this->pluginObj->txt('default_grp_mapping'), 'default_grp_mapping'); // $grp_owner = new ilSelectInputGUI($lng->txt('owner'), 'grp_owner'); // $grp_owner->setOptions($xavc_options); // $mapping_grp->addSubItem($grp_owner); $grp_admin = new ilSelectInputGUI($lng->txt('il_grp_admin'), 'grp_admin'); $grp_admin->setOptions($xavc_options); $mapping_grp->addSubItem($grp_admin); $grp_member = new ilSelectInputGUI($lng->txt('il_grp_member'), 'grp_member'); $grp_member->setOptions($xavc_options); $mapping_grp->addSubItem($grp_member); $this->form->addItem($mapping_grp); $ac_permissions = ilXAVCPermissions::getPermissionsArray(); //@todo nahmad: in Template auslagern! $tbl = "<table width='100%' >\n\t\t<tr>\n\t\t<td> </td> \n\t\t<td>" . $this->pluginObj->txt('presenter') . "</td>\n\t\t<td>" . $this->pluginObj->txt('moderator') . "</td>\n\t\t<td>" . $this->pluginObj->txt('participant') . "</td>\n\t\t<td>" . $this->pluginObj->txt('denied') . "</td>\n\t\t\n\t\t</tr>"; foreach ($ac_permissions as $ac_permission => $ac_roles) { $tbl .= "<tr> <td>" . $this->pluginObj->txt($ac_permission) . "</td>"; foreach ($ac_roles as $ac_role => $ac_access) { $tbl .= "<td>"; $tbl .= ilUtil::formCheckbox((bool) $ac_access, 'permissions[' . $ac_permission . '][' . $ac_role . ']', $ac_role, false); $tbl .= "</td>"; } $tbl .= "</tr>"; } $tbl .= "</table>"; $matrix = new ilCustomInputGUI($this->pluginObj->txt('ac_permissions'), ''); $matrix->setHtml($tbl); $this->form->addItem($matrix); }
/** * Show user agreement * * @access protected * @return */ protected function fillAgreement() { global $ilUser; if (!$this->isRegistrationPossible()) { return true; } include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; if (!$this->privacy->confirmationRequired($this->type) and !ilCourseDefinedFieldDefinition::_hasFields($this->container->getId())) { return true; } $this->lng->loadLanguageModule('ps'); include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; $fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->container->getId())); if (!count($fields_info->getExportableFields())) { return true; } $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('usr_agreement')); $this->form->addItem($section); $fields = new ilCustomInputGUI($this->lng->txt($this->type . '_user_agreement'), ''); $tpl = new ilTemplate('tpl.agreement_form.html', true, true, 'Services/Membership'); $tpl->setVariable('TXT_INFO_AGREEMENT', $this->lng->txt($this->type . '_info_agreement')); foreach ($fields_info->getExportableFields() as $field) { $tpl->setCurrentBlock('field_item'); $tpl->setVariable('FIELD_NAME', $this->lng->txt($field)); $tpl->parseCurrentBlock(); } $fields->setHtml($tpl->get()); $this->form->addItem($fields); $this->showCustomFields(); // Checkbox agreement if ($this->privacy->confirmationRequired($this->type)) { $agreement = new ilCheckboxInputGUI($this->lng->txt($this->type . '_agree'), 'agreement'); $agreement->setRequired(true); $agreement->setOptionTitle($this->lng->txt($this->type . '_info_agree')); $agreement->setValue(1); $this->form->addItem($agreement); } return true; }
/** * Creates an output of the edit form for the question * @param bool $checkonly * @return bool */ function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart(FALSE); $form->setTableWidth('100%'); $form->setId('assformulaquestion'); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // Add info text $question = $form->getItemByPostVar('question'); $question->setInfo($this->lng->txt('fq_question_desc')); $variables = $this->object->getVariables(); $categorized_units = $this->object->getUnitrepository()->getCategorizedUnits(); $result_units = $this->object->__get('resultunits'); $unit_options = array(); $category_name = ''; $new_category = false; foreach ((array) $categorized_units as $item) { /** * @var $item assFormulaQuestionUnitCategory|assFormulaQuestionUnit */ if ($item instanceof assFormulaQuestionUnitCategory) { if ($category_name != $item->getDisplayString()) { $new_category = true; $category_name = $item->getDisplayString(); } continue; } $unit_options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : ''); $new_category = false; } if (count($variables)) { uasort($variables, function (assFormulaQuestionVariable $v1, assFormulaQuestionVariable $v2) { $num_v1 = (int) substr($v1->getVariable(), 2); $num_v2 = (int) substr($v2->getVariable(), 2); if ($num_v1 > $num_v2) { return 1; } else { if ($num_v1 < $num_v2) { return -1; } } return 0; }); foreach ($variables as $variable) { /** * @var $variable assFormulaQuestionVariable */ $variable_header = new ilFormSectionHeaderGUI(); $variable_header->setTitle(sprintf($this->lng->txt('variable_x'), $variable->getVariable())); $range_min = new ilNumberInputGUI($this->lng->txt('range_min'), 'range_min_' . $variable->getVariable()); $range_min->allowDecimals(true); $range_min->setSize(3); $range_min->setRequired(true); $range_min->setValue($variable->getRangeMin()); $range_max = new ilNumberInputGUI($this->lng->txt('range_max'), 'range_max_' . $variable->getVariable()); $range_max->allowDecimals(true); $range_max->setSize(3); $range_max->setRequired(true); $range_max->setValue($variable->getRangeMax()); $units = new ilSelectInputGUI($this->lng->txt('unit'), 'unit_' . $variable->getVariable()); $units->setOptions(array(0 => $this->lng->txt('no_selection')) + $unit_options); if (is_object($variable->getUnit())) { $units->setValue($variable->getUnit()->getId()); } $precision = new ilNumberInputGUI($this->lng->txt('precision'), 'precision_' . $variable->getVariable()); $precision->setRequired(true); $precision->setSize(3); $precision->setMinValue(0); $precision->setValue($variable->getPrecision()); $precision->setInfo($this->lng->txt('fq_precision_info')); $intprecision = new ilNumberInputGUI($this->lng->txt('intprecision'), 'intprecision_' . $variable->getVariable()); $intprecision->setSize(3); $intprecision->setMinValue(1); $intprecision->setValue($variable->getIntprecision()); $intprecision->setInfo($this->lng->txt('intprecision_info')); $form->addItem($variable_header); $form->addItem($range_min); $form->addItem($range_max); $form->addItem($units); $form->addItem($precision); $form->addItem($intprecision); } } $results = $this->object->getResults(); if (count($results)) { require_once 'Services/Form/classes/class.ilMultiSelectInputGUI.php'; uasort($results, function (assFormulaQuestionResult $r1, assFormulaQuestionResult $r2) { $num_r1 = (int) substr($r1->getResult(), 2); $num_r2 = (int) substr($r2->getResult(), 2); if ($num_r1 > $num_r2) { return 1; } else { if ($num_r1 < $num_r2) { return -1; } } return 0; }); foreach ($results as $result) { /** * @var $result assFormulaQuestionResult */ $result_header = new ilFormSectionHeaderGUI(); $result_header->setTitle(sprintf($this->lng->txt('result_x'), $result->getResult())); $formula = new ilTextInputGUI($this->lng->txt('formula'), 'formula_' . $result->getResult()); $formula->setInfo($this->lng->txt('fq_formula_desc')); $formula->setRequired(true); $formula->setSize(50); $formula->setValue($result->getFormula()); $formula->setSuffix(' = ' . $result->getResult()); if (preg_match("/suggestrange_(.*)/", $this->ctrl->getCmd(), $matches) && strcmp($matches[1], $result->getResult()) == 0) { // suggest a range for the result if (strlen($result->substituteFormula($variables, $results))) { $result->suggestRange($variables, $results); } } $range_min = new ilNumberInputGUI($this->lng->txt('range_min'), 'range_min_' . $result->getResult()); $range_min->allowDecimals(true); $range_min->setSize(3); $range_min->setRequired(true); $range_min->setValue($result->getRangeMin()); $range_max = new ilNumberInputGUI($this->lng->txt('range_max'), 'range_max_' . $result->getResult()); $range_max->allowDecimals(true); $range_max->setSize(3); $range_max->setRequired(true); $range_max->setValue($result->getRangeMax()); $matches = array(); $precision = new ilNumberInputGUI($this->lng->txt('precision'), 'precision_' . $result->getResult()); $precision->setRequired(true); $precision->setSize(3); $precision->setMinValue(0); $precision->setInfo($this->lng->txt('fq_precision_info')); $precision->setValue($result->getPrecision()); $tolerance = new ilNumberInputGUI($this->lng->txt('tolerance'), 'tolerance_' . $result->getResult()); $tolerance->setSize(3); $tolerance->setMinValue(0); $tolerance->setMaxValue(100); $tolerance->allowDecimals(false); $tolerance->setInfo($this->lng->txt('tolerance_info')); $tolerance->setValue($result->getTolerance()); $suggest_range_button = new ilCustomInputGUI('', ''); $suggest_range_button->setHtml('<input type="submit" class="btn btn-default" name="cmd[suggestrange_' . $result->getResult() . ']" value="' . $this->lng->txt("suggest_range") . '" />'); $sel_result_units = new ilSelectInputGUI($this->lng->txt('unit'), 'unit_' . $result->getResult()); $sel_result_units->setOptions(array(0 => $this->lng->txt('no_selection')) + $unit_options); $sel_result_units->setInfo($this->lng->txt('result_unit_info')); if (is_object($result->getUnit())) { $sel_result_units->setValue($result->getUnit()->getId()); } $mc_result_units = new ilMultiSelectInputGUI($this->lng->txt('result_units'), 'units_' . $result->getResult()); $mc_result_units->setOptions($unit_options); $mc_result_units->setInfo($this->lng->txt('result_units_info')); $selectedvalues = array(); foreach ($unit_options as $unit_id => $txt) { if ($this->hasResultUnit($result, $unit_id, $result_units)) { $selectedvalues[] = $unit_id; } } $mc_result_units->setValue($selectedvalues); $result_type = new ilRadioGroupInputGUI($this->lng->txt('result_type_selection'), 'result_type_' . $result->getResult()); $result_type->setRequired(true); $no_type = new ilRadioOption($this->lng->txt('no_result_type'), 0); $no_type->setInfo($this->lng->txt('fq_no_restriction_info')); $result_dec = new ilRadioOption($this->lng->txt('result_dec'), 1); $result_dec->setInfo($this->lng->txt('result_dec_info')); $result_frac = new ilRadioOption($this->lng->txt('result_frac'), 2); $result_frac->setInfo($this->lng->txt('result_frac_info')); $result_co_frac = new ilRadioOption($this->lng->txt('result_co_frac'), 3); $result_co_frac->setInfo($this->lng->txt('result_co_frac_info')); $result_type->addOption($no_type); $result_type->addOption($result_dec); $result_type->addOption($result_frac); $result_type->addOption($result_co_frac); $result_type->setValue(strlen($result->getResultType()) ? $result->getResultType() : 0); $points = new ilNumberInputGUI($this->lng->txt('points'), 'points_' . $result->getResult()); $points->allowDecimals(true); $points->setRequired(true); $points->setSize(3); $points->setMinValue(0); $points->setValue(strlen($result->getPoints()) ? $result->getPoints() : 1); $rating_type = new ilCheckboxInputGUI($this->lng->txt('advanced_rating'), 'rating_advanced_' . $result->getResult()); $rating_type->setValue(1); $rating_type->setInfo($this->lng->txt('advanced_rating_info')); if (!$save) { $advanced_rating = $this->canUseAdvancedRating($result); if (!$advanced_rating) { $rating_type->setDisabled(true); $rating_type->setChecked(false); } else { $rating_type->setChecked(strlen($result->getRatingSimple()) && $result->getRatingSimple() ? false : true); } } $sign = new ilNumberInputGUI($this->lng->txt('rating_sign'), 'rating_sign_' . $result->getResult()); $sign->setRequired(true); $sign->setSize(3); $sign->setMinValue(0); $sign->setValue($result->getRatingSign()); $rating_type->addSubItem($sign); $value = new ilNumberInputGUI($this->lng->txt('rating_value'), 'rating_value_' . $result->getResult()); $value->setRequired(true); $value->setSize(3); $value->setMinValue(0); $value->setValue($result->getRatingValue()); $rating_type->addSubItem($value); $unit = new ilNumberInputGUI($this->lng->txt('rating_unit'), 'rating_unit_' . $result->getResult()); $unit->setRequired(true); $unit->setSize(3); $unit->setMinValue(0); $unit->setValue($result->getRatingUnit()); $rating_type->addSubItem($unit); $info_text = new ilNonEditableValueGUI($this->lng->txt('additional_rating_info')); $rating_type->addSubItem($info_text); $form->addItem($result_header); $form->addItem($formula); $form->addItem($range_min); $form->addItem($range_max); $form->addItem($suggest_range_button); $form->addItem($precision); $form->addItem($tolerance); $form->addItem($sel_result_units); $form->addItem($mc_result_units); $form->addItem($result_type); $form->addItem($points); $form->addItem($rating_type); } $defined_result_vars = array(); $quest_vars = array(); $defined_result_res = array(); $result_vars = array(); foreach ($variables as $key => $object) { $quest_vars[$key] = $key; } foreach ($results as $key => $object) { $result_vars[$key] = $key; } foreach ($results as $tmp_result) { /** * @var $tmp_result assFormulaQuestionResult */ $formula = $tmp_result->getFormula(); preg_match_all("/([\$][v][0-9]*)/", $formula, $form_vars); preg_match_all("/([\$][r][0-9]*)/", $formula, $form_res); foreach ($form_vars[0] as $res_var) { $defined_result_vars[$res_var] = $res_var; } foreach ($form_res[0] as $res_res) { $defined_result_res[$res_res] = $res_res; } } } $result_has_undefined_vars = array(); $question_has_unused_vars = array(); if (is_array($quest_vars) && count($quest_vars) > 0) { $result_has_undefined_vars = array_diff($defined_result_vars, $quest_vars); $question_has_unused_vars = array_diff($quest_vars, $defined_result_vars); } if (is_array($result_vars) && count($result_vars) > 0) { $result_has_undefined_res = array_diff($defined_result_res, $result_vars); } $error_message = ''; if (count($result_has_undefined_vars) > 0 || count($question_has_unused_vars) > 0) { if (count($result_has_undefined_vars) > 0) { $error_message .= $this->lng->txt("res_contains_undef_var") . '<br>'; } if (count($question_has_unused_vars) > 0) { $error_message .= $this->lng->txt("que_contains_unused_var") . '<br>'; } $checked = false; if ($save) { ilUtil::sendFailure($error_message); } } if (count($result_has_undefined_res) > 0) { $error_message .= $this->lng->txt("res_contains_undef_res") . '<br>'; $checked = false; } if ($save && !$checked) { ilUtil::sendFailure($error_message); } if ($this->object->getId()) { $hidden = new ilHiddenInputGUI("", "ID"); $hidden->setValue($this->object->getId()); $form->addItem($hidden); } $this->populateTaxonomyFormSection($form); $form->addCommandButton('parseQuestion', $this->lng->txt("parseQuestion")); $form->addCommandButton('saveReturnFQ', $this->lng->txt("save_return")); $form->addCommandButton('saveFQ', $this->lng->txt("save")); $errors = $checked; if ($save) { $found_vars = array(); $found_results = array(); foreach ((array) $_POST as $key => $value) { if (preg_match("/^unit_(\\\$v\\d+)\$/", $key, $matches)) { array_push($found_vars, $matches[1]); } if (preg_match("/^unit_(\\\$r\\d+)\$/", $key, $matches)) { array_push($found_results, $matches[1]); } } $form->setValuesByPost(); $errors = !$form->checkInput(); $custom_errors = false; if (count($variables)) { foreach ($variables as $variable) { /** * @var $variable assFormulaQuestionVariable */ $min_range = $form->getItemByPostVar('range_min_' . $variable->getVariable()); $max_range = $form->getItemByPostVar('range_max_' . $variable->getVariable()); if ($min_range->getValue() > $max_range->getValue()) { $min_range->setAlert($this->lng->txt('err_range')); $max_range->setAlert($this->lng->txt('err_range')); $custom_errors = true; } } } if (count($results)) { foreach ($results as $result) { /** * @var $result assFormulaQuestionResult */ $min_range = $form->getItemByPostVar('range_min_' . $result->getResult()); $max_range = $form->getItemByPostVar('range_max_' . $result->getResult()); if ($min_range->getValue() > $max_range->getValue()) { $min_range->setAlert($this->lng->txt('err_range')); $max_range->setAlert($this->lng->txt('err_range')); $custom_errors = true; } $formula = $form->getItemByPostVar('formula_' . $result->getResult()); if (strpos($formula->getValue(), $result->getResult()) !== FALSE) { $formula->setAlert($this->lng->txt('errRecursionInResult')); $custom_errors = true; } $result_unit = $form->getItemByPostVar('unit_' . $result->getResult()); $rating_advanced = $form->getItemByPostVar('rating_advanced_' . $result->getResult()); if ((int) $result_unit->getValue() <= 0 && $rating_advanced->getChecked()) { unset($_POST['rating_advanced_' . $result->getResult()]); $rating_advanced->setDisabled(true); $rating_advanced->setChecked(false); $rating_advanced->setAlert($this->lng->txt('err_rating_advanced_not_allowed')); $custom_errors = true; } else { if ($rating_advanced->getChecked()) { $rating_sign = $form->getItemByPostVar('rating_sign_' . $result->getResult()); $rating_value = $form->getItemByPostVar('rating_value_' . $result->getResult()); $rating_unit = $form->getItemByPostVar('rating_unit_' . $result->getResult()); $percentage = $rating_sign->getValue() + $rating_value->getValue() + $rating_unit->getValue(); if ($percentage != 100) { $rating_advanced->setAlert($this->lng->txt('err_wrong_rating_advanced')); $custom_errors = true; } } } preg_match_all("/([\$][v][0-9]*)/", $formula->getValue(), $form_vars); $result_has_undefined_vars = array_diff($form_vars[0], (array) $found_vars); if (count($result_has_undefined_vars)) { $errors = true; ilUtil::sendInfo($this->lng->txt('res_contains_undef_var')); } } } if ($custom_errors && !$errors) { $errors = true; ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable('QUESTION_DATA', $form->getHTML()); } return $errors; }
/** * Init form. * * @param int $a_mode Edit Mode */ public function initPropertiesForm() { global $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // title $ti = new ilTextInputGUI($this->txt("title"), "title"); $ti->setRequired(true); $this->form->addItem($ti); // description $ta = new ilTextAreaInputGUI($this->txt("description"), "desc"); $this->form->addItem($ta); // online $cb = new ilCheckboxInputGUI($this->lng->txt("online"), "online"); $this->form->addItem($cb); // online //$rd = new ilCheckboxInputGUI($this->lng->txt("learners_see_rpt_details"), "learners_see_rpt_details"); $rd = new ilCheckboxInputGUI("Learners See Report Details", "learners_see_rpt_details"); $this->form->addItem($rd); // version $v = new ilNonEditableValueGUI($this->lng->txt("version"), "version"); $this->form->addItem($v); // SCORM PIF if ($this->object->getExistsOnCloud()) { $uploadTxt = $this->txt("upload_new_package_version"); } else { $uploadTxt = $this->txt("upload_package"); } $sf = new ilCustomInputGUI($uploadTxt, "scormfile"); $id = $this->object->getId(); $mode = ""; // "update" if package already exists $uploadFormHtml = '<form action="' . $CFG->wwwroot . '/mod/rscloud/uploadhandler.php?id=' . $id . '&mode=' . $mode . '" method="post" ' . 'enctype="multipart/form-data">' . '<input type="file" name="file" id="file" /> ' . '<br />' . '<input type="submit" name="submit" value="Submit" />' . '</form>'; $uploadInputItem = '<input type="file" name="scormcloudfile" id="scormcloudfile" /> '; $sf->setHtml($uploadInputItem); $this->form->addItem($sf); $this->form->setMultipart(true); $this->form->addCommandButton("updateProperties", $this->txt("save")); $this->form->setTitle($this->txt("edit_properties")); $this->form->setFormAction($ilCtrl->getFormAction($this)); }
private function buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues = false) { global $ilCtrl, $lng; require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php'; require_once 'Services/Form/classes/class.ilCustomInputGUI.php'; require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php'; require_once 'Services/Form/classes/class.ilTextInputGUI.php'; require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php'; $ilCtrl->setParameter($this, 'active_id', $activeId); $ilCtrl->setParameter($this, 'pass', $pass); $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle(sprintf($lng->txt('manscoring_results_pass'), $pass + 1)); $form->setTableWidth('100%'); foreach ($questionGuiList as $questionId => $questionGUI) { $questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle()); $questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true); $bestSolution = $questionGUI->object->getSuggestedSolutionOutput(); $sect = new ilFormSectionHeaderGUI(); $sect->setTitle($questionHeader . ' [' . $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']'); $form->addItem($sect); $cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution')); $cust->setHtml($questionSolution); $form->addItem($cust); $text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points"); if ($initValues) { $text->setValue(assQuestion::_getReachedPoints($activeId, $questionId, $pass)); } $form->addItem($text); $nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints"); if ($initValues) { $nonedit->setValue(assQuestion::_getMaximumPoints($questionId)); } $form->addItem($nonedit); $area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback"); $area->setUseRTE(true); if ($initValues) { $area->setValue($this->object->getManualFeedback($activeId, $questionId, $pass)); } $form->addItem($area); if (strlen(trim($bestSolution))) { $cust = new ilCustomInputGUI($lng->txt('tst_show_solution_suggested')); $cust->setHtml($bestSolution); $form->addItem($cust); } } $sect = new ilFormSectionHeaderGUI(); $sect->setTitle($lng->txt('tst_participant')); $form->addItem($sect); $check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done'); if ($initValues && ilTestService::isManScoringDone($activeId)) { $check->setChecked(true); } $form->addItem($check); $check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify'); $form->addItem($check); $form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save')); $form->addCommandButton('saveReturnManScoringParticipantScreen', $lng->txt('save_return')); $form->addCommandButton('saveNextManScoringParticipantScreen', $lng->txt('save_and_next')); return $form; }
/** * 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); } } }
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; }
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); } }
/** * fill max members * * @access protected * @param * @return */ protected function fillMaxMembers() { global $ilUser; if (!$this->container->isSubscriptionMembershipLimited()) { return true; } $tpl = new ilTemplate('tpl.max_members_form.html', true, true, 'Services/Membership'); $tpl->setVariable('TXT_MAX', $this->lng->txt('mem_max_users')); $tpl->setVariable('NUM_MAX', $this->container->getSubscriptionMaxMembers()); $tpl->setVariable('TXT_FREE', $this->lng->txt('mem_free_places') . ":"); $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers()); if ($free) { $tpl->setVariable('NUM_FREE', $free); } else { $tpl->setVariable('WARN_FREE', $free); } include_once './Modules/Course/classes/class.ilCourseWaitingList.php'; $waiting_list = new ilCourseWaitingList($this->container->getId()); if ($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) { if ($waiting_list->isOnList($ilUser->getId())) { $tpl->setVariable('TXT_WAIT', $this->lng->txt('mem_waiting_list_position')); $tpl->setVariable('NUM_WAIT', $waiting_list->getPosition($ilUser->getId())); } else { $tpl->setVariable('TXT_WAIT', $this->lng->txt('mem_waiting_list')); if ($free and $waiting_list->getCountUsers()) { $tpl->setVariable('WARN_WAIT', $waiting_list->getCountUsers()); } else { $tpl->setVariable('NUM_WAIT', $waiting_list->getCountUsers()); } } } $alert = ''; if (!$free and !$this->container->enabledWaitingList()) { // Disable registration $this->enableRegistration(false); ilUtil::sendFailure($this->lng->txt('mem_alert_no_places')); #$alert = $this->lng->txt('mem_alert_no_places'); } elseif ($this->container->enabledWaitingList() and $this->container->isSubscriptionMembershipLimited() and $waiting_list->isOnList($ilUser->getId())) { // Disable registration $this->enableRegistration(false); } elseif (!$free and $this->container->enabledWaitingList() and $this->container->isSubscriptionMembershipLimited()) { ilUtil::sendFailure($this->lng->txt('crs_warn_no_max_set_on_waiting_list')); #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list'); } elseif ($free and $this->container->enabledWaitingList() and $this->container->isSubscriptionMembershipLimited() and $this->getWaitingList()->getCountUsers()) { ilUtil::sendFailure($this->lng->txt('crs_warn_wl_set_on_waiting_list')); #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list'); } $max = new ilCustomInputGUI($this->lng->txt('mem_participants')); $max->setHtml($tpl->get()); if (strlen($alert)) { $max->setAlert($alert); } $this->form->addItem($max); return true; }
/** * Show create/edit single link * @param int form mode * @return */ protected function initFormLink($a_mode) { global $ilTabs; $ilTabs->activateTab("id_content"); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); switch ($a_mode) { case self::LINK_MOD_CREATE: // Header $this->ctrl->setParameter($this, 'new_type', 'webr'); $this->form->setTitle($this->lng->txt('webr_new_link')); $this->form->setTableWidth('600px'); // Buttons $this->form->addCommandButton('save', $this->lng->txt('webr_add')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); break; case self::LINK_MOD_ADD: // Header $this->form->setTitle($this->lng->txt('webr_new_link')); // Buttons $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add')); $this->form->addCommandButton('view', $this->lng->txt('cancel')); break; case self::LINK_MOD_EDIT: // Header $this->ctrl->setParameter($this, 'link_id', (int) $_REQUEST['link_id']); $this->form->setTitle($this->lng->txt('webr_edit')); // Buttons $this->form->addCommandButton('updateLink', $this->lng->txt('save')); $this->form->addCommandButton('view', $this->lng->txt('cancel')); break; } $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired()) { ilUtil::sendInfo($this->lng->txt('webr_container_info')); $this->form->setTitle($this->lng->txt('webr_edit_list')); // List Title $title = new ilTextInputGUI($this->lng->txt('webr_list_title'), 'lti'); $title->setRequired(true); $title->setSize(40); $title->setMaxLength(127); $this->form->addItem($title); // List Description $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'), 'tde'); $desc->setRows(3); $desc->setCols(40); $this->form->addItem($desc); // Addtional section $sect = new ilFormSectionHeaderGUI(); $sect->setTitle($this->lng->txt('webr_add')); $this->form->addItem($sect); } // Target /* $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar'); $tar->setValue("http://"); $tar->setSize(40); $tar->setMaxLength(500); */ include_once 'Services/Form/classes/class.ilLinkInputGUI.php'; $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'), 'tar'); $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem")); $tar->setRequired(true); $this->form->addItem($tar); // Title $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'), 'tit'); $tit->setRequired(true); $tit->setSize(40); $tit->setMaxLength(127); $this->form->addItem($tit); // Description $des = new ilTextAreaInputGUI($this->lng->txt('description'), 'des'); $des->setRows(3); $des->setCols(40); $this->form->addItem($des); if ($a_mode != self::LINK_MOD_CREATE) { // Active $act = new ilCheckboxInputGUI($this->lng->txt('active'), 'act'); $act->setChecked(true); $act->setValue(1); $this->form->addItem($act); // Check $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'), 'che'); $che->setValue(1); $this->form->addItem($che); } // Valid if ($a_mode == self::LINK_MOD_EDIT) { $val = new ilCheckboxInputGUI($this->lng->txt('valid'), 'vali'); $this->form->addItem($val); } if (ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE) { $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter')); $dyn->setInfo($this->lng->txt('links_dynamic_info')); if (count($links = ilParameterAppender::_getParams((int) $_GET['link_id']))) { $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'), 'ex'); $dyn->addSubItem($ex); foreach ($links as $id => $link) { $p = new ilCustomInputGUI(); $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html', true, true, 'Modules/WebResource'); $ptpl->setVariable('INFO_TXT', ilParameterAppender::parameterToInfo($link['name'], $link['value'])); $this->ctrl->setParameter($this, 'param_id', $id); $ptpl->setVariable('LINK_DEL', $this->ctrl->getLinkTarget($this, 'deleteParameterForm')); $ptpl->setVariable('LINK_TXT', $this->lng->txt('delete')); $p->setHtml($ptpl->get()); $dyn->addSubItem($p); } } // Existing parameters // New parameter if ($a_mode != self::LINK_MOD_CREATE) { #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),''); #$dyn->addSubItem($new); } // Dynyamic name $nam = new ilTextInputGUI($this->lng->txt('links_name'), 'nam'); $nam->setSize(12); $nam->setMaxLength(128); $dyn->addSubItem($nam); // Dynamic value $val = new ilSelectInputGUI($this->lng->txt('links_value'), 'val'); $val->setOptions(ilParameterAppender::_getOptionSelect()); $val->setValue(0); $dyn->addSubItem($val); $this->form->addItem($dyn); } }
protected function showtlt() { global $lng, $ilCtrl, $tpl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "showtlt")); $form->setTitle($lng->txt("learning_progress")); $form->setDescription($lng->txt("trac_collection_tlt_learner_info")); $coll_items = array(); include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->getObjId()); $collection = $olp->getCollectionInstance(); if ($collection) { $coll_items = $collection->getItems(); $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles } include_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $class = ilLPStatusFactory::_getClassById($this->getObjId(), ilLPObjSettings::LP_MODE_COLLECTION_TLT); $info = $class::_getStatusInfo($this->getObjId(), true); foreach ($coll_items as $item_id) { $field = new ilCustomInputGUI($possible_items[$item_id]["title"]); // lp status $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (isset($info["completed"][$item_id]) && in_array($ilUser->getId(), $info["completed"][$item_id])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (isset($info["in_progress"][$item_id]) && in_array($ilUser->getId(), $info["in_progress"][$item_id])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status); $text = ilLearningProgressBaseGUI::_getStatusText($status); $field->setHtml(ilUtil::img($path, $text)); // stats $spent = 0; if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) { $spent = $info["tlt_users"][$item_id][$ilUser->getId()]; } $needed = $info["tlt"][$item_id]; if ($needed) { $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"), ilFormat::_secondsToString($spent), ilFormat::_secondsToString($needed), min(100, round(abs($spent) / $needed * 100)))); } $form->addItem($field); } $tpl->setContent($form->getHTML()); }
/** * Detail view of a mail */ public function showMail() { /** * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI * @var $ilTabs ilTabsGUI */ global $ilUser, $ilToolbar, $ilTabs; if ($_SESSION['mail_id']) { $_GET['mail_id'] = $_SESSION['mail_id']; $_SESSION['mail_id'] = ''; } $ilTabs->clearTargets(); $ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder')); $this->umail->markRead(array((int) $_GET['mail_id'])); $mailData = $this->umail->getMail((int) $_GET['mail_id']); $this->tpl->setTitle($this->lng->txt('mail_mails_of')); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setTableWidth('100%'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $form->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $this->ctrl->clearParameters($this); $form->setTitle($this->lng->txt('mail_mails_of')); if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent')); } include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php'; /** * @var $sender ilObjUser */ $sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY); $this->ctrl->clearParameters($this); } $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank'); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails'); $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE); $this->ctrl->clearParameters($this); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $linked_fullname = $sender->getPublicName(); $picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName()); $add_to_addb_button = ''; if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) { $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'user', $sender->getId()); $linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>'; $this->ctrl->clearParameters($this); } if ($sender->getId() != $ilUser->getId()) { require_once 'Services/Contact/classes/class.ilAddressbook.php'; $abook = new ilAddressbook($ilUser->getId()); if ($abook->checkEntryByLogin($sender->getLogin()) == 0) { $tplbtn = new ilTemplate('tpl.buttons.html', true, true); $tplbtn->setCurrentBlock('btn_cell'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add')); $this->ctrl->clearParameters($this); $tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook')); $tplbtn->parseCurrentBlock(); $add_to_addb_button = '<br />' . $tplbtn->get(); } } $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button); $form->addItem($from); } else { if (!$sender || !$sender->getId()) { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')'); $form->addItem($from); } else { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName()); $form->addItem($from); } } $to = new ilCustomInputGUI($this->lng->txt('mail_to')); $to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false)); $form->addItem($to); if ($mailData['rcp_cc']) { $cc = new ilCustomInputGUI($this->lng->txt('cc')); $cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false)); $form->addItem($cc); } if ($mailData['rcp_bcc']) { $bcc = new ilCustomInputGUI($this->lng->txt('bc')); $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false)); $form->addItem($bcc); } $subject = new ilCustomInputGUI($this->lng->txt('subject')); $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true)); $form->addItem($subject); $date = new ilCustomInputGUI($this->lng->txt('date')); $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME))); $form->addItem($date); $message = new ilCustomInputGUI($this->lng->txt('message')); $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true)); $form->addItem($message); if ($mailData['attachments']) { $att = new ilCustomInputGUI($this->lng->txt('attachments')); $radiog = new ilRadioGroupInputGUI('', 'filename'); foreach ($mailData['attachments'] as $file) { $radiog->addOption(new ilRadioOption($file, md5($file))); } $att->setHtml($radiog->render()); $form->addCommandButton('deliverFile', $this->lng->txt('download')); $form->addItem($att); } $isTrashFolder = false; if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) { $isTrashFolder = true; } $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']); $selectOptions = array(); $actions = $this->mbox->getActions((int) $_GET["mobj_id"]); foreach ($actions as $key => $action) { if ($key == 'moveMails') { $folders = $this->mbox->getSubFolders(); foreach ($folders as $folder) { if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) { $optionText = ''; if ($folder['type'] != 'user_folder') { $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : ''); } else { $optionText = $action . ' ' . $folder['title']; } $selectOptions[$folder['obj_id']] = $optionText; } } } } if ($current_folder_data['type'] == 'user_folder') { $txt_folder = $current_folder_data['title']; } else { $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']); } $ilToolbar->addSeparator(); $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder)); if (is_array($selectOptions) && count($selectOptions)) { include_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $actions = new ilSelectInputGUI('', 'selected_cmd'); $actions->setOptions($selectOptions); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $ilToolbar->addInputItem($actions); $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder'); } // Navigation $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']); $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']); if (is_array($prevMail) || is_array($nextMail)) { $ilToolbar->addSeparator(); if ($prevMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']); $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } if ($nextMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']); $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } } $this->tpl->setContent($form->getHTML()); $this->tpl->show(); }
/** * Shows access link */ public function showAccessLink() { $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $this->pluginObj->includeClass('class.ilAdobeConnectQuota.php'); $this->pluginObj->includeClass('class.ilAdobeConnectServer.php'); $presentation_url = ilAdobeConnectServer::getPresentationUrl(); $this->tabs->activateTab("access"); $form = new ilPropertyFormGUI(); $form->setTitle($this->pluginObj->txt('access_meeting_title')); $this->object->doRead(); if ($this->object->getStartDate() != NULL) { $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $ilAdobeConnectUser->ensureAccountExistance(); $xavc_login = $ilAdobeConnectUser->getXAVCLogin(); $quota = new ilAdobeConnectQuota(); // show link $link = new ilNonEditableValueGUI($this->pluginObj->txt("access_link")); if ($this->doProvideAccessLink() && $this->object->isParticipant($xavc_login)) { if (!$quota->mayStartScheduledMeeting($this->object->getScoId())) { $link->setValue($this->txt("meeting_not_available_no_slots")); } else { $link = new ilCustomInputGUI($this->pluginObj->txt("access_link")); $href = '<a href="' . $this->ctrl->getLinkTarget($this, 'performSso') . '" target="_blank" >' . $presentation_url . $this->object->getURL() . '</a>'; $link->setHtml($href); } } else { $link->setValue($this->txt("meeting_not_available")); } $form->addItem($link); $start_date = new ilNonEditableValueGUI($this->txt('start_date')); $start_date->setValue(ilDatePresentation::formatDate(new ilDateTime($this->object->getStartDate()->getUnixTime(), IL_CAL_UNIX))); $form->addItem($start_date); $duration = new ilNonEditableValueGUI($this->txt('duration')); $duration->setValue(ilDatePresentation::formatPeriod(new ilDateTime($this->object->getStartDate()->getUnixTime(), IL_CAL_UNIX), new ilDateTime($this->object->getEndDate()->getUnixTime(), IL_CAL_UNIX))); $form->addItem($duration); $this->tpl->setContent($form->getHTML()); } else { ilUtil::sendFailure($this->txt('error_connect_ac_server')); } }
/** * Init settings form */ protected function initFormCSettings() { include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php'; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('settings')); // individual course allocation $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled'); $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled()); $form->addItem($check); // add default container $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat'); $imp->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'default_cat'); $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory(); $tpl->setVariable('PROPERTY_VALUE', $default); if ($default) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $imp->setHtml($tpl->get()); $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info')); $form->addItem($imp); // all in one category $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone'); $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled()); $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info')); $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat'); $allinone_cat->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'allinone_cat'); $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory(); $tpl->setVariable('PROPERTY_VALUE', $cat); if ($cat) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $allinone_cat->setHtml($tpl->get()); $allinone->addSubItem($allinone_cat); $form->addItem($allinone); // multiple attributes $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple'); $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled()); // attribute selection include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php'; $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts'); $attributes->setMulti(true); $attributes->setValue(ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getAttributeValues()); $attributes->setRequired(true); $attributes->setOptions(ilECSMappingUtils::getCourseMappingFieldSelectOptions()); $multiple->addSubItem($attributes); $form->addItem($multiple); // role mapping $rm = new ilFormSectionHeaderGUI(); $rm->setTitle($this->lng->txt('ecs_role_mappings')); $form->addItem($rm); $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings(); include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) { $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), $name); $role_map->setValue($mapping_defs[$name]); $role_map->setSize(32); $role_map->setMaxLength(64); $role_map->setRequired($info['required']); $form->addItem($role_map); } $form->addCommandButton('cUpdateSettings', $this->lng->txt('save')); $form->addCommandButton('cSettings', $this->lng->txt('cancel')); 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 $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; }
/** * Add export field info to form * @global type $lng * @param type $form * @param type $a_obj_id * @param type $a_type * @return type */ public static function addExportFieldInfo($form, $a_obj_id, $a_type) { global $lng; include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; $fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($a_obj_id)); $fields = new ilCustomInputGUI($lng->txt($a_type . '_user_agreement'), ''); $tpl = new ilTemplate('tpl.agreement_form.html', true, true, 'Services/Membership'); $tpl->setVariable('TXT_INFO_AGREEMENT', $lng->txt($a_type . '_info_agreement')); foreach ($fields_info->getExportableFields() as $field) { $tpl->setCurrentBlock('field_item'); $tpl->setVariable('FIELD_NAME', $lng->txt($field)); $tpl->parseCurrentBlock(); } $fields->setHtml($tpl->get()); $form->addItem($fields); return $form; }
protected function initAssignmentTextForm(ilExAssignment $a_ass, $a_read_only = false, $a_cancel_cmd = "showOverview", $a_peer_review_cmd = null, $a_peer_rating_html = null) { global $ilCtrl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt("exc_assignment") . " \"" . $a_ass->getTitle() . "\""); if (!$a_read_only) { $text = new ilTextAreaInputGUI($this->lng->txt("exc_your_text"), "atxt"); $text->setRequired((bool) $a_ass->getMandatory()); $text->setRows(40); $form->addItem($text); // custom rte tags $text->setUseRte(true); $text->setRTESupport($ilUser->getId(), "exca~", "exc_ass"); // see ilObjForumGUI $text->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext')); $form->setFormAction($ilCtrl->getFormAction($this, "updateAssignmentText")); $form->addCommandButton("updateAssignmentTextAndReturn", $this->lng->txt("save_return")); $form->addCommandButton("updateAssignmentText", $this->lng->txt("save")); } else { $text = new ilNonEditableValueGUI($this->lng->txt("exc_files_returned_text"), "atxt", true); $form->addItem($text); if (!$a_peer_review_cmd) { $form->setFormAction($ilCtrl->getFormAction($this, "showOverview")); } else { $rating = new ilCustomInputGUI($this->lng->txt("exc_peer_review_rating")); $rating->setHtml($a_peer_rating_html); $form->addItem($rating); $comm = new ilTextAreaInputGUI($this->lng->txt("exc_peer_review_comment"), "comm"); $comm->setCols(75); $comm->setRows(15); $form->addItem($comm); $form->setFormAction($ilCtrl->getFormAction($this, $a_peer_review_cmd)); $form->addCommandButton($a_peer_review_cmd, $this->lng->txt("save")); } } $form->addCommandButton($a_cancel_cmd, $this->lng->txt("cancel")); return $form; }
/** * Init properties form * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) * @param array (assoc) form values * @access protected */ protected function initForm($a_mode, $a_values = array()) { if (is_object($this->form)) { return true; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($a_mode != "create") { $item = new ilCustomInputGUI($this->lng->txt('type'), ''); $item->setHtml($this->object->typedef->getTitle()); $item->setInfo($this->object->typedef->getDescription()); $this->form->addItem($item); } $item = new ilTextInputGUI($this->lng->txt('title'), 'title'); $item->setSize(40); $item->setMaxLength(128); $item->setRequired(true); $item->setInfo($this->txt('xxco_title_info')); $item->setValue($a_values['title']); $this->form->addItem($item); $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $item->setInfo($this->txt('xxco_description_info')); $item->setRows(2); $item->setCols(80); $item->setValue($a_values['description']); $this->form->addItem($item); if ($a_mode == "create") { $item = new ilRadioGroupInputGUI($this->lng->txt('type'), 'type_id'); $item->setRequired(true); $types = ilExternalContentType::_getTypesData(false, ilExternalContentType::AVAILABILITY_CREATE); foreach ($types as $type) { $option = new ilRadioOption($type['title'], $type['type_id'], $type['description']); $item->addOption($option); } $this->form->addItem($item); $this->form->setTitle($this->txt('xxco_new')); $this->form->addCommandButton(!$this->checkCreationMode() ? 'update' : 'save', $this->lng->txt('save')); $this->form->addCommandButton('cancelCreate', $this->lng->txt("cancel")); } else { $item = new ilCheckboxInputGUI($this->lng->txt('online'), 'online'); $item->setInfo($this->txt("xxco_online_info")); $item->setValue("1"); if ($a_values['online']) { $item->setChecked(true); } $this->form->addItem($item); // add the type specific fields $this->object->typedef->addFormElements($this->form, $a_values, "object"); $this->form->setTitle($this->lng->txt('settings')); $this->form->addCommandButton("update", $this->lng->txt("save")); $this->form->addCommandButton("view", $this->lng->txt("cancel")); if ($this->object->typedef->getMetaDataUrl()) { $this->form->addCommandButton("refreshMeta", $this->lng->txt("xxco_refresh_meta_data")); } } }