4 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
13 include_once
"./Services/Form/classes/class.ilImageFileInputGUI.php";
34 parent::__construct($a_title, $a_postvar);
49 $this->areas = $a_areas;
59 $this->line_color = $a_color;
69 $this->image_path = $a_path;
79 $this->image_path_web = $a_path_web;
84 if (is_array($a_areas[
'name']))
86 $this->areas =
array();
87 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
88 foreach ($a_areas[
'name'] as $idx => $name)
92 $pointsUnchecked = $a_areas[
'points_unchecked'][$idx];
96 $pointsUnchecked = 0.0;
101 $a_areas[
'points'][$idx],
103 $a_areas[
'coords'][$idx], $a_areas[
'shape'][$idx],
129 parent::setValue($a_value);
146 $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
147 $suffix = $filename_arr[
"extension"];
148 $mimetype = $_FILES[$this->
getPostVar()][
"type"];
149 $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
150 $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
158 case UPLOAD_ERR_INI_SIZE:
159 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
163 case UPLOAD_ERR_FORM_SIZE:
164 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
168 case UPLOAD_ERR_PARTIAL:
169 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
173 case UPLOAD_ERR_NO_FILE:
178 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
184 case UPLOAD_ERR_NO_TMP_DIR:
185 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
189 case UPLOAD_ERR_CANT_WRITE:
190 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
194 case UPLOAD_ERR_EXTENSION:
195 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
202 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"" &&
205 if (!in_array(strtolower($suffix), $this->
getSuffixes()))
207 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
213 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"")
216 if ($vir[0] ==
false)
218 $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
228 if ((!strlen(
$_POST[$this->
getPostVar()][
'coords'][
'points'][$idx])) && ($this->getRequired))
230 $this->
setAlert($lng->txt(
'form_msg_area_missing_points'));
235 $this->
setAlert($lng->txt(
'form_msg_numeric_value_required'));
242 if ($max == 0 && (!
$filename) && !$_FILES[
'imagemapfile'][
'tmp_name'])
244 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
257 $template =
new ilTemplate(
"tpl.prop_imagemap_file.html",
true,
true,
"Modules/TestQuestionPool");
265 $template->setCurrentBlock(
"has_value");
266 $template->setVariable(
"TEXT_IMAGE_NAME", $this->
getValue());
267 $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
268 $template->parseCurrentBlock();
270 $template->setCurrentBlock(
"image");
273 include_once
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
275 foreach ($this->
getAreas() as $index => $area)
277 $preview->addArea($index, $area->getArea(), $area->getCoords(), $area->getAnswertext(),
"",
"",
true, $this->
getLineColor());
281 $template->setVariable(
"SRC_IMAGE", $imagepath);
285 $template->setVariable(
"SRC_IMAGE", $this->
getImage());
287 $template->setVariable(
"ALT_IMAGE", $this->
getAlt());
288 $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
289 $template->setVariable(
"TXT_DELETE_EXISTING",
290 $lng->txt(
"delete_existing_file"));
291 $template->setVariable(
"TEXT_ADD_RECT", $lng->txt(
'add_rect'));
292 $template->setVariable(
"TEXT_ADD_CIRCLE", $lng->txt(
'add_circle'));
293 $template->setVariable(
"TEXT_ADD_POLY", $lng->txt(
'add_poly'));
294 $template->parseCurrentBlock();
300 foreach ($this->
getAreas() as $area)
302 if (strlen($area->getPoints()))
304 $template->setCurrentBlock(
'area_points_value');
305 $template->setVariable(
'VALUE_POINTS', $area->getPoints());
306 $template->parseCurrentBlock();
310 if (strlen($area->getPointsUnchecked()))
312 $template->setCurrentBlock(
'area_points_unchecked_value');
313 $template->setVariable(
'VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
314 $template->parseCurrentBlock();
317 $template->setCurrentBlock(
'area_points_unchecked_field');
318 $template->parseCurrentBlock();
320 if (strlen($area->getAnswertext()))
322 $template->setCurrentBlock(
'area_name_value');
323 $template->setVariable(
'VALUE_NAME', $area->getAnswertext());
324 $template->parseCurrentBlock();
326 $template->setCurrentBlock(
'row');
327 $template->setVariable(
'POST_VAR_R', $this->
getPostVar());
328 $template->setVariable(
'TEXT_SHAPE', strtoupper($area->getArea()));
329 $template->setVariable(
'VALUE_SHAPE', $area->getArea());
330 $coords = preg_replace(
"/(\d+,\d+,)/",
"\$1 ", $area->getCoords());
331 $template->setVariable(
'VALUE_COORDINATES', $area->getCoords());
332 $template->setVariable(
'TEXT_COORDINATES',
$coords);
333 $template->setVariable(
'COUNTER',
$counter);
335 $template->parseCurrentBlock();
338 $template->setCurrentBlock(
"areas");
339 $template->setVariable(
"TEXT_NAME", $lng->txt(
"ass_imap_hint"));
342 $template->setVariable(
"TEXT_POINTS", $lng->txt(
"points_checked"));
344 $template->setCurrentBlock(
'area_points_unchecked_head');
345 $template->setVariable(
"TEXT_POINTS_UNCHECKED", $lng->txt(
"points_unchecked"));
346 $template->parseCurrentBlock();
350 $template->setVariable(
"TEXT_POINTS", $lng->txt(
"points"));
352 $template->setVariable(
"TEXT_SHAPE", $lng->txt(
"shape"));
353 $template->setVariable(
"TEXT_COORDINATES", $lng->txt(
"coordinates"));
354 $template->setVariable(
"TEXT_COMMANDS", $lng->txt(
"actions"));
355 $template->parseCurrentBlock();
358 $template->setVariable(
"POST_VAR", $this->
getPostVar());
359 $template->setVariable(
"ID", $this->
getFieldId());
360 $template->setVariable(
"TXT_BROWSE", $lng->txt(
"select_file"));
361 $template->setVariable(
"TXT_MAX_SIZE", $lng->txt(
"file_notice").
" ".
364 $a_tpl->setCurrentBlock(
"prop_generic");
365 $a_tpl->setVariable(
"PROP_GENERIC", $template->get());
366 $a_tpl->parseCurrentBlock();
369 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
370 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/imagemap.js");
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
Class for true/false or yes/no answers.
static get($a_glyph, $a_text="")
Get glyph html.
Image map image preview creator.
special template class to simplify handling of ITX/PEAR
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.