ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilKprimChoiceWizardInputGUI Class Reference
+ Inheritance diagram for ilKprimChoiceWizardInputGUI:
+ Collaboration diagram for ilKprimChoiceWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setFiles ($files)
 
 getFiles ()
 
 setIgnoreMissingUploadsEnabled ($ignoreMissingUploadsEnabled)
 
 isIgnoreMissingUploadsEnabled ()
 
 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
 checkUploads ($foundvalues)
 
 collectValidFiles ()
 
- 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 ()
 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...
 

Data Fields

const CUSTOM_UPLOAD_ERR = 99
 

Protected Attributes

 $tpl
 
 $qstObject
 
- Protected Attributes inherited from ilSingleChoiceWizardInputGUI
 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ilTestLegacyFormsHelper $forms_helper
 
GlyphFactory $glyph_factory
 
ButtonFactory $button_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
 

Private Member Functions

 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 

Private Attributes

 $files
 
 $ignoreMissingUploadsEnabled
 

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

Definition at line 27 of file class.ilKprimChoiceWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilKprimChoiceWizardInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilSingleChoiceWizardInputGUI.

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

46 {
47 parent::__construct($a_title, $a_postvar);
48
49 global $DIC;
50 $lng = $DIC['lng'];
51 $tpl = $DIC['tpl'];
52
53 $this->lng = $lng;
54 $this->tpl = $tpl;
55
56 $this->files = [];
57
58 $this->ignoreMissingUploadsEnabled = false;
59 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ilFormPropertyGUI\$lng, $tpl, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilKprimChoiceWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilSingleChoiceWizardInputGUI.

Reimplemented in ilKprimChoiceCorrectionsInputGUI.

Definition at line 114 of file class.ilKprimChoiceWizardInputGUI.php.

114 : bool
115 {
116 $data = $this->raw($this->getPostVar());
117
118 if (!is_array($data)) {
119 $this->setAlert($this->lng->txt('msg_input_is_required'));
120 return false;
121 }
122
123 // check answers
124 $answers = $this->checkAnswersInput($data);
125 if (!is_array($answers)) {
126 $this->setAlert($this->lng->txt($answers));
127 return false;
128 }
129
130 // check correctness
131 $correctness = $this->forms_helper->transformArray($data, 'correctness', $this->refinery->kindlyTo()->bool());
132 if (count($answers) !== count($correctness)) {
133 $this->setAlert($this->lng->txt('msg_input_is_required'));
134 return false;
135 }
136
137 if (!$this->checkUploads($data)) {
138 return false;
139 }
140
141 return $this->checkSubItemsInput();
142 }
checkAnswersInput(array $data)
Checks the input of the answers and returns the answers as an array if the input is valid or a string...
$data
Definition: storeScorm.php:45

References $data, ilSingleChoiceWizardInputGUI\checkAnswersInput(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), checkUploads(), ilFormPropertyGUI\getPostVar(), ILIAS\Repository\lng(), ilFormPropertyGUI\raw(), ILIAS\Repository\refinery(), and ilFormPropertyGUI\setAlert().

+ Here is the call graph for this function:

◆ checkUploads()

ilKprimChoiceWizardInputGUI::checkUploads (   $foundvalues)

Definition at line 313 of file class.ilKprimChoiceWizardInputGUI.php.

313 : bool
314 {
315 if (is_array($_FILES) && count($_FILES) && $this->getSingleline()) {
316 if (!$this->hideImages) {
317 if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
318 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
319 // error handling
320 if ($error > 0) {
321 switch ($error) {
322 case UPLOAD_ERR_FORM_SIZE:
323 case UPLOAD_ERR_INI_SIZE:
324 $this->setAlert($this->lng->txt("form_msg_file_size_exceeds"));
325 return false;
326 break;
327
328 case UPLOAD_ERR_PARTIAL:
329 $this->setAlert($this->lng->txt("form_msg_file_partially_uploaded"));
330 return false;
331 break;
332
333 case UPLOAD_ERR_NO_FILE:
334 if ($this->getRequired() && !$this->isIgnoreMissingUploadsEnabled()) {
335 $has_image = isset($foundvalues['imagename'][$index]) ? true : false;
336 if (!$has_image && (!strlen($foundvalues['answer'][$index]))) {
337 $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
338 return false;
339 }
340 }
341 break;
342
343 case UPLOAD_ERR_NO_TMP_DIR:
344 $this->setAlert($this->lng->txt("form_msg_file_missing_tmp_dir"));
345 return false;
346 break;
347
348 case UPLOAD_ERR_CANT_WRITE:
349 $this->setAlert($this->lng->txt("form_msg_file_cannot_write_to_disk"));
350 return false;
351 break;
352
353 case UPLOAD_ERR_EXTENSION:
354 $this->setAlert($this->lng->txt("form_msg_file_upload_stopped_ext"));
355 return false;
356 break;
357 }
358 }
359 }
360 } else {
361 if ($this->getRequired()) {
362 $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
363 return false;
364 }
365 }
366
367 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
368 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
369 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
370 $filename_arr = pathinfo($filename);
371 if (isset($filename_arr["extension"])) {
372 $suffix = $filename_arr["extension"];
373 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
374 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
375 // check suffixes
376 if (strlen($tmpname) && is_array($this->getSuffixes())) {
377 if (!in_array(strtolower($suffix), $this->getSuffixes())) {
378 $this->setAlert($this->lng->txt("form_msg_file_wrong_file_type"));
379 return false;
380 }
381 }
382 }
383 }
384 }
385
386 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
387 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
388 if ($_FILES[$this->getPostVar()]['error']['image'][$index] > 0) {
389 continue;
390 }
391
392 $mimetype = ilObjMediaObject::getMimeType($tmpname);
393
394 if (!preg_match("/^image/", $mimetype)) {
395 $_FILES[$this->getPostVar()]['error']['image'][$index] = self::CUSTOM_UPLOAD_ERR;
396 $this->setAlert($this->lng->txt("form_msg_file_wrong_mime_type"));
397 return false;
398 }
399 }
400 }
401
402
403 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
404 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
405 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
406 $filename_arr = pathinfo($filename);
407 if (isset($filename_arr["extension"])) {
408 $suffix = $filename_arr["extension"];
409 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
410 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
411 // virus handling
412 if (strlen($tmpname)) {
414 if ($vir[0] == false) {
415 $_FILES[$this->getPostVar()]['error']['image'][$index] = self::CUSTOM_UPLOAD_ERR;
416 $this->setAlert($this->lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
417 return false;
418 }
419 }
420 }
421 }
422 }
423 }
424 }
425
426 return true;
427 }
$filename
Definition: buildRTE.php:78
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)

References $filename, ilTextInputGUI\$suffix, CUSTOM_UPLOAD_ERR, ilObjMediaObject\getMimeType(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilSingleChoiceWizardInputGUI\getSingleline(), ilSingleChoiceWizardInputGUI\getSuffixes(), isIgnoreMissingUploadsEnabled(), ILIAS\Repository\lng(), ilFormPropertyGUI\setAlert(), and ilVirusScanner\virusHandling().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupAnswerText()

ilKprimChoiceWizardInputGUI::cleanupAnswerText ( array  $answer_text,
bool  $is_rte 
)
private

sk - 12.05.2023: This is one more of those that we need, but don't want.

Deprecated:

Definition at line 450 of file class.ilKprimChoiceWizardInputGUI.php.

450 : array
451 {
452 if (!is_array($answer_text)) {
453 return [];
454 }
455
456 if ($is_rte) {
458 $answer_text,
459 false,
461 );
462 }
463
465 $answer_text,
466 true,
468 );
469 }
const ALLOWED_PLAIN_TEXT_TAGS
sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI.
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
static _getUsedHTMLTagsAsString(string $module='')

References ilRTESettings\_getUsedHTMLTagsAsString(), assQuestionGUI\ALLOWED_PLAIN_TEXT_TAGS, and ilArrayUtil\stripSlashesRecursive().

Referenced by setValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectValidFiles()

ilKprimChoiceWizardInputGUI::collectValidFiles ( )

Definition at line 429 of file class.ilKprimChoiceWizardInputGUI.php.

429 : void
430 {
431 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $err) {
432 if ($err > 0) {
433 continue;
434 }
435
436 $this->files[$index] = [
437 'position' => $index,
438 'tmp_name' => $_FILES[$this->getPostVar()]['tmp_name']['image'][$index],
439 'name' => $_FILES[$this->getPostVar()]['name']['image'][$index],
440 'type' => $_FILES[$this->getPostVar()]['type']['image'][$index],
441 'size' => $_FILES[$this->getPostVar()]['size']['image'][$index]
442 ];
443 }
444 }

References ilFormPropertyGUI\getPostVar().

+ Here is the call graph for this function:

◆ getFiles()

ilKprimChoiceWizardInputGUI::getFiles ( )

Definition at line 66 of file class.ilKprimChoiceWizardInputGUI.php.

References $files.

◆ insert()

ilKprimChoiceWizardInputGUI::insert ( ilTemplate  $a_tpl)
Parameters
$a_tplilTemplate

Reimplemented from ilSingleChoiceWizardInputGUI.

Definition at line 147 of file class.ilKprimChoiceWizardInputGUI.php.

147 : void
148 {
149 $tpl = new ilTemplate("tpl.prop_kprimchoicewizardinput.html", true, true, "components/ILIAS/TestQuestionPool");
150
151 foreach ($this->values as $value) {
152 if ($this->getSingleline()) {
153 if (!$this->hideImages) {
154 if ($value->getImageFile() !== null
155 && $value->getImageFile() !== '') {
156 $imagename = $value->getImageWebPath();
157
158 if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
159 if (@file_exists($value->getThumbFsPath())) {
160 $imagename = $value->getThumbWebPath();
161 }
162 }
163
164 $tpl->setCurrentBlock('image');
165 $tpl->setVariable('SRC_IMAGE', $imagename);
166 $tpl->setVariable('IMAGE_NAME', $value->getImageFile());
167 $tpl->setVariable(
168 'ALT_IMAGE',
170 );
171 $tpl->setVariable("TXT_DELETE_EXISTING", $this->lng->txt("delete_existing_file"));
172 $tpl->setVariable("IMAGE_ROW_NUMBER", $value->getPosition());
173 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
174 $tpl->parseCurrentBlock();
175 }
176 $tpl->setCurrentBlock('addimage');
177 $tpl->setVariable("IMAGE_BROWSE", $this->lng->txt('select_file'));
178 $tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][{$value->getPosition()}]");
179 $tpl->setVariable('MAX_SIZE_WARNING', $this->lng->txt('form_msg_file_size_exceeds'));
180 $tpl->setVariable('MAX_SIZE', $this->upload_limit->getPhpUploadLimitInBytes());
181 $tpl->setVariable("IMAGE_SUBMIT", $this->lng->txt("upload"));
182 $tpl->setVariable("IMAGE_ROW_NUMBER", $value->getPosition());
183 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
184 $tpl->parseCurrentBlock();
185 }
186
187 $tpl->setCurrentBlock("prop_text_propval");
188 $tpl->setVariable(
189 "PROPERTY_VALUE",
190 ilLegacyFormElementsUtil::prepareFormOutput(htmlspecialchars_decode((string) $value->getAnswertext()))
191 );
192 $tpl->parseCurrentBlock();
193
194 $tpl->setCurrentBlock('singleline');
195 $tpl->setVariable("SIZE", $this->getSize());
196 $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
197 $tpl->setVariable("SINGLELINE_ROW_NUMBER", $value->getPosition());
198 $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
199 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
200 if ($this->getDisabled()) {
201 $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
202 }
203 $tpl->parseCurrentBlock();
204 } elseif (!$this->getSingleline()) {
205 $tpl->setCurrentBlock('multiline');
206 $tpl->setVariable(
207 "PROPERTY_VALUE",
208 ilLegacyFormElementsUtil::prepareFormOutput((string) $value->getAnswertext())
209 );
210 $tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
211 $tpl->setVariable("MULTILINE_ROW_NUMBER", $value->getPosition());
212 $tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
213 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
214 if ($this->getDisabled()) {
215 $tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
216 }
217 $tpl->parseCurrentBlock();
218 }
219 if ($this->getAllowMove()) {
220 $tpl->setCurrentBlock("move");
221 $tpl->setVariable("UP_ID", "up_{$this->getPostVar()}[{$value->getPosition()}]");
222 $tpl->setVariable("DOWN_ID", "down_{$this->getPostVar()}[{$value->getPosition()}]");
223 $tpl->setVariable("UP_BUTTON", $this->renderer->render(
224 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->up())
225 ));
226 $tpl->setVariable("DOWN_BUTTON", $this->renderer->render(
227 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->down())
228 ));
229 $tpl->parseCurrentBlock();
230 }
231
232 $tpl->setCurrentBlock("row");
233
234 $tpl->setVariable("POST_VAR", $this->getPostVar());
235 $tpl->setVariable("ROW_NUMBER", $value->getPosition());
236 $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
237
238 $tpl->setVariable(
239 "CORRECTNESS_TRUE_ID",
240 $this->getPostVar() . "[correctness][{$value->getPosition()}][true]"
241 );
242 $tpl->setVariable(
243 "CORRECTNESS_FALSE_ID",
244 $this->getPostVar() . "[correctness][{$value->getPosition()}][false]"
245 );
246 $tpl->setVariable("CORRECTNESS_TRUE_VALUE", 1);
247 $tpl->setVariable("CORRECTNESS_FALSE_VALUE", 0);
248
249 if ($value->getCorrectness() !== null) {
250 if ($value->getCorrectness()) {
251 $tpl->setVariable('CORRECTNESS_TRUE_SELECTED', ' checked="checked"');
252 } else {
253 $tpl->setVariable('CORRECTNESS_FALSE_SELECTED', ' checked="checked"');
254 }
255 }
256
257 if ($this->getDisabled()) {
258 $tpl->setVariable("DISABLED_CORRECTNESS", " disabled=\"disabled\"");
259 }
260
261 $tpl->parseCurrentBlock();
262 }
263
264 if ($this->getSingleline()) {
265 if (!$this->hideImages) {
266 if (is_array($this->getSuffixes())) {
267 $suff_str = $delim = "";
268 foreach ($this->getSuffixes() as $suffix) {
269 $suff_str .= $delim . "." . $suffix;
270 $delim = ", ";
271 }
272 $tpl->setCurrentBlock('allowed_image_suffixes');
273 $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $this->lng->txt("file_allowed_suffixes") . " " . $suff_str);
274 $tpl->parseCurrentBlock();
275 }
276
277 $tpl->setCurrentBlock("image_heading");
278 $tpl->setVariable("ANSWER_IMAGE", $this->lng->txt('answer_image'));
279 $tpl->setVariable("TXT_MAX_SIZE", ilFileUtils::getFileSizeInfo());
280 $tpl->parseCurrentBlock();
281 }
282 }
283
284 foreach ($this->qstObject->getValidOptionLabels() as $optionLabel) {
285 if ($this->qstObject->isCustomOptionLabel($optionLabel)) {
286 continue;
287 }
288
289 $tpl->setCurrentBlock('option_label_translations');
290 $tpl->setVariable('OPTION_LABEL', $optionLabel);
291 $tpl->setVariable('TRANSLATION_TRUE', $this->qstObject->getTrueOptionLabelTranslation($this->lng, $optionLabel));
292 $tpl->setVariable('TRANSLATION_FALSE', $this->qstObject->getFalseOptionLabelTranslation($this->lng, $optionLabel));
293 $tpl->parseCurrentBlock();
294 }
295
296 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
297 $tpl->setVariable("DELETE_IMAGE_HEADER", $this->lng->txt('delete_image_header'));
298 $tpl->setVariable("DELETE_IMAGE_QUESTION", $this->lng->txt('delete_image_question'));
299 $tpl->setVariable("ANSWER_TEXT", $this->lng->txt('answer_text'));
300
301 $tpl->setVariable("OPTIONS_TEXT", $this->lng->txt('options'));
302
303 $a_tpl->setCurrentBlock("prop_generic");
304 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
305 $a_tpl->parseCurrentBlock();
306
307 $this->tpl->addJavascript("assets/js/answerwizardinput.js");
308 $this->tpl->addJavascript("assets/js/kprimchoicewizard.js");
309 $this->tpl->addJavascript('assets/js/ilAssKprimChoice.js');
310 }
renderer()
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static getFileSizeInfo()
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilSingleChoiceWizardInputGUI\getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFileUtils\getFileSizeInfo(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), ilTextInputGUI\getSize(), ilSingleChoiceWizardInputGUI\getSuffixes(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), renderer(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ isIgnoreMissingUploadsEnabled()

ilKprimChoiceWizardInputGUI::isIgnoreMissingUploadsEnabled ( )

Definition at line 76 of file class.ilKprimChoiceWizardInputGUI.php.

References $ignoreMissingUploadsEnabled.

Referenced by checkUploads().

+ Here is the caller graph for this function:

◆ setFiles()

ilKprimChoiceWizardInputGUI::setFiles (   $files)

Definition at line 61 of file class.ilKprimChoiceWizardInputGUI.php.

61 : void
62 {
63 $this->files = $files;
64 }

References $files.

◆ setIgnoreMissingUploadsEnabled()

ilKprimChoiceWizardInputGUI::setIgnoreMissingUploadsEnabled (   $ignoreMissingUploadsEnabled)

Definition at line 71 of file class.ilKprimChoiceWizardInputGUI.php.

71 : void
72 {
73 $this->ignoreMissingUploadsEnabled = $ignoreMissingUploadsEnabled;
74 }

References $ignoreMissingUploadsEnabled.

◆ setValue()

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

Reimplemented from ilSingleChoiceWizardInputGUI.

Reimplemented in ilKprimChoiceCorrectionsInputGUI.

Definition at line 81 of file class.ilKprimChoiceWizardInputGUI.php.

81 : void
82 {
83 $this->values = [];
84
85 $answer_type = $this->str('answer_type');
86 $a_value = $this->cleanupAnswerText($a_value, $answer_type === 'multiLine');
87 $answers = $this->forms_helper->transformArray($a_value, 'answer', $this->refinery->kindlyTo()->string());
88 $imagename = $this->forms_helper->transformArray($a_value, 'imagename', $this->refinery->kindlyTo()->string());
89 $correctness = $this->forms_helper->transformArray($a_value, 'correctness', $this->refinery->kindlyTo()->bool());
90
91 foreach ($answers as $index => $value) {
92 $answer = new ilAssKprimChoiceAnswer();
93
94 $answer->setPosition($index);
95 $answer->setAnswertext($value);
96 $answer->setThumbPrefix($this->qstObject->getThumbPrefix());
97 $answer->setImageFsDir($this->qstObject->getImagePath());
98 $answer->setImageWebDir($this->qstObject->getImagePathWeb());
99
100 if ($this->forms_helper->inArray($imagename, $index)) {
101 $answer->setImageFile($imagename[$index]);
102 }
103
104 if (isset($correctness[$index])) {
105 $answer->setCorrectness($correctness[$index]);
106 }
107
108 $this->values[] = $answer;
109 }
110
111 #vd($this->values);
112 }
cleanupAnswerText(array $answer_text, bool $is_rte)
sk - 12.05.2023: This is one more of those that we need, but don't want.

References ilTextInputGUI\$value, cleanupAnswerText(), ILIAS\Repository\refinery(), and ilFormPropertyGUI\str().

+ Here is the call graph for this function:

Field Documentation

◆ $files

ilKprimChoiceWizardInputGUI::$files
private

Definition at line 41 of file class.ilKprimChoiceWizardInputGUI.php.

Referenced by getFiles(), and setFiles().

◆ $ignoreMissingUploadsEnabled

ilKprimChoiceWizardInputGUI::$ignoreMissingUploadsEnabled
private

◆ $qstObject

ilKprimChoiceWizardInputGUI::$qstObject
protected

Definition at line 39 of file class.ilKprimChoiceWizardInputGUI.php.

◆ $tpl

ilKprimChoiceWizardInputGUI::$tpl
protected

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

Referenced by __construct(), and insert().

◆ CUSTOM_UPLOAD_ERR

const ilKprimChoiceWizardInputGUI::CUSTOM_UPLOAD_ERR = 99

Definition at line 29 of file class.ilKprimChoiceWizardInputGUI.php.

Referenced by checkUploads().


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