public function addToForm() { global $lng; $def = $this->getADT()->getCopyOfDefinition(); $selection = $this->getADT()->getSelection(); $options = $def->getOptions(); asort($options); // ? if (!$this->isRequired()) { $options = array("" => "-") + $options; } else { if ($this->getADT()->isNull()) { $options = array("" => $lng->txt("please_select")) + $options; } } if (!(bool) $this->force_radio) { $select = new ilSelectInputGUI($this->getTitle(), $this->getElementId()); $select->setOptions($options); } else { $select = new ilRadioGroupInputGUI($this->getTitle(), $this->getElementId()); foreach ($options as $value => $caption) { $option = new ilRadioOption($caption, $value); if (is_array($this->option_infos) && array_key_exists($value, $this->option_infos)) { $option->setInfo($this->option_infos[$value]); } $select->addOption($option); } } $this->addBasicFieldProperties($select, $def); $select->setValue($selection); $this->addToParentElement($select); }
function initAddCodesForm() { global $ilCtrl, $lng; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, 'createCodes')); $this->form_gui->setTitle($lng->txt('user_account_codes_edit_header')); $count = new ilNumberInputGUI($lng->txt('user_account_codes_number'), 'acc_codes_number'); $count->setSize(4); $count->setMaxLength(4); $count->setMinValue(1); $count->setMaxValue(1000); $count->setRequired(true); $this->form_gui->addItem($count); $valid = new ilRadioGroupInputGUI($lng->txt('user_account_code_valid_until'), 'valid_type'); $valid->setRequired(true); $unl = new ilRadioOption($lng->txt('user_account_code_valid_until_unlimited'), 'valid_unlimited'); $valid->addOption($unl); $st = new ilRadioOption($lng->txt('user_account_code_valid_until_static'), 'valid_static'); $valid->addOption($st); $dt = new ilDateTimeInputGUI($lng->txt('date'), 'valid_date'); $dt->setRequired(true); $st->addSubItem($dt); $dyn = new ilRadioOption($lng->txt('user_account_code_valid_until_dynamic'), 'valid_dynamic'); $valid->addOption($dyn); $ds = new ilNumberInputGUI($lng->txt('days'), 'valid_days'); $ds->setSize(5); $ds->setRequired(true); $dyn->addSubItem($ds); $this->form_gui->addItem($valid); $this->form_gui->addCommandButton('createCodes', $lng->txt('create')); $this->form_gui->addCommandButton('listCodes', $lng->txt('cancel')); }
/** * Init property form * * @return ilPropertyFormGUI $form */ protected function initFormSettings() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('tracking_settings')); $form->setFormAction($this->ctrl->getFormAction($this)); // Mode $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus'); $mod->setRequired(true); $mod->setValue($this->obj_lp->getCurrentMode()); $form->addItem($mod); foreach ($this->obj_lp->getValidModes() as $mode_key) { $opt = new ilRadioOption($this->obj_lp->getModeText($mode_key), $mode_key, $this->obj_lp->getModeInfoText($mode_key)); $opt->setValue($mode_key); $mod->addOption($opt); // :TODO: Subitem for visits ?! if ($mode_key == ilLPObjSettings::LP_MODE_VISITS) { $vis = new ilNumberInputGUI($this->lng->txt('trac_visits'), 'visits'); $vis->setSize(3); $vis->setMaxLength(4); $vis->setInfo(sprintf($this->lng->txt('trac_visits_info'), ilObjUserTracking::_getValidTimeSpan())); $vis->setRequired(true); $vis->setValue($this->obj_settings->getVisits()); $opt->addSubItem($vis); } } $form->addCommandButton('saveSettings', $this->lng->txt('save')); return $form; }
public function build(ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $availableTaxonomyIds) { $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI)); $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form')); $this->setId('tstRndQuestSetCfgPoolForm'); $this->addCommandButton($this->getSaveCommand(), $this->lng->txt('save')); $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SHOW_SRC_POOL_DEF_LIST, $this->lng->txt('cancel')); $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id'); $hiddenDefId->setValue($sourcePool->getId()); $this->addItem($hiddenDefId); $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id'); $hiddenPoolId->setValue($sourcePool->getPoolId()); $this->addItem($hiddenPoolId); $nonEditablePoolLabel = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_label'), 'quest_pool_label'); $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng)); $this->addItem($nonEditablePoolLabel); if (count($availableTaxonomyIds)) { $taxRadio = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax'); $taxRadio->setRequired(true); $taxRadio->addOption(new ilRadioOption($this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0)); $taxRadio->setValue(0); require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php'; foreach ($availableTaxonomyIds as $taxId) { $taxonomy = new ilObjTaxonomy($taxId); $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle()); $taxRadioOption = new ilRadioOption($label, $taxId); $taxRadio->addOption($taxRadioOption); $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_{$taxId}", false); $taxSelect->setRequired(true); $taxRadioOption->addSubItem($taxSelect); if ($taxId == $sourcePool->getOriginalFilterTaxId()) { $taxRadio->setValue($sourcePool->getOriginalFilterTaxId()); $taxSelect->setValue($sourcePool->getOriginalFilterTaxNodeId()); } } $this->addItem($taxRadio); } else { $hiddenNoTax = new ilHiddenInputGUI('filter_tax'); $hiddenNoTax->setValue(0); $this->addItem($hiddenNoTax); $nonEditableNoTax = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'no_tax_label'); $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint')); $this->addItem($nonEditableNoTax); } if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) { $questionAmountPerSourcePool = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_source_pool'), 'question_amount_per_pool'); $questionAmountPerSourcePool->setRequired(true); $questionAmountPerSourcePool->allowDecimals(false); $questionAmountPerSourcePool->setMinValue(0); $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true); $questionAmountPerSourcePool->setSize(4); if ($sourcePool->getQuestionAmount()) { $questionAmountPerSourcePool->setValue($sourcePool->getQuestionAmount()); } $this->addItem($questionAmountPerSourcePool); } }
function initEditForm($a_job_id) { global $ilCtrl, $lng; $job = ilCronManager::getJobInstanceById($a_job_id); if (!$job) { $ilCtrl->redirect($this, "render"); } $ilCtrl->setParameter($this, "jid", $a_job_id); $data = array_pop(ilCronManager::getCronJobData($job->getId())); include_once "Services/Cron/classes/class.ilCronJob.php"; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "update")); $form->setTitle($lng->txt("cron_action_edit") . ': "' . $job->getTitle() . '"'); if ($job->hasFlexibleSchedule()) { $type = new ilRadioGroupInputGUI($lng->txt("cron_schedule_type"), "type"); $type->setRequired(true); $type->setValue($data["schedule_type"]); $type->addOption(new ilRadioOption($lng->txt("cron_schedule_daily"), ilCronJob::SCHEDULE_TYPE_DAILY)); $type->addOption(new ilRadioOption($lng->txt("cron_schedule_weekly"), ilCronJob::SCHEDULE_TYPE_WEEKLY)); $type->addOption(new ilRadioOption($lng->txt("cron_schedule_monthly"), ilCronJob::SCHEDULE_TYPE_MONTHLY)); $type->addOption(new ilRadioOption($lng->txt("cron_schedule_quarterly"), ilCronJob::SCHEDULE_TYPE_QUARTERLY)); $type->addOption(new ilRadioOption($lng->txt("cron_schedule_yearly"), ilCronJob::SCHEDULE_TYPE_YEARLY)); $min = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_minutes"), "x"), ilCronJob::SCHEDULE_TYPE_IN_MINUTES); $mini = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "smini"); $mini->setRequired(true); $mini->setSize(5); if ($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_MINUTES) { $mini->setValue($data["schedule_value"]); } $min->addSubItem($mini); $type->addOption($min); $hr = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_hours"), "x"), ilCronJob::SCHEDULE_TYPE_IN_HOURS); $hri = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "shri"); $hri->setRequired(true); $hri->setSize(5); if ($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_HOURS) { $hri->setValue($data["schedule_value"]); } $hr->addSubItem($hri); $type->addOption($hr); $dy = new ilRadioOption(sprintf($lng->txt("cron_schedule_in_days"), "x"), ilCronJob::SCHEDULE_TYPE_IN_DAYS); $dyi = new ilNumberInputGUI($lng->txt("cron_schedule_value"), "sdyi"); $dyi->setRequired(true); $dyi->setSize(5); if ($data["schedule_type"] == ilCronJob::SCHEDULE_TYPE_IN_DAYS) { $dyi->setValue($data["schedule_value"]); } $dy->addSubItem($dyi); $type->addOption($dy); $form->addItem($type); } if ($job->hasCustomSettings()) { $job->addCustomSettingsToForm($form); } $form->addCommandButton("update", $lng->txt("save")); $form->addCommandButton("render", $lng->txt("cancel")); return $form; }
/** * Add membership form elements * @param ilPropertyFormGUI $form */ public final function addMembershipFormElements(ilPropertyFormGUI $form, $a_parent_post = '') { // Registration type $reg_type = new ilRadioGroupInputGUI($this->txt('reg_type'), 'registration_type'); //$reg_type->setValue($this->object->getRegistrationType()); if (in_array(ilMembershipRegistrationSettings::TYPE_DIRECT, $this->getOptions())) { $opt_dir = new ilRadioOption($this->txt('reg_direct'), ilMembershipRegistrationSettings::TYPE_DIRECT); #$this->lng->txt('grp_reg_direct_info')); $reg_type->addOption($opt_dir); } if (in_array(ilMembershipRegistrationSettings::TYPE_PASSWORD, $this->getOptions())) { $opt_pass = new ilRadioOption($this->txt('reg_pass'), ilMembershipRegistrationSettings::TYPE_PASSWORD); $pass = new ilTextInputGUI($GLOBALS['lng']->txt("password"), 'password'); $pass->setInfo($this->txt('reg_password_info')); #$pass->setValue($this->object->getPassword()); $pass->setSize(10); $pass->setMaxLength(32); $opt_pass->addSubItem($pass); $reg_type->addOption($opt_pass); } if (in_array(ilMembershipRegistrationSettings::TYPE_REQUEST, $this->getOptions())) { $opt_req = new ilRadioOption($this->txt('reg_request'), ilMembershipRegistrationSettings::TYPE_REQUEST, $this->txt('reg_request_info')); $reg_type->addOption($opt_req); } if (in_array(ilMembershipRegistrationSettings::TYPE_NONE, $this->getOptions())) { $opt_deact = new ilRadioOption($this->txt('reg_disabled'), ilMembershipRegistrationSettings::TYPE_NONE, $this->txt('reg_disabled_info')); $reg_type->addOption($opt_deact); } // Add to form $form->addItem($reg_type); if (in_array(ilMembershipRegistrationSettings::REGISTRATION_LIMITED_USERS, $this->getOptions())) { // max member $lim = new ilCheckboxInputGUI($this->txt('reg_max_members_short'), 'registration_membership_limited'); $lim->setValue(1); #$lim->setOptionTitle($this->lng->txt('reg_grp_max_members')); #$lim->setChecked($this->object->isMembershipLimited()); $max = new ilTextInputGUI($this->txt('reg_max_members'), 'registration_max_members'); #$max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : ''); //$max->setTitle($this->lng->txt('members')); $max->setSize(3); $max->setMaxLength(4); $max->setInfo($this->txt('reg_max_members_info')); $lim->addSubItem($max); $wait = new ilCheckboxInputGUI($this->txt('reg_waiting_list'), 'waiting_list'); $wait->setValue(1); //$wait->setOptionTitle($this->lng->txt('grp_waiting_list')); $wait->setInfo($this->txt('reg_waiting_list_info')); #$wait->setChecked($this->object->isWaitingListEnabled() ? true : false); $lim->addSubItem($wait); $form->addItem($lim); } $this->setFormValues($form); }
/** * Init property form * * @return ilPropertyFormGUI $form */ protected function initFormSettings() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('tracking_settings')); $form->setFormAction($this->ctrl->getFormAction($this)); // Mode $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus'); $mod->setRequired(true); $mod->setValue($this->obj_settings->getMode()); $form->addItem($mod); foreach ($this->obj_settings->getValidModes() as $mode_key => $mode_name) { $opt = new ilRadioOption($mode_name, $mode_key, ilLPObjSettings::_mode2InfoText($mode_key)); $opt->setValue($mode_key); $mod->addOption($opt); // Subitem for vistits if ($mode_key == LP_MODE_VISITS) { $vis = new ilNumberInputGUI($this->lng->txt('trac_visits'), 'visits'); $vis->setSize(3); $vis->setMaxLength(4); $vis->setInfo(sprintf($this->lng->txt('trac_visits_info'), ilObjUserTracking::_getValidTimeSpan())); $vis->setRequired(true); $vis->setValue($this->obj_settings->getVisits()); $opt->addSubItem($vis); } } /* // Info Active $act = new ilCustomInputGUI($this->lng->txt('trac_activated'), ''); $img = new ilTemplate('tpl.obj_settings_img_row.html',true,true,'Services/Tracking'); $img->setVariable("IMG_SRC", $activated = ilObjUserTracking::_enabledLearningProgress() ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png') ); $act->setHTML($img->get()); $form->addItem($act); // Info Anonymized $ano = new ilCustomInputGUI($this->lng->txt('trac_anonymized'), ''); $img = new ilTemplate('tpl.obj_settings_img_row.html',true,true,'Services/Tracking'); $img->setVariable("IMG_SRC", $anonymized = !ilObjUserTracking::_enabledUserRelatedData() ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png') ); $ano->setHTML($img->get()); $form->addItem($ano); */ $form->addCommandButton('saveSettings', $this->lng->txt('save')); return $form; }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // orientation $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation"); $orientation->setRequired(false); $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0)); $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1)); $a_form->addItem($orientation); // minimum answers $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers"); $minanswers->setValue(1); $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option")); $minanswers->setRequired(FALSE); $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers"); $nranswers->setSize(5); $nranswers->setDecimals(0); $nranswers->setRequired(false); $nranswers->setMinValue(1); $minanswers->addSubItem($nranswers); $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers"); $nrmaxanswers->setSize(5); $nrmaxanswers->setDecimals(0); $nrmaxanswers->setRequired(false); $nrmaxanswers->setMinValue(1); $minanswers->addSubItem($nrmaxanswers); $a_form->addItem($minanswers); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(false); $answers->setAllowMove(true); $answers->setShowWizard(false); $answers->setShowSavePhrase(false); $answers->setUseOtherAnswer(true); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer')); $answers->setDisabledScale(false); $a_form->addItem($answers); // values $orientation->setValue($this->object->getOrientation()); $minanswers->setChecked($this->object->use_min_answers); $nranswers->setValue($this->object->nr_min_answers); $nrmaxanswers->setValue($this->object->nr_max_answers); if (!$this->object->getCategories()->getCategoryCount()) { $this->object->getCategories()->addCategory(""); } $answers->setValues($this->object->getCategories()); }
/** * Edit resources form. */ public function edit($a_insert = false) { global $ilCtrl, $tpl, $lng, $objDefinition; $this->displayValidationError(); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_login_page")); } else { $form->setTitle($this->lng->txt("cont_update_login_page")); } // type selection $type_prop = new ilRadioGroupInputGUI($this->lng->txt("cont_type"), "type"); foreach (ilPCLoginPageElement::getAllTypes() as $index => $lang_key) { $types[$index] = $this->lng->txt('cont_lpe_' . $lang_key); $option = new ilRadioOption($this->lng->txt('cont_lpe_' . $lang_key), $index); $type_prop->addOption($option); } $selected = $a_insert ? "" : $this->content_obj->getLoginPageElementType(); $type_prop->setValue($selected); $form->addItem($type_prop); // horizonal align $align_prop = new ilSelectInputGUI($this->lng->txt("cont_align"), "horizontal_align"); $options = array("Left" => $lng->txt("cont_left"), "Center" => $lng->txt("cont_center"), "Right" => $lng->txt("cont_right")); # "LeftFloat" => $lng->txt("cont_left_float"), # "RightFloat" => $lng->txt("cont_right_float")); $align_prop->setOptions($options); $align_prop->setValue($this->content_obj->getAlignment()); $form->addItem($align_prop); // save/cancel buttons if ($a_insert) { $form->addCommandButton("create_login_page_element", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); } else { $form->addCommandButton("update_login_page_element", $lng->txt("save")); $form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } $html = $form->getHTML(); $tpl->setContent($html); return $ret; }
/** * completes a given form object with the specific form properties * required by this question type * * (overwrites the method from ilAssMultiOptionQuestionFeedback, because of individual setting) * * @access public * @param ilPropertyFormGUI $form */ public function completeSpecificFormProperties(ilPropertyFormGUI $form) { $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt('feedback_answers')); $form->addItem($header); if (!$this->questionOBJ->getSelfAssessmentEditingMode()) { require_once './Services/Form/classes/class.ilRadioGroupInputGUI.php'; require_once './Services/Form/classes/class.ilRadioOption.php'; $feedback = new ilRadioGroupInputGUI($this->lng->txt('feedback_setting'), 'feedback_setting'); $feedback->addOption(new ilRadioOption($this->lng->txt('feedback_all'), 1), true); $feedback->addOption(new ilRadioOption($this->lng->txt('feedback_checked'), 2)); $feedback->addOption(new ilRadioOption($this->lng->txt('feedback_correct'), 3)); $form->addItem($feedback); foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) { $propertyLabel = $this->questionOBJ->prepareTextareaOutput($this->buildAnswerOptionLabel($index, $answer), true); $propertyPostVar = "feedback_answer_{$index}"; $form->addItem($this->buildFeedbackContentFormProperty($propertyLabel, $propertyPostVar, $this->questionOBJ->isAdditionalContentEditingModePageObject())); } } }
/** * Init creation from */ function initForm() { global $ilCtrl, $lng; // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->lng->txt("cont_ed_insert_templ")); $radg = new ilRadioGroupInputGUI($lng->txt("cont_template"), "page_templ"); $radg->setRequired(true); $ts = $this->getPage()->getContentTemplates(); foreach ($ts as $t) { $op = new ilRadioOption($t["title"], $t["id"] . ":" . $t["parent_type"]); $radg->addOption($op); } $form->addItem($radg); $form->addCommandButton("create_templ", $lng->txt("insert")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); return $form; }
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form) { // orientation $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation"); $orientation->setRequired(false); $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0)); $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1)); $orientation->addOption(new ilRadioOption($this->lng->txt('combobox'), 2)); $a_form->addItem($orientation); // Answers include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php"; $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(false); $answers->setAllowMove(true); $answers->setShowWizard(true); $answers->setShowSavePhrase(true); $answers->setUseOtherAnswer(true); $answers->setShowNeutralCategory(true); $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer')); $answers->setDisabledScale(false); $a_form->addItem($answers); // values $orientation->setValue($this->object->getOrientation()); if (!$this->object->getCategories()->getCategoryCount()) { $this->object->getCategories()->addCategory(""); } $answers->setValues($this->object->getCategories()); }
public function build() { $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI)); $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_general_form')); $this->setId('tstRndQuestSetCfgGeneralForm'); $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SAVE_GENERAL_CONFIG_FORM, $this->lng->txt('save')); // Require Pools with Homogeneous Scored Questions $requirePoolsQuestionsHomoScored = new ilCheckboxInputGUI($this->lng->txt('tst_inp_all_quest_points_equal_per_pool'), 'quest_points_equal_per_pool'); $requirePoolsQuestionsHomoScored->setInfo($this->lng->txt('tst_inp_all_quest_points_equal_per_pool_desc')); $requirePoolsQuestionsHomoScored->setChecked($this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired()); $this->addItem($requirePoolsQuestionsHomoScored); // question amount config mode (per test / per pool) $questionAmountConfigMode = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_quest_amount_cfg_mode'), 'quest_amount_cfg_mode'); $questionAmountConfigMode->setValue($this->fetchValidQuestionAmountConfigModeWithFallbackModePerTest($this->questionSetConfig)); $questionAmountConfigModePerTest = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_test'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST); $questionAmountConfigMode->addOption($questionAmountConfigModePerTest); $questionAmountConfigModePerPool = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_pool'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL); $questionAmountConfigMode->addOption($questionAmountConfigModePerPool); $questionAmountConfigMode->setRequired(true); $this->addItem($questionAmountConfigMode); // question amount per test $questionAmountPerTest = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_test'), 'quest_amount_per_test'); $questionAmountPerTest->setRequired(true); $questionAmountPerTest->setMinValue(0); $questionAmountPerTest->allowDecimals(false); $questionAmountPerTest->setMinvalueShouldBeGreater(true); $questionAmountPerTest->setSize(4); $questionAmountPerTest->setValue($this->questionSetConfig->getQuestionAmountPerTest()); $questionAmountConfigModePerTest->addSubItem($questionAmountPerTest); if ($this->testOBJ->participantDataExist()) { $requirePoolsQuestionsHomoScored->setDisabled(true); $questionAmountConfigMode->setDisabled(true); $questionAmountPerTest->setDisabled(true); } }
/** * Additional check for either block or custom chars * * @return boolean Input ok, true/false */ function checkInput() { global $lng; if (!parent::checkInput()) { return false; } if ($_POST['char_selector_availability'] == ilCharSelectorConfig::ENABLED and trim(implode($_POST['char_selector_blocks'])) == "" and trim($_POST['char_selector_custom_items']) == '') { $this->setAlert($lng->txt("char_selector_msg_blocks_or_custom_needed")); return false; } else { return true; } }
/** * add the configuration elements to a property form * @param object property form */ public function addFormProperties(ilPropertyFormGUI $a_form) { global $lng; $lng->loadLanguageModule('adve'); $availability = new ilRadioGroupInputGUI($lng->txt('char_selector'), 'char_selector_availability'); $inactive = new ilRadioOption($lng->txt('char_selector_inactive'), ilCharSelectorConfig::INACTIVE); $inactive->setInfo($lng->txt('char_selector_inactive_info_' . $this->config->getContext())); $inherit = new ilRadioOption($lng->txt('char_selector_inherit'), ilCharSelectorConfig::INHERIT); $inherit->setInfo($lng->txt('char_selector_inherit_info_' . $this->config->getContext())); $enabled = new ilRadioOption($lng->txt('char_selector_enabled'), ilCharSelectorConfig::ENABLED); $enabled->setInfo($lng->txt('char_selector_enabled_info_' . $this->config->getContext())); $disabled = new ilRadioOption($lng->txt('char_selector_disabled'), ilCharSelectorConfig::DISABLED); $disabled->setInfo($lng->txt('char_selector_disabled_info_' . $this->config->getContext())); $blocks = new ilSelectInputGUI($lng->txt('char_selector_blocks'), 'char_selector_blocks'); $blocks->setInfo($lng->txt('char_selector_blocks_info')); $blocks->setOptions($this->config->getBlockOptions()); $blocks->setMulti(true); $enabled->addSubItem($blocks); $custom_items = new ilTextAreaInputGUI($lng->txt('char_selector_custom_items'), 'char_selector_custom_items'); $tpl = new ilTemplate("tpl.char_selector_custom_info.html", true, true, "Services/UIComponent/CharSelector"); $tpl->setVariable('1', $lng->txt('char_selector_custom_items_info1')); $tpl->setVariable('2a', $lng->txt('char_selector_custom_items_info2a')); $tpl->setVariable('2b', $lng->txt('char_selector_custom_items_info2b')); $tpl->setVariable('3a', $lng->txt('char_selector_custom_items_info3a')); $tpl->setVariable('3b', $lng->txt('char_selector_custom_items_info3b')); $tpl->setVariable('4a', $lng->txt('char_selector_custom_items_info4a')); $tpl->setVariable('4b', $lng->txt('char_selector_custom_items_info4b')); $tpl->setVariable('5a', $lng->txt('char_selector_custom_items_info5a')); $tpl->setVariable('5b', $lng->txt('char_selector_custom_items_info5b')); $tpl->setVariable('6a', $lng->txt('char_selector_custom_items_info6a')); $tpl->setVariable('6b', $lng->txt('char_selector_custom_items_info6b')); $custom_items->setInfo($tpl->get()); $enabled->addSubItem($custom_items); switch ($this->config->getContext()) { case ilCharSelectorConfig::CONTEXT_ADMIN: $availability->addOption($inactive); $availability->addOption($enabled); $availability->addOption($disabled); $a_form->addItem($availability); break; case ilCharSelectorConfig::CONTEXT_USER: case ilCharSelectorConfig::CONTEXT_TEST: $availability->addOption($inherit); $availability->addOption($enabled); $availability->addOption($disabled); $a_form->addItem($availability); break; } }
protected function addCustomEditForm(ilPropertyFormGUI $a_form) { $radio_grp = new ilRadioGroupInputGUI($this->lng->txt('ecs_availability'), 'activation_type'); $radio_grp->setValue($this->object->getAvailabilityType()); $radio_grp->setDisabled(true); $radio_opt = new ilRadioOption($this->lng->txt('offline'), ilObjRemoteLearningModule::ACTIVATION_OFFLINE); $radio_grp->addOption($radio_opt); $radio_opt = new ilRadioOption($this->lng->txt('online'), ilObjRemoteLearningModule::ACTIVATION_ONLINE); $radio_grp->addOption($radio_opt); $a_form->addItem($radio_grp); }
/** * @param ilRadioOption $option */ public function initPluginCreationFormSection(ilRadioOption $option) { // $option->setInfo($this->txt('create_info1') . '</br>' . $this->txt('create_info2') . $this->getAdminConfigObject()->getAppName() // . $this->txt('create_info3')); $sub_selection = new ilRadioGroupInputGUI($this->txt(self::F_BASE_FOLDER), self::F_BASE_FOLDER); $sub_selection->setRequired(true); $option_default = new ilRadioOption($this->txt(self::F_DEFAULT_BASE_FOLDER), self::F_DEFAULT_BASE_FOLDER); $option_custom = new ilRadioOption($this->txt('custom_base_folder'), self::F_CUSTOM_FOLDER_SELECTION); $custom_base_folder_input = new ilTextInputGUI($this->txt(self::F_CUSTOM_BASE_FOLDER_INPUT), self::F_CUSTOM_BASE_FOLDER_INPUT); $custom_base_folder_input->setRequired(true); $custom_base_folder_input->setInfo($this->txt('custom_base_folder_input_info')); $option_custom->addSubItem($custom_base_folder_input); $sub_selection->addOption($option_default); $sub_selection->addOption($option_custom); $sub_selection->setValue(self::F_DEFAULT_BASE_FOLDER); $option->addSubItem($sub_selection); }
protected function addCustomEditForm(ilPropertyFormGUI $a_form) { $radio_grp = new ilRadioGroupInputGUI($this->lng->txt('grp_visibility'), 'activation_type'); $radio_grp->setValue($this->object->getAvailabilityType()); $radio_grp->setDisabled(true); $radio_opt = new ilRadioOption($this->lng->txt('grp_visibility_unvisible'), ilObjRemoteTest::ACTIVATION_OFFLINE); $radio_grp->addOption($radio_opt); $radio_opt = new ilRadioOption($this->lng->txt('grp_visibility_limitless'), ilObjRemoteTest::ACTIVATION_UNLIMITED); $radio_grp->addOption($radio_opt); // :TODO: not supported in ECS yet $radio_opt = new ilRadioOption($this->lng->txt('grp_visibility_until'), ilObjRemoteTest::ACTIVATION_LIMITED); $start = new ilDateTimeInputGUI($this->lng->txt('grp_start'), 'start'); $start->setDate(new ilDateTime(time(), IL_CAL_UNIX)); $start->setDisabled(true); $start->setShowTime(true); $radio_opt->addSubItem($start); $end = new ilDateTimeInputGUI($this->lng->txt('grp_end'), 'end'); $end->setDate(new ilDateTime(time(), IL_CAL_UNIX)); $end->setDisabled(true); $end->setShowTime(true); $radio_opt->addSubItem($end); $radio_grp->addOption($radio_opt); $a_form->addItem($radio_grp); }
/** * @param ilRadioOption $option * @throws ilCloudPluginConfigException */ public function initPluginCreationFormSection(ilRadioOption $option) { $option->setInfo($this->txt("create_info1") . "</br>" . $this->txt("create_info2") . $this->getAdminConfigObject()->getAppName() . $this->txt("create_info3")); $sub_selection = new ilRadioGroupInputGUI($this->txt(self::F_BASE_FOLDER), "dropbox_base_folder"); $sub_selection->setRequired(true); $option_default = new ilRadioOption($this->txt("default_base_folder"), self::F_DROPBOX_DEFAULT_BASE_FOLDER); $option_custom = new ilRadioOption($this->txt("custom_base_folder"), self::F_DROPBOX_CUSTOM_FOLDER_SELECTION); $custom_base_folder_input = new ilTextInputGUI($this->txt("custom_base_folder_input"), self::F_DROPBOX_CUSTOM_BASE_FOLDER_INPUT); $custom_base_folder_input->setRequired(true); $custom_base_folder_input->setInfo($this->txt("custom_base_folder_input_info")); $option_custom->addSubItem($custom_base_folder_input); $sub_selection->addOption($option_default); $sub_selection->addOption($option_custom); $sub_selection->setValue(self::F_DROPBOX_DEFAULT_BASE_FOLDER); $option->addSubItem($sub_selection); $sub_selection2 = new ilCheckboxInputGUI($this->txt(self::F_ONLINE), self::F_ONLINE); if ($this->getAdminConfigObject()->getValue('config_default_online')) { $sub_selection2->setChecked(true); } $option->addSubItem($sub_selection2); }
/** * Edit resources form. */ function edit($a_insert = false) { global $ilCtrl, $tpl, $lng, $objDefinition; $this->displayValidationError(); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_resources")); } else { $form->setTitle($this->lng->txt("cont_update_resources")); } // count number of existing objects per type and collect item groups $ref_id = (int) $_GET["ref_id"]; $childs = $this->rep_tree->getChilds($ref_id); $type_counts = array(); $item_groups = array(); foreach ($childs as $c) { $type_counts[$c["type"]] += 1; if ($c["type"] == "itgr") { $item_groups[$c["ref_id"]] = $c["title"]; } } if (count($item_groups) > 0) { // radio group for type selection $radg = new ilRadioGroupInputGUI($lng->txt("cont_resources"), "res_type"); if (!$a_insert && $this->content_obj->getMainType() == "ItemGroup") { $radg->setValue("itgr"); } else { $radg->setValue("by_type"); } $op_type = new ilRadioOption($lng->txt("cont_resources_of_type"), "by_type", ""); $radg->addOption($op_type); $op_itemgroup = new ilRadioOption($lng->txt("obj_itgr"), "itgr", ""); $radg->addOption($op_itemgroup); $form->addItem($radg); } // type selection $type_prop = new ilSelectInputGUI($this->lng->txt("cont_type"), "type"); $obj_id = ilObject::_lookupObjId($_GET["ref_id"]); $obj_type = ilObject::_lookupType($obj_id); $sub_objs = $objDefinition->getGroupedRepositoryObjectTypes($obj_type); $types = array(); foreach ($sub_objs as $k => $so) { if ($k != "itgr") { $types[$k] = $this->lng->txt("objs_" . $k) . " (" . (int) $type_counts[$k] . ")"; } } $type_prop->setOptions($types); $selected = $a_insert ? "" : $this->content_obj->getResourceListType(); $type_prop->setValue($selected); if (count($item_groups) > 0) { $op_type->addSubItem($type_prop); } else { $form->addItem($type_prop); } if (count($item_groups) > 0) { // item groups $options = $item_groups; $si = new ilSelectInputGUI($this->lng->txt("obj_itgr"), "itgr"); $si->setOptions($options); $selected = $a_insert ? "" : $this->content_obj->getItemGroupRefId(); $op_itemgroup->addSubItem($si); } // save/cancel buttons if ($a_insert) { $form->addCommandButton("create_resources", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); } else { $form->addCommandButton("update_resources", $lng->txt("save")); $form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } $html = $form->getHTML(); $tpl->setContent($html); return $ret; }
/** * initEditCustomForm * * @param string $a_mode values: create | edit */ public function initForm($a_mode = "create") { global $ilCtrl, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); if ($a_mode == "edit") { $this->form->setTitle($lng->txt('dcl_edit_field')); $hidden_prop = new ilHiddenInputGUI("field_id"); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "update"); $this->form->addCommandButton('update', $lng->txt('dcl_update_field')); } else { $this->form->setTitle($lng->txt('dcl_new_field')); $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->field_obj->getTableId()); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this), "save"); $this->form->addCommandButton('save', $lng->txt('dcl_create_field')); } $this->form->addCommandButton('cancel', $lng->txt('cancel')); $text_prop = new ilTextInputGUI($lng->txt("title"), "title"); $text_prop->setRequired(true); $text_prop->setValidationRegexp("/^[a-zA-Z\\d -.,äöüÄÖÜà éèÀÉÈç¢]*\$/i"); $this->form->addItem($text_prop); $edit_datatype = new ilRadioGroupInputGUI($lng->txt('dcl_datatype'), 'datatype'); foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) { $opt = new ilRadioOption($lng->txt('dcl_' . $datatype['title']), $datatype['id']); foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) { //Type Reference: List Tabels if ($datatype['id'] == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE and $property['id'] == ilDataCollectionField::PROPERTYID_REFERENCE) { // Get Tables require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php"; $tables = $this->parent_obj->getDataCollectionObject()->getTables(); foreach ($tables as $table) { foreach ($table->getRecordFields() as $field) { //referencing references may lead to endless loops. if ($field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $options[$field->getId()] = $table->getTitle() . "->" . $field->getTitle(); } } } $table_selection = new ilSelectInputGUI('', 'prop_' . $property['id']); $table_selection->setOptions($options); //$table_selection->setValue($this->table_id); $opt->addSubItem($table_selection); } elseif ($property['datatype_id'] == $datatype['id']) { if ($property['inputformat'] == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) { $subitem = new ilCheckboxInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); $opt->addSubItem($subitem); } else { $subitem = new ilTextInputGUI($lng->txt('dcl_' . $property['title']), 'prop_' . $property['id']); $opt->addSubItem($subitem); } } } $edit_datatype->addOption($opt); } $edit_datatype->setRequired(true); //you can't change type but we still need it in POST if ($a_mode == "edit") { $edit_datatype->setDisabled(true); } $this->form->addItem($edit_datatype); // Description $text_prop = new ilTextAreaInputGUI($lng->txt("dcl_field_description"), "description"); $this->form->addItem($text_prop); // Required $cb = new ilCheckboxInputGUI($lng->txt("dcl_field_required"), "required"); $this->form->addItem($cb); //Unique $cb = new ilCheckboxInputGUI($lng->txt("dcl_unique"), "unique"); $this->form->addItem($cb); }
public function editPriceObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id']; $price = ilPaymentPrices::_getPrice($price_id); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false); if ($tmp_obj) { $form->setTitle($tmp_obj->getTitle()); } else { $form->setTitle($this->lng->txt('object_not_found')); } //price_type $radio_group = new ilRadioGroupInputGUI('', 'price_type'); $radio_group->setTitle($this->lng->txt('duration')); $radio_group->setRequired(true); $radio_group->setValue($price['price_type']); $radio_group->setPostVar('price_type'); $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH); // duration month $oDuration = new ilNumberInputGUI(); $oDuration->setTitle($this->lng->txt('paya_months')); $oDuration->setSize('20%'); $oDuration->setValue($price['duration']); $oDuration->setPostVar('duration_month'); $radio_option_1->addSubItem($oDuration); $radio_group->addOption($radio_option_1); $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE); // duration_date from $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setTitle($this->lng->txt('cal_from')); $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE)); $o_date_from->setPostVar('duration_date_from'); $radio_option_3->addSubItem($o_date_from); // duration_date until $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setTitle($this->lng->txt('cal_until')); $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE)); $o_date_until->setPostVar('duration_date_until'); $radio_option_3->addSubItem($o_date_until); $radio_group->addOption($radio_option_3); $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION); $radio_group->addOption($radio_option_2); $form->addItem($radio_group); // description $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $oDescription->setRows(4); $oDescription->setCols(35); $oDescription->setValue($price['description']); $form->addItem($oDescription); // price $oPrice = new ilNumberInputGUI(); $oPrice->setTitle($this->lng->txt('price_a')); $oPrice->setSize('20%'); $oPrice->setRequired(true); $oPrice->setValue($price['price']); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $oPrice->setInfo($genSet->get('currency_unit')); $oPrice->setPostVar('price'); $oPrice->allowDecimals(true); $form->addItem($oPrice); //extension $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension'); $oExtension->setChecked($price['extension']); $form->addItem($oExtension); $o_hidden_1 = new ilHiddenInputGUI('pobject_id'); $o_hidden_1->setValue((int) $_GET['pobject_id']); $o_hidden_1->setPostVar('pobject_id'); $o_hidden_2 = new ilHiddenInputGUI('price_id'); $o_hidden_2->setValue((int) $_GET['price_id']); $o_hidden_2->setPostVar('price_id'); $form->addItem($o_hidden_1); $form->addItem($o_hidden_2); $form->addCommandButton('updatePrice', $this->lng->txt('save')); $form->addCommandButton('editPrices', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $form->getHTML()); }
/** * Show didactic template types * @param ilPropertyFormGUI $form * @return ilPropertyFormGUI $form */ protected function initDidacticTemplate(ilPropertyFormGUI $form) { global $lng; $lng->loadLanguageModule('didactic'); $options = array(); $options['dtpl_0'] = array($this->lng->txt('didactic_default_type'), sprintf($this->lng->txt('didactic_default_type_info'), $this->lng->txt('objs_' . $this->type))); include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php'; $templates = ilDidacticTemplateSettings::getInstanceByObjectType($this->type)->getTemplates(); if ($templates) { foreach ($templates as $template) { $options["dtpl_" . $template->getId()] = array($template->getTitle(), $template->getDescription()); } } $this->addDidacticTemplateOptions($options); if (sizeof($options) > 1) { $type = new ilRadioGroupInputGUI($this->lng->txt('type'), 'didactic_type'); // workaround for containers in edit mode if (!$this->getCreationMode()) { include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; $type->setValue('dtpl_' . ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId())); } else { $type->setValue('dtpl_0'); } $form->addItem($type); ilUtil::sortArray($options, 0); foreach ($options as $id => $data) { $option = new ilRadioOption($data[0], $id, $data[1]); $type->addOption($option); } } return $form; }
/** * Get layout option * * @return object layout form option */ static function getLayoutOption($a_txt, $a_var, $a_def_option = "") { global $lng; // default layout $layout = new ilRadioGroupInputGUI($a_txt, $a_var); if ($a_def_option != "") { if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) { $im_tag = ilUtil::img($im, $a_def_option); } $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><b>" . $lng->txt("cont_lm_default_layout") . "</b>: " . $lng->txt("cont_layout_" . $a_def_option) . "</td></tr></table>", "")); } foreach (ilObjContentObject::getAvailableLayouts() as $l) { $im_tag = ""; if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) { $im_tag = ilUtil::img($im, $l); } $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" . $im_tag . "</td><td style='padding:5px;'><b>" . $lng->txt("cont_layout_" . $l) . "</b>: " . $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l)); } return $layout; }
/** * init edit/create category form * * @access protected * @return */ protected function initFormCategory($a_mode) { global $rbacsystem, $ilUser; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo((int) $_GET['category_id']); $this->form = new ilPropertyFormGUI(); #$this->form->setTableWidth('40%'); switch ($a_mode) { case 'edit': $category = new ilCalendarCategory((int) $_GET['category_id']); $this->form->setTitle($this->lng->txt('cal_edit_category')); $this->ctrl->saveParameter($this, array('seed', 'category_id')); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($this->isEditable()) { $this->form->addCommandButton('update', $this->lng->txt('save')); /* if($cat_info['type'] == ilCalendarCategory::TYPE_USR) { $this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share')); } $this->form->addCommandButton('confirmDelete',$this->lng->txt('delete')); */ $this->form->addCommandButton('manage', $this->lng->txt('cancel')); } break; case 'create': $this->editable = true; $category = new ilCalendarCategory(0); $this->ctrl->saveParameter($this, array('category_id')); $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('cal_add_category')); $this->form->addCommandButton('save', $this->lng->txt('save')); $this->form->addCommandButton('manage', $this->lng->txt('cancel')); break; } // Calendar name $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'), 'title'); if ($a_mode == 'edit') { $title->setDisabled(!$this->isEditable()); } $title->setRequired(true); $title->setMaxLength(64); $title->setSize(32); $title->setValue($category->getTitle()); $this->form->addItem($title); include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if ($a_mode == 'create' and $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) { $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'), 'type'); $type->setValue($category->getType()); $type->setRequired(true); $opt = new ilRadioOption($this->lng->txt('cal_type_personal'), ilCalendarCategory::TYPE_USR); $type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('cal_type_system'), ilCalendarCategory::TYPE_GLOBAL); $type->addOption($opt); $type->setInfo($this->lng->txt('cal_type_info')); $this->form->addItem($type); } $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'), 'color'); $color->setValue($category->getColor()); if (!$this->isEditable()) { $color->setDisabled(true); } $color->setRequired(true); $this->form->addItem($color); $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl'); $location->setDisabled($a_mode == 'edit'); $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL); $location->addOption($location_local); $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE); $location->addOption($location_remote); $location->setValue($category->getLocationType()); $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url'); $url->setDisabled($a_mode == 'edit'); $url->setValue($category->getRemoteUrl()); $url->setMaxLength(500); $url->setSize(60); $url->setRequired(true); $location_remote->addSubItem($url); $user = new ilTextInputGUI($this->lng->txt('username'), 'remote_user'); $user->setDisabled($a_mode == 'edit'); $user->setValue($category->getRemoteUser()); $user->setMaxLength(50); $user->setSize(20); $user->setRequired(false); $location_remote->addSubItem($user); $pass = new ilPasswordInputGUI($this->lng->txt('password'), 'remote_pass'); $pass->setDisabled($a_mode == 'edit'); $pass->setValue($category->getRemotePass()); $pass->setMaxLength(50); $pass->setSize(20); $pass->setRetype(false); $pass->setInfo($this->lng->txt('remote_pass_info')); $location_remote->addSubItem($pass); $this->form->addItem($location); }
public function initFormSearch() { global $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'search')); $this->form->setTitle($this->getTitle()); $this->form->addCommandButton('performSearch', $this->lng->txt('search')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); $kind = new ilRadioGroupInputGUI($this->lng->txt('search_type'), 'search_for'); $kind->setValue($this->search_type); $this->form->addItem($kind); // Users $users = new ilRadioOption($this->lng->txt('search_for_users'), 'usr'); // UDF include_once 'Services/Search/classes/class.ilUserSearchOptions.php'; foreach (ilUserSearchOptions::_getSearchableFieldsInfo(!$this->isSearchableCheckEnabled()) as $info) { switch ($info['type']) { case FIELD_TYPE_UDF_SELECT: case FIELD_TYPE_SELECT: $sel = new ilSelectInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]"); $sel->setOptions($info['values']); $users->addSubItem($sel); break; case FIELD_TYPE_UDF_TEXT: case FIELD_TYPE_TEXT: if (isset($info['autoComplete']) and $info['autoComplete']) { $ilCtrl->setParameterByClass(get_class($this), 'autoCompleteField', $info['db']); $ul = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]"); $ul->setDataSource($ilCtrl->getLinkTarget($this, "doUserAutoComplete", "", true)); $ul->setSize(30); $ul->setMaxLength(120); $users->addSubItem($ul); } else { $txt = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]"); $txt->setSize(30); $txt->setMaxLength(120); $users->addSubItem($txt); } break; } } $kind->addOption($users); // Role $roles = new ilRadioOption($this->lng->txt('search_for_role_members'), 'role'); $role = new ilTextInputGUI($this->lng->txt('search_role_title'), 'rep_query[role][title]'); $role->setSize(30); $role->setMaxLength(120); $roles->addSubItem($role); $kind->addOption($roles); // Course $groups = new ilRadioOption($this->lng->txt('search_for_crs_members'), 'crs'); $group = new ilTextInputGUI($this->lng->txt('search_crs_title'), 'rep_query[crs][title]'); $group->setSize(30); $group->setMaxLength(120); $groups->addSubItem($group); $kind->addOption($groups); // Group $groups = new ilRadioOption($this->lng->txt('search_for_grp_members'), 'grp'); $group = new ilTextInputGUI($this->lng->txt('search_grp_title'), 'rep_query[grp][title]'); $group->setSize(30); $group->setMaxLength(120); $groups->addSubItem($group); $kind->addOption($groups); }
/** * Insert new question form */ function insert($a_mode = "create") { global $ilUser, $lng, $ilCtrl; $this->setInsertTabs("new_question"); $this->displayValidationError(); // get all question types (@todo: we have to check, whether they are // suitable for self assessment or not) include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $all_types = ilObjQuestionPool::_getSelfAssessmentQuestionTypes(); $options = array(); $all_types = ilUtil::sortArray($all_types, "order", "asc", true, true); foreach ($all_types as $k => $v) { $options[$v["type_tag"]] = $k; } // new table form (input of rows and columns) include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); $this->form_gui->setTitle($lng->txt("cont_ed_insert_pcqst")); // Select Question Type $qtype_input = new ilSelectInputGUI($lng->txt("cont_question_type"), "q_type"); $qtype_input->setOptions($options); $qtype_input->setRequired(true); $this->form_gui->addItem($qtype_input); // additional content editor // assessment include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php"; if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) { $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode"); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT)); $ri->addOption(new ilRadioOption($this->lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT)); $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $this->form_gui->addItem($ri, true); } else { $hi = new ilHiddenInputGUI("question_content_editing_type"); $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT); $this->form_gui->addItem($hi, true); } // Select Question Pool /* include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"); $qpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, false, true, false, "write"); if (count($qpools) > 0) { $pool_options = array(); foreach ($qpools as $key => $value) { $pool_options[$key] = $value["title"]; } $pool_input = new ilSelectInputGUI($lng->txt("cont_question_pool"), "qpool_ref_id"); $pool_input->setOptions($pool_options); $pool_input->setRequired(true); $this->form_gui->addItem($pool_input); } else { $pool_input = new ilTextInputGUI($lng->txt("cont_question_pool"), "qpool_title"); $pool_input->setRequired(true); $this->form_gui->addItem($pool_input); } */ if ($a_mode == "edit_empty") { $this->form_gui->addCommandButton("edit", $lng->txt("save")); } else { $this->form_gui->addCommandButton("create_pcqst", $lng->txt("save")); $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel")); } $this->tpl->setContent($this->form_gui->getHTML()); }
/** * FORM NewsItem: Init form. * * @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE) */ public function initFormNewsItem($a_mode) { global $lng, $ilTabs; $ilTabs->clearTargets(); //$this->setTabs(); $lng->loadLanguageModule("news"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); // Property Title $text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title"); $text_input->setInfo(""); $text_input->setRequired(true); $text_input->setMaxLength(200); $this->form_gui->addItem($text_input); // Property Content $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content"); $text_area->setInfo(""); $text_area->setRequired(false); $this->form_gui->addItem($text_area); // Property Visibility $radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility"); $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("news_news_item_visibility_info")); $radio_group->setRequired(false); $radio_group->setValue("users"); $this->form_gui->addItem($radio_group); // Property ContentLong $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long"); $text_area->setInfo($lng->txt("news_news_item_content_long_info")); $text_area->setRequired(false); $text_area->setCols("40"); $text_area->setRows("8"); $text_area->setUseRte(true); $this->form_gui->addItem($text_area); // save and cancel commands if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) { $this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel")); } else { $this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save")); $this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel")); } $this->form_gui->setTitle($lng->txt("news_news_item_head")); $this->form_gui->setFormAction($this->ctrl->getFormAction($this)); $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_news.png")); $news_set = new ilSetting("news"); if (!$news_set->get("enable_rss_for_internal")) { $this->form_gui->removeItemByPostVar("news_visibility"); } else { $nv = $this->form_gui->getItemByPostVar("news_visibility"); if (is_object($nv)) { $nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"])); } } }
public function adoptTeamAssignmentsFormObject() { global $ilCtrl, $ilTabs, $lng, $tpl; $this->checkPermission("write"); if (!$this->ass) { $ilCtrl->redirect($this, "listAssignments"); } $ilTabs->activateTab("content"); $this->addContentSubTabs("list_assignments"); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTitle($lng->txt("exc_team_assignment_adopt")); $form->setFormAction($ilCtrl->getFormAction($this, "adoptTeamAssignments")); $options = ilExAssignment::getAdoptableTeamAssignments($this->ass->getExerciseId()); // we must not have existing teams in assignment if (array_key_exists($this->ass->getId(), $options)) { $ilCtrl->redirect($this, "listAssignments"); } $teams = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt"); $teams->setValue(-1); $teams->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1)); foreach ($options as $id => $item) { $option = new ilRadioOption($item["title"], $id); $option->setInfo($lng->txt("exc_team_assignment_adopt_teams") . ": " . $item["teams"]); $teams->addOption($option); } $form->addItem($teams); $form->addCommandButton("adoptTeamAssignments", $lng->txt("save")); $form->addCommandButton("listAssignments", $lng->txt("cancel")); $tpl->setContent($form->getHTML()); }
public function initForm($a_as_multi_assignment = FALSE) { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt('crs_loc_tst_assignment')); $form->setFormAction($this->ctrl->getFormAction($this->getGUI())); if ($a_as_multi_assignment) { $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save')); } else { $form->addCommandButton('saveTest', $this->lng->txt('save')); } switch ($this->getTestType()) { case ilLOSettings::TYPE_TEST_INITIAL: $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl')); break; case ilLOSettings::TYPE_TEST_QUALIFIED: $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl')); break; } $assignable = $this->getAssignableTests(); $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode'); $cr_mode->setRequired(true); $cr_mode->setValue(self::TEST_NEW); $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW); switch ($this->getTestType()) { case ilLOSettings::TYPE_TEST_INITIAL: $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info")); break; case ilLOSettings::TYPE_TEST_QUALIFIED: $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info")); break; } // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setMaxLength(128); $ti->setSize(40); $ti->setRequired(true); $new->addSubItem($ti); // description $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc"); $ta->setCols(40); $ta->setRows(2); $new->addSubItem($ta); // Question assignment type include_once './Modules/Test/classes/class.ilObjTest.php'; $this->lng->loadLanguageModule('assessment'); $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype'); $qst->setRequired(true); $random = new ilRadioOption($this->lng->txt('tst_question_set_type_random'), ilObjTest::QUESTION_SET_TYPE_RANDOM); $qst->addOption($random); $fixed = new ilRadioOption($this->lng->txt('tst_question_set_type_fixed'), ilObjTest::QUESTION_SET_TYPE_FIXED); $qst->addOption($fixed); $new->addSubItem($qst); $cr_mode->addOption($new); // assign existing $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN); switch ($this->getTestType()) { case ilLOSettings::TYPE_TEST_INITIAL: $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info")); break; case ilLOSettings::TYPE_TEST_QUALIFIED: $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info")); break; } if (!$assignable) { $existing->setDisabled(true); } $cr_mode->addOption($existing); $options = array(); $options[''] = $this->lng->txt('select_one'); foreach ((array) $assignable as $tst_ref_id) { $tst_obj_id = ilObject::_lookupObjId($tst_ref_id); $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id); } $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst'); $selectable->setRequired(true); $selectable->setOptions($options); $existing->addSubItem($selectable); $form->addItem($cr_mode); if ($a_as_multi_assignment) { include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php'; $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId()); include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), FALSE); $options = array(); $options[''] = $this->lng->txt('select_one'); foreach ($objective_ids as $oid) { $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType()); if (!$already_assigned_tst) { $options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid); } } $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective'); $objective->setRequired(TRUE); $objective->setOptions($options); $form->addItem($objective); } return $form; }