ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilKprimChoiceWizardInputGUI Class Reference
+ Inheritance diagram for ilKprimChoiceWizardInputGUI:
+ Collaboration diagram for ilKprimChoiceWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 
 setFiles ($files)
 
 getFiles ()
 
 setIgnoreMissingUploadsEnabled ($ignoreMissingUploadsEnabled)
 
 isIgnoreMissingUploadsEnabled ()
 
 setValue ($a_value)
 
 checkInput ()
 
 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 ()
 
 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...
 

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
 
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 25 of file class.ilKprimChoiceWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

44  {
45  parent::__construct($a_title, $a_postvar);
46 
47  global $DIC;
48  $lng = $DIC['lng'];
49  $tpl = $DIC['tpl'];
50 
51  $this->lng = $lng;
52  $this->tpl = $tpl;
53 
54  $this->files = [];
55 
56  $this->ignoreMissingUploadsEnabled = false;
57  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilKprimChoiceWizardInputGUI::checkInput ( )

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

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

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

◆ checkUploads()

ilKprimChoiceWizardInputGUI::checkUploads (   $foundvalues)

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

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

Referenced by checkInput().

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

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

Referenced by setValue().

447  : array
448  {
449  if (!is_array($answer_text)) {
450  return [];
451  }
452 
453  if ($is_rte) {
455  $answer_text,
456  false,
458  );
459  }
460 
462  $answer_text,
463  true,
465  );
466  }
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
const ALLOWED_PLAIN_TEXT_TAGS
sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectValidFiles()

ilKprimChoiceWizardInputGUI::collectValidFiles ( )

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

References ilFormPropertyGUI\getPostVar().

426  : void
427  {
428  foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $err) {
429  if ($err > 0) {
430  continue;
431  }
432 
433  $this->files[$index] = [
434  'position' => $index,
435  'tmp_name' => $_FILES[$this->getPostVar()]['tmp_name']['image'][$index],
436  'name' => $_FILES[$this->getPostVar()]['name']['image'][$index],
437  'type' => $_FILES[$this->getPostVar()]['type']['image'][$index],
438  'size' => $_FILES[$this->getPostVar()]['size']['image'][$index]
439  ];
440  }
441  }
+ Here is the call graph for this function:

◆ getFiles()

ilKprimChoiceWizardInputGUI::getFiles ( )

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

References $files.

64  : array
65  {
66  return $this->files;
67  }

◆ insert()

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

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

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(), null, ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), renderer(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by ilKprimChoiceCorrectionsInputGUI\checkInput().

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

◆ isIgnoreMissingUploadsEnabled()

ilKprimChoiceWizardInputGUI::isIgnoreMissingUploadsEnabled ( )

Definition at line 74 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 59 of file class.ilKprimChoiceWizardInputGUI.php.

References $files.

59  : void
60  {
61  $this->files = $files;
62  }

◆ setIgnoreMissingUploadsEnabled()

ilKprimChoiceWizardInputGUI::setIgnoreMissingUploadsEnabled (   $ignoreMissingUploadsEnabled)

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

References $ignoreMissingUploadsEnabled.

69  : void
70  {
71  $this->ignoreMissingUploadsEnabled = $ignoreMissingUploadsEnabled;
72  }

◆ setValue()

ilKprimChoiceWizardInputGUI::setValue (   $a_value)

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

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

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

Field Documentation

◆ $files

ilKprimChoiceWizardInputGUI::$files
private

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

Referenced by getFiles(), and setFiles().

◆ $ignoreMissingUploadsEnabled

ilKprimChoiceWizardInputGUI::$ignoreMissingUploadsEnabled
private

◆ $qstObject

ilKprimChoiceWizardInputGUI::$qstObject
protected

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

◆ $tpl

ilKprimChoiceWizardInputGUI::$tpl
protected

◆ CUSTOM_UPLOAD_ERR

const ilKprimChoiceWizardInputGUI::CUSTOM_UPLOAD_ERR = 99

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


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