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); } }
/** * @param array $row */ public function fillRow(array $row) { $short_name = new ilTextInputGUI('', 'mark_short_' . $row['mark_id']); $short_name->setValue($row['mark_short']); $short_name->setDisabled(!$this->is_editable); $short_name->setSize(10); $official_name = new ilTextInputGUI('', 'mark_official_' . $row['mark_id']); $official_name->setSize(20); $official_name->setDisabled(!$this->object->canEditMarks()); $official_name->setValue($row['mark_official']); $percentage = new ilNumberInputGUI('', 'mark_percentage_' . $row['mark_id']); $percentage->allowDecimals(true); $percentage->setValue($row['mark_percentage']); $percentage->setSize(10); $percentage->setDisabled(!$this->is_editable); $percentage->setMinValue(0); $percentage->setMaxValue(100); $this->tpl->setVariable('VAL_MARK_ID', $row['mark_id']); $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'marks[]', $row['mark_id'], !$this->is_editable)); $this->tpl->setVariable('VAL_SHORT_NAME', $short_name->render()); $this->tpl->setVariable('VAL_OFFICIAL_NAME', $official_name->render()); $this->tpl->setVariable('VAL_PERCENTAGE', $percentage->render()); $this->tpl->setVariable('VAL_PASSED_CHECKBOX', ilUtil::formCheckbox((bool) $row['mark_passed'], 'passed_' . $row['mark_id'], '1', !$this->is_editable)); }
/** * ilPropertyFormGUI initialisation * * @access private */ private function initRoomAllocationForm() { /** * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveRoomAllocation')); $this->form->setTitle($this->getPluginObject()->txt('room_allocation')); $this->form->addCommandButton('saveRoomAllocation', $lng->txt('save')); $this->form->addCommandButton('cancelRoomAllocation', $lng->txt('cancel')); $form_max_pax = new ilNumberInputGUI($this->getPluginObject()->txt('max_pax'), 'max_pax'); $form_max_pax->setInfo($this->getPluginObject()->txt('max_pax_settings_desc')); $form_max_pax->allowDecimals(false); $form_max_pax->setSize(5); $form_max_pax->setRequired(true); $this->form->addItem($form_max_pax); $form_ac_obj = new ilNumberInputGUI($this->getPluginObject()->txt('ac_interface_objects'), 'ac_interface_objects'); $form_ac_obj->setInfo($this->getPluginObject()->txt('enter_number_of_scos')); $form_ac_obj->setSize(5); $this->form->addItem($form_ac_obj); $form_ac_buf = new ilNumberInputGUI($this->getPluginObject()->txt('ac_buffer'), 'ac_interface_objects_buffer'); $form_ac_buf->setInfo($this->getPluginObject()->txt('enter_number_of_sco_buffer')); $form_ac_buf->setSize(5); $this->form->addItem($form_ac_buf); }
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()); }
/** * builds the questions hints form * * @access private * @global ilCtrl $ilCtrl * @global ilLanguage $lng * @return ilPropertyFormGUI $form */ private function buildForm(ilAssQuestionHint $questionHint = null) { global $ilCtrl, $lng; require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php'; require_once 'Services/Form/classes/class.ilNumberInputGUI.php'; require_once 'Services/Form/classes/class.ilHiddenInputGUI.php'; $form = new ilPropertyFormGUI(); $form->setTableWidth('100%'); if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { // form input: hint text $areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text'); $areaInp->setRequired(true); $areaInp->setRows(10); $areaInp->setCols(80); if (!$this->questionOBJ->getPreventRteUsage()) { $areaInp->setUseRte(true); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $areaInp->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment'); $areaInp->addPlugin("latex"); $areaInp->addButton("latex"); $areaInp->addButton("pastelatex"); $form->addItem($areaInp); } // form input: hint points $numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points'); $numInp->allowDecimals(true); $numInp->setRequired(true); $numInp->setSize(3); $form->addItem($numInp); if ($questionHint instanceof ilAssQuestionHint) { // build form title for an existing hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_edit'), $questionHint->getIndex(), $this->questionOBJ->getTitle())); // hidden input: hint id $hiddenInp = new ilHiddenInputGUI('hint_id'); $form->addItem($hiddenInp); // init values require_once 'Services/Utilities/classes/class.ilUtil.php'; if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { $areaInp->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true)); } $numInp->setValue($questionHint->getPoints()); $hiddenInp->setValue($questionHint->getId()); } else { // build form title for a new hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_create'), $this->questionOBJ->getTitle())); } if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) { if ($questionHint instanceof ilAssQuestionHint) { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points'); } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page'); } } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save'); } $form->setFormAction($ilCtrl->getFormAction($this)); $form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel')); $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel); return $form; }
public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form) { // maxsize $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize"); $maxsize->setValue($this->object->getMaxSize()); $maxsize->setInfo($this->lng->txt("maxsize_info")); $maxsize->setSize(10); $maxsize->setMinValue(0); $maxsize->setMaxValue($this->determineMaxFilesize()); $maxsize->setRequired(FALSE); $form->addItem($maxsize); // allowedextensions $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions"); $allowedextensions->setInfo($this->lng->txt("allowedextensions_info")); $allowedextensions->setValue($this->object->getAllowedExtensions()); $allowedextensions->setRequired(FALSE); $form->addItem($allowedextensions); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->allowDecimals(true); $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(false); $form->addItem($points); $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission'); $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info')); $subcompl->setValue(1); $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled()); $form->addItem($subcompl); return $form; }
/** * @global ilCtrl $ilCtrl * @global ilLanguage $lng * @param array $row */ public function fillRow($row) { /** * @var $ilCtrl ilCtrl */ global $ilCtrl; $this->tpl->setVariable('VAL_NAME', $row['participant']->getName()); $reached_points = new ilNumberInputGUI('', 'scoring[' . $row['pass_id'] . '][' . $row['active_id'] . '][' . $row['qst_id'] . ']'); $reached_points->allowDecimals(true); $reached_points->setSize(5); if (count($this->manPointsPostData)) { if ($this->isMaxPointsExceededByPostValue($row['pass_id'], $row['active_id'], $row['qst_id'])) { $reached_points->setAlert(sprintf($this->lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $row['maximum_points'])); $this->tpl->setCurrentBlock("reached_points_alert"); $this->tpl->setVariable("REACHED_POINTS_IMG_ALERT", ilUtil::getImagePath("icon_alert.svg")); $this->tpl->setVariable("REACHED_POINTS_ALT_ALERT", $this->lng->txt("alert")); $this->tpl->setVariable("REACHED_POINTS_TXT_ALERT", $reached_points->getAlert()); $this->tpl->parseCurrentBlock(); } $reached_points->setValue($this->manPointsPostData[$row['pass_id']][$row['active_id']][$row['qst_id']]); } else { $reached_points->setValue($row['reached_points']); } $this->tpl->setVariable('VAL_REACHED_POINTS', $reached_points->render()); $this->tpl->setVariable('VAL_ID', md5($row['pass_id'] . $row['active_id'] . $row['qst_id'])); $ilCtrl->setParameter($this->getParentObject(), 'qst_id', $row['qst_id']); $ilCtrl->setParameter($this->getParentObject(), 'active_id', $row['active_id']); $ilCtrl->setParameter($this->getParentObject(), 'pass_id', $row['pass_id']); $this->tpl->setVariable('VAL_LINK_ANSWER', $ilCtrl->getLinkTarget($this->getParentObject(), 'getAnswerDetail', '', true, false)); $ilCtrl->setParameter($this->getParentObject(), 'qst_id', ''); $ilCtrl->setParameter($this->getParentObject(), 'active_id', ''); $ilCtrl->setParameter($this->getParentObject(), 'pass_id', ''); $this->tpl->setVariable('VAL_TXT_ANSWER', $this->lng->txt('tst_eval_show_answer')); }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // ordertext $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext"); $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText())); $ordertext->setRequired(TRUE); $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator)); $ordertext->setRows(10); $ordertext->setCols(80); $form->addItem($ordertext); // textsize $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize"); $textsize->setValue($this->object->getTextSize()); $textsize->setInfo($this->lng->txt("textsize_info")); $textsize->setSize(6); $textsize->setMinValue(10); $textsize->setRequired(FALSE); $form->addItem($textsize); // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->allowDecimals(true); // mbecker: Fix for mantis bug 7866: Predefined values schould make sense. // This implements a default value of "1" for this question type. if ($this->object->getPoints() == null) { $points->setValue("1"); } else { $points->setValue($this->object->getPoints()); } $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); }
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_and_back')); if (null !== $this->getSaveAndNewCommand()) { $this->addCommandButton($this->getSaveAndNewCommand(), $this->lng->txt('tst_save_and_create_new_rule')); } $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); } }
private function buildSettingsForm() { /** * @var $ilAccess ilAccessHandler */ global $ilAccess; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("settings"); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt('settings')); $form->addItem($header); // question process locking behaviour (e.g. on saving users working data) $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock'); $chb->setChecked($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE); $chb->setInfo($this->lng->txt('ass_process_lock_desc')); $form->addItem($chb); $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode'); $rg->setRequired(true); $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_file'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_FILE); $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc')); $rg->addOption($opt); $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_db'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_DB); $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc')); $rg->addOption($opt); if ($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) { $rg->setValue($this->object->getAssessmentProcessLockMode()); } $chb->addSubItem($rg); $assessmentSetting = new ilSetting('assessment'); $imap_line_color = array_key_exists('imap_line_color', $_GET) ? $_GET['imap_line_color'] : $assessmentSetting->get('imap_line_color'); if (strlen($imap_line_color) == 0) { $imap_line_color = 'FF0000'; } $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color'); $linepicker->setValue($imap_line_color); $form->addItem($linepicker); $user_criteria = array_key_exists('user_criteria', $_GET) ? $_GET['user_criteria'] : $assessmentSetting->get('user_criteria'); $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria'); $userCriteria->setInfo($this->lng->txt('user_criteria_desc')); $userCriteria->setRequired(true); $fields = array('usr_id', 'login', 'email', 'matriculation', 'ext_account'); $usr_fields = array(); foreach ($fields as $field) { $usr_fields[$field] = $field; } $userCriteria->setOptions($usr_fields); $userCriteria->setValue($user_criteria); $form->addItem($userCriteria); $numRequiredAnswers = new ilNumberInputGUI($this->lng->txt('tst_skill_triggerings_num_req_answers'), 'num_req_answers'); $numRequiredAnswers->setInfo($this->lng->txt('tst_skill_triggerings_num_req_answers_desc')); $numRequiredAnswers->setSize(4); $numRequiredAnswers->allowDecimals(false); $numRequiredAnswers->setMinValue(1); $numRequiredAnswers->setMinvalueShouldBeGreater(false); $numRequiredAnswers->setValue($this->object->getSkillTriggeringNumAnswersBarrier()); $form->addItem($numRequiredAnswers); // question settings $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("assf_questiontypes")); $form->addItem($header); // available question types $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes"); $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE); $forbidden_types = $this->object->_getForbiddenQuestionTypes(); $allowedtypes = array(); foreach ($questiontypes as $qt) { if (!in_array($qt['question_type_id'], $forbidden_types)) { array_push($allowedtypes, $qt['question_type_id']); } } $allowed->setValue($allowedtypes); foreach ($questiontypes as $type_name => $qtype) { $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc')); $form->addItem($allowed); // manual scoring $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring"); $manscoring = $this->object->_getManualScoring(); $manual->setValue($manscoring); foreach ($questiontypes as $type_name => $qtype) { $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc')); $form->addItem($manual); // scoring adjustment active $scoring_activation = new ilCheckboxInputGUI($this->lng->txt('assessment_scoring_adjust'), 'chb_scoring_adjust'); $scoring_activation->setChecked($this->object->getScoringAdjustmentEnabled()); $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc')); $form->addItem($scoring_activation); // scoring adjustment $scoring = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_scoring_adjustment_activate'), "chb_scoring_adjustment"); $scoring_active = $this->object->getScoringAdjustableQuestions(); $scoring->setValue($scoring_active); foreach ($questiontypes as $type_name => $qtype) { $scoring->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc')); $form->addItem($scoring); if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) { $form->addCommandButton("saveSettings", $this->lng->txt("save")); } return $form; }
private function buildResultSkillPointsInputField() { $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points'); $questResultSkillPoints->setRequired(true); $questResultSkillPoints->setSize(4); $questResultSkillPoints->setMinvalueShouldBeGreater(false); $questResultSkillPoints->setMinValue(1); $questResultSkillPoints->allowDecimals(false); $questResultSkillPoints->setValue($this->assignment->getSkillPoints()); if (!$this->isManipulationEnabled()) { $questResultSkillPoints->setDisabled(true); } return $questResultSkillPoints; }
public function addCoupon() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); if (isset($_GET['coupon_id'])) { if ($this->error == '') { $this->coupon_obj->getCouponById($_GET['coupon_id']); } $this->ctrl->setParameter($this, 'coupon_id', $this->coupon_obj->getId()); $this->__showButtons(); } $oForm = new ilPropertyFormGUI(); $oForm->setId('frm_add_coupon'); $oForm->setFormAction($this->ctrl->getFormAction($this, 'saveCouponForm')); $oForm->setTitle($this->coupon_obj->getId() ? $this->lng->txt('paya_coupons_edit') : $this->lng->txt('paya_coupons_add')); // Title $oTitle = new ilTextInputGUI($this->lng->txt(paya_coupons_title), 'title'); $oTitle->setValue($this->coupon_obj->getTitle()); $oTitle->setRequired(true); $oForm->addItem($oTitle); // Description $oDescription = new ilTextAreaInputGUI($this->lng->txt(paya_coupons_description), 'description'); $oDescription->setValue($this->coupon_obj->getDescription()); $oForm->addItem($oDescription); // Type $o_coupon_type = new ilSelectInputGUI(); $coupon_option = array('fix' => $this->lng->txt('paya_coupons_fix'), 'percent' => $this->lng->txt('paya_coupons_percentaged')); $o_coupon_type->setTitle($this->lng->txt('coupon_type')); $o_coupon_type->setOptions($coupon_option); $o_coupon_type->setValue($this->coupon_obj->getType()); $o_coupon_type->setRequired(true); $o_coupon_type->setPostVar('coupon_type'); $oForm->addItem($o_coupon_type); // Value $o_coupon_value = new ilNumberInputGUI($this->lng->txt('paya_coupons_value'), 'coupon_value'); $o_coupon_value->setSize(5); $o_coupon_value->allowDecimals(true); $o_coupon_value->setValue($this->coupon_obj->getValue()); $o_coupon_value->setRequired(true); $oForm->addItem($o_coupon_value); // Date Valid From $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('paya_coupons_from'), 'from_check'); $o_from_check->setValue(1); $o_from_check->setChecked($this->coupon_obj->getFromDateEnabled() ? 1 : 0); $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setPostVar('from'); $from_date = explode('-', $this->coupon_obj->getFromDate()); $date_f['from']['date']['d'] = $from_date[2] != '00' ? $from_date[2] : ''; $date_f['from']['date']['m'] = $from_date[1] != '00' ? $from_date[1] : ''; $date_f['from']['date']['y'] = $from_date[0] != '0000' ? $from_date[0] : ''; $_POST['from'] = $date_f['from']; if ($this->coupon_obj->getFromDateEnabled() == '1') { $o_date_from->checkInput(); } $o_from_check->addSubItem($o_date_from); $oForm->addItem($o_from_check); // Date Valid Until $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('paya_coupons_till'), 'until_check'); $o_until_check->setValue(1); $o_until_check->setChecked($this->coupon_obj->getTillDateEnabled() ? 1 : 0); $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setPostVar('til'); $till_date = explode('-', $this->coupon_obj->getTillDate()); $date_t['til']['date']['d'] = $till_date[2] != '00' ? $till_date[2] : ''; $date_t['til']['date']['m'] = $till_date[1] != '00' ? $till_date[1] : ''; $date_t['til']['date']['y'] = $till_date[0] != '0000' ? $till_date[0] : ''; $_POST['til'] = $date_t['til']; if ($this->coupon_obj->getTillDateEnabled() == '1') { $o_date_until->checkInput(); } $o_until_check->addSubItem($o_date_until); $oForm->addItem($o_until_check); $o_usage = new ilNumberInputGUI($this->lng->txt('paya_coupons_availability'), 'usage'); $o_usage->setSize(5); $o_usage->setValue($this->coupon_obj->getUses()); $oForm->addItem($o_usage); $oForm->addCommandButton('saveCouponForm', $this->lng->txt('save')); $oForm->addCommandButton('showCoupons', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $oForm->getHTML()); }
/** * @return ilPropertyFormGUI */ protected function getEctsForm() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, 'saveEctsForm')); $form->addCommandButton('saveEctsForm', $this->lng->txt('save')); $form->setTitle($this->lng->txt('ects_output_of_ects_grades')); $allow_ects_marks = new ilCheckboxInputGUI($this->lng->txt('ects_allow_ects_grades'), 'ectcs_status'); for ($i = ord('a'); $i <= ord('e'); $i++) { $mark = chr($i); $mark_step = new ilNumberInputGUI(chr($i - 32) . ' - ' . $this->lng->txt('ects_grade_' . $mark . '_short'), 'ects_grade_' . $mark); $mark_step->setSize(5); $mark_step->allowDecimals(true); $mark_step->setMinValue(0, true); $mark_step->setMaxValue(100, true); $mark_step->setSuffix($this->lng->txt('percentile')); $mark_step->setRequired(true); $allow_ects_marks->addSubItem($mark_step); } $use_ects_fx = new ilCheckboxInputGUI($this->lng->txt('use_ects_fx'), 'use_ects_fx'); $threshold = new ilNumberInputGUI($this->lng->txt('ects_fx_threshold'), 'ects_fx_threshold'); $threshold->setInfo($this->lng->txt('ects_fx_threshold_info')); $threshold->setSuffix($this->lng->txt('percentile')); $threshold->allowDecimals(true); $threshold->setSize(5); $threshold->setRequired(true); $use_ects_fx->addSubItem($threshold); $allow_ects_marks->addSubItem($use_ects_fx); $form->addItem($allow_ects_marks); return $form; }
/** * 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; }
/** * @param assFormulaQuestionUnitCategory $category * @param assFormulaQuestionUnit $unit * @return ilPropertyFormGUI */ protected function initUnitForm(assFormulaQuestionUnitCategory $category = null, assFormulaQuestionUnit $unit = null) { if ($this->unit_form instanceof ilPropertyFormGUI) { return $this->unit_form; } $unit_in_use = false; if ($unit instanceof assFormulaQuestionUnit && $this->repository->isUnitInUse($unit->getId())) { $unit_in_use = true; } $this->unit_form = new ilPropertyFormGUI(); $title = new ilTextInputGUI($this->lng->txt('unit'), 'unit_title'); $title->setDisabled($unit_in_use); $title->setRequired(true); $this->unit_form->addItem($title); $baseunit = new ilSelectInputGUI($this->lng->txt('baseunit'), 'base_unit'); $items = $this->repository->getCategorizedUnits(); $options = array(); $category_name = ''; $new_category = false; foreach ((array) $items as $item) { if ($unit instanceof assFormulaQuestionUnit && $unit->getId() == $item->getId()) { continue; } /** * @var $item assFormulaQuestionUnitCategory|assFormulaQuestionUnitCategory */ if ($item instanceof assFormulaQuestionUnitCategory) { if ($category_name != $item->getDisplayString()) { $new_category = true; $category_name = $item->getDisplayString(); } continue; } $options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : ''); $new_category = false; } $baseunit->setDisabled($unit_in_use); $baseunit->setOptions(array(0 => $this->lng->txt('no_selection')) + $options); $this->unit_form->addItem($baseunit); $factor = new ilNumberInputGUI($this->lng->txt('factor'), 'factor'); $factor->setRequired(true); $factor->setSize(3); $factor->setMinValue(0); $factor->allowDecimals(true); $factor->setDisabled($unit_in_use); $this->unit_form->addItem($factor); if (null === $unit) { $this->unit_form->setTitle($this->lng->txt('new_unit')); $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'addUnit')); $this->unit_form->addCommandButton('addUnit', $this->lng->txt('save')); } else { $this->ctrl->setParameter($this, 'unit_id', $unit->getId()); if ($unit_in_use) { $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'showUnitsOfCategory')); } else { $this->unit_form->addCommandButton('saveUnit', $this->lng->txt('save')); $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'saveUnit')); } $this->unit_form->setTitle(sprintf($this->lng->txt('un_sel_cat_sel_unit'), $category->getDisplayString(), $unit->getDisplayString())); } $this->unit_form->addCommandButton('showUnitsOfCategory', $this->lng->txt('cancel')); return $this->unit_form; }
/** * Creates an output of the edit form for the question * * @access public */ public function editQuestion($checkonly = FALSE) { $save = $this->isSaveCommand(); $this->getQuestionTemplate(); # if ($_REQUEST['prev_qid']) { # $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); # } 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("assclozetest"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); $q_item = $form->getItemByPostVar("question"); $q_item->setInfo($this->lng->txt("close_text_hint")); $q_item->setTitle($this->lng->txt("cloze_text")); // text rating if (!$this->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"); $fixedTextLength->setValue(ilUtil::prepareFormOutput($this->object->getFixedTextLength())); $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); } for ($i = 0; $i < $this->object->getGapCount(); $i++) { $gap = $this->object->getGap($i); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("gap") . " " . ($i + 1)); $form->addItem($header); $gapcounter = new ilHiddenInputGUI("gap[{$i}]"); $gapcounter->setValue($i); $form->addItem($gapcounter); $gaptype = new ilSelectInputGUI($this->lng->txt('type'), "clozetype_{$i}"); $options = array(0 => $this->lng->txt("text_gap"), 1 => $this->lng->txt("select_gap"), 2 => $this->lng->txt("numeric_gap")); $gaptype->setOptions($options); $gaptype->setValue($gap->getType()); $form->addItem($gaptype); if ($gap->getType() == CLOZE_TEXT) { // Choices include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php"; $values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . ""); $values->setRequired(true); $values->setQuestionObject($this->object); $values->setSingleline(true); $values->setAllowMove(false); if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } $values->setValues($gap->getItemsRaw()); $form->addItem($values); } else { if ($gap->getType() == CLOZE_SELECT) { include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php"; $values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . ""); $values->setRequired(true); $values->setQuestionObject($this->object); $values->setSingleline(true); $values->setAllowMove(false); if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } $values->setValues($gap->getItemsRaw()); $form->addItem($values); // shuffle $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_" . $i . ""); $shuffle->setValue(1); $shuffle->setChecked($gap->getShuffle()); $shuffle->setRequired(FALSE); $form->addItem($shuffle); } else { if ($gap->getType() == CLOZE_NUMERIC) { if (count($gap->getItemsRaw()) == 0) { $gap->addItem(new assAnswerCloze("", 0, 0)); } foreach ($gap->getItemsRaw() as $item) { // #8944: the js-based ouput in self-assessment cannot support formulas if (!$this->getSelfAssessmentEditingMode()) { $value = new ilFormulaInputGUI($this->lng->txt('value'), "gap_" . $i . "_numeric"); $value->setInlineStyle('text-align: right;'); $lowerbound = new ilFormulaInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $i . "_numeric_lower"); $lowerbound->setInlineStyle('text-align: right;'); $upperbound = new ilFormulaInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $i . "_numeric_upper"); $upperbound->setInlineStyle('text-align: right;'); } else { $value = new ilNumberInputGUI($this->lng->txt('value'), "gap_" . $i . "_numeric"); $value->allowDecimals(true); $lowerbound = new ilNumberInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $i . "_numeric_lower"); $lowerbound->allowDecimals(true); $upperbound = new ilNumberInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $i . "_numeric_upper"); $upperbound->allowDecimals(true); } $value->setSize(10); $value->setValue(ilUtil::prepareFormOutput($item->getAnswertext())); $value->setRequired(true); $form->addItem($value); $lowerbound->setSize(10); $lowerbound->setRequired(true); $lowerbound->setValue(ilUtil::prepareFormOutput($item->getLowerBound())); $form->addItem($lowerbound); $upperbound->setSize(10); $upperbound->setRequired(true); $upperbound->setValue(ilUtil::prepareFormOutput($item->getUpperBound())); $form->addItem($upperbound); $points = new ilNumberInputGUI($this->lng->txt('points'), "gap_" . $i . "_numeric_points"); $points->setSize(3); $points->setRequired(true); $points->setValue(ilUtil::prepareFormOutput($item->getPoints())); $form->addItem($points); } } } } } $form->addCommandButton('createGaps', $this->lng->txt('create_gaps')); $this->addQuestionFormCommandButtons($form); $errors = false; if ($save) { $form->setValuesByPost(); $errors = !$form->checkInput(); $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("QUESTION_DATA", $form->getHTML()); } return $errors; }
/** * @param ilPropertyFormGUI $form */ private function addTestRunProperties(ilPropertyFormGUI $form) { // section header test run $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_settings_header_test_run")); $form->addItem($header); // max. number of passes $limitPasses = new ilCheckboxInputGUI($this->lng->txt("tst_limit_nr_of_tries"), 'limitPasses'); $limitPasses->setInfo($this->lng->txt("tst_nr_of_tries_desc")); $limitPasses->setChecked($this->testOBJ->getNrOfTries() > 0); $nr_of_tries = new ilNumberInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->allowDecimals(false); $nr_of_tries->setMinValue(1); $nr_of_tries->setMinvalueShouldBeGreater(false); $nr_of_tries->setValue($this->testOBJ->getNrOfTries() ? $this->testOBJ->getNrOfTries() : 1); $nr_of_tries->setRequired(true); if ($this->testOBJ->participantDataExist()) { $limitPasses->setDisabled(true); $nr_of_tries->setDisabled(true); } $limitPasses->addSubItem($nr_of_tries); $form->addItem($limitPasses); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->setValue(1); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilNumberInputGUI($this->lng->txt("tst_processing_time_duration"), 'processing_time'); $processingtime->allowDecimals(false); $processingtime->setMinValue(1); $processingtime->setMinvalueShouldBeGreater(false); $processingtime->setValue($this->testOBJ->getProcessingTimeAsMinutes()); $processingtime->setSize(5); $processingtime->setSuffix($this->lng->txt('minutes')); $processingtime->setInfo($this->lng->txt("tst_processing_time_duration_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $examIdInPass = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_pass'), 'examid_in_test_pass'); $examIdInPass->setInfo($this->lng->txt('examid_in_test_pass_desc')); $examIdInPass->setChecked($this->testOBJ->isShowExamIdInTestPassEnabled()); $form->addItem($examIdInPass); }
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { $orderingtype = $this->getOrderingTypeFromPost(); // Edit mode $hidden = new ilHiddenInputGUI("ordering_type"); $hidden->setValue($orderingtype); $form->addItem($hidden); if (!$this->object->getSelfAssessmentEditingMode()) { $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height"); $element_height->setValue($this->object->getElementHeight()); $element_height->setRequired(false); $element_height->setMaxLength(6); $element_height->setMinValue(20); $element_height->setSize(6); $element_height->setInfo($this->lng->txt("element_height_info")); $form->addItem($element_height); } if ($orderingtype == OQ_PICTURES) { $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry"); $geometry->setValue($this->object->getThumbGeometry()); $geometry->setRequired(true); $geometry->setMaxLength(6); $geometry->setMinValue(20); $geometry->setSize(6); $geometry->setInfo($this->lng->txt("thumb_geometry_info")); $form->addItem($geometry); } // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->allowDecimals(true); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); return $form; }
public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form) { $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode'); $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc')); $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc')); $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc')); $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc')); $scoringMode->addOption($scoringOptionNone); $scoringMode->addOption($scoringOptionAnyKeyword); $scoringMode->addOption($scoringOptionAllKeyword); $scoringMode->addOption($scoringOptionOneKeyword); $scoringMode->setRequired(true); $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non'); if ($this->object->getAnswerCount() == 0) { $this->object->addAnswer("", 1, 0, 0); } require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php"; // Without Keywords $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points"); $nonKeywordPoints->allowDecimals(true); $nonKeywordPoints->setValue($this->object->getPoints()); $nonKeywordPoints->setRequired(TRUE); $nonKeywordPoints->setSize(3); $nonKeywordPoints->setMinValue(0.0); $nonKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionNone->addSubItem($nonKeywordPoints); // Any Keyword $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword"); $anyKeyword->setRequired(TRUE); $anyKeyword->setQuestionObject($this->object); $anyKeyword->setSingleline(TRUE); $anyKeyword->setValues($this->object->getAnswers()); $scoringOptionAnyKeyword->addSubItem($anyKeyword); // All Keywords $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword"); $allKeyword->setRequired(TRUE); //$allKeyword->setQuestionObject($this->object); //$allKeyword->setSingleline(TRUE); $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionAllKeyword->addSubItem($allKeyword); $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points"); $allKeywordPoints->allowDecimals(true); $allKeywordPoints->setValue($this->object->getPoints()); $allKeywordPoints->setRequired(TRUE); $allKeywordPoints->setSize(3); $allKeywordPoints->setMinValue(0.0); $allKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionAllKeyword->addSubItem($allKeywordPoints); // One Keywords $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword"); $oneKeyword->setRequired(TRUE); //$oneKeyword->setQuestionObject($this->object); //$oneKeyword->setSingleline(TRUE); $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers())); $scoringOptionOneKeyword->addSubItem($oneKeyword); $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points"); $oneKeywordPoints->allowDecimals(true); $oneKeywordPoints->setValue($this->object->getPoints()); $oneKeywordPoints->setRequired(TRUE); $oneKeywordPoints->setSize(3); $oneKeywordPoints->setMinValue(0.0); $oneKeywordPoints->setMinvalueShouldBeGreater(true); $scoringOptionOneKeyword->addSubItem($oneKeywordPoints); $form->addItem($scoringMode); }
/** * @param ilPropertyFormGUI $form * @return ilPropertyFormGUI */ public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form) { // shuffle answers $shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_answers_enabled"); $shuffleAnswers->setChecked($this->object->isShuffleAnswersEnabled()); $form->addItem($shuffleAnswers); if (!$this->object->getSelfAssessmentEditingMode()) { // answer mode (single-/multi-line) $answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type'); $answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng)); $answerType->setValue($this->object->getAnswerType()); $form->addItem($answerType); } if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType())) { // thumb size $thumbSize = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_size'); $thumbSize->setSuffix($this->lng->txt("thumb_size_unit_pixel")); $thumbSize->setInfo($this->lng->txt('thumb_size_info')); $thumbSize->setDecimals(false); $thumbSize->setMinValue(20); $thumbSize->setSize(6); $thumbSize->setValue($this->object->getThumbSize()); $form->addItem($thumbSize); } // option label $optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label'); $optionLabel->setInfo($this->lng->txt('option_label_info')); $optionLabel->setRequired(true); $optionLabel->setValue($this->object->getOptionLabel()); foreach ($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText) { $option = new ilRadioOption($labelText, $labelValue); $optionLabel->addOption($option); if ($this->object->isCustomOptionLabel($labelValue)) { $customLabelTrue = new ilTextInputGUI($this->lng->txt('option_label_custom_true'), 'option_label_custom_true'); $customLabelTrue->setValue($this->object->getCustomTrueOptionLabel()); $option->addSubItem($customLabelTrue); $customLabelFalse = new ilTextInputGUI($this->lng->txt('option_label_custom_false'), 'option_label_custom_false'); $customLabelFalse->setValue($this->object->getCustomFalseOptionLabel()); $option->addSubItem($customLabelFalse); } } $form->addItem($optionLabel); // points $points = new ilNumberInputGUI($this->lng->txt('points'), 'points'); $points->setRequired(true); $points->setSize(3); $points->allowDecimals(true); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $points->setValue($this->object->getPoints()); $form->addItem($points); // score partial solution $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled'); $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info')); $scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled()); $form->addItem($scorePartialSolution); return $form; }
/** * @param ilPropertyFormGUI $a_form */ public function addCustomSettingsToForm(ilPropertyFormGUI $a_form) { /** * @var $lng ilLanguage */ global $lng; $lng->loadLanguageModule('forum'); $max_notification_age = new ilNumberInputGUI($lng->txt('frm_max_notification_age'), 'max_notification_age'); $max_notification_age->setSize(5); $max_notification_age->setSuffix($lng->txt('frm_max_notification_age_unit')); $max_notification_age->setRequired(true); $max_notification_age->allowDecimals(false); $max_notification_age->setMinValue(1); $max_notification_age->setInfo($lng->txt('frm_max_notification_age_info')); $max_notification_age->setValue($this->settings->get('max_notification_age', 30)); $a_form->addItem($max_notification_age); }
private function initLoginSettingsForm() { $this->setSubTabs('settings'); $this->tabs_gui->setTabActive('settings'); $this->tabs_gui->setSubTabActive('loginname_settings'); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->loginSettingsForm = new ilPropertyFormGUI(); $this->loginSettingsForm->setFormAction($this->ctrl->getFormAction($this, 'saveLoginnameSettings')); $this->loginSettingsForm->setTitle($this->lng->txt('loginname_settings')); $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname'); $chbChangeLogin->setValue(1); $this->loginSettingsForm->addItem($chbChangeLogin); $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname'); $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info')); $chbCreateHistory->setValue(1); $chbChangeLogin->addSubItem($chbCreateHistory); $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames'); $chbReuseLoginnames->setValue(1); $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info')); $chbChangeLogin->addSubItem($chbReuseLoginnames); $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time'); $chbChangeBlockingTime->allowDecimals(true); $chbChangeBlockingTime->setSuffix($this->lng->txt('days')); $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info')); $chbChangeBlockingTime->setSize(10); $chbChangeBlockingTime->setMaxLength(10); $chbChangeLogin->addSubItem($chbChangeBlockingTime); $this->loginSettingsForm->addCommandButton('saveLoginnameSettings', $this->lng->txt('save')); }
/** * init form table 'substitutions' * * @access protected */ protected function initFormSubstitutions() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; if (!($visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())) { return; } $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); #$this->form->setTableWidth('100%'); // substitution foreach ($visible_records as $obj_type => $records) { $perm = null; // :TODO: hardwird ? if (in_array($obj_type, array("crs", "cat"))) { $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION, $obj_type, array(ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS)); } include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php'; $sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type); // Show section $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('objs_' . $obj_type)); $this->form->addItem($section); $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_desc_show')); $check->setChecked($sub->isDescriptionEnabled() ? true : false); $this->form->addItem($check); if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION]) { $check->setDisabled(true); } $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_fields_show')); $check->setChecked($sub->enabledFieldNames() ? true : false); $this->form->addItem($check); if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES]) { $check->setDisabled(true); } #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type); #$area->setUseRte(true); #$area->setRteTagSet('standard'); #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString())); #$area->setRows(5); #$area->setCols(80); #$this->form->addItem($area); if ($perm) { $perm_pos = $perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS]; } $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($obj_type); $definitions = $sub->sortDefinitions($definitions); $counter = 1; foreach ($definitions as $def) { $definition_id = $def->getFieldId(); $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id); $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId()); $title = $def->getTitle() . ' (' . $title . ')'; $check = new ilCheckboxInputGUI($title, 'show[' . $obj_type . '][' . $definition_id . ']'); $check->setValue(1); $check->setOptionTitle($this->lng->txt('md_adv_show')); $check->setChecked($sub->isSubstituted($definition_id)); if ($perm && !$perm["show"]) { $check->setDisabled(true); } $pos = new ilNumberInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']'); $pos->setSize(3); $pos->setMaxLength(4); $pos->allowDecimals(true); $pos->setValue(sprintf('%.1f', $counter++)); $check->addSubItem($pos); if ($perm && !$perm_pos) { $pos->setDisabled(true); } $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']'); $bold->setValue(1); $bold->setChecked($sub->isBold($definition_id)); $check->addSubItem($bold); if ($perm && !$perm["bold"]) { $bold->setDisabled(true); } $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']'); $bold->setValue(1); $bold->setChecked($sub->hasNewline($definition_id)); $check->addSubItem($bold); if ($perm && !$perm["newline"]) { $bold->setDisabled(true); } $this->form->addItem($check); } // placeholder /* $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders')); $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData'); foreach($records as $record) { foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition) { $tpl->setCurrentBlock('field'); $tpl->setVariable('FIELD_NAME',$definition->getTitle()); $tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'. '[/IF_F_'.$definition->getFieldId().']'); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('record'); $tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for')); $tpl->setVariable('TITLE',$record->getTitle()); $tpl->parseCurrentBlock(); } $custom->setHTML($tpl->get()); $this->form->addItem($custom); */ } $this->form->setTitle($this->lng->txt('md_adv_substitution_table')); $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save')); return true; }
/** * @param ilPropertyFormGUI $form * @return \ilPropertyFormGUI|void */ public function populateAnswerSpecificFormPart(ilPropertyFormGUI $form) { $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("errors_section")); $form->addItem($header); include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php"; $errordata = new ilErrorTextWizardInputGUI($this->lng->txt("errors"), "errordata"); $errordata->setKeyName($this->lng->txt('text_wrong')); $errordata->setValueName($this->lng->txt('text_correct')); $errordata->setValues($this->object->getErrorData()); $form->addItem($errordata); // points for wrong selection $points_wrong = new ilNumberInputGUI($this->lng->txt("points_wrong"), "points_wrong"); $points_wrong->allowDecimals(true); $points_wrong->setValue($this->object->getPointsWrong()); $points_wrong->setInfo($this->lng->txt("points_wrong_info")); $points_wrong->setSize(6); $points_wrong->setRequired(true); $form->addItem($points_wrong); return $form; }
/** * Populates the form-part for a numeric gap. * * This includes: The type selector, value, lower bound, upper bound and points. * * @param $form ilPropertyFormGUI Reference to the form, that receives the point. * @param $gap mixed Raw numeric gap item. * @param $gapCounter integer Ordinal number of the gap in the sequence of gaps. * * @return ilPropertyFormGUI */ protected function populateNumericGapFormPart($form, $gap, $gapCounter) { // #8944: the js-based ouput in self-assessment cannot support formulas if (!$this->object->getSelfAssessmentEditingMode()) { $value = new ilFormulaInputGUI($this->lng->txt('value'), "gap_" . $gapCounter . "_numeric"); $value->setInlineStyle('text-align: right;'); $lowerbound = new ilFormulaInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $gapCounter . "_numeric_lower"); $lowerbound->setInlineStyle('text-align: right;'); $upperbound = new ilFormulaInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $gapCounter . "_numeric_upper"); $upperbound->setInlineStyle('text-align: right;'); } else { $value = new ilNumberInputGUI($this->lng->txt('value'), "gap_" . $gapCounter . "_numeric"); $value->allowDecimals(true); $lowerbound = new ilNumberInputGUI($this->lng->txt('range_lower_limit'), "gap_" . $gapCounter . "_numeric_lower"); $lowerbound->allowDecimals(true); $upperbound = new ilNumberInputGUI($this->lng->txt('range_upper_limit'), "gap_" . $gapCounter . "_numeric_upper"); $upperbound->allowDecimals(true); } $value->setSize(10); $value->setValue(ilUtil::prepareFormOutput($gap->getAnswertext())); $value->setRequired(true); $form->addItem($value); $lowerbound->setSize(10); $lowerbound->setRequired(true); $lowerbound->setValue(ilUtil::prepareFormOutput($gap->getLowerBound())); $form->addItem($lowerbound); $upperbound->setSize(10); $upperbound->setRequired(true); $upperbound->setValue(ilUtil::prepareFormOutput($gap->getUpperBound())); $form->addItem($upperbound); $points = new ilNumberInputGUI($this->lng->txt('points'), "gap_" . $gapCounter . "_numeric_points"); $points->setSize(3); $points->setRequired(true); $points->setValue(ilUtil::prepareFormOutput($gap->getPoints())); $form->addItem($points); return $form; }
public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form) { // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->allowDecimals(true); $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : ''); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0.0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("range")); $form->addItem($header); // lower bound $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit"); $lower_limit->setSize(25); $lower_limit->setMaxLength(20); $lower_limit->setRequired(true); $lower_limit->setValue($this->object->getLowerLimit()); $form->addItem($lower_limit); // upper bound $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit"); $upper_limit->setSize(25); $upper_limit->setMaxLength(20); $upper_limit->setRequired(true); $upper_limit->setValue($this->object->getUpperLimit()); $form->addItem($upper_limit); // reset input length, if max chars are set if ($this->object->getMaxChars() > 0) { $lower_limit->setSize($this->object->getMaxChars()); $lower_limit->setMaxLength($this->object->getMaxChars()); $upper_limit->setSize($this->object->getMaxChars()); $upper_limit->setMaxLength($this->object->getMaxChars()); } }
/** * Inits form */ public function initPropertiesForm() { global $ilCtrl; $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); $instructions = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions'); $instructions->setRows(self::CREATION_FORM_TA_ROWS); $instructions->setCols(self::CREATION_FORM_TA_COLS); $this->form->addItem($instructions); // contact_info $contact_info = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info"); $contact_info->setRows(self::CREATION_FORM_TA_ROWS); $contact_info->setCols(self::CREATION_FORM_TA_COLS); $this->form->addItem($contact_info); $radio_access_level = new ilRadioGroupInputGUI($this->pluginObj->txt('access'), 'access_level'); $opt_private = new ilRadioOption($this->pluginObj->txt('private_room'), ilObjAdobeConnect::ACCESS_LEVEL_PRIVATE); $opt_protected = new ilRadioOption($this->pluginObj->txt('protected_room'), ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED); $opt_public = new ilRadioOption($this->pluginObj->txt('public_room'), ilObjAdobeConnect::ACCESS_LEVEL_PUBLIC); $radio_access_level->addOption($opt_private); $radio_access_level->addOption($opt_protected); $radio_access_level->addOption($opt_public); $this->form->addItem($radio_access_level); $radio_time_type = new ilRadioGroupInputGUI($this->pluginObj->txt('time_type_selection'), 'time_type_selection'); // option: permanent room $permanent_room = new ilRadioOption($this->pluginObj->txt('permanent_room'), 'permanent_room'); $permanent_room->setInfo($this->pluginObj->txt('permanent_room_info')); $radio_time_type->addOption($permanent_room); // option: date selection $opt_date = new ilRadioOption($this->pluginObj->txt('start_date'), 'date_selection'); // start date $sd = new ilDateTimeInputGUI($this->txt("start_date"), "start_date"); $sd->setDate(new ilDateTime($this->object->getStartDate()->getUnixTime(), IL_CAL_UNIX)); $sd->setShowTime(true); $sd->setInfo($this->txt("info_start_date")); $sd->setRequired(true); $opt_date->addSubItem($sd); $duration = new ilDurationInputGUI($this->pluginObj->txt("duration"), "duration"); $duration->setRequired(true); $opt_date->addSubItem($duration); $radio_time_type->addOption($opt_date); $this->form->addItem($radio_time_type); $cb_uploads = new ilCheckboxInputGUI($this->pluginObj->txt('read_contents'), 'read_contents'); $cb_records = new ilCheckboxInputGUI($this->pluginObj->txt('read_records'), 'read_records'); $this->form->addItem($cb_uploads); $this->form->addItem($cb_records); $settings = ilAdobeConnectServer::_getInstance(); $available_langs = $settings->getSetting('langs'); if ($available_langs == '' || $available_langs == NULL) { $available_langs = 'en'; } $available_langs = explode(",", $available_langs); $available_langs_prepared = array(); foreach ($available_langs as $lang) { $lang = trim($lang); $available_langs_prepared[$lang] = $lang; } $meeting_lang = new ilSelectInputGUI($this->pluginObj->txt('meeting_lang'), 'meeting_lang'); $meeting_lang->setOptions($available_langs_prepared); $meeting_lang->setRequired(true); $this->form->addItem($meeting_lang); $max_allowed_pax = $settings->getSetting('max_pax'); if (empty($max_allowed_pax)) { $max_allowed_pax = 200; } $max_pax = new ilNumberInputGUI($this->pluginObj->txt('max_pax'), 'max_pax'); $max_pax->setInfo($this->pluginObj->txt('max_pax_desc')); $max_pax->allowDecimals(false); $max_pax->setMaxValue($max_allowed_pax); $this->form->addItem($max_pax); $this->form->addCommandButton("updateProperties", $this->txt("save")); $this->form->addCommandButton("editProperties", $this->txt("cancel")); $this->form->setTitle($this->txt("edit_properties")); $this->form->setFormAction($this->ctrl->getFormAction($this)); }