4 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
13 include_once
"./Services/Form/classes/class.ilImageFileInputGUI.php";
35 parent::__construct($a_title, $a_postvar);
50 $this->areas = $a_areas;
60 $this->line_color = $a_color;
70 $this->image_path = $a_path;
80 $this->image_path_web = $a_path_web;
85 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) {
90 $pointsUnchecked = $a_areas[
'points_unchecked'][$idx];
92 $pointsUnchecked = 0.0;
97 $a_areas[
'points'][$idx],
99 $a_areas[
'coords'][$idx],
100 $a_areas[
'shape'][$idx],
126 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"];
151 $error = $_FILES[$this->
getPostVar()][
"error"];
156 case UPLOAD_ERR_INI_SIZE:
157 $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
161 case UPLOAD_ERR_FORM_SIZE:
162 $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
166 case UPLOAD_ERR_PARTIAL:
167 $this->
setAlert(
$lng->txt(
"form_msg_file_partially_uploaded"));
171 case UPLOAD_ERR_NO_FILE:
180 case UPLOAD_ERR_NO_TMP_DIR:
181 $this->
setAlert(
$lng->txt(
"form_msg_file_missing_tmp_dir"));
185 case UPLOAD_ERR_CANT_WRITE:
186 $this->
setAlert(
$lng->txt(
"form_msg_file_cannot_write_to_disk"));
190 case UPLOAD_ERR_EXTENSION:
191 $this->
setAlert(
$lng->txt(
"form_msg_file_upload_stopped_ext"));
198 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"" &&
200 if (!in_array(strtolower($suffix), $this->
getSuffixes())) {
201 $this->
setAlert(
$lng->txt(
"form_msg_file_wrong_file_type"));
207 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"") {
209 if ($vir[0] ==
false) {
210 $this->
setAlert(
$lng->txt(
"form_msg_file_virus_found") .
"<br />" . $vir[1]);
218 if ((!strlen(
$_POST[$this->
getPostVar()][
'coords'][
'points'][$idx])) && ($this->getRequired)) {
219 $this->
setAlert(
$lng->txt(
'form_msg_area_missing_points'));
223 $this->
setAlert(
$lng->txt(
'form_msg_numeric_value_required'));
232 if ($max == 0 && (!
$filename) && !$_FILES[
'imagemapfile'][
'tmp_name']) {
233 $this->
setAlert(
$lng->txt(
"enter_enough_positive_points"));
247 $template =
new ilTemplate(
"tpl.prop_imagemap_file.html",
true,
true,
"Modules/TestQuestionPool");
260 include_once
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
267 $template->setVariable(
"SRC_IMAGE", $imagepath);
274 "TXT_DELETE_EXISTING",
275 $lng->txt(
"delete_existing_file")
277 $template->setVariable(
"TEXT_ADD_RECT",
$lng->txt(
'add_rect'));
278 $template->setVariable(
"TEXT_ADD_CIRCLE",
$lng->txt(
'add_circle'));
279 $template->setVariable(
"TEXT_ADD_POLY",
$lng->txt(
'add_poly'));
285 foreach ($this->
getAreas() as $area) {
286 if (strlen($area->getPoints())) {
287 $template->setCurrentBlock(
'area_points_value');
288 $template->setVariable(
'VALUE_POINTS', $area->getPoints());
292 if (strlen($area->getPointsUnchecked())) {
293 $template->setCurrentBlock(
'area_points_unchecked_value');
294 $template->setVariable(
'VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
298 $template->setCurrentBlock(
'area_points_unchecked_field');
301 if (strlen($area->getAnswertext())) {
302 $template->setCurrentBlock(
'area_name_value');
303 $template->setVariable(
'VALUE_NAME', $area->getAnswertext());
308 $template->setVariable(
'TEXT_SHAPE', strtoupper($area->getArea()));
309 $template->setVariable(
'VALUE_SHAPE', $area->getArea());
310 $coords = preg_replace(
"/(\d+,\d+,)/",
"\$1 ", $area->getCoords());
311 $template->setVariable(
'VALUE_COORDINATES', $area->getCoords());
313 $template->setVariable(
'COUNTER', $counter);
319 $template->setVariable(
"TEXT_NAME",
$lng->txt(
"ass_imap_hint"));
321 $template->setVariable(
"TEXT_POINTS",
$lng->txt(
"points_checked"));
323 $template->setCurrentBlock(
'area_points_unchecked_head');
324 $template->setVariable(
"TEXT_POINTS_UNCHECKED",
$lng->txt(
"points_unchecked"));
330 $template->setVariable(
"TEXT_COORDINATES",
$lng->txt(
"coordinates"));
331 $template->setVariable(
"TEXT_COMMANDS",
$lng->txt(
"actions"));
337 $template->setVariable(
"TXT_BROWSE",
$lng->txt(
"select_file"));
338 $template->setVariable(
"TXT_MAX_SIZE",
$lng->txt(
"file_notice") .
" " .
341 $a_tpl->setCurrentBlock(
"prop_generic");
342 $a_tpl->setVariable(
"PROP_GENERIC",
$template->get());
343 $a_tpl->parseCurrentBlock();
347 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
348 $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.