ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSingleChoiceWizardInputGUI Class Reference

This class represents a single choice wizard property in a property form. More...

+ Inheritance diagram for ilSingleChoiceWizardInputGUI:
+ Collaboration diagram for ilSingleChoiceWizardInputGUI:

Public Member Functions

 __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

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

This class represents a single choice wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 13 of file class.ilSingleChoiceWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSingleChoiceWizardInputGUI::__construct (   $a_title = '',
  $a_postvar = '' 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

Reimplemented in ilKprimChoiceWizardInputGUI.

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

33 {
34 parent::__construct($a_title, $a_postvar);
35 $this->setSuffixes(['jpg', 'jpeg', 'png', 'gif']);
36 $this->setSize('25');
37 $this->validationRegexp = '';
38 }
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setSize($a_size)
Set Size.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), ilTextInputGUI\setSize(), and setSuffixes().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilSingleChoiceWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilKprimChoiceWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, ilAssSingleChoiceCorrectionsInputGUI, and ilKprimChoiceCorrectionsInputGUI.

Definition at line 184 of file class.ilSingleChoiceWizardInputGUI.php.

185 {
186 global $DIC;
187 $lng = $DIC['lng'];
188
189 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
190
191 if (is_array($_POST[$this->getPostVar()]) && $_POST["types"] == 1) {
193 $_POST[$this->getPostVar()],
194 false,
196 );
197 } elseif (is_array($_POST[$this->getPostVar()]) && $_POST["types"] == 0) {
199 $_POST[$this->getPostVar()],
200 true,
202 );
203 }
204
205 $foundvalues = $_POST[$this->getPostVar()];
206 if (is_array($foundvalues)) {
207 // check answers
208 if (is_array($foundvalues['answer'])) {
209 foreach ($foundvalues['answer'] as $aidx => $answervalue) {
210 if (((strlen($answervalue)) == 0) && (!isset($foundvalues['imagename'][$aidx]) || strlen($foundvalues['imagename'][$aidx]) == 0)) {
211 $this->setAlert($lng->txt("msg_input_is_required"));
212 return false;
213 }
214 }
215 }
216 // check points
217 $max = 0;
218 if (is_array($foundvalues['points'])) {
219 foreach ($foundvalues['points'] as $points) {
220 if ($points > $max) {
221 $max = $points;
222 }
223 if (((strlen($points)) == 0) || (!is_numeric($points))) {
224 $this->setAlert($lng->txt("form_msg_numeric_value_required"));
225 return false;
226 }
227 }
228 }
229 if ($max == 0) {
230 $this->setAlert($lng->txt("enter_enough_positive_points"));
231 return false;
232 }
233
234 if (is_array($_FILES) && count($_FILES) && $this->getSingleline() && (!$this->hideImages)) {
235 if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
236 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
237 // error handling
238 if ($error > 0) {
239 switch ($error) {
240 case UPLOAD_ERR_INI_SIZE:
241 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
242 return false;
243 break;
244
245 case UPLOAD_ERR_FORM_SIZE:
246 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
247 return false;
248 break;
249
250 case UPLOAD_ERR_PARTIAL:
251 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
252 return false;
253 break;
254
255 case UPLOAD_ERR_NO_FILE:
256 if ($this->getRequired()) {
257 if ((!strlen($foundvalues['imagename'][$index])) && (!strlen($foundvalues['answer'][$index]))) {
258 $this->setAlert($lng->txt("form_msg_file_no_upload"));
259 return false;
260 }
261 }
262 break;
263
264 case UPLOAD_ERR_NO_TMP_DIR:
265 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
266 return false;
267 break;
268
269 case UPLOAD_ERR_CANT_WRITE:
270 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
271 return false;
272 break;
273
274 case UPLOAD_ERR_EXTENSION:
275 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
276 return false;
277 break;
278 }
279 }
280 }
281 } else {
282 if ($this->getRequired()) {
283 $this->setAlert($lng->txt("form_msg_file_no_upload"));
284 return false;
285 }
286 }
287
288 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
289 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
290 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
291 $filename_arr = pathinfo($filename);
292 $suffix = $filename_arr["extension"];
293 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
294 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
295 // check suffixes
296 if (strlen($tmpname) && is_array($this->getSuffixes())) {
297 if (!in_array(strtolower($suffix), $this->getSuffixes())) {
298 $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
299 return false;
300 }
301 }
302 }
303 }
304
305 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
306 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
307 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
308 $filename_arr = pathinfo($filename);
309 $suffix = $filename_arr["extension"];
310 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
311 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
312 // virus handling
313 if (strlen($tmpname)) {
314 $vir = ilUtil::virusHandling($tmpname, $filename);
315 if ($vir[0] == false) {
316 $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
317 return false;
318 }
319 }
320 }
321 }
322 }
323 } else {
324 $this->setAlert($lng->txt("msg_input_is_required"));
325 return false;
326 }
327
328 return $this->checkSubItemsInput();
329 }
$filename
Definition: buildRTE.php:89
$_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.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
global $DIC
Definition: goto.php:24
$index
Definition: metadata.php:128

References $_POST, $DIC, $filename, $index, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), ALLOWED_PAGE_HTML_TAGS, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSingleline(), getSuffixes(), ilFormPropertyGUI\setAlert(), ilUtil\stripSlashesRecursive(), and ilUtil\virusHandling().

+ Here is the call graph for this function:

◆ getAllowMove()

ilSingleChoiceWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 174 of file class.ilSingleChoiceWizardInputGUI.php.

References $allowMove.

Referenced by ilMultipleChoiceWizardInputGUI\insert(), and insert().

+ Here is the caller graph for this function:

◆ getQuestionObject()

ilSingleChoiceWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

Definition at line 154 of file class.ilSingleChoiceWizardInputGUI.php.

References $qstObject.

◆ getShowPoints()

ilSingleChoiceWizardInputGUI::getShowPoints ( )

Definition at line 94 of file class.ilSingleChoiceWizardInputGUI.php.

References $showPoints.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getSingleline()

◆ getSuffixes()

ilSingleChoiceWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

Definition at line 84 of file class.ilSingleChoiceWizardInputGUI.php.

References $suffixes.

Referenced by ilMultipleChoiceWizardInputGUI\checkInput(), checkInput(), ilKprimChoiceWizardInputGUI\checkUploads(), ilMultipleChoiceWizardInputGUI\insert(), and insert().

+ Here is the caller graph for this function:

◆ getValues()

ilSingleChoiceWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

◆ insert()

ilSingleChoiceWizardInputGUI::insert (   $a_tpl)
Parameters
$a_tplilTemplate

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, and ilAssSingleChoiceCorrectionsInputGUI.

Definition at line 334 of file class.ilSingleChoiceWizardInputGUI.php.

335 {
336 global $DIC;
337 $lng = $DIC['lng'];
338
339 $tpl = new ilTemplate("tpl.prop_singlechoicewizardinput.html", true, true, "Modules/TestQuestionPool");
340 $i = 0;
341 foreach ($this->values as $value) {
342 if ($this->getSingleline()) {
343 if (!$this->hideImages) {
344 if (strlen($value->getImage())) {
345 $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
346 if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
347 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
348 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
349 }
350 }
351 $tpl->setCurrentBlock('image');
352 $tpl->setVariable('SRC_IMAGE', $imagename);
353 $tpl->setVariable('IMAGE_NAME', $value->getImage());
354 $tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value->getAnswertext()));
355 $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
356 $tpl->setVariable("IMAGE_ROW_NUMBER", $i);
357 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
358 $tpl->parseCurrentBlock();
359 }
360 $tpl->setCurrentBlock('addimage');
361 $tpl->setVariable("IMAGE_BROWSE", $lng->txt('select_file'));
362 $tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][$i]");
363 $tpl->setVariable("IMAGE_SUBMIT", $lng->txt("upload"));
364 $tpl->setVariable("IMAGE_ROW_NUMBER", $i);
365 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
366 $tpl->parseCurrentBlock();
367 }
368
369 if (is_object($value)) {
370 $tpl->setCurrentBlock("prop_text_propval");
371 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
372 $tpl->parseCurrentBlock();
373 if ($this->getShowPoints()) {
374 $tpl->setCurrentBlock("prop_points_propval");
375 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
376 $tpl->parseCurrentBlock();
377 }
378 $tpl->setCurrentBlock("prop_answer_id_propval");
379 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getId()));
380 $tpl->parseCurrentBlock();
381 }
382 $tpl->setCurrentBlock('singleline');
383 $tpl->setVariable("SIZE", $this->getSize());
384 $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
385 $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
386 $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
387 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
388 if ($this->getDisabled()) {
389 $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
390 }
391 $tpl->parseCurrentBlock();
392 } elseif (!$this->getSingleline()) {
393 if (is_object($value)) {
394 if ($this->getShowPoints()) {
395 $tpl->setCurrentBlock("prop_points_propval");
396 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
397 $tpl->parseCurrentBlock();
398 }
399 $tpl->setCurrentBlock("prop_answer_id_propval");
400 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getId()));
401 $tpl->parseCurrentBlock();
402 }
403 $tpl->setCurrentBlock('multiline');
404 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
405 $tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][$i]");
406 $tpl->setVariable("MULTILINE_ROW_NUMBER", $i);
407 $tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
408 if ($this->getDisabled()) {
409 $tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
410 }
411 $tpl->parseCurrentBlock();
412 }
413 if ($this->getAllowMove()) {
414 $tpl->setCurrentBlock("move");
415 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
416 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
417 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
418 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
419 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
420 $tpl->parseCurrentBlock();
421 }
422 if ($this->getShowPoints()) {
423 $tpl->setCurrentBlock("points");
424 $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
425 $tpl->setVariable("POINTS_POST_VAR", $this->getPostVar());
426 $tpl->setVariable("POINTS_ROW_NUMBER", $i);
427 $tpl->parseCurrentBlock();
428 }
429 $tpl->setCurrentBlock("row");
430 $tpl->setVariable("POST_VAR", $this->getPostVar());
431 $tpl->setVariable("ROW_NUMBER", $i);
432 $tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
433 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
434 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
435 if ($this->getDisabled()) {
436 $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
437 }
438 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
439 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
440 $tpl->parseCurrentBlock();
441 $i++;
442 }
443
444 if ($this->getSingleline()) {
445 if (!$this->hideImages) {
446 if (is_array($this->getSuffixes())) {
447 $suff_str = $delim = "";
448 foreach ($this->getSuffixes() as $suffix) {
449 $suff_str .= $delim . "." . $suffix;
450 $delim = ", ";
451 }
452 $tpl->setCurrentBlock('allowed_image_suffixes');
453 $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
454 $tpl->parseCurrentBlock();
455 }
456 $tpl->setCurrentBlock("image_heading");
457 $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
458 $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
459 $tpl->parseCurrentBlock();
460 }
461 }
462
463 if ($this->getShowPoints()) {
464 $tpl->setCurrentBlock("points_heading");
465 $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
466 $tpl->parseCurrentBlock();
467 }
468
469 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
470 $tpl->setVariable("TEXT_YES", $lng->txt('yes'));
471 $tpl->setVariable("TEXT_NO", $lng->txt('no'));
472 $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
473 $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
474 $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
475 $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
476
477 $a_tpl->setCurrentBlock("prop_generic");
478 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
479 $a_tpl->parseCurrentBlock();
480
481 global $DIC;
482 $tpl = $DIC['tpl'];
483 $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
484 $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/singlechoicewizard.js");
485 }
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
getMaxLength()
Get Max Length.
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, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilUtil\getFileSizeInfo(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), getShowPoints(), getSingleline(), ilTextInputGUI\getSize(), getSuffixes(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, and ilGlyphGUI\UP.

+ Here is the call graph for this function:

◆ setAllowMove()

ilSingleChoiceWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 164 of file class.ilSingleChoiceWizardInputGUI.php.

165 {
166 $this->allowMove = $a_allow_move;
167 }

◆ setHideImages()

ilSingleChoiceWizardInputGUI::setHideImages (   $a_hide)

Set hide images.

Parameters
array$a_hideHide images

Definition at line 74 of file class.ilSingleChoiceWizardInputGUI.php.

75 {
76 $this->hideImages = $a_hide;
77 }

◆ setQuestionObject()

ilSingleChoiceWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

Definition at line 144 of file class.ilSingleChoiceWizardInputGUI.php.

145 {
146 $this->qstObject = &$a_value;
147 }

◆ setShowPoints()

ilSingleChoiceWizardInputGUI::setShowPoints (   $a_value)

Definition at line 89 of file class.ilSingleChoiceWizardInputGUI.php.

90 {
91 $this->showPoints = $a_value;
92 }

◆ setSingleline()

ilSingleChoiceWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

Definition at line 124 of file class.ilSingleChoiceWizardInputGUI.php.

125 {
126 $this->singleline = $a_value;
127 }

◆ setSuffixes()

ilSingleChoiceWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

65 {
66 $this->suffixes = $a_suffixes;
67 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValue()

ilSingleChoiceWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilKprimChoiceWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, ilAssSingleChoiceCorrectionsInputGUI, and ilKprimChoiceCorrectionsInputGUI.

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

46 {
47 $this->values = [];
48 if (is_array($a_value)) {
49 if (is_array($a_value['answer'])) {
50 foreach ($a_value['answer'] as $index => $value) {
51 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
52 $answer = new ASS_AnswerBinaryStateImage($value, $a_value['points'][$index], $index, 1, $a_value['imagename'][$index], $a_value['answer_id'][$index]);
53 array_push($this->values, $answer);
54 }
55 }
56 }
57 }
Class for answers with a binary state indicator.

References $index, and ilTextInputGUI\$value.

◆ setValues()

ilSingleChoiceWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 104 of file class.ilSingleChoiceWizardInputGUI.php.

105 {
106 $this->values = $a_values;
107 }

Field Documentation

◆ $allowMove

ilSingleChoiceWizardInputGUI::$allowMove = false
protected

Definition at line 19 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getAllowMove().

◆ $hideImages

ilSingleChoiceWizardInputGUI::$hideImages = false
protected

Definition at line 24 of file class.ilSingleChoiceWizardInputGUI.php.

◆ $qstObject

ilSingleChoiceWizardInputGUI::$qstObject = null
protected

Definition at line 21 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getQuestionObject().

◆ $showPoints

ilSingleChoiceWizardInputGUI::$showPoints = true
protected

Definition at line 23 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getShowPoints().

◆ $singleline

ilSingleChoiceWizardInputGUI::$singleline = true
protected

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

Referenced by getSingleline().

◆ $suffixes

ilSingleChoiceWizardInputGUI::$suffixes = []
protected

Definition at line 22 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getSuffixes().

◆ $values

ilSingleChoiceWizardInputGUI::$values = []
protected

Definition at line 18 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getValues().

◆ ALLOWED_PAGE_HTML_TAGS

const ilSingleChoiceWizardInputGUI::ALLOWED_PAGE_HTML_TAGS = '<em>, <strong>'
protected

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