ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilAssMatchingPairCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssMatchingPairCorrectionsInputGUI:
+ Collaboration diagram for ilAssMatchingPairCorrectionsInputGUI:

Public Member Functions

 getPairs ()
 
 setThumbsWebPathWithPrefix (string $path_including_prefix)
 
 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilMatchingPairWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 
 setTerms ($a_terms)
 Set terms. More...
 
 setDefinitions ($a_definitions)
 Set definitions. More...
 
 setPairs ($a_pairs)
 Set pairs. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
- 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 ()
 Check input, strip slashes etc. More...
 
 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)
 Get item by post var. More...
 
- 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
 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...
 

Private Attributes

string $path_including_prefix
 

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
 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)
 
- Protected Attributes inherited from ilMatchingPairWizardInputGUI
 $pairs = []
 
 $allowMove = false
 
 $terms = []
 
 $definitions = []
 
ilTestLegacyFormsHelper $forms_helper
 
GlyphFactory $glyph_factory
 
Renderer $renderer
 
- 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
 

Detailed Description

Member Function Documentation

◆ checkInput()

ilAssMatchingPairCorrectionsInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilMatchingPairWizardInputGUI.

Definition at line 51 of file class.ilAssMatchingPairCorrectionsInputGUI.php.

51 : bool
52 {
53 $data = $this->raw($this->getPostVar());
54 $result = $this->forms_helper->checkPointsInput($data, $this->getRequired());
55
56 if (!is_array($result)) {
57 $this->setAlert($this->lng->txt($result));
58 return false;
59 }
60
61 if (max($result) <= 0) {
62 $this->setAlert($this->lng->txt('enter_enough_positive_points'));
63 return false;
64 }
65
66 return $this->checkSubItemsInput();
67 }

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

+ Here is the call graph for this function:

◆ getPairs()

ilAssMatchingPairCorrectionsInputGUI::getPairs ( )

◆ insert()

ilAssMatchingPairCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Reimplemented from ilMatchingPairWizardInputGUI.

Definition at line 69 of file class.ilAssMatchingPairCorrectionsInputGUI.php.

69 : void
70 {
71 $tpl = new ilTemplate('tpl.prop_matchingpaircorrection_input.html', true, true, 'components/ILIAS/TestQuestionPool');
72 $i = 0;
73 $term_ids = [];
74 $definition_ids = [];
75 foreach ($this->pairs as $pair) {
76 $tpl->setCurrentBlock('row');
77
78 foreach ($this->terms as $term) {
79 if ($pair->getTerm()->getIdentifier() !== $term->getIdentifier()) {
80 continue;
81 }
82 $term_ids[] = $term->getIdentifier();
83 if ($term->getText() !== '') {
84 $tpl->setVariable('TERM', ilLegacyFormElementsUtil::prepareTextareaOutput($term->getText(), true, true));
85 }
86 if ($term->getPicture() !== '') {
87 $tpl->setCurrentBlock('term_image');
88 $tpl->setVariable('THUMBNAIL_HREF', $this->path_including_prefix . $term->getPicture());
89 $tpl->setVariable('THUMB_ALT', $this->lng->txt('image'));
90 $tpl->setVariable('THUMB_TITLE', $this->lng->txt('image'));
91 $tpl->parseCurrentBlock();
92 $tpl->setCurrentBlock('row');
93 }
94 break;
95 }
96 foreach ($this->definitions as $definition) {
97 if ($pair->getDefinition()->getIdentifier() !== $definition->getIdentifier()) {
98 continue;
99 }
100 $definition_ids[] = $definition->getIdentifier();
101 if ($definition->getText() !== '') {
102 $tpl->setVariable('DEFINITION', ilLegacyFormElementsUtil::prepareTextareaOutput($definition->getText(), true, true));
103 }
104 if ($definition->getPicture() !== '') {
105 $tpl->setCurrentBlock('definition_image');
106 $tpl->setVariable('THUMBNAIL_HREF', $this->path_including_prefix . $definition->getPicture());
107 $tpl->setVariable('THUMB_ALT', $this->lng->txt('image'));
108 $tpl->setVariable('THUMB_TITLE', $this->lng->txt('image'));
109 $tpl->parseCurrentBlock();
110 $tpl->setCurrentBlock('row');
111 }
112 break;
113 }
114
115 $tpl->setVariable('POINTS_VALUE', $pair->getPoints());
116 $tpl->setVariable('ROW_NUMBER', $i);
117
118 $tpl->setVariable('ID', $this->getPostVar() . "[$i]");
119 $tpl->setVariable('POST_VAR', $this->getPostVar());
120
121 $tpl->parseCurrentBlock();
122
123 $i++;
124 }
125
126 $tpl->setCurrentBlock('term_ids');
127 $tpl->setVariable('POST_VAR', $this->getPostVar());
128 $tpl->setVariable('TERM_IDS', join(',', $term_ids));
129 $tpl->parseCurrentBlock();
130
131 $tpl->setCurrentBlock('definition_ids');
132 $tpl->setVariable('POST_VAR', $this->getPostVar());
133 $tpl->setVariable('DEFINITION_IDS', join(',', $definition_ids));
134 $tpl->parseCurrentBlock();
135
136 $tpl->setVariable('ELEMENT_ID', $this->getPostVar());
137 $tpl->setVariable('TEXT_POINTS', $this->lng->txt('points'));
138 $tpl->setVariable('TEXT_DEFINITION', $this->lng->txt('definition'));
139 $tpl->setVariable('TEXT_TERM', $this->lng->txt('term'));
140 $tpl->setVariable('TEXT_ACTIONS', $this->lng->txt('actions'));
141
142 $a_tpl->setCurrentBlock('prop_generic');
143 $a_tpl->setVariable('PROP_GENERIC', $tpl->get());
144 $a_tpl->parseCurrentBlock();
145 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilFormPropertyGUI\getPostVar(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareTextareaOutput(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ setThumbsWebPathWithPrefix()

ilAssMatchingPairCorrectionsInputGUI::setThumbsWebPathWithPrefix ( string  $path_including_prefix)

Definition at line 36 of file class.ilAssMatchingPairCorrectionsInputGUI.php.

36 : void
37 {
38 $this->path_including_prefix = $path_including_prefix;
39 }

References $path_including_prefix.

◆ setValue()

ilAssMatchingPairCorrectionsInputGUI::setValue (   $a_value)
Parameters
string | array$a_value

Reimplemented from ilMatchingPairWizardInputGUI.

Definition at line 40 of file class.ilAssMatchingPairCorrectionsInputGUI.php.

40 : void
41 {
42 foreach ($this->forms_helper->transformPoints($a_value) as $index => $value) {
43 if ($value === null) {
44 return;
45 }
46
47 $this->pairs[$index] = $this->pairs[$index]->withPoints($value);
48 }
49 }

References ilTextInputGUI\$value.

Field Documentation

◆ $path_including_prefix

string ilAssMatchingPairCorrectionsInputGUI::$path_including_prefix
private

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