4require_once 
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
 
   13include_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);
 
  143                while (substr($_FILES[$this->
getPostVar()][
"name"],-1) == 
'/')
 
  149                $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
 
  150                $suffix = $filename_arr[
"extension"];
 
  151                $mimetype = $_FILES[$this->
getPostVar()][
"type"];
 
  152                $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
 
  153                $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
 
  154                $error = $_FILES[$this->
getPostVar()][
"error"];
 
  161                                case UPLOAD_ERR_INI_SIZE:
 
  162                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  166                                case UPLOAD_ERR_FORM_SIZE:
 
  167                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  171                                case UPLOAD_ERR_PARTIAL:
 
  172                                        $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  176                                case UPLOAD_ERR_NO_FILE:
 
  181                                                        $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  187                                case UPLOAD_ERR_NO_TMP_DIR:
 
  188                                        $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  192                                case UPLOAD_ERR_CANT_WRITE:
 
  193                                        $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  197                                case UPLOAD_ERR_EXTENSION:
 
  198                                        $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  205                if ($_FILES[$this->
getPostVar()][
"tmp_name"] != 
"" &&
 
  208                        if (!in_array(strtolower($suffix), $this->
getSuffixes()))
 
  210                                $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  216                if ($_FILES[$this->
getPostVar()][
"tmp_name"] != 
"")
 
  219                        if ($vir[0] == 
false)
 
  221                                $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
 
  233                                        $this->
setAlert($lng->txt(
'form_msg_area_missing_points'));
 
  238                                        $this->
setAlert($lng->txt(
'form_msg_numeric_value_required'));
 
  247                        $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
 
  260                $template = 
new ilTemplate(
"tpl.prop_imagemap_file.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  268                                $template->setCurrentBlock(
"has_value");
 
  269                                $template->setVariable(
"TEXT_IMAGE_NAME", $this->
getValue());
 
  270                                $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
 
  271                                $template->parseCurrentBlock();
 
  273                        $template->setCurrentBlock(
"image");
 
  276                                include_once 
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
 
  278                                foreach ($this->
getAreas() as $index => $area)
 
  280                                        $preview->addArea($index, $area->getArea(), $area->getCoords(), $area->getAnswertext(), 
"", 
"", 
true, $this->getLineColor());
 
  284                                $template->setVariable(
"SRC_IMAGE", $imagepath);
 
  288                                $template->setVariable(
"SRC_IMAGE", $this->
getImage());
 
  290                        $template->setVariable(
"ALT_IMAGE", $this->
getAlt());
 
  291                        $template->setVariable(
"POST_VAR_D", $this->
getPostVar());
 
  292                        $template->setVariable(
"TXT_DELETE_EXISTING",
 
  293                                $lng->txt(
"delete_existing_file"));
 
  294                        $template->setVariable(
"TEXT_ADD_RECT", 
$lng->txt(
'add_rect'));
 
  295                        $template->setVariable(
"TEXT_ADD_CIRCLE", 
$lng->txt(
'add_circle'));
 
  296                        $template->setVariable(
"TEXT_ADD_POLY", 
$lng->txt(
'add_poly'));
 
  297                        $template->parseCurrentBlock();
 
  303                        foreach ($this->
getAreas() as $area)
 
  305                                if (strlen($area->getPoints()))
 
  307                                        $template->setCurrentBlock(
'area_points_value');
 
  308                                        $template->setVariable(
'VALUE_POINTS', $area->getPoints());
 
  309                                        $template->parseCurrentBlock();
 
  313                                        if (strlen($area->getPointsUnchecked()))
 
  315                                                $template->setCurrentBlock(
'area_points_unchecked_value');
 
  316                                                $template->setVariable(
'VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
 
  317                                                $template->parseCurrentBlock();
 
  320                                        $template->setCurrentBlock(
'area_points_unchecked_field');
 
  321                                        $template->parseCurrentBlock();
 
  323                                if (strlen($area->getAnswertext()))
 
  325                                        $template->setCurrentBlock(
'area_name_value');
 
  326                                        $template->setVariable(
'VALUE_NAME', $area->getAnswertext());
 
  327                                        $template->parseCurrentBlock();
 
  329                                $template->setCurrentBlock(
'row');
 
  330                                $template->setVariable(
'POST_VAR_R', $this->
getPostVar());
 
  331                                $template->setVariable(
'TEXT_SHAPE', strtoupper($area->getArea()));
 
  332                                $template->setVariable(
'VALUE_SHAPE', $area->getArea());
 
  333                                $coords = preg_replace(
"/(\d+,\d+,)/", 
"\$1 ", $area->getCoords());
 
  334                                $template->setVariable(
'VALUE_COORDINATES', $area->getCoords());
 
  335                                $template->setVariable(
'TEXT_COORDINATES', $coords);
 
  336                                $template->setVariable(
'COUNTER', $counter);
 
  338                                $template->parseCurrentBlock();
 
  341                        $template->setCurrentBlock(
"areas");
 
  342                        $template->setVariable(
"TEXT_NAME", 
$lng->txt(
"hint"));
 
  345                                $template->setVariable(
"TEXT_POINTS", 
$lng->txt(
"points_checked"));
 
  347                                $template->setCurrentBlock(
'area_points_unchecked_head');
 
  348                                $template->setVariable(
"TEXT_POINTS_UNCHECKED", 
$lng->txt(
"points_unchecked"));
 
  349                                $template->parseCurrentBlock();
 
  353                                $template->setVariable(
"TEXT_POINTS", 
$lng->txt(
"points"));
 
  355                        $template->setVariable(
"TEXT_SHAPE", 
$lng->txt(
"shape"));
 
  356                        $template->setVariable(
"TEXT_COORDINATES", 
$lng->txt(
"coordinates"));
 
  357                        $template->setVariable(
"TEXT_COMMANDS", 
$lng->txt(
"actions"));
 
  358                        $template->parseCurrentBlock();
 
  361                $template->setVariable(
"POST_VAR", $this->
getPostVar());
 
  362                $template->setVariable(
"ID", $this->
getFieldId());
 
  363                $template->setVariable(
"TXT_MAX_SIZE", 
$lng->txt(
"file_notice").
" ".
 
  364                        $this->getMaxFileSizeString());
 
  366                $a_tpl->setCurrentBlock(
"prop_generic");
 
  367                $a_tpl->setVariable(
"PROP_GENERIC", $template->get());
 
  368                $a_tpl->parseCurrentBlock();
 
  371                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  372                $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/imagemap.js");
 
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.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible