ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilImagemapCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilImagemapCorrectionsInputGUI:
+ Collaboration diagram for ilImagemapCorrectionsInputGUI:

Public Member Functions

 setValueByArray ($a_values)
 
 setAreasByArray ($a_areas)
 
 checkInput ()
 
 insert ($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 ($a_values)
 Set value by array. More...
 
 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilImageFileInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setALlowDeletion ($a_val)
 Set allow deletion. More...
 
 getALlowDeletion ()
 Get allow deletion. More...
 
 setUseCache ($a_cache)
 Set cache. More...
 
 getUseCache ()
 Get cache. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setAlt ($a_alt)
 Set Alternative Text. More...
 
 getAlt ()
 Get Alternative Text. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getDeletionFlag ()
 Get deletion flag. More...
 
- Public Member Functions inherited from ilFileInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setSize ($a_size)
 Set Size. More...
 
 getSize ()
 Get Size. More...
 
 setFilename ($a_val)
 Set filename value (if filename selection is enabled) More...
 
 getFilename ()
 Get Value. More...
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setForbiddenSuffixes ($a_suffixes)
 Set forbidden Suffixes. More...
 
 getForbiddenSuffixes ()
 Get Accepted Suffixes. More...
 
 setPending ($a_val)
 Set pending filename value. More...
 
 getPending ()
 Get pending filename. More...
 
 enableFileNameSelection ($a_post_var)
 If enabled, users get the possibility to enter a filename for the uploaded file. More...
 
 isFileNameSelectionEnabled ()
 Check if filename selection is enabled. More...
 
 getFileNamePostVar ()
 Get file name post var. More...
 
 setALlowDeletion ($a_val)
 Set allow deletion. More...
 
 getALlowDeletion ()
 Get allow deletion. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ($a_mode="")
 Render html. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getDeletionFlag ()
 Get deletion flag. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
- 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFileInputGUI
static setPersonalWorkspaceQuotaCheck ($a_value)
 
- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFileInputGUI
 outputSuffixes ($a_tpl, $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 ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 
- Protected Attributes inherited from ilImagemapFileInputGUI
 $areas = array()
 
 $image_path = ""
 
 $image_path_web = ""
 
 $line_color = ""
 
 $pointsUncheckedFieldEnabled = false
 
- Protected Attributes inherited from ilImageFileInputGUI
 $cache
 
- Protected Attributes inherited from ilFileInputGUI
 $lng
 
 $size = 40
 
 $pending
 
 $allow_deletion
 
 $forbidden_suffixes = array()
 
- 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
 
- Static Protected Attributes inherited from ilFileInputGUI
static $check_wsp_quota
 

Detailed Description

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

Member Function Documentation

◆ checkInput()

ilImagemapCorrectionsInputGUI::checkInput ( )

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

References $_POST, $DIC, ilFileInputGUI\$lng, $name, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

36  {
37  global $DIC;
38  $lng = $DIC['lng'];
39 
40  if (is_array($_POST[$this->getPostVar()])) {
42  }
43 
44  $max = 0;
45  if (is_array($_POST[$this->getPostVar()]['coords']['points'])) {
46  foreach ($_POST[$this->getPostVar()]['coords']['points'] as $idx => $name) {
47  if ((!strlen($_POST[$this->getPostVar()]['coords']['points'][$idx])) && ($this->getRequired)) {
48  $this->setAlert($lng->txt('form_msg_area_missing_points'));
49  return false;
50  }
51  if ((!is_numeric($_POST[$this->getPostVar()]['coords']['points'][$idx]))) {
52  $this->setAlert($lng->txt('form_msg_numeric_value_required'));
53  return false;
54  }
55  if ($_POST[$this->getPostVar()]['coords']['points'][$idx] > 0) {
56  $max = $_POST[$this->getPostVar()]['coords']['points'][$idx];
57  }
58  }
59  }
60 
61  if ($max == 0) {
62  $this->setAlert($lng->txt("enter_enough_positive_points"));
63  return false;
64  }
65  return true;
66  }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
$_POST["username"]
+ Here is the call graph for this function:

◆ insert()

ilImagemapCorrectionsInputGUI::insert (   $a_tpl)

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

References $coords, $DIC, $index, ilFileInputGUI\$lng, $preview, $template, $tpl, ilImageFileInputGUI\getAlt(), ilImagemapFileInputGUI\getAreas(), ilFormPropertyGUI\getFieldId(), ilImageFileInputGUI\getImage(), ilImagemapFileInputGUI\getImagePath(), ilImagemapFileInputGUI\getImagePathWeb(), ilImagemapFileInputGUI\getLineColor(), ilFileInputGUI\getMaxFileSizeString(), ilImagemapFileInputGUI\getPointsUncheckedFieldEnabled(), ilFormPropertyGUI\getPostVar(), and ilFileInputGUI\getValue().

69  {
70  global $DIC;
71  $lng = $DIC['lng'];
72 
73  $template = new ilTemplate("tpl.prop_imagemapquestioncorrection_input.html", true, true, "Modules/TestQuestionPool");
74 
75  if ($this->getImage() != "") {
76  $template->setCurrentBlock("image");
77  if (count($this->getAreas())) {
78  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
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 (strlen($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 (strlen($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 (strlen($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 
153  global $DIC;
154  $tpl = $DIC['tpl'];
155  #$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
156  #$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagemap.js");
157  }
getAlt()
Get Alternative Text.
$template
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
$preview
$index
Definition: metadata.php:60
$coords
Definition: example_030.php:88
Image map image preview creator.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ setAreasByArray()

ilImagemapCorrectionsInputGUI::setAreasByArray (   $a_areas)

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

References $name, and ilImagemapFileInputGUI\getPointsUncheckedFieldEnabled().

Referenced by setValueByArray().

21  {
22  if (is_array($a_areas['points'])) {
23  foreach ($this->areas as $idx => $name) {
24  if ($this->getPointsUncheckedFieldEnabled() && isset($a_areas['points_unchecked'])) {
25  $this->areas[$idx]->setPointsUnchecked($a_areas['points_unchecked'][$idx]);
26  } else {
27  $this->areas[$idx]->setPointsUnchecked(0);
28  }
29 
30  $this->areas[$idx]->setPoints($a_areas['points'][$idx]);
31  }
32  }
33  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilImagemapCorrectionsInputGUI::setValueByArray (   $a_values)

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

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

16  {
17  $this->setAreasByArray($a_values[$this->getPostVar()]['coords']);
18  }
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

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