ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAssMultipleChoiceCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssMultipleChoiceCorrectionsInputGUI:
+ Collaboration diagram for ilAssMultipleChoiceCorrectionsInputGUI:

Public Member Functions

 setValue ($a_value)
 Set Value. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 setValue ($a_value)
 Set Value. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilSingleChoiceWizardInputGUI
 __construct ($a_title='', $a_postvar='')
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 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...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($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...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $qstObject
 
- Protected Attributes inherited from ilSingleChoiceWizardInputGUI
const ALLOWED_PAGE_HTML_TAGS = '<em>, <strong>'
 
 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
- Protected Attributes inherited from ilTextInputGUI
 $value
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = false
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

Member Function Documentation

◆ checkInput()

ilAssMultipleChoiceCorrectionsInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilMultipleChoiceWizardInputGUI.

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

33 {
34 global $DIC;
35 $lng = $DIC['lng'];
36
37 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
38 if (is_array($_POST[$this->getPostVar()])) {
40 }
41 $foundvalues = $_POST[$this->getPostVar()];
42 if (is_array($foundvalues)) {
43 // check points
44 $max = 0;
45 if (is_array($foundvalues['points'])) {
46 foreach ($foundvalues['points'] as $points) {
47 if ($points > $max) {
48 $max = $points;
49 }
50 if (((strlen($points)) == 0) || (!is_numeric($points))) {
51 $this->setAlert($lng->txt("form_msg_numeric_value_required"));
52 return false;
53 }
54 }
55 foreach ($foundvalues['points_unchecked'] as $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 }
$_POST["username"]
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
global $DIC
Definition: goto.php:24

References $_POST, $DIC, ilFormPropertyGUI\$lng, ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

+ Here is the call graph for this function:

◆ insert()

ilAssMultipleChoiceCorrectionsInputGUI::insert (   $a_tpl)

Insert property html.

Parameters
$a_tplilTemplate

Reimplemented from ilMultipleChoiceWizardInputGUI.

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

78 {
79 global $DIC; /* @var ILIAS\DI\Container $DIC */
80 $lng = $DIC->language();
81
82 $tpl = new ilTemplate("tpl.prop_multiplechoicecorrection_input.html", true, true, "Modules/TestQuestionPool");
83
84 $i = 0;
85
86 foreach ($this->values as $value) {
87 if ($this->qstObject->isSingleline) {
88 if (strlen($value->getImage())) {
89 $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
90 if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
91 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
92 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
93 }
94 }
95
96 $tpl->setCurrentBlock('image');
97 $tpl->setVariable('SRC_IMAGE', $imagename);
98 $tpl->setVariable('IMAGE_NAME', $value->getImage());
99 $tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value->getAnswertext()));
100 $tpl->parseCurrentBlock();
101 } else {
102 $tpl->setCurrentBlock('image');
103 $tpl->touchBlock('image');
104 $tpl->parseCurrentBlock();
105 }
106 }
107
108 $tpl->setCurrentBlock("answer");
109 $tpl->setVariable("ANSWER", $value->getAnswertext());
110 $tpl->parseCurrentBlock();
111
112 $tpl->setCurrentBlock("row");
113 $tpl->setVariable("POINTS_POST_VAR", $this->getPostVar());
114 $tpl->setVariable("POINTS_ROW_NUMBER", $i);
115 $tpl->setVariable("PROPERTY_VALUE_CHECKED", ilUtil::prepareFormOutput($value->getPointsChecked()));
116 $tpl->setVariable("PROPERTY_VALUE_UNCHECKED", ilUtil::prepareFormOutput($value->getPointsUnchecked()));
117 $tpl->parseCurrentBlock();
118
119 $i++;
120 }
121
122 if ($this->qstObject->isSingleline) {
123 $tpl->setCurrentBlock("image_heading");
124 $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
125 $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
126 $tpl->parseCurrentBlock();
127 }
128
129 $tpl->setCurrentBlock("points_heading");
130 $tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('points_checked'));
131 $tpl->setVariable("POINTS_UNCHECKED_TEXT", $lng->txt('points_unchecked'));
132 $tpl->parseCurrentBlock();
133
134 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
135 $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
136
137 $a_tpl->setCurrentBlock("prop_generic");
138 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
139 $a_tpl->parseCurrentBlock();
140 }
special template class to simplify handling of ITX/PEAR
static getFileSizeInfo()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:24

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilUtil\getFileSizeInfo(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ setValue()

ilAssMultipleChoiceCorrectionsInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilMultipleChoiceWizardInputGUI.

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

21 {
22 if (is_array($a_value)) {
23 if (is_array($a_value['points']) && is_array($a_value['points_unchecked'])) {
24 foreach ($this->values as $index => $value) {
25 $this->values[$index]->setPoints($a_value['points'][$index]);
26 $this->values[$index]->setPointsUnchecked($a_value['points_unchecked'][$index]);
27 }
28 }
29 }
30 }
$index
Definition: metadata.php:128

References $index, and ilTextInputGUI\$value.

Field Documentation

◆ $qstObject

ilAssMultipleChoiceCorrectionsInputGUI::$qstObject
protected

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