/**
  * Init form.
  *
  * @param string $a_mode edit mode
  */
 public function initForm($a_mode = "edit")
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // title
     $ti = new ilTextInputGUI($lng->txt("title"), "title");
     $ti->setMaxLength(200);
     $ti->setSize(50);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // order nr
     $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr");
     $ni->setMaxLength(6);
     $ni->setSize(6);
     $ni->setRequired(true);
     $this->form->addItem($ni);
     // save and cancel commands
     if ($a_mode == "create") {
         $this->form->addCommandButton("save", $lng->txt("save"));
         $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
         $this->form->setTitle($lng->txt("skmg_create_skll"));
     } else {
         $this->form->addCommandButton("update", $lng->txt("save"));
         $this->form->setTitle($lng->txt("skmg_edit_skll"));
     }
     $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     $this->form->setFormAction($ilCtrl->getFormAction($this));
 }
 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);
     }
 }
 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'));
 }
 /**
  * Creates an output of the edit form for the question	
  * @access public
  */
 function editQuestion()
 {
     global $ilDB, $tpl;
     $plugin = $this->object->getPlugin();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("assJSMEQuestion");
     // Basiseingabefelder: title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     // points
     $points = new ilNumberInputGUI($plugin->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(10);
     $points->setMinValue(0.0);
     $form->addItem($points);
     // optionString for the JSME-Applet
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $optionString = new ilTextInputGUI($plugin->txt("optionString"), "optionString");
     $optionString->setValue($this->object->getOptionString());
     $form->addItem($optionString);
     // JSME-Applet for sampleSolution
     include_once "./Services/Form/classes/class.ilCustomInputGUI.php";
     $sampleSolution = new ilCustomInputGUI($plugin->txt("sampleSolution"), "sampleSolution");
     $template = $this->getJsmeOutputTemplate("", $this->object->getOptionString(), $this->object->getSampleSolution());
     $sampleSolution->setHtml($template->get());
     $form->addItem($sampleSolution);
     $form->addCommandButton('save', $plugin->txt("save"));
     $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
 }
 protected function addFieldsToEditForm(ilPropertyFormGUI $a_form)
 {
     // maximum number of characters
     $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
     $maxchars->setRequired(false);
     $maxchars->setSize(5);
     $maxchars->setDecimals(0);
     $a_form->addItem($maxchars);
     // textwidth
     $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth");
     $textwidth->setRequired(true);
     $textwidth->setSize(3);
     $textwidth->setDecimals(0);
     $textwidth->setMinValue(10);
     $a_form->addItem($textwidth);
     // textheight
     $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight");
     $textheight->setRequired(true);
     $textheight->setSize(3);
     $textheight->setDecimals(0);
     $textheight->setMinValue(1);
     $a_form->addItem($textheight);
     // values
     if ($this->object->getMaxChars() > 0) {
         $maxchars->setValue($this->object->getMaxChars());
     }
     $textwidth->setValue($this->object->getTextWidth());
     $textheight->setValue($this->object->getTextHeight());
 }
 /**
  * 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 addToForm()
 {
     global $lng;
     $adt = $this->getADT();
     $default = false;
     if ($adt->isNull()) {
         // see ilPersonalProfileGUI::addLocationToForm()
         // use installation default
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $def = ilMapUtil::getDefaultSettings();
         $adt->setLatitude($def["latitude"]);
         $adt->setLongitude($def["longitude"]);
         $adt->setZoom($def["zoom"]);
         $default = true;
     }
     $optional = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl"));
     if (!$default && !$adt->isNull()) {
         $optional->setChecked(true);
     }
     $loc = new ilLocationInputGUI($lng->txt("location"), $this->getElementId());
     $loc->setLongitude($adt->getLongitude());
     $loc->setLatitude($adt->getLatitude());
     $loc->setZoom($adt->getZoom());
     $optional->addSubItem($loc);
     $rad = new ilNumberInputGUI($lng->txt("form_location_radius"), $this->addToElementId("rad"));
     $rad->setSize(4);
     $rad->setSuffix($lng->txt("form_location_radius_km"));
     $rad->setValue($this->radius);
     $rad->setRequired(true);
     $optional->addSubItem($rad);
     $this->addToParentElement($optional);
 }
 public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
 {
     global $lng, $ilSetting;
     $num_days = new ilNumberInputGUI($lng->txt('payment_notification_days'), 'payment_notification_days');
     $num_days->setSize(3);
     $num_days->setMinValue(0);
     $num_days->setMaxValue(120);
     $num_days->setRequired(true);
     $num_days->setValue($ilSetting->get('payment_notification_days'));
     $num_days->setInfo($lng->txt('payment_notification_days_desc'));
     $a_form->addItem($num_days);
 }
 /**
  * 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());
 }
 /**
  * Init configuration form
  * @global type $ilCtrl 
  */
 protected function initConfigurationForm()
 {
     global $ilCtrl, $lng;
     $settings = ilFhoevEventSettings::getInstance();
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->getPluginObject()->txt('tbl_fhoev_event_settings'));
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->addCommandButton('save', $lng->txt('save'));
     $form->setShowTopButtons(false);
     $lock = new ilCheckboxInputGUI($this->getPluginObject()->txt('tbl_settings_active'), 'active');
     $lock->setValue(1);
     $lock->setChecked($settings->isActive());
     $form->addItem($lock);
     $dtpl = new ilNumberInputGUI($this->getPluginObject()->txt('tbl_settings_dtpl'), 'dtpl');
     $dtpl->setSize(8);
     $dtpl->setValue($settings->getTemplateId());
     $dtpl->setRequired(TRUE);
     $dtpl->setMinValue(1);
     $form->addItem($dtpl);
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public 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("orderinghorizontal");
     $this->addBasicQuestionFormProperties($form);
     // errortext
     $errortext = new ilTextAreaInputGUI($this->lng->txt("errortext"), "errortext");
     $errortext->setValue(ilUtil::prepareFormOutput($this->object->getErrorText()));
     $errortext->setRequired(TRUE);
     $errortext->setInfo($this->lng->txt("errortext_info"));
     $errortext->setRows(10);
     $errortext->setCols(80);
     $form->addItem($errortext);
     if (!$this->getSelfAssessmentEditingMode()) {
         // textsize
         $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
         $textsize->setValue(strlen($this->object->getTextSize()) ? $this->object->getTextSize() : 100.0);
         $textsize->setInfo($this->lng->txt("textsize_errortext_info"));
         $textsize->setSize(6);
         $textsize->setSuffix("%");
         $textsize->setMinValue(10);
         $textsize->setRequired(true);
         $form->addItem($textsize);
     }
     if (count($this->object->getErrorData()) || $checkonly) {
         $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");
         $values = array();
         $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->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);
     }
     $form->addCommandButton("analyze", $this->lng->txt('analyze_errortext'));
     $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;
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // shuffle
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getShuffle());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     if ($this->object->getId()) {
         $hidden = new ilHiddenInputGUI("", "ID");
         $hidden->setValue($this->object->getId());
         $form->addItem($hidden);
     }
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
         // Answer types
         $types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types");
         $types->setRequired(false);
         $types->setValue($isSingleline ? 0 : 1);
         $types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline')));
         $form->addItem($types);
     }
     if ($isSingleline) {
         // thumb size
         $thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size");
         $thumb_size->setMinValue(20);
         $thumb_size->setDecimals(0);
         $thumb_size->setSize(6);
         $thumb_size->setInfo($this->lng->txt('thumb_size_info'));
         $thumb_size->setValue($this->object->getThumbSize());
         $thumb_size->setRequired(false);
         $form->addItem($thumb_size);
         return $isSingleline;
     }
     return $isSingleline;
 }
 /**
  * Init settings property form
  *
  * @access protected
  */
 protected function initFormSettings()
 {
     global $lng;
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('blog_settings'));
     $form->addCommandButton('saveSettings', $this->lng->txt('save'));
     $form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $banner = new ilCheckboxInputGUI($lng->txt("blog_preview_banner"), "banner");
     $banner->setInfo($lng->txt("blog_preview_banner_info"));
     $form->addItem($banner);
     $width = new ilNumberInputGUI($lng->txt("blog_preview_banner_width"), "width");
     $width->setRequired(true);
     $width->setSize(4);
     $banner->addSubItem($width);
     $height = new ilNumberInputGUI($lng->txt("blog_preview_banner_height"), "height");
     $height->setRequired(true);
     $height->setSize(4);
     $banner->addSubItem($height);
     $blga_set = new ilSetting("blga");
     $banner->setChecked($blga_set->get("banner", false));
     if ($blga_set->get("banner")) {
         $width->setValue($blga_set->get("banner_width"));
         $height->setValue($blga_set->get("banner_height"));
     } else {
         $width->setValue(1370);
         $height->setValue(100);
     }
     $mask = new ilCheckboxInputGUI($lng->txt("blog_allow_html"), "mask");
     $mask->setInfo($lng->txt("blog_allow_html_info"));
     $mask->setChecked($blga_set->get("mask", false));
     $form->addItem($mask);
     return $form;
 }
示例#15
0
 protected function initQuestionForm($a_read_only = false)
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion"));
     $form->setTitle($lng->txt("obj_poll"));
     $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question");
     $question->setRequired(true);
     $question->setCols(40);
     $question->setRows(2);
     $question->setValue($this->object->getQuestion());
     $question->setDisabled($a_read_only);
     $form->addItem($question);
     $dimensions = " (" . ilObjPoll::getImageSize() . "px)";
     $img = new ilImageFileInputGUI($lng->txt("poll_image") . $dimensions, "image");
     $img->setDisabled($a_read_only);
     $form->addItem($img);
     // show existing file
     $file = $this->object->getImageFullPath(true);
     if ($file) {
         $img->setImage($file);
     }
     $anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode");
     $anonymous->setRequired(true);
     $option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0);
     $option->setInfo($lng->txt("poll_mode_anonymous_info"));
     $anonymous->addOption($option);
     $option = new ilRadioOption($lng->txt("poll_mode_personal"), 1);
     $option->setInfo($lng->txt("poll_mode_personal_info"));
     $anonymous->addOption($option);
     $anonymous->setValue($this->object->getNonAnonymous());
     $anonymous->setDisabled($a_read_only);
     $form->addItem($anonymous);
     $nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers");
     $nanswers->setRequired(true);
     $nanswers->setMinValue(1);
     $nanswers->setSize(3);
     $nanswers->setValue($this->object->getMaxNumberOfAnswers());
     $nanswers->setDisabled($a_read_only);
     $form->addItem($nanswers);
     $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers");
     $answers->setRequired(true);
     $answers->setMulti(true, true);
     $answers->setDisabled($a_read_only);
     $form->addItem($answers);
     $multi_answers = array();
     foreach ($this->object->getAnswers() as $idx => $item) {
         if (!$idx) {
             $answers->setValue($item["answer"]);
         }
         $multi_answers[] = $item["answer"];
     }
     $answers->setMultiValues($multi_answers);
     if (!$a_read_only) {
         $form->addCommandButton("saveQuestion", $lng->txt("save"));
     }
     return $form;
 }
示例#16
0
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
示例#17
0
 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());
     }
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $form->addItem($points);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("applet_attributes"));
     $form->addItem($header);
     // java applet
     $javaapplet = $this->object->getJavaAppletFilename();
     $applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName');
     $applet->setSuffixes(array('jar', 'class'));
     $applet->setRequired(false);
     if (strlen($javaapplet)) {
         $filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet');
         $filename->setValue($javaapplet);
         $applet->addSubItem($filename);
         $delete = new ilCheckboxInputGUI('', 'delete_applet');
         $delete->setOptionTitle($this->lng->txt('delete'));
         $delete->setValue(1);
         $applet->addSubItem($delete);
     }
     $form->addItem($applet);
     // Code
     $code = new ilTextInputGUI($this->lng->txt("code"), "java_code");
     $code->setValue($this->object->getJavaCode());
     $code->setRequired(TRUE);
     $form->addItem($code);
     if (!strlen($javaapplet)) {
         // Archive
         $archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive");
         $archive->setValue($this->object->getJavaArchive());
         $archive->setRequired(false);
         $form->addItem($archive);
         // Codebase
         $codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase");
         $codebase->setValue($this->object->getJavaCodebase());
         $codebase->setRequired(false);
         $form->addItem($codebase);
     }
     // Width
     $width = new ilNumberInputGUI($this->lng->txt("width"), "java_width");
     $width->setDecimals(0);
     $width->setSize(6);
     $width->setMinValue(50);
     $width->setMaxLength(6);
     $width->setValue($this->object->getJavaWidth());
     $width->setRequired(TRUE);
     $form->addItem($width);
     // Height
     $height = new ilNumberInputGUI($this->lng->txt("height"), "java_height");
     $height->setDecimals(0);
     $height->setSize(6);
     $height->setMinValue(50);
     $height->setMaxLength(6);
     $height->setValue($this->object->getJavaHeight());
     $height->setRequired(TRUE);
     $form->addItem($height);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("applet_parameters"));
     $form->addItem($header);
     include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
     $kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp");
     $values = array();
     for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
         $param = $this->object->getParameter($i);
         array_push($values, array($param['name'], $param['value']));
     }
     if (count($values) == 0) {
         array_push($values, array("", ""));
     }
     $kvp->setKeyName($this->lng->txt('name'));
     $kvp->setValueName($this->lng->txt('value'));
     $kvp->setValues($values);
     $form->addItem($kvp);
 }
示例#19
0
 /**
  * @param $form ilPropertyFormGUI
  * @return \ilPropertyFormGUI|void
  */
 public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 {
     // errortext
     $errortext = new ilTextAreaInputGUI($this->lng->txt("errortext"), "errortext");
     $errortext->setValue($this->object->getErrorText());
     $errortext->setRequired(TRUE);
     $errortext->setInfo($this->lng->txt("errortext_info"));
     $errortext->setRows(10);
     $errortext->setCols(80);
     $form->addItem($errortext);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // textsize
         $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
         $textsize->setValue(strlen($this->object->getTextSize()) ? $this->object->getTextSize() : 100.0);
         $textsize->setInfo($this->lng->txt("textsize_errortext_info"));
         $textsize->setSize(6);
         $textsize->setSuffix("%");
         $textsize->setMinValue(10);
         $textsize->setRequired(true);
         $form->addItem($textsize);
     }
 }
 /**
  * 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;
 }
示例#21
0
 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;
 }
 /**
  * Show lucene settings form 
  * @param
  * @return
  */
 protected function initFormLuceneSettings()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Search/classes/class.ilSearchSettings.php';
     $this->settings = ilSearchSettings::getInstance();
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'cancel'));
     $this->form->setTitle($this->lng->txt('lucene_settings_title'));
     $this->form->addCommandButton('saveLuceneSettings', $this->lng->txt('save'));
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     // Offline filter
     /*
     		$offline = new ilCheckboxInputGUI($this->lng->txt('lucene_offline_filter_setting'),'offline_filter');
     		$offline->setInfo($this->lng->txt('lucene_offline_filter_setting_info'));
     		$offline->setValue(1);
     		$offline->setChecked($this->settings->isLuceneOfflineFilterEnabled());
     		$this->form->addItem($offline);
     */
     // user search
     $us = new ilCheckboxInputGUI($this->lng->txt('search_user_search_form'), 'user_search_enabled');
     $us->setInfo($this->lng->txt('search_user_search_info_form'));
     $us->setValue(1);
     $us->setChecked($this->settings->isLuceneUserSearchEnabled());
     $this->form->addItem($us);
     // Item filter
     $if = new ilCheckboxInputGUI($this->lng->txt('search_mime_filter_form'), 'mime_enabled');
     $if->setValue(1);
     $if->setChecked($this->settings->isLuceneMimeFilterEnabled());
     $if->setInfo($this->lng->txt('search_item_filter_form_info'));
     $this->form->addItem($if);
     $mimes = $this->settings->getLuceneMimeFilter();
     foreach (ilSearchSettings::getLuceneMimeFilterDefinitions() as $mime => $def) {
         $ch = new ilCheckboxInputGUI($this->lng->txt($def['trans']), 'mime[' . $mime . ']');
         if (isset($mimes[$mime]) and $mimes[$mime]) {
             $ch->setChecked(true);
         }
         $ch->setValue(1);
         $if->addSubItem($ch);
     }
     $prefix = new ilCheckboxInputGUI($this->lng->txt('lucene_prefix_wildcard'), 'prefix');
     $prefix->setValue(1);
     $prefix->setInfo($this->lng->txt('lucene_prefix_wildcard_info'));
     $prefix->setChecked($this->settings->isPrefixWildcardQueryEnabled());
     $this->form->addItem($prefix);
     $numFrag = new ilNumberInputGUI($this->lng->txt('lucene_num_fragments'), 'fragmentCount');
     $numFrag->setRequired(true);
     $numFrag->setSize(2);
     $numFrag->setMaxLength(2);
     $numFrag->setMinValue(1);
     $numFrag->setMaxValue(10);
     $numFrag->setInfo($this->lng->txt('lucene_num_frag_info'));
     $numFrag->setValue($this->settings->getFragmentCount());
     $this->form->addItem($numFrag);
     $sizeFrag = new ilNumberInputGUI($this->lng->txt('lucene_size_fragments'), 'fragmentSize');
     $sizeFrag->setRequired(true);
     $sizeFrag->setSize(2);
     $sizeFrag->setMaxLength(4);
     $sizeFrag->setMinValue(10);
     $sizeFrag->setMaxValue(1000);
     $sizeFrag->setInfo($this->lng->txt('lucene_size_frag_info'));
     $sizeFrag->setValue($this->settings->getFragmentSize());
     $this->form->addItem($sizeFrag);
     $maxSub = new ilNumberInputGUI($this->lng->txt('lucene_max_sub'), 'maxSubitems');
     $maxSub->setRequired(true);
     $maxSub->setSize(2);
     $maxSub->setMaxLength(2);
     $maxSub->setMinValue(1);
     $maxSub->setMaxValue(10);
     $maxSub->setInfo($this->lng->txt('lucene_max_sub_info'));
     $maxSub->setValue($this->settings->getMaxSubitems());
     $this->form->addItem($maxSub);
     $relevance = new ilCheckboxInputGUI($this->lng->txt('lucene_relevance'), 'relevance');
     $relevance->setOptionTitle($this->lng->txt('lucene_show_relevance'));
     $relevance->setInfo($this->lng->txt('lucene_show_relevance_info'));
     $relevance->setValue(1);
     $relevance->setChecked($this->settings->isRelevanceVisible());
     $this->form->addItem($relevance);
     // begin-patch mime_filter
     $subrel = new ilCheckboxInputGUI('', 'subrelevance');
     $subrel->setOptionTitle($this->lng->txt('lucene_show_sub_relevance'));
     $subrel->setValue(1);
     $subrel->setChecked($this->settings->isSubRelevanceVisible());
     $relevance->addSubItem($subrel);
     // end-patch mime_filter
     $last_index = new ilDateTimeInputGUI($this->lng->txt('lucene_last_index_time'), 'last_index');
     $last_index->setShowTime(true);
     $last_index->setDate($this->settings->getLastIndexTime());
     $last_index->setInfo($this->lng->txt('lucene_last_index_time_info'));
     $this->form->addItem($last_index);
     return true;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $orderingtype = array_key_exists('ordering_type', $_POST) ? $_POST['ordering_type'] : $this->object->getOrderingType();
     if (strcmp($this->ctrl->getCmd(), 'changeToText') == 0) {
         $orderingtype = OQ_TERMS;
     }
     if (strcmp($this->ctrl->getCmd(), 'changeToPictures') == 0) {
         $orderingtype = OQ_PICTURES;
     }
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE);
     $form->setTableWidth("100%");
     $form->setId("ordering");
     // Edit mode
     $hidden = new ilHiddenInputGUI("ordering_type");
     $hidden->setValue($orderingtype);
     $form->addItem($hidden);
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     if (!$this->getSelfAssessmentEditingMode()) {
         $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height");
         $element_height->setValue($this->object->getElementHeight());
         $element_height->setRequired(false);
         $element_height->setMaxLength(6);
         $element_height->setMinValue(20);
         $element_height->setSize(6);
         $element_height->setInfo($this->lng->txt("element_height_info"));
         $form->addItem($element_height);
     }
     if ($orderingtype == OQ_PICTURES) {
         $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry");
         $geometry->setValue($this->object->getThumbGeometry());
         $geometry->setRequired(true);
         $geometry->setMaxLength(6);
         $geometry->setMinValue(20);
         $geometry->setSize(6);
         $geometry->setInfo($this->lng->txt("thumb_geometry_info"));
         $form->addItem($geometry);
     }
     if (count($this->object->getAnswers()) == 0) {
         $this->object->addAnswer();
     }
     // Answers
     if ($orderingtype == OQ_PICTURES) {
         include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php";
         $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers");
         $answers->setRequired(TRUE);
         $answers->setQuestionObject($this->object);
         $answers->setInfo($this->lng->txt('ordering_answer_sequence_info'));
         $answers->setAllowMove(TRUE);
         $answervalues = array();
         foreach ($this->object->getAnswers() as $index => $answervalue) {
             $answervalues[$index] = $answervalue->getAnswertext();
         }
         $answers->setValues($answervalues);
         $form->addItem($answers);
     } else {
         $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers");
         $answers->setRequired(TRUE);
         $answers->setInfo($this->lng->txt('ordering_answer_sequence_info'));
         $answers->setAllowMove(TRUE);
         $answervalues = array();
         foreach ($this->object->getAnswers() as $index => $answervalue) {
             $answervalues[$index] = $answervalue->getAnswertext();
         }
         ksort($answervalues);
         $answers->setValues($answervalues);
         $form->addItem($answers);
     }
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     if (true || !$this->getSelfAssessmentEditingMode()) {
         if ($orderingtype == OQ_PICTURES) {
             $form->addCommandButton("changeToText", $this->lng->txt("order_terms"));
         } else {
             $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures"));
         }
     }
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     if ($save) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }
示例#24
0
 private function formTimingObject()
 {
     global $ilAccess;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("tst_change_workingtime");
     $form->setTitle($this->lng->txt("tst_change_workingtime"));
     // test users
     $participantslist = new ilSelectInputGUI($this->lng->txt('participants'), "participant");
     $participants =& $this->object->getTestParticipants();
     $times = $this->object->getStartingTimeOfParticipants();
     $addons = $this->object->getTimeExtensionsOfParticipants();
     $options = array('' => $this->lng->txt('please_select'), '0' => $this->lng->txt('all_participants'));
     foreach ($participants as $participant) {
         $started = "";
         if ($this->object->getAnonymity()) {
             $name = $this->lng->txt("anonymous");
         } else {
             $name = $participant['lastname'] . ', ' . $participant['firstname'];
         }
         if ($times[$participant['active_id']]) {
             $started = ", " . $this->lng->txt('tst_started') . ': ' . ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
         }
         if ($addons[$participant['active_id']] > 0) {
             $started .= ", " . $this->lng->txt('extratime') . ': ' . $addons[$participant['active_id']] . ' ' . $this->lng->txt('minutes');
         }
         $options[$participant['active_id']] = $participant['login'] . ' (' . $name . ')' . $started;
     }
     $participantslist->setRequired(true);
     $participantslist->setOptions($options);
     $form->addItem($participantslist);
     // extra time
     $extratime = new ilNumberInputGUI($this->lng->txt("extratime"), "extratime");
     $extratime->setInfo($this->lng->txt('tst_extratime_info'));
     $extratime->setRequired(true);
     $extratime->setMinValue(0);
     $extratime->setMinvalueShouldBeGreater(false);
     $extratime->setSuffix($this->lng->txt('minutes'));
     $extratime->setSize(5);
     $form->addItem($extratime);
     if (is_array($_POST) && strlen($_POST['cmd']['timing'])) {
         $form->setValuesByArray($_POST);
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("timing", $this->lng->txt("save"));
     }
     $form->addCommandButton('timingOverview', $this->lng->txt("cancel"));
     return $form;
 }
 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());
 }
 /**
  * @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;
 }
示例#27
0
 /**
  * Init assignment form.
  *
  * @param        int        $a_mode        "create"/"edit"
  */
 public function initAssignmentForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilSetting;
     // init form
     $lng->loadLanguageModule("form");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setTableWidth("600px");
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt("exc_edit_assignment"));
     } else {
         $this->form->setTitle($lng->txt("exc_new_assignment"));
     }
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     // type
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $types = array(ilExAssignment::TYPE_UPLOAD => $this->lng->txt("exc_type_upload"), ilExAssignment::TYPE_UPLOAD_TEAM => $this->lng->txt("exc_type_upload_team"), ilExAssignment::TYPE_TEXT => $this->lng->txt("exc_type_text"));
     if (!$ilSetting->get('disable_wsp_blogs')) {
         $types[ilExAssignment::TYPE_BLOG] = $this->lng->txt("exc_type_blog");
     }
     if ($ilSetting->get('user_portfolios')) {
         $types[ilExAssignment::TYPE_PORTFOLIO] = $this->lng->txt("exc_type_portfolio");
     }
     if (sizeof($types) > 1) {
         $ty = new ilSelectInputGUI($this->lng->txt("exc_assignment_type"), "type");
         $ty->setOptions($types);
         $ty->setRequired(true);
     } else {
         $ty = new ilHiddenInputGUI("type");
         $ty->setValue(ilExAssignment::TYPE_UPLOAD);
     }
     $this->form->addItem($ty);
     // title
     $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
     $ti->setMaxLength(200);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // start time y/n
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_start_time"), "start_time_cb");
     $this->form->addItem($cb);
     // start time
     $edit_date = new ilDateTimeInputGUI("", "start_time");
     $edit_date->setShowTime(true);
     $cb->addSubItem($edit_date);
     // deadline y/n
     $dcb = new ilCheckboxInputGUI($this->lng->txt("exc_deadline"), "deadline_cb");
     $dcb->setChecked(true);
     $this->form->addItem($dcb);
     // Deadline
     $edit_date = new ilDateTimeInputGUI($lng->txt(""), "deadline");
     $edit_date->setShowTime(true);
     $dcb->addSubItem($edit_date);
     // mandatory
     $cb = new ilCheckboxInputGUI($this->lng->txt("exc_mandatory"), "mandatory");
     $cb->setInfo($this->lng->txt("exc_mandatory_info"));
     $cb->setChecked(true);
     $this->form->addItem($cb);
     // Work Instructions
     $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
     $desc_input->setRows(20);
     $desc_input->setUseRte(true);
     $desc_input->setRteTagSet("mini");
     $this->form->addItem($desc_input);
     // files
     if ($a_mode == "create") {
         $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
         $files->setFilenames(array(0 => ''));
         $this->form->addItem($files);
     }
     // peer review
     $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
     $peer->setInfo($this->lng->txt("exc_peer_review_ass_setting_info"));
     $this->form->addItem($peer);
     if ($a_mode == "create") {
         $peer->setInfo($lng->txt("exc_peer_review_info"));
     }
     $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
     $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info"));
     $peer_min->setRequired(true);
     $peer_min->setValue(5);
     $peer_min->setSize(3);
     $peer_min->setValue(2);
     $peer->addSubItem($peer_min);
     $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
     $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
     $peer_dl->enableDateActivation("", "peer_dl_tgl");
     $peer_dl->setShowTime(true);
     $peer->addSubItem($peer_dl);
     $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
     $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
     $peer->addSubItem($peer_file);
     $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
     $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
     $peer->addSubItem($peer_prsl);
     if ($a_mode != "create" && $this->ass && $this->ass->getDeadline() && $this->ass->getDeadline() < time()) {
         $peer_prsl->setDisabled(true);
     }
     // global feedback
     $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
     $this->form->addItem($fb);
     $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
     // $fb_file->setRequired(true);
     $fb_file->setALlowDeletion(true);
     $fb->addSubItem($fb_file);
     $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
     $fb_date->setRequired(true);
     $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
     $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
     $fb->addSubItem($fb_date);
     $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
     $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
     $fb->addSubItem($fb_cron);
     // save and cancel commands
     if ($a_mode == "create") {
         $this->form->addCommandButton("saveAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     } else {
         $this->form->addCommandButton("updateAssignment", $lng->txt("save"));
         $this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
     }
 }
 /**
  * Init  form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initSettingsForm()
 {
     global $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // title
     $title = new ilTextInputGUI($this->txt("title"), "title");
     $title->setRequired(true);
     $this->form->addItem($title);
     // description
     $description = new ilTextAreaInputGUI($this->txt("description"), "description");
     $description->setCols(39);
     $description->setRows(4);
     $this->form->addItem($description);
     // show submissions
     $show_submissions = new ilCheckboxInputGUI($this->txt("show_submissions"), "show_submissions");
     $show_submissions->setInfo($this->txt("show_submissions_info"));
     $this->form->addItem($show_submissions);
     // pass mode
     $pass_mode = new ilRadioGroupInputGUI($this->txt("pass_mode"), "pass_mode");
     $pass_all = new ilRadioOption($this->txt("pass_all"), "all", $this->txt("pass_all_info"));
     $pass_mode->addOption($pass_all);
     $pass_min = new ilRadioOption($this->txt("pass_minimum_nr"), "pass_min", $this->txt("pass_minimum_nr_info"));
     $pass_mode->addOption($pass_min);
     // minimum number of assignments to pass
     $min_number = new ilNumberInputGUI($this->txt("min_nr"), "min_number");
     $min_number->setSize(4);
     $min_number->setMaxLength(4);
     $min_number->setRequired(true);
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $mand = ilEphAssignment::countMandatory($this->object->getId());
     $min = max($mand, 1);
     $min_number->setMinValue($min);
     $pass_min->addSubItem($min_number);
     $this->form->addItem($pass_mode);
     $notification = new ilCheckboxInputGUI($this->txt("submission_notification"), "notification");
     $notification->setInfo($this->txt("submission_notification_info"));
     $this->form->addItem($notification);
     $copletion_by_submission = new ilCheckboxInputGUI($this->txt('completion_by_submission'), 'completion_by_submission');
     $copletion_by_submission->setInfo($this->txt('completion_by_submission_info'));
     $copletion_by_submission->setValue(1);
     $this->form->addItem($copletion_by_submission);
     $processtype = new ilSelectInputGUI($this->txt("processtype"), "processtype");
     $processtype->setOptions(array(1 => $this->txt("default"), 2 => $this->txt("reference"), 3 => $this->txt("private")));
     $processtype->setInfo($this->txt("processtype_description"));
     $this->form->addItem($processtype);
     $this->form->addCommandButton("updateSettings", $this->txt("save"));
     $this->form->setTitle($this->txt("edit_ephorus_exercise"));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
 }
 /**
  * Init form
  * @param int $a_mode
  * @return 
  */
 protected function initFormSequence($a_mode)
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initDomEvent();
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     switch ($a_mode) {
         case self::MODE_CREATE:
             $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
             $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
             $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             break;
             /*
             			case self::MODE_UPDATE:
             				$this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
             				$this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
             				$this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             				break;
             */
         /*
         			case self::MODE_UPDATE:
         				$this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
         				$this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
         				$this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
         				break;
         */
         case self::MODE_MULTI:
             $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
             $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
             $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
             break;
     }
     // in case of existing groups show a selection
     include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
     if (count($options = ilConsultationHourGroups::getGroupSelectOptions($this->getUserId()))) {
         $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'), 'grp');
         $group->setOptions($options);
         $group->setRequired(false);
         $this->form->addItem($group);
     }
     // Title
     $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
     $ti->setSize(32);
     $ti->setMaxLength(128);
     $ti->setRequired(true);
     $this->form->addItem($ti);
     if ($a_mode != self::MODE_MULTI) {
         // Start
         include_once './Services/Form/classes/class.ilDateTimeInputGUI.php';
         $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
         $dur->setShowTime(true);
         $dur->setMinuteStepSize(5);
         $this->form->addItem($dur);
         // Duration
         $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
         $du->setShowMinutes(true);
         $du->setShowHours(true);
         $this->form->addItem($du);
         // Number of appointments
         $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
         $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
         $nu->setSize(2);
         $nu->setMaxLength(2);
         $nu->setRequired(true);
         $nu->setMinValue(1);
         $this->form->addItem($nu);
         // Recurrence
         include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php';
         $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
         $rec->setEnabledSubForms(array(IL_CAL_FREQ_DAILY, IL_CAL_FREQ_WEEKLY, IL_CAL_FREQ_MONTHLY));
         $this->form->addItem($rec);
     }
     // Number of bookings
     $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
     $nu->setSize(2);
     $nu->setMaxLength(2);
     $nu->setMinValue(1);
     $nu->setRequired(true);
     $this->form->addItem($nu);
     // Deadline
     $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
     $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
     $dead->setShowMinutes(false);
     $dead->setShowHours(true);
     $dead->setShowDays(true);
     $this->form->addItem($dead);
     // Location
     $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
     $lo->setSize(32);
     $lo->setMaxLength(128);
     $this->form->addItem($lo);
     // Description
     $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
     $de->setRows(10);
     $de->setCols(60);
     $this->form->addItem($de);
     // Target Object
     $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
     $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
     $tgt->setSize(16);
     $tgt->setMaxLength(128);
     $this->form->addItem($tgt);
 }
 protected function initJavaServerIniForm()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $GLOBALS['lng']->loadLanguageModule('search');
     $this->form->setTitle($this->lng->txt('lucene_tbl_create_ini'));
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'createJavaServerIni'));
     $this->form->addCommandButton('downloadJavaServerIni', $this->lng->txt('lucene_download_ini'));
     $this->form->addCommandButton('showJavaServer', $this->lng->txt('cancel'));
     // Host
     $ip = new ilTextInputGUI($this->lng->txt('lucene_host'), 'ho');
     $ip->setInfo($this->lng->txt('lucene_host_info'));
     $ip->setMaxLength(128);
     $ip->setSize(32);
     $ip->setRequired(true);
     $this->form->addItem($ip);
     // Port
     $port = new ilNumberInputGUI($this->lng->txt('lucene_port'), 'po');
     $port->setSize(5);
     $port->setMinValue(1);
     $port->setMaxValue(65535);
     $port->setRequired(true);
     $this->form->addItem($port);
     // Index Path
     $path = new ilTextInputGUI($this->lng->txt('lucene_index_path'), 'in');
     $path->setSize(80);
     $path->setMaxLength(1024);
     $path->setInfo($this->lng->txt('lucene_index_path_info'));
     $path->setRequired(true);
     $this->form->addItem($path);
     // Logging
     $log = new ilTextInputGUI($this->lng->txt('lucene_log'), 'lo');
     $log->setSize(80);
     $log->setMaxLength(1024);
     $log->setInfo($this->lng->txt('lucene_log_info'));
     $log->setRequired(true);
     $this->form->addItem($log);
     // Level
     $lev = new ilSelectInputGUI($this->lng->txt('lucene_level'), 'le');
     $lev->setOptions(array('DEBUG' => 'DEBUG', 'INFO' => 'INFO', 'WARN' => 'WARN', 'ERROR' => 'ERROR', 'FATAL' => 'FATAL'));
     $lev->setValue('INFO');
     $lev->setRequired(true);
     $this->form->addItem($lev);
     // CPU
     $cpu = new ilNumberInputGUI($this->lng->txt('lucene_cpu'), 'cp');
     $cpu->setValue(1);
     $cpu->setSize(1);
     $cpu->setMaxLength(2);
     $cpu->setMinValue(1);
     $cpu->setRequired(true);
     $this->form->addItem($cpu);
     // Max file size
     $fs = new ilNumberInputGUI($this->lng->txt('lucene_max_fs'), 'fs');
     $fs->setInfo($this->lng->txt('lucene_max_fs_info'));
     $fs->setValue(500);
     $fs->setSize(4);
     $fs->setMaxLength(4);
     $fs->setMinValue(1);
     $fs->setRequired(true);
     $this->form->addItem($fs);
     return true;
 }