ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssSingleChoiceCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssSingleChoiceCorrectionsInputGUI:
+ Collaboration diagram for ilAssSingleChoiceCorrectionsInputGUI:

Public Member Functions

 setValue ($a_value)
 
 checkInput ()
 
 insert (ilTemplate $a_tpl)
 
- 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()

ilAssSingleChoiceCorrectionsInputGUI::checkInput ( )

Definition at line 44 of file class.ilAssSingleChoiceCorrectionsInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), and ilLanguage\txt().

44  : bool
45  {
46  global $DIC;
47  $lng = $DIC['lng'];
48 
49  $foundvalues = $_POST[$this->getPostVar()];
50  if (is_array($foundvalues)) {
51  // check points
52  $max = 0;
53  if (is_array($foundvalues['points'])) {
54  foreach ($foundvalues['points'] as $points) {
55  $points = str_replace(',', '.', $points);
56  if ($points > $max) {
57  $max = $points;
58  }
59  if (((strlen($points)) == 0) || (!is_numeric($points))) {
60  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
61  return false;
62  }
63  }
64  }
65  if ($max == 0) {
66  $this->setAlert($lng->txt("enter_enough_positive_points"));
67  return false;
68  }
69  } else {
70  $this->setAlert($lng->txt("msg_input_is_required"));
71  return false;
72  }
73 
74  return $this->checkSubItemsInput();
75  }
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()

ilAssSingleChoiceCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 77 of file class.ilAssSingleChoiceCorrectionsInputGUI.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().

77  : void
78  {
79  global $DIC; /* @var ILIAS\DI\Container $DIC */
80  $lng = $DIC->language();
81 
82  $tpl = new ilTemplate("tpl.prop_singlechoicecorrection_input.html", true, true, "Modules/TestQuestionPool");
83 
84  $i = 0;
85 
86  if ($this->values === null) {
87  $this->values = $this->value;
88  }
89 
90  foreach ($this->values as $value) {
91  if ($this->qstObject->isSingleline()) {
92  if (strlen($value->getImage())) {
93  $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
94  if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
95  if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
96  $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
97  }
98  }
99 
100  $tpl->setCurrentBlock('image');
101  $tpl->setVariable('SRC_IMAGE', $imagename);
102  $tpl->setVariable('IMAGE_NAME', $value->getImage());
103  $tpl->setVariable('ALT_IMAGE', ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext()));
104  $tpl->parseCurrentBlock();
105  } else {
106  $tpl->setCurrentBlock('image');
107  $tpl->touchBlock('image');
108  $tpl->parseCurrentBlock();
109  }
110  }
111 
112  $tpl->setCurrentBlock("answer");
113  $tpl->setVariable("ANSWER", $value->getAnswertext());
114  $tpl->parseCurrentBlock();
115 
116  $tpl->setCurrentBlock("prop_points_propval");
117  $tpl->setVariable("POINTS_POST_VAR", $this->getPostVar());
118  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value->getPoints()));
119  $tpl->parseCurrentBlock();
120 
121  $tpl->setCurrentBlock("row");
122  $tpl->parseCurrentBlock();
123  }
124 
125  if ($this->qstObject->isSingleline()) {
126  $tpl->setCurrentBlock("image_heading");
127  $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
128  $tpl->setVariable("TXT_MAX_SIZE", ilFileUtils::getFileSizeInfo());
129  $tpl->parseCurrentBlock();
130  }
131 
132  $tpl->setCurrentBlock("points_heading");
133  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
134  $tpl->parseCurrentBlock();
135 
136  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
137  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
138 
139  $a_tpl->setCurrentBlock("prop_generic");
140  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
141  $a_tpl->parseCurrentBlock();
142  }
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()

ilAssSingleChoiceCorrectionsInputGUI::setValue (   $a_value)

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

References $index, and ilTextInputGUI\$value.

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

Field Documentation

◆ $qstObject

ilAssSingleChoiceCorrectionsInputGUI::$qstObject
protected

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