ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssMultipleChoiceCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssMultipleChoiceCorrectionsInputGUI:
+ Collaboration diagram for ilAssMultipleChoiceCorrectionsInputGUI:

Public Member Functions

 setValue ($a_value)
 
 checkInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilMultipleChoiceWizardInputGUI
 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
 setPending (string $a_val)
 
 getPending ()
 
- Public Member Functions inherited from ilSingleChoiceWizardInputGUI
 __construct ($a_title='', $a_postvar='')
 Constructor. More...
 
 setValue ($a_value)
 
 setValueByArray (array $a_values)
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 setHideImages ($a_hide)
 Set hide images. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setShowPoints ($a_value)
 
 getShowPoints ()
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 setSingleline ($a_value)
 Set singleline. More...
 
 getSingleline ()
 Get singleline. More...
 
 setQuestionObject ($a_value)
 Set question object. More...
 
 getQuestionObject ()
 Get question object. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 setPending (string $val)
 
 checkInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValue ($a_value)
 
 getValue ()
 
 setValidationFailureMessage (string $a_msg)
 
 getValidationFailureMessage ()
 
 setValidationRegexp (string $a_value)
 
 getValidationRegexp ()
 
 setMaxLength (?int $a_maxlength)
 
 getMaxLength ()
 
 setSize (int $a_size)
 
 setInlineStyle (string $a_style)
 
 getInlineStyle ()
 
 setCssClass (string $a_class)
 
 getCssClass ()
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 setSuffix (string $a_value)
 
 getSuffix ()
 
 setInputType (string $a_type)
 set input type More...
 
 getInputType ()
 
 setSubmitFormOnEnter (bool $a_val)
 
 getSubmitFormOnEnter ()
 
 checkInput ()
 
 getInput ()
 
 getDataSource ()
 
 setDataSource (string $href, ?string $a_delimiter=null)
 
 setDataSourceSubmitOnSelection (bool $a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl (string $a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
 setDisableHtmlAutoComplete (bool $autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
 getPostValueForComparison ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Attributes

 $qstObject
 
- Protected Attributes inherited from ilSingleChoiceWizardInputGUI
 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ilTestLegacyFormsHelper $forms_helper
 
GlyphFactory $glyph_factory
 
Renderer $renderer
 
UploadLimitResolver $upload_limit
 
- Protected Attributes inherited from ilTextInputGUI
 $value = null
 
int $maxlength = 200
 
int $size = 40
 
string $validationRegexp = ""
 
string $validationFailureMessage = ''
 
string $suffix = ""
 
string $style_css = ""
 
string $css_class = ""
 
string $ajax_datasource = ""
 
string $ajax_datasource_delimiter = null
 
bool $ajax_datasource_commit = false
 
string $ajax_datasource_commit_url = ""
 
bool $submit_form_on_enter = false
 
bool $autocomplete_disabled = false
 
string $input_type = ""
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilSingleChoiceWizardInputGUI
 checkAnswersInput (array $data)
 Checks the input of the answers and returns the answers as an array if the input is valid or a string with the error message if the input is invalid. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

Member Function Documentation

◆ checkInput()

ilAssMultipleChoiceCorrectionsInputGUI::checkInput ( )

Definition at line 45 of file class.ilAssMultipleChoiceCorrectionsInputGUI.php.

References $data, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ILIAS\Repository\lng(), ilFormPropertyGUI\raw(), and ilFormPropertyGUI\setAlert().

45  : bool
46  {
47  $data = $this->raw($this->getPostVar());
48 
49  $result = $this->forms_helper->checkPointsInputEnoughPositive($data, $this->getRequired(), 'points');
50  if (!is_array($result)) {
51  $this->setAlert($this->lng->txt($result));
52  return false;
53  }
54 
55  $result = $this->forms_helper->checkPointsInput($data, $this->getRequired(), 'points_unchecked');
56  if (!is_array($result)) {
57  $this->setAlert($this->lng->txt($result));
58  return false;
59  }
60 
61  return $this->checkSubItemsInput();
62  }
+ Here is the call graph for this function:

◆ insert()

ilAssMultipleChoiceCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 64 of file class.ilAssMultipleChoiceCorrectionsInputGUI.php.

References ilTextInputGUI\$value, ilFileUtils\getFileSizeInfo(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

64  : void
65  {
66  $tpl = new ilTemplate("tpl.prop_multiplechoicecorrection_input.html", true, true, "components/ILIAS/TestQuestionPool");
67 
68  $i = 0;
69  foreach ($this->values as $value) {
70  if ($this->qstObject->isSingleline()) {
71  if ($value->hasImage()) {
72  $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
73  if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
74  if (file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
75  $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
76  }
77  }
78 
79  $tpl->setCurrentBlock('image');
80  $tpl->setVariable('SRC_IMAGE', $imagename);
81  $tpl->setVariable('IMAGE_NAME', $value->getImage());
82  $tpl->setVariable('ALT_IMAGE', ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext()));
83  $tpl->parseCurrentBlock();
84  } else {
85  $tpl->setCurrentBlock('image');
86  $tpl->touchBlock('image');
87  $tpl->parseCurrentBlock();
88  }
89  }
90 
91  $tpl->setCurrentBlock("answer");
92  $tpl->setVariable("ANSWER", $value->getAnswertext());
93  $tpl->parseCurrentBlock();
94 
95  $tpl->setCurrentBlock("row");
96  $tpl->setVariable("POINTS_POST_VAR", $this->getPostVar());
97  $tpl->setVariable("POINTS_ROW_NUMBER", $i);
98  $tpl->setVariable(
99  "PROPERTY_VALUE_CHECKED",
100  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsChecked())
101  );
102  $tpl->setVariable(
103  "PROPERTY_VALUE_UNCHECKED",
104  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsUnchecked())
105  );
106  $tpl->parseCurrentBlock();
107 
108  $i++;
109  }
110 
111  if ($this->qstObject->isSingleline()) {
112  $tpl->setCurrentBlock("image_heading");
113  $tpl->setVariable("ANSWER_IMAGE", $this->lng->txt('answer_image'));
114  $tpl->setVariable("TXT_MAX_SIZE", ilFileUtils::getFileSizeInfo());
115  $tpl->parseCurrentBlock();
116  }
117 
118  $tpl->setCurrentBlock("points_heading");
119  $tpl->setVariable("POINTS_CHECKED_TEXT", $this->lng->txt('points_checked'));
120  $tpl->setVariable("POINTS_UNCHECKED_TEXT", $this->lng->txt('points_unchecked'));
121  $tpl->parseCurrentBlock();
122 
123  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
124  $tpl->setVariable("ANSWER_TEXT", $this->lng->txt('answer_text'));
125 
126  $a_tpl->setCurrentBlock("prop_generic");
127  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
128  $a_tpl->parseCurrentBlock();
129  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static prepareFormOutput($a_str, bool $a_strip=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static getFileSizeInfo()
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setValue()

ilAssMultipleChoiceCorrectionsInputGUI::setValue (   $a_value)

Definition at line 34 of file class.ilAssMultipleChoiceCorrectionsInputGUI.php.

References ilTextInputGUI\$value.

34  : void
35  {
36  $points = $this->forms_helper->transformPoints($a_value, 'points');
37  $points_unchecked = $this->forms_helper->transformPoints($a_value, 'points_unchecked');
38 
39  foreach ($this->values as $index => $value) {
40  $this->values[$index]->setPoints($points[$index] ?? 0.0);
41  $this->values[$index]->setPointsUnchecked($points_unchecked[$index] ?? 0.0);
42  }
43  }

Field Documentation

◆ $qstObject

ilAssMultipleChoiceCorrectionsInputGUI::$qstObject
protected

The documentation for this class was generated from the following file: