本文整理汇总了PHP中ilNumberInputGUI::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP ilNumberInputGUI::setRequired方法的具体用法?PHP ilNumberInputGUI::setRequired怎么用?PHP ilNumberInputGUI::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilNumberInputGUI
的用法示例。
在下文中一共展示了ilNumberInputGUI::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initForm
/**
* 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));
}
示例2: build
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);
}
}
示例3: initAddCodesForm
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'));
}
示例4: editQuestion
/**
* 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());
}
示例5: addFieldsToEditForm
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());
}
示例6: initFormSettings
/**
* 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;
}
示例7: addToForm
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);
}
示例8: addCustomSettingsToForm
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);
}
示例9: initFormSettings
/**
* 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;
}
示例10: addFieldsToEditForm
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());
}
示例11: initConfigurationForm
/**
* 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;
}
示例12: editQuestion
/**
* 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;
}
示例13: populateQuestionSpecificFormPart
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;
}
示例14: initFormSettings
/**
* 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: initQuestionForm
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;
}