本文整理汇总了PHP中ilCheckboxInputGUI::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP ilCheckboxInputGUI::setRequired方法的具体用法?PHP ilCheckboxInputGUI::setRequired怎么用?PHP ilCheckboxInputGUI::setRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilCheckboxInputGUI
的用法示例。
在下文中一共展示了ilCheckboxInputGUI::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// obligatory
$shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getObligatory());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
// orientation
$orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
$orientation->setRequired(false);
$orientation->setValue($this->object->getOrientation());
$orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0));
$orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1));
$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->setChecked($this->object->use_min_answers);
$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);
$nranswers->setValue($this->object->nr_min_answers);
$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);
$nrmaxanswers->setValue($this->object->nr_max_answers);
$minanswers->addSubItem($nrmaxanswers);
$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'));
if (!$this->object->getCategories()->getCategoryCount()) {
$this->object->getCategories()->addCategory("");
}
$answers->setValues($this->object->getCategories());
$answers->setDisabledScale(false);
$form->addItem($answers);
$this->addCommandButtons($form);
//.........这里部分代码省略.........
示例3: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
# if ($_REQUEST['prev_qid']) {
# $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
# }
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("assclozetest");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
$q_item = $form->getItemByPostVar("question");
$q_item->setInfo($this->lng->txt("close_text_hint"));
$q_item->setTitle($this->lng->txt("cloze_text"));
// text rating
if (!$this->getSelfAssessmentEditingMode()) {
$textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "textgap_rating");
$text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"), "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"), "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"), "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"), "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"), "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"));
$textrating->setOptions($text_options);
$textrating->setValue($this->object->getTextgapRating());
$form->addItem($textrating);
// text field length
$fixedTextLength = new ilNumberInputGUI($this->lng->txt("cloze_fixed_textlength"), "fixedTextLength");
$fixedTextLength->setValue(ilUtil::prepareFormOutput($this->object->getFixedTextLength()));
$fixedTextLength->setMinValue(0);
$fixedTextLength->setSize(3);
$fixedTextLength->setMaxLength(6);
$fixedTextLength->setInfo($this->lng->txt('cloze_fixed_textlength_description'));
$fixedTextLength->setRequired(false);
$form->addItem($fixedTextLength);
// identical scoring
$identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring");
$identical_scoring->setValue(1);
$identical_scoring->setChecked($this->object->getIdenticalScoring());
$identical_scoring->setInfo($this->lng->txt('identical_scoring_desc'));
$identical_scoring->setRequired(FALSE);
$form->addItem($identical_scoring);
}
for ($i = 0; $i < $this->object->getGapCount(); $i++) {
$gap = $this->object->getGap($i);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("gap") . " " . ($i + 1));
$form->addItem($header);
$gapcounter = new ilHiddenInputGUI("gap[{$i}]");
$gapcounter->setValue($i);
$form->addItem($gapcounter);
$gaptype = new ilSelectInputGUI($this->lng->txt('type'), "clozetype_{$i}");
$options = array(0 => $this->lng->txt("text_gap"), 1 => $this->lng->txt("select_gap"), 2 => $this->lng->txt("numeric_gap"));
$gaptype->setOptions($options);
$gaptype->setValue($gap->getType());
$form->addItem($gaptype);
if ($gap->getType() == CLOZE_TEXT) {
// Choices
include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
$values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . "");
$values->setRequired(true);
$values->setQuestionObject($this->object);
$values->setSingleline(true);
$values->setAllowMove(false);
if (count($gap->getItemsRaw()) == 0) {
$gap->addItem(new assAnswerCloze("", 0, 0));
}
$values->setValues($gap->getItemsRaw());
$form->addItem($values);
} else {
if ($gap->getType() == CLOZE_SELECT) {
include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
$values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $i . "");
$values->setRequired(true);
$values->setQuestionObject($this->object);
$values->setSingleline(true);
$values->setAllowMove(false);
if (count($gap->getItemsRaw()) == 0) {
$gap->addItem(new assAnswerCloze("", 0, 0));
}
$values->setValues($gap->getItemsRaw());
$form->addItem($values);
// shuffle
$shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_" . $i . "");
$shuffle->setValue(1);
$shuffle->setChecked($gap->getShuffle());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
} else {
if ($gap->getType() == CLOZE_NUMERIC) {
if (count($gap->getItemsRaw()) == 0) {
$gap->addItem(new assAnswerCloze("", 0, 0));
}
//.........这里部分代码省略.........
示例4: addFieldsToEditForm
protected function addFieldsToEditForm(ilPropertyFormGUI $a_form)
{
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(false);
$subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
foreach ($subtypes as $idx => $st) {
$subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
}
$a_form->addItem($subtype);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_appearance"));
$a_form->addItem($header);
// column separators
$column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
$column_separators->setValue(1);
$column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
$column_separators->setRequired(false);
$a_form->addItem($column_separators);
// row separators
$row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
$row_separators->setValue(1);
$row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
$row_separators->setRequired(false);
$a_form->addItem($row_separators);
// neutral column separators
$neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
$neutral_column_separator->setValue(1);
$neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
$neutral_column_separator->setRequired(false);
$a_form->addItem($neutral_column_separator);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_columns"));
$a_form->addItem($header);
// Answers
include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
$columns = new ilCategoryWizardInputGUI("", "columns");
$columns->setRequired(false);
$columns->setAllowMove(true);
$columns->setShowWizard(true);
$columns->setShowNeutralCategory(true);
$columns->setDisabledScale(false);
$columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
$columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
$columns->setShowSavePhrase(true);
$a_form->addItem($columns);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_column_settings"));
$a_form->addItem($header);
// bipolar adjectives
$bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
$bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
// left pole
$bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
$bipolar1->setRequired(false);
$bipolar->addSubItem($bipolar1);
// right pole
$bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
$bipolar2->setRequired(false);
$bipolar->addSubItem($bipolar2);
$a_form->addItem($bipolar);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_rows"));
$a_form->addItem($header);
// matrix rows
include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
$rows = new ilMatrixRowWizardInputGUI("", "rows");
$rows->setRequired(false);
$rows->setAllowMove(true);
$rows->setLabelText($this->lng->txt('label'));
$rows->setUseOtherAnswer(true);
$a_form->addItem($rows);
// values
$subtype->setValue($this->object->getSubtype());
$column_separators->setChecked($this->object->getColumnSeparators());
$row_separators->setChecked($this->object->getRowSeparators());
$neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
if (!$this->object->getColumnCount()) {
$this->object->columns->addCategory("");
}
$columns->setValues($this->object->getColumns());
$bipolar1->setValue($this->object->getBipolarAdjective(0));
$bipolar2->setValue($this->object->getBipolarAdjective(1));
if ($this->object->getRowCount() == 0) {
$this->object->getRows()->addCategory("");
}
$rows->setValues($this->object->getRows());
}
示例5: buildForm
/**
* builds the question set config form and initialises the fields
* with the config currently saved in database
*
* @return ilPropertyFormGUI $form
*/
private function buildForm()
{
$this->questionSetConfig->loadFromDb($this->testOBJ->getTestId());
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save"));
$form->setId("tst_form_dynamic_question_set_config");
$form->setTitle($this->lng->txt('tst_form_dynamic_question_set_config'));
$form->setTableWidth("100%");
if ($this->testOBJ->participantDataExist()) {
$pool = new ilNonEditableValueGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_title');
$pool->setValue($this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree));
$pool->setDisabled(true);
$form->addItem($pool);
} else {
$poolInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_id');
$poolInput->setOptions($this->buildQuestionPoolSelectInputOptionArray($this->testOBJ->getAvailableQuestionpools(true, false, false, true, true)));
$poolInput->setValue($this->questionSetConfig->getSourceQuestionPoolId());
$poolInput->setRequired(true);
$form->addItem($poolInput);
}
$questionOderingInput = new ilRadioGroupInputGUI($this->lng->txt('tst_input_dynamic_question_set_question_ordering'), 'question_ordering');
$questionOderingInput->setValue($this->questionSetConfig->getOrderingTaxonomyId() ? self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE);
$optionOrderByDate = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_date'), self::QUESTION_ORDERING_TYPE_UPDATE_DATE, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_date_desc'));
$questionOderingInput->addOption($optionOrderByDate);
$optionOrderByTax = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_tax'), self::QUESTION_ORDERING_TYPE_TAXONOMY, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_tax_desc'));
$orderTaxInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_ordering_tax'), 'ordering_tax');
$orderTaxInput->setInfo($this->lng->txt('tst_input_dynamic_question_set_ordering_tax_description'));
$orderTaxInput->setValue($this->questionSetConfig->getOrderingTaxonomyId());
$orderTaxInput->setRequired(true);
$orderTaxInput->setOptions($this->buildTaxonomySelectInputOptionnArray($this->questionSetConfig->getSourceQuestionPoolId()));
$optionOrderByTax->addSubItem($orderTaxInput);
$questionOderingInput->addOption($optionOrderByTax);
$form->addItem($questionOderingInput);
$taxFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dynamic_question_set_taxonomie_filter_enabled'), 'tax_filter_enabled');
$taxFilterInput->setValue(1);
$taxFilterInput->setChecked($this->questionSetConfig->isTaxonomyFilterEnabled());
$taxFilterInput->setRequired(true);
$form->addItem($taxFilterInput);
if ($this->testOBJ->participantDataExist()) {
$questionOderingInput->setDisabled(true);
$taxFilterInput->setDisabled(true);
}
return $form;
}
示例6: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(false);
$subtype->setValue($this->object->getSubtype());
$subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
foreach ($subtypes as $idx => $st) {
$subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
}
$form->addItem($subtype);
// obligatory
$shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getObligatory());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_appearance"));
$form->addItem($header);
// column separators
$column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
$column_separators->setValue(1);
$column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
$column_separators->setChecked($this->object->getColumnSeparators());
$column_separators->setRequired(false);
$form->addItem($column_separators);
// row separators
$row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
$row_separators->setValue(1);
$row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
$row_separators->setChecked($this->object->getRowSeparators());
$row_separators->setRequired(false);
$form->addItem($row_separators);
// neutral column separators
$neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
$neutral_column_separator->setValue(1);
$neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
$neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
$neutral_column_separator->setRequired(false);
$form->addItem($neutral_column_separator);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_columns"));
$form->addItem($header);
// Answers
include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
$columns = new ilCategoryWizardInputGUI("", "columns");
$columns->setRequired(false);
$columns->setAllowMove(true);
$columns->setShowWizard(true);
$columns->setShowNeutralCategory(true);
$columns->setDisabledScale(false);
$columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
//.........这里部分代码省略.........
示例7: __initForm
protected function __initForm()
{
global $lng, $ilUser;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
// code handling
if ($this->code_enabled) {
include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
$code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code");
$code->setSize(40);
$code->setMaxLength(ilRegistrationCode::CODE_LENGTH);
if ((bool) $this->registration_settings->registrationCodeRequired()) {
$code->setRequired(true);
$code->setInfo($lng->txt("registration_code_required_info"));
} else {
$code->setInfo($lng->txt("registration_code_optional_info"));
}
$this->form->addItem($code);
}
// user defined fields
$user_defined_data = $ilUser->getUserDefinedData();
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$user_defined_fields =& ilUserDefinedFields::_getInstance();
$custom_fields = array();
foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) {
if ($definition['field_type'] == UDF_TYPE_TEXT) {
$custom_fields["udf_" . $definition['field_id']] = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setMaxLength(255);
$custom_fields["udf_" . $definition['field_id']]->setSize(40);
} else {
if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
$custom_fields["udf_" . $definition['field_id']] = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setUseRte(true);
} else {
$custom_fields["udf_" . $definition['field_id']] = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
}
}
if ($definition['required']) {
$custom_fields["udf_" . $definition['field_id']]->setRequired(true);
}
}
// standard fields
include_once "./Services/User/classes/class.ilUserProfile.php";
$up = new ilUserProfile();
$up->setMode(ilUserProfile::MODE_REGISTRATION);
$up->skipGroup("preferences");
// add fields to form
$up->addStandardFieldsToForm($this->form, NULL, $custom_fields);
unset($custom_fields);
// set language selection to current display language
$flang = $this->form->getItemByPostVar("usr_language");
if ($flang) {
$flang->setValue($lng->getLangKey());
}
// add information to role selection (if not hidden)
if ($this->code_enabled) {
$role = $this->form->getItemByPostVar("usr_roles");
if ($role && $role->getType() == "select") {
$role->setInfo($lng->txt("registration_code_role_info"));
}
}
// user agreement
$field = new ilFormSectionHeaderGUI();
$field->setTitle($lng->txt("usr_agreement"));
$this->form->addItem($field);
$field = new ilCustomInputGUI();
$field->setHTML('<div id="agreement">' . ilUserAgreement::_getText() . '</div>');
$this->form->addItem($field);
$field = new ilCheckboxInputGUI($lng->txt("accept_usr_agreement"), "usr_agreement");
$field->setRequired(true);
$field->setValue(1);
$this->form->addItem($field);
$this->form->addCommandButton("saveForm", $lng->txt("register"));
}
示例8: createUserAgreementCheckBox
/**
* Generate and always set the user agreement checkbox.
*
* @return \ilCheckboxInputGUI
*/
private function createUserAgreementCheckBox()
{
$agreement_id = $this->book->getRoomAgreementFileId();
$link = $this->getFileLinkForUserAgreementId($agreement_id);
$title = $this->lng->txt("rep_robj_xrs_rooms_user_agreement_accept");
$checkbox_agreement = new ilCheckboxInputGUI($title, "accept_room_rules");
$checkbox_agreement->setRequired(true);
$checkbox_agreement->setOptionTitle($link);
$checkbox_agreement->setChecked(true);
$checkbox_agreement->setValue(1);
$checkbox_agreement->setDisabled(true);
return $checkbox_agreement;
}
示例9: __initForm
protected function __initForm()
{
global $lng, $ilUser;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
// code handling
if ($this->code_enabled) {
include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
$code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code");
$code->setSize(40);
$code->setMaxLength(ilRegistrationCode::CODE_LENGTH);
if ((bool) $this->registration_settings->registrationCodeRequired()) {
$code->setRequired(true);
$code->setInfo($lng->txt("registration_code_required_info"));
} else {
$code->setInfo($lng->txt("registration_code_optional_info"));
}
$this->form->addItem($code);
}
// user defined fields
$user_defined_data = $ilUser->getUserDefinedData();
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$user_defined_fields =& ilUserDefinedFields::_getInstance();
$custom_fields = array();
foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) {
if ($definition['field_type'] == UDF_TYPE_TEXT) {
$custom_fields["udf_" . $definition['field_id']] = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setMaxLength(255);
$custom_fields["udf_" . $definition['field_id']]->setSize(40);
} else {
if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
$custom_fields["udf_" . $definition['field_id']] = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setUseRte(true);
} else {
$custom_fields["udf_" . $definition['field_id']] = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
$custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
$custom_fields["udf_" . $definition['field_id']]->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
}
}
if ($definition['required']) {
$custom_fields["udf_" . $definition['field_id']]->setRequired(true);
}
}
// standard fields
include_once "./Services/User/classes/class.ilUserProfile.php";
$up = new ilUserProfile();
$up->setMode(ilUserProfile::MODE_REGISTRATION);
$up->skipGroup("preferences");
// add fields to form
$up->addStandardFieldsToForm($this->form, NULL, $custom_fields);
unset($custom_fields);
// set language selection to current display language
$flang = $this->form->getItemByPostVar("usr_language");
if ($flang) {
$flang->setValue($lng->getLangKey());
}
// add information to role selection (if not hidden)
if ($this->code_enabled) {
$role = $this->form->getItemByPostVar("usr_roles");
if ($role && $role->getType() == "select") {
$role->setInfo($lng->txt("registration_code_role_info"));
}
}
// #11407
$domains = array();
foreach ($this->registration_settings->getAllowedDomains() as $item) {
if (trim($item)) {
$domains[] = $item;
}
}
if (sizeof($domains)) {
$mail_obj = $this->form->getItemByPostVar('usr_email');
$mail_obj->setInfo(sprintf($lng->txt("reg_email_domains"), implode(", ", $domains)) . "<br />" . ($this->code_enabled ? $lng->txt("reg_email_domains_code") : ""));
}
if (ilTermsOfServiceHelper::isEnabled()) {
try {
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
$document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng);
$field = new ilFormSectionHeaderGUI();
$field->setTitle($lng->txt('usr_agreement'));
$this->form->addItem($field);
$field = new ilCustomInputGUI();
$field->setHTML('<div id="agreement">' . $document->getContent() . '</div>');
$this->form->addItem($field);
$field = new ilCheckboxInputGUI($lng->txt('accept_usr_agreement'), 'accept_terms_of_service');
$field->setRequired(true);
$field->setValue(1);
$this->form->addItem($field);
} catch (ilTermsOfServiceNoSignableDocumentFoundException $e) {
}
}
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
if (ilCaptchaUtil::isActiveForRegistration()) {
require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
$captcha = new ilCaptchaInputGUI($lng->txt("captcha_code"), 'captcha_code');
$captcha->setRequired(true);
$this->form->addItem($captcha);
//.........这里部分代码省略.........
示例10: addAgreement
/**
* Add agreement to form
* @param type $form
* @param type $a_obj_id
* @param type $a_type
*/
public static function addAgreement($form, $a_obj_id, $a_type)
{
global $lng;
$agreement = new ilCheckboxInputGUI($lng->txt($a_type . '_agree'), 'agreement');
$agreement->setRequired(true);
$agreement->setOptionTitle($lng->txt($a_type . '_info_agree'));
$agreement->setValue(1);
$form->addItem($agreement);
return $form;
}
示例11: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(true);
$subtype->setValue($this->object->getSubtype());
$form->addItem($subtype);
// #10652
$opt = new ilRadioOption($this->lng->txt('non_ratio'), 3, $this->lng->txt("metric_subtype_description_interval"));
$subtype->addOption($opt);
// minimum value
$minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
if ($this->object->getSubtype() == 3) {
$minimum->setValue($this->object->getMinimum());
}
$minimum->setRequired(false);
$minimum->setSize(6);
$opt->addSubItem($minimum);
// maximum value
$maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
if ($this->object->getSubtype() == 3) {
$maximum->setValue($this->object->getMaximum());
}
$maximum->setRequired(false);
$maximum->setSize(6);
$opt->addSubItem($maximum);
$opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), 4, $this->lng->txt("metric_subtype_description_rationonabsolute"));
$subtype->addOption($opt);
// minimum value
$minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
if ($this->object->getSubtype() == 4) {
$minimum->setValue($this->object->getMinimum());
}
$minimum->setRequired(false);
$minimum->setSize(6);
$minimum->setMinValue(0);
$opt->addSubItem($minimum);
// maximum value
$maximum = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
if ($this->object->getSubtype() == 4) {
$maximum->setValue($this->object->getMaximum());
}
$maximum->setRequired(false);
$maximum->setSize(6);
$opt->addSubItem($maximum);
$opt = new ilRadioOption($this->lng->txt('ratio_absolute'), 5, $this->lng->txt("metric_subtype_description_ratioabsolute"));
$subtype->addOption($opt);
// minimum value
$minimum = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
if ($this->object->getSubtype() == 5) {
$minimum->setValue($this->object->getMinimum());
}
$minimum->setRequired(false);
//.........这里部分代码省略.........
示例12: randomQuestionsObject
function randomQuestionsObject()
{
global $ilUser;
$total = $this->object->evalTotalPersons();
$save = strcmp($this->ctrl->getCmd(), "saveRandomQuestions") == 0 ? TRUE : FALSE;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'randomQuestions'));
$form->setTitle($this->lng->txt('random_selection'));
$form->setDescription($this->lng->txt('tst_select_random_questions'));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("randomSelectionForm");
// question selection
$selection_mode = $save ? $_POST['chbQuestionSelectionMode'] : $ilUser->getPref("tst_question_selection_mode_equal");
$question_selection = new ilCheckboxInputGUI($this->lng->txt("tst_question_selection"), "chbQuestionSelectionMode");
$question_selection->setValue(1);
$question_selection->setChecked($selection_mode);
$question_selection->setOptionTitle($this->lng->txt('tst_question_selection_equal'));
$question_selection->setInfo($this->lng->txt('tst_question_selection_description'));
$question_selection->setRequired(false);
$form->addItem($question_selection);
// total amount of questions
$total_questions = new ilNumberInputGUI($this->lng->txt('tst_total_questions'), 'total_questions');
$total_questions->setValue($this->object->getRandomQuestionCount());
$total_questions->setSize(3);
$total_questions->setInfo($this->lng->txt('tst_total_questions_description'));
$total_questions->setRequired(false);
$form->addItem($total_questions);
if ($total == 0) {
$found_qpls = $this->object->getRandomQuestionpoolData();
include_once "./Modules/Test/classes/class.ilRandomTestData.php";
if (count($found_qpls) == 0) {
array_push($found_qpls, new ilRandomTestData());
}
$available_qpl =& $this->object->getAvailableQuestionpools(TRUE, $selection_mode, FALSE, TRUE, TRUE);
include_once './Modules/Test/classes/class.ilRandomTestInputGUI.php';
$source = new ilRandomTestInputGUI($this->lng->txt('tst_random_questionpools'), 'source');
$source->setUseEqualPointsOnly($selection_mode);
$source->setRandomQuestionPools($available_qpl);
$source->setUseQuestionCount(array_key_exists('total_questions', $_POST) ? $_POST['total_questions'] < 1 : $this->object->getRandomQuestionCount() < 1);
$source->setValues($found_qpls);
$form->addItem($source);
} else {
$qpls = $this->object->getUsedRandomQuestionpools();
include_once './Modules/Test/classes/class.ilRandomTestROInputGUI.php';
$source = new ilRandomTestROInputGUI($this->lng->txt('tst_random_questionpools'), 'source');
$source->setValues($qpls);
$form->addItem($source);
}
if ($total == 0) {
$form->addCommandButton("saveRandomQuestions", $this->lng->txt("save"));
}
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
if (!$errors) {
// check total amount of questions
if ($_POST['total_questions'] > 0) {
$totalcount = 0;
foreach ($_POST['source']['qpl'] as $idx => $qpl) {
$totalcount += $available_qpl[$qpl]['count'];
}
if ($_POST['total_questions'] > $totalcount) {
$total_questions->setAlert($this->lng->txt('msg_total_questions_too_high'));
$errors = true;
}
}
}
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
return $errors;
}
示例13: fillAgreement
/**
* Show user agreement
*
* @access protected
* @return
*/
protected function fillAgreement()
{
global $ilUser;
if (!$this->isRegistrationPossible()) {
return true;
}
include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
if (!$this->privacy->confirmationRequired($this->type) and !ilCourseDefinedFieldDefinition::_hasFields($this->container->getId())) {
return true;
}
$this->lng->loadLanguageModule('ps');
include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
$fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->container->getId()));
if (!count($fields_info->getExportableFields())) {
return true;
}
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('usr_agreement'));
$this->form->addItem($section);
$fields = new ilCustomInputGUI($this->lng->txt($this->type . '_user_agreement'), '');
$tpl = new ilTemplate('tpl.agreement_form.html', true, true, 'Services/Membership');
$tpl->setVariable('TXT_INFO_AGREEMENT', $this->lng->txt($this->type . '_info_agreement'));
foreach ($fields_info->getExportableFields() as $field) {
$tpl->setCurrentBlock('field_item');
$tpl->setVariable('FIELD_NAME', $this->lng->txt($field));
$tpl->parseCurrentBlock();
}
$fields->setHtml($tpl->get());
$this->form->addItem($fields);
$this->showCustomFields();
// Checkbox agreement
if ($this->privacy->confirmationRequired($this->type)) {
$agreement = new ilCheckboxInputGUI($this->lng->txt($this->type . '_agree'), 'agreement');
$agreement->setRequired(true);
$agreement->setOptionTitle($this->lng->txt($this->type . '_info_agree'));
$agreement->setValue(1);
$this->form->addItem($agreement);
}
return true;
}
示例14: cloneInitForm
/**
* Initialize clone form
*/
function cloneInitForm()
{
global $lng, $ilCtrl;
$this->checkDisplayMode();
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
$this->form->setId("clone_form");
$this->form->setFormAction("setup.php?cmd=gateway");
if ($this->setup->getClient()->status["access"]["status"] === false and stripos($this->setup->getClient()->getName(), "master") === false and $this->setup->getClient()->getdbType() == "mysql" and $this->setup->getClient()->db_exists) {
$this->form->setTitle($this->lng->txt("clone_source"));
$clients = array();
$clientlist = new ilClientList($this->setup->db_connections);
$list = $clientlist->getClients();
$clientlistarray = array();
foreach ($list as $key => $client) {
if (strcmp($key, $this->setup->getClient()->getId()) != '0' && $client->getDbType() == 'mysql') {
// You cannot clone yourself
$clientlistarray[$client->id] = $client->id;
}
}
$si = new ilSelectInputGUI($lng->txt("clone_selectsource"), "source");
$si->setOptions(array_merge(array("" => "-- " . $lng->txt("please_select") . " --"), $clientlistarray));
$si->setRequired(true);
$this->form->addItem($si);
$cb = new ilCheckboxInputGUI($lng->txt("clone_areyousure"), "iamsure");
$cb->setRequired(true);
$this->form->addItem($cb);
$this->form->addCommandButton("cloneSaveSource", $lng->txt("cloneit"));
} else {
$disabledmessage = "<h1>" . $this->lng->txt("clone_disabledmessage") . "</h1><br>";
if (!$this->setup->getClient()->status["access"]["status"] === false) {
$disabledmessage .= $this->lng->txt("clone_clientnotdisabled") . "<br>";
}
if (!stripos($this->setup->getClient()->getName(), "aster") === false) {
$disabledmessage .= $this->lng->txt("clone_clientismaster") . "<br>";
}
if ($this->setup->getClient()->getdbType() != "mysql") {
$disabledmessage .= $this->lng->txt("clone_clientisnotmysql") . "<br>";
}
if (!$this->setup->getClient()->db_exists) {
$disabledmessage .= $this->lng->txt("clone_clientnodatabase") . "<br>";
}
$this->form->setTitle($disabledmessage);
}
}
示例15: populateSelectGapFormPart
/**
* Populates the form-part for a select gap.
*
* This includes: The AnswerWizardGUI for the individual select items and points as well as
* the the checkbox for the shuffle option.
*
* @param $form ilPropertyFormGUI Reference to the form, that receives the point.
* @param $gap mixed Raw text gap item.
* @param $gapCounter integer Ordinal number of the gap in the sequence of gaps
*
* @return ilPropertyFormGUI
*/
protected function populateSelectGapFormPart($form, $gap, $gapCounter)
{
include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
$values = new ilAnswerWizardInputGUI($this->lng->txt("values"), "gap_" . $gapCounter . "");
$values->setRequired(true);
$values->setQuestionObject($this->object);
$values->setSingleline(true);
$values->setAllowMove(false);
$values->setValues($gap->getItemsRaw());
$form->addItem($values);
// shuffle
$shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_" . $gapCounter . "");
$shuffle->setValue(1);
$shuffle->setChecked($gap->getShuffle());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
return $form;
}