ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 ()
 Check input, strip slashes etc. More...
 
 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
 
ArrayBasedRequestWrapper $post_wrapper
 
- 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 ilFormPropertyGUI
 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 $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), and ilLanguage\txt().

45  : bool
46  {
47  global $DIC;
48  $lng = $DIC['lng'];
49 
50  $foundvalues = $_POST[$this->getPostVar()];
51  if (is_array($foundvalues)) {
52  // check points
53  $max = 0;
54  if (is_array($foundvalues['points'])) {
55  foreach ($foundvalues['points'] as $points) {
56  $points = str_replace(',', '.', $points);
57  if ($points > $max) {
58  $max = $points;
59  }
60  if (((strlen($points)) == 0) || (!is_numeric($points))) {
61  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
62  return false;
63  }
64  }
65  foreach ($foundvalues['points_unchecked'] as $points) {
66  if ($points > $max) {
67  $max = $points;
68  }
69  if (((strlen($points)) == 0) || (!is_numeric($points))) {
70  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
71  return false;
72  }
73  }
74  }
75  if ($max == 0) {
76  $this->setAlert($lng->txt("enter_enough_positive_points"));
77  return false;
78  }
79  } else {
80  $this->setAlert($lng->txt("msg_input_is_required"));
81  return false;
82  }
83 
84  return $this->checkSubItemsInput();
85  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ insert()

ilAssMultipleChoiceCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

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

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilFileUtils\getFileSizeInfo(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

87  : void
88  {
89  global $DIC; /* @var ILIAS\DI\Container $DIC */
90  $lng = $DIC->language();
91 
92  $tpl = new ilTemplate("tpl.prop_multiplechoicecorrection_input.html", true, true, "Modules/TestQuestionPool");
93 
94  $i = 0;
95 
96  foreach ($this->values as $value) {
97  if ($this->qstObject->isSingleline()) {
98  if (strlen($value->getImage())) {
99  $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
100  if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
101  if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
102  $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
103  }
104  }
105 
106  $tpl->setCurrentBlock('image');
107  $tpl->setVariable('SRC_IMAGE', $imagename);
108  $tpl->setVariable('IMAGE_NAME', $value->getImage());
109  $tpl->setVariable('ALT_IMAGE', ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext()));
110  $tpl->parseCurrentBlock();
111  } else {
112  $tpl->setCurrentBlock('image');
113  $tpl->touchBlock('image');
114  $tpl->parseCurrentBlock();
115  }
116  }
117 
118  $tpl->setCurrentBlock("answer");
119  $tpl->setVariable("ANSWER", $value->getAnswertext());
120  $tpl->parseCurrentBlock();
121 
122  $tpl->setCurrentBlock("row");
123  $tpl->setVariable("POINTS_POST_VAR", $this->getPostVar());
124  $tpl->setVariable("POINTS_ROW_NUMBER", $i);
125  $tpl->setVariable(
126  "PROPERTY_VALUE_CHECKED",
127  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsChecked())
128  );
129  $tpl->setVariable(
130  "PROPERTY_VALUE_UNCHECKED",
131  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsUnchecked())
132  );
133  $tpl->parseCurrentBlock();
134 
135  $i++;
136  }
137 
138  if ($this->qstObject->isSingleline()) {
139  $tpl->setCurrentBlock("image_heading");
140  $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
141  $tpl->setVariable("TXT_MAX_SIZE", ilFileUtils::getFileSizeInfo());
142  $tpl->parseCurrentBlock();
143  }
144 
145  $tpl->setCurrentBlock("points_heading");
146  $tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('points_checked'));
147  $tpl->setVariable("POINTS_UNCHECKED_TEXT", $lng->txt('points_unchecked'));
148  $tpl->parseCurrentBlock();
149 
150  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
151  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
152 
153  $a_tpl->setCurrentBlock("prop_generic");
154  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
155  $a_tpl->parseCurrentBlock();
156  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
global $DIC
Definition: feed.php:28
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static getFileSizeInfo()
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setValue()

ilAssMultipleChoiceCorrectionsInputGUI::setValue (   $a_value)

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

References $index, and ilTextInputGUI\$value.

33  : void
34  {
35  if (is_array($a_value)) {
36  if (is_array($a_value['points']) && is_array($a_value['points_unchecked'])) {
37  foreach ($this->values as $index => $value) {
38  $this->values[$index]->setPoints($a_value['points'][$index]);
39  $this->values[$index]->setPointsUnchecked($a_value['points_unchecked'][$index]);
40  }
41  }
42  }
43  }
$index
Definition: metadata.php:145

Field Documentation

◆ $qstObject

ilAssMultipleChoiceCorrectionsInputGUI::$qstObject
protected

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