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

Public Member Functions

 setValueByArray (array $a_values)
 
 setAreasByArray ($a_areas)
 
 checkInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilImagemapFileInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setPointsUncheckedFieldEnabled ($pointsUncheckedFieldEnabled)
 
 getPointsUncheckedFieldEnabled ()
 
 setAreas ($a_areas)
 
 getLineColor ()
 
 setLineColor ($a_color)
 
 getImagePath ()
 
 setImagePath ($a_path)
 
 getImagePathWeb ()
 
 setImagePathWeb ($a_path_web)
 
 setAreasByArray ($a_areas)
 
 getAreas ()
 
 setValueByArray (array $a_values)
 Set value by array. More...
 
 setValue ($a_value)
 
 getInput ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilImageFileInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setAllowDeletion (bool $a_val)
 
 getALlowDeletion ()
 
 setAllowCapture (bool $a_val)
 
 getAllowCapture ()
 
 setUseCache (bool $a_cache)
 Set cache. More...
 
 getUseCache ()
 
 setImage (string $a_image)
 
 getImage ()
 
 setAlt (string $a_alt)
 
 getAlt ()
 
 insert (ilTemplate $a_tpl)
 
 getDeletionFlag ()
 
- Public Member Functions inherited from ilFileInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValueByArray (array $a_values)
 
 setValue (string $a_value)
 Set Value. More...
 
 getValue ()
 
 setSize (int $a_size)
 
 getSize ()
 
 setFilename (string $a_val)
 
 getFilename ()
 
 setSuffixes (array $a_suffixes)
 
 getSuffixes ()
 
 setForbiddenSuffixes (array $a_suffixes)
 
 getForbiddenSuffixes ()
 
 setPending (string $a_val)
 
 getPending ()
 
 enableFileNameSelection (string $a_post_var)
 
 isFileNameSelectionEnabled ()
 
 getFileNamePostVar ()
 
 setAllowDeletion (bool $a_val)
 
 getALlowDeletion ()
 
 checkInput ()
 
 getInput ()
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getDeletionFlag ()
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
- 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...
 

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 ilFileInputGUI
 outputSuffixes (ilTemplate $a_tpl, string $a_block="allowed_suffixes")
 
 getMaxFileSizeString ()
 
 getMaxFileUploads ()
 Get number of maximum file uploads as declared in php.ini. 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 ilImagemapFileInputGUI
 $areas = []
 
 $image_path = ""
 
 $image_path_web = ""
 
 $line_color = ""
 
 $pointsUncheckedFieldEnabled = false
 
ilTestLegacyFormsHelper $forms_helper
 
GlyphFactory $glyph_factory
 
Renderer $renderer
 
- Protected Attributes inherited from ilImageFileInputGUI
ilGlobalTemplateInterface $tpl
 
bool $cache = false
 
string $alt = ""
 
string $image = ""
 
bool $allow_capture = false
 
- Protected Attributes inherited from ilFileInputGUI
int $size = 40
 
string $pending = ""
 
bool $allow_deletion = false
 
bool $filename_selection = false
 
array $forbidden_suffixes = []
 
array $suffixes = []
 
string $value = ""
 
FileUpload $upload_service
 
UploadLimitResolver $upload_limit
 
- 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

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

Member Function Documentation

◆ checkInput()

ilImagemapCorrectionsInputGUI::checkInput ( )

Definition at line 48 of file class.ilImagemapCorrectionsInputGUI.php.

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

48  : bool
49  {
50  $data = $this->raw($this->getPostVar());
51  if (!is_array($data) || !is_array($data['coords'])) {
52  $this->setAlert($this->lng->txt('form_msg_input_is_required'));
53  return false;
54  }
55 
56  $result = $this->forms_helper->checkPointsInputEnoughPositive($data['coords'], $this->getRequired());
57  if (!is_array($result)) {
58  if ($result === 'msg_input_is_required') {
59  $this->setAlert($this->lng->txt('form_msg_area_missing_points'));
60  } else {
61  $this->setAlert($this->lng->txt($result));
62  }
63  return false;
64  }
65 
66  return true;
67  }
+ Here is the call graph for this function:

◆ insert()

ilImagemapCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

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

References $DIC, ilFormPropertyGUI\$lng, ilImageFileInputGUI\getAlt(), ilImagemapFileInputGUI\getAreas(), ilFormPropertyGUI\getFieldId(), ilImageFileInputGUI\getImage(), ilImagemapFileInputGUI\getImagePath(), ilImagemapFileInputGUI\getImagePathWeb(), ilImagemapFileInputGUI\getLineColor(), ilFileInputGUI\getMaxFileSizeString(), ilImagemapFileInputGUI\getPointsUncheckedFieldEnabled(), ilFormPropertyGUI\getPostVar(), ilFileInputGUI\getValue(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

69  : void
70  {
71  global $DIC;
72  $lng = $DIC['lng'];
73 
74  $template = new ilTemplate('tpl.prop_imagemapquestioncorrection_input.html', true, true, 'components/ILIAS/TestQuestionPool');
75 
76  if ($this->getImage() !== '') {
77  $template->setCurrentBlock('image');
78  if (count($this->getAreas())) {
79  $preview = new ilImagemapPreview($this->getImagePath() . $this->getValue());
80  foreach ($this->getAreas() as $index => $area) {
81  $preview->addArea($index, $area->getArea(), $area->getCoords(), $area->getAnswertext(), '', '', true, $this->getLineColor());
82  }
83  $preview->createPreview();
84  $imagepath = $this->getImagePathWeb() . $preview->getPreviewFilename($this->getImagePath(), $this->getValue()) . '?img=' . time();
85  $template->setVariable('SRC_IMAGE', $imagepath);
86  } else {
87  $template->setVariable('SRC_IMAGE', $this->getImage());
88  }
89  $template->setVariable('ALT_IMAGE', $this->getAlt());
90  $template->setVariable('POST_VAR_D', $this->getPostVar());
91  $template->parseCurrentBlock();
92  }
93 
94  if (is_array($this->getAreas()) && $this->getAreas()) {
95  $counter = 0;
96  foreach ($this->getAreas() as $area) {
97  if ($area->getPoints() !== '') {
98  $template->setCurrentBlock('area_points_value');
99  $template->setVariable('VALUE_POINTS', $area->getPoints());
100  $template->parseCurrentBlock();
101  }
102  if ($this->getPointsUncheckedFieldEnabled()) {
103  if ($area->getPointsUnchecked() !== '') {
104  $template->setCurrentBlock('area_points_unchecked_value');
105  $template->setVariable('VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
106  $template->parseCurrentBlock();
107  }
108 
109  $template->setCurrentBlock('area_points_unchecked_field');
110  $template->parseCurrentBlock();
111  }
112  $template->setCurrentBlock('row');
113  if ($area->getAnswertext() !== '') {
114  $template->setVariable('ANSWER_AREA', $area->getAnswertext());
115  }
116  $template->setVariable('POST_VAR_R', $this->getPostVar());
117  $template->setVariable('TEXT_SHAPE', strtoupper($area->getArea()));
118  $template->setVariable('VALUE_SHAPE', $area->getArea());
119  $coords = preg_replace("/(\d+,\d+,)/", "\$1 ", $area->getCoords());
120  $template->setVariable('VALUE_COORDINATES', $area->getCoords());
121  $template->setVariable('TEXT_COORDINATES', $coords);
122  $template->setVariable('COUNTER', $counter);
123  $template->parseCurrentBlock();
124  $counter++;
125  }
126  $template->setCurrentBlock('areas');
127  $template->setVariable('TEXT_NAME', $lng->txt('ass_imap_hint'));
128  if ($this->getPointsUncheckedFieldEnabled()) {
129  $template->setVariable('TEXT_POINTS', $lng->txt('points_checked'));
130 
131  $template->setCurrentBlock('area_points_unchecked_head');
132  $template->setVariable('TEXT_POINTS_UNCHECKED', $lng->txt('points_unchecked'));
133  $template->parseCurrentBlock();
134  } else {
135  $template->setVariable('TEXT_POINTS', $lng->txt('points'));
136  }
137  $template->setVariable('TEXT_SHAPE', $lng->txt('shape'));
138  $template->setVariable('TEXT_COORDINATES', $lng->txt('coordinates'));
139  $template->setVariable('TEXT_COMMANDS', $lng->txt('actions'));
140  $template->parseCurrentBlock();
141  }
142 
143  $template->setVariable('POST_VAR', $this->getPostVar());
144  $template->setVariable('ID', $this->getFieldId());
145  $template->setVariable('TXT_BROWSE', $lng->txt('select_file'));
146  $template->setVariable('TXT_MAX_SIZE', $lng->txt('file_notice') . ' ' .
147  $this->getMaxFileSizeString());
148 
149  $a_tpl->setCurrentBlock('prop_generic');
150  $a_tpl->setVariable('PROP_GENERIC', $template->get());
151  $a_tpl->parseCurrentBlock();
152  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
global $DIC
Definition: shib_login.php:22
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setAreasByArray()

ilImagemapCorrectionsInputGUI::setAreasByArray (   $a_areas)

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

References ilImagemapFileInputGUI\getPointsUncheckedFieldEnabled().

Referenced by setValueByArray().

34  : void
35  {
36  $points = $this->forms_helper->transformPoints($a_areas, 'points');
37  $points_unchecked = $this->forms_helper->transformPoints($a_areas, 'points_unchecked');
38 
39  foreach (array_keys($this->areas) as $index) {
40  $points_unchecked[$index] = $this->getPointsUncheckedFieldEnabled() && isset($points_unchecked[$index])
41  ? $points_unchecked[$index] : 0.0;
42 
43  $this->areas[$index]->setPointsUnchecked($points_unchecked[$index]);
44  $this->areas[$index]->setPoints($points[$index]);
45  }
46  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilImagemapCorrectionsInputGUI::setValueByArray ( array  $a_values)

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

References ilFormPropertyGUI\getPostVar(), and setAreasByArray().

29  : void
30  {
31  $this->setAreasByArray($a_values[$this->getPostVar()]['coords']);
32  }
+ Here is the call graph for this function:

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