ILIAS  release_8 Revision v8.24
ilImagemapCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilImagemapCorrectionsInputGUI:
+ Collaboration diagram for ilImagemapCorrectionsInputGUI:

Public Member Functions

 setValueByArray (array $a_values)
 Set value by array. More...
 
 setAreasByArray ($a_areas)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
- 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 ()
 Check input, strip slashes etc. More...
 
 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)
 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...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. 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
 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 = array()
 
 $image_path = ""
 
 $image_path_web = ""
 
 $line_color = ""
 
 $pointsUncheckedFieldEnabled = false
 
- 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 = ""
 
ILIAS FileUpload FileUpload $upload_service
 
- 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 ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilImagemapFileInputGUI.

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

49 : bool
50 {
51 global $DIC;
52 $lng = $DIC['lng'];
53
54 if (is_array($_POST[$this->getPostVar()])) {
55 $_POST[$this->getPostVar()] = ilArrayUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
56 }
57
58 $max = 0;
59 if (is_array($_POST[$this->getPostVar()]['coords']['points'])) {
60 foreach ($_POST[$this->getPostVar()]['coords']['points'] as $idx => $name) {
61 if ((!strlen($_POST[$this->getPostVar()]['coords']['points'][$idx])) && ($this->getRequired())) {
62 $this->setAlert($lng->txt('form_msg_area_missing_points'));
63 return false;
64 }
65 if ((!is_numeric($_POST[$this->getPostVar()]['coords']['points'][$idx]))) {
66 $this->setAlert($lng->txt('form_msg_numeric_value_required'));
67 return false;
68 }
69 if ($_POST[$this->getPostVar()]['coords']['points'][$idx] > 0) {
70 $max = $_POST[$this->getPostVar()]['coords']['points'][$idx];
71 }
72 }
73 }
74
75 if ($max == 0) {
76 $this->setAlert($lng->txt("enter_enough_positive_points"));
77 return false;
78 }
79 return true;
80 }
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
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...
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247

References $DIC, ilFormPropertyGUI\$lng, $name, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilArrayUtil\stripSlashesRecursive(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ insert()

ilImagemapCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Reimplemented from ilImagemapFileInputGUI.

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

82 : void
83 {
84 global $DIC;
85 $lng = $DIC['lng'];
86
87 $template = new ilTemplate("tpl.prop_imagemapquestioncorrection_input.html", true, true, "Modules/TestQuestionPool");
88
89 if ($this->getImage() != "") {
90 $template->setCurrentBlock("image");
91 if (count($this->getAreas())) {
92 include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
93 $preview = new ilImagemapPreview($this->getImagePath() . $this->getValue());
94 foreach ($this->getAreas() as $index => $area) {
95 $preview->addArea($index, $area->getArea(), $area->getCoords(), $area->getAnswertext(), "", "", true, $this->getLineColor());
96 }
97 $preview->createPreview();
98 $imagepath = $this->getImagePathWeb() . $preview->getPreviewFilename($this->getImagePath(), $this->getValue()) . "?img=" . time();
99 $template->setVariable("SRC_IMAGE", $imagepath);
100 } else {
101 $template->setVariable("SRC_IMAGE", $this->getImage());
102 }
103 $template->setVariable("ALT_IMAGE", $this->getAlt());
104 $template->setVariable("POST_VAR_D", $this->getPostVar());
105 $template->parseCurrentBlock();
106 }
107
108 if (is_array($this->getAreas()) && $this->getAreas()) {
109 $counter = 0;
110 foreach ($this->getAreas() as $area) {
111 if (strlen($area->getPoints())) {
112 $template->setCurrentBlock('area_points_value');
113 $template->setVariable('VALUE_POINTS', $area->getPoints());
114 $template->parseCurrentBlock();
115 }
116 if ($this->getPointsUncheckedFieldEnabled()) {
117 if (strlen($area->getPointsUnchecked())) {
118 $template->setCurrentBlock('area_points_unchecked_value');
119 $template->setVariable('VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
120 $template->parseCurrentBlock();
121 }
122
123 $template->setCurrentBlock('area_points_unchecked_field');
124 $template->parseCurrentBlock();
125 }
126 $template->setCurrentBlock('row');
127 if (strlen($area->getAnswertext())) {
128 $template->setVariable('ANSWER_AREA', $area->getAnswertext());
129 }
130 $template->setVariable('POST_VAR_R', $this->getPostVar());
131 $template->setVariable('TEXT_SHAPE', strtoupper($area->getArea()));
132 $template->setVariable('VALUE_SHAPE', $area->getArea());
133 $coords = preg_replace("/(\d+,\d+,)/", "\$1 ", $area->getCoords());
134 $template->setVariable('VALUE_COORDINATES', $area->getCoords());
135 $template->setVariable('TEXT_COORDINATES', $coords);
136 $template->setVariable('COUNTER', $counter);
137 $template->parseCurrentBlock();
138 $counter++;
139 }
140 $template->setCurrentBlock("areas");
141 $template->setVariable("TEXT_NAME", $lng->txt("ass_imap_hint"));
142 if ($this->getPointsUncheckedFieldEnabled()) {
143 $template->setVariable("TEXT_POINTS", $lng->txt("points_checked"));
144
145 $template->setCurrentBlock('area_points_unchecked_head');
146 $template->setVariable("TEXT_POINTS_UNCHECKED", $lng->txt("points_unchecked"));
147 $template->parseCurrentBlock();
148 } else {
149 $template->setVariable("TEXT_POINTS", $lng->txt("points"));
150 }
151 $template->setVariable("TEXT_SHAPE", $lng->txt("shape"));
152 $template->setVariable("TEXT_COORDINATES", $lng->txt("coordinates"));
153 $template->setVariable("TEXT_COMMANDS", $lng->txt("actions"));
154 $template->parseCurrentBlock();
155 }
156
157 $template->setVariable("POST_VAR", $this->getPostVar());
158 $template->setVariable("ID", $this->getFieldId());
159 $template->setVariable("TXT_BROWSE", $lng->txt("select_file"));
160 $template->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " .
161 $this->getMaxFileSizeString());
162
163 $a_tpl->setCurrentBlock("prop_generic");
164 $a_tpl->setVariable("PROP_GENERIC", $template->get());
165 $a_tpl->parseCurrentBlock();
166
167 global $DIC;
168 $tpl = $DIC['tpl'];
169 #$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
170 #$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagemap.js");
171 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
$preview
Definition: imgupload.php:81
$index
Definition: metadata.php:145

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

+ Here is the call graph for this function:

◆ setAreasByArray()

ilImagemapCorrectionsInputGUI::setAreasByArray (   $a_areas)

Reimplemented from ilImagemapFileInputGUI.

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

34 : void
35 {
36 if (is_array($a_areas['points'])) {
37 foreach ($this->areas as $idx => $name) {
38 if ($this->getPointsUncheckedFieldEnabled() && isset($a_areas['points_unchecked'])) {
39 $this->areas[$idx]->setPointsUnchecked($a_areas['points_unchecked'][$idx]);
40 } else {
41 $this->areas[$idx]->setPointsUnchecked(0);
42 }
43
44 $this->areas[$idx]->setPoints($a_areas['points'][$idx]);
45 }
46 }
47 }

References $name, and ilImagemapFileInputGUI\getPointsUncheckedFieldEnabled().

Referenced by setValueByArray().

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

◆ setValueByArray()

ilImagemapCorrectionsInputGUI::setValueByArray ( array  $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Reimplemented from ilImagemapFileInputGUI.

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

29 : void
30 {
31 $this->setAreasByArray($a_values[$this->getPostVar()]['coords']);
32 }

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

+ Here is the call graph for this function:

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