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'])) {
85 $this->areas =
array();
86 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
87 foreach ($a_areas[
'name'] as $idx =>
$name) {
89 $pointsUnchecked = $a_areas[
'points_unchecked'][$idx];
91 $pointsUnchecked = 0.0;
96 $a_areas[
'points'][$idx],
98 $a_areas[
'coords'][$idx],
99 $a_areas[
'shape'][$idx],
125 parent::setValue($a_value);
144 $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
145 $suffix = $filename_arr[
"extension"];
146 $mimetype = $_FILES[$this->
getPostVar()][
"type"];
147 $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
148 $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
154 case UPLOAD_ERR_INI_SIZE:
155 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
159 case UPLOAD_ERR_FORM_SIZE:
160 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
164 case UPLOAD_ERR_PARTIAL:
165 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
169 case UPLOAD_ERR_NO_FILE:
172 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
178 case UPLOAD_ERR_NO_TMP_DIR:
179 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
183 case UPLOAD_ERR_CANT_WRITE:
184 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
188 case UPLOAD_ERR_EXTENSION:
189 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
196 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"" &&
198 if (!in_array(strtolower($suffix), $this->
getSuffixes())) {
199 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
205 if ($_FILES[$this->
getPostVar()][
"tmp_name"] !=
"") {
207 if ($vir[0] ==
false) {
208 $this->
setAlert($lng->txt(
"form_msg_file_virus_found") .
"<br />" . $vir[1]);
216 if ((!strlen(
$_POST[$this->
getPostVar()][
'coords'][
'points'][$idx])) && ($this->getRequired)) {
217 $this->
setAlert($lng->txt(
'form_msg_area_missing_points'));
221 $this->
setAlert($lng->txt(
'form_msg_numeric_value_required'));
230 if ($max == 0 && (!
$filename) && !$_FILES[
'imagemapfile'][
'tmp_name']) {
231 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
244 $template =
new ilTemplate(
"tpl.prop_imagemap_file.html",
true,
true,
"Modules/TestQuestionPool");
257 include_once
"./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
264 $template->setVariable(
"SRC_IMAGE", $imagepath);
271 "TXT_DELETE_EXISTING",
272 $lng->txt(
"delete_existing_file")
274 $template->setVariable(
"TEXT_ADD_RECT", $lng->txt(
'add_rect'));
275 $template->setVariable(
"TEXT_ADD_CIRCLE", $lng->txt(
'add_circle'));
276 $template->setVariable(
"TEXT_ADD_POLY", $lng->txt(
'add_poly'));
282 foreach ($this->
getAreas() as $area) {
283 if (strlen($area->getPoints())) {
284 $template->setCurrentBlock(
'area_points_value');
285 $template->setVariable(
'VALUE_POINTS', $area->getPoints());
289 if (strlen($area->getPointsUnchecked())) {
290 $template->setCurrentBlock(
'area_points_unchecked_value');
291 $template->setVariable(
'VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
295 $template->setCurrentBlock(
'area_points_unchecked_field');
298 if (strlen($area->getAnswertext())) {
299 $template->setCurrentBlock(
'area_name_value');
300 $template->setVariable(
'VALUE_NAME', $area->getAnswertext());
305 $template->setVariable(
'TEXT_SHAPE', strtoupper($area->getArea()));
306 $template->setVariable(
'VALUE_SHAPE', $area->getArea());
307 $coords = preg_replace(
"/(\d+,\d+,)/",
"\$1 ", $area->getCoords());
308 $template->setVariable(
'VALUE_COORDINATES', $area->getCoords());
316 $template->setVariable(
"TEXT_NAME", $lng->txt(
"ass_imap_hint"));
318 $template->setVariable(
"TEXT_POINTS", $lng->txt(
"points_checked"));
320 $template->setCurrentBlock(
'area_points_unchecked_head');
321 $template->setVariable(
"TEXT_POINTS_UNCHECKED", $lng->txt(
"points_unchecked"));
324 $template->setVariable(
"TEXT_POINTS", $lng->txt(
"points"));
326 $template->setVariable(
"TEXT_SHAPE", $lng->txt(
"shape"));
327 $template->setVariable(
"TEXT_COORDINATES", $lng->txt(
"coordinates"));
328 $template->setVariable(
"TEXT_COMMANDS", $lng->txt(
"actions"));
334 $template->setVariable(
"TXT_BROWSE", $lng->txt(
"select_file"));
335 $template->setVariable(
"TXT_MAX_SIZE", $lng->txt(
"file_notice") .
" " .
338 $a_tpl->setCurrentBlock(
"prop_generic");
339 $a_tpl->setVariable(
"PROP_GENERIC",
$template->get());
340 $a_tpl->parseCurrentBlock();
343 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
344 $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.