36 $points = $this->forms_helper->transformPoints($a_areas,
'points');
37 $points_unchecked = $this->forms_helper->transformPoints($a_areas,
'points_unchecked');
39 foreach (array_keys($this->areas) as $index) {
40 if ($points[$index] ===
null) {
45 ? $points_unchecked[$index] : 0.0;
47 $this->areas[$index]->setPointsUnchecked($points_unchecked[$index]);
48 $this->areas[$index]->setPoints($points[$index]);
55 if (!is_array(
$data) || !is_array(
$data[
'coords'])) {
56 $this->
setAlert($this->
lng->txt(
'form_msg_input_is_required'));
60 $result = $this->forms_helper->checkPointsInputEnoughPositive(
$data[
'coords'], $this->
getRequired());
61 if (!is_array($result)) {
62 if ($result ===
'msg_input_is_required') {
63 $this->
setAlert($this->
lng->txt(
'form_msg_area_missing_points'));
78 $template =
new ilTemplate(
'tpl.prop_imagemapquestioncorrection_input.html',
true,
true,
'components/ILIAS/TestQuestionPool');
81 $template->setCurrentBlock(
'image');
84 foreach ($this->
getAreas() as $index => $area) {
85 $preview->addArea($index, $area->getArea(), $area->getCoords(), $area->getAnswertext(),
'',
'',
true, $this->getLineColor());
87 $preview->createPreview();
89 $template->setVariable(
'SRC_IMAGE', $imagepath);
91 $template->setVariable(
'SRC_IMAGE', $this->
getImage());
93 $template->setVariable(
'ALT_IMAGE', $this->
getAlt());
94 $template->setVariable(
'POST_VAR_D', $this->
getPostVar());
95 $template->parseCurrentBlock();
100 foreach ($this->
getAreas() as $area) {
101 if ($area->getPoints() !==
'') {
102 $template->setCurrentBlock(
'area_points_value');
103 $template->setVariable(
'VALUE_POINTS', $area->getPoints());
104 $template->parseCurrentBlock();
107 if ($area->getPointsUnchecked() !==
'') {
108 $template->setCurrentBlock(
'area_points_unchecked_value');
109 $template->setVariable(
'VALUE_POINTS_UNCHECKED', $area->getPointsUnchecked());
110 $template->parseCurrentBlock();
113 $template->setCurrentBlock(
'area_points_unchecked_field');
114 $template->parseCurrentBlock();
116 $template->setCurrentBlock(
'row');
117 if ($area->getAnswertext() !==
'') {
118 $template->setVariable(
'ANSWER_AREA', $area->getAnswertext());
120 $template->setVariable(
'POST_VAR_R', $this->
getPostVar());
121 $template->setVariable(
'TEXT_SHAPE', strtoupper($area->getArea()));
122 $template->setVariable(
'VALUE_SHAPE', $area->getArea());
123 $coords = preg_replace(
"/(\d+,\d+,)/",
"\$1 ", $area->getCoords());
124 $template->setVariable(
'VALUE_COORDINATES', $area->getCoords());
125 $template->setVariable(
'TEXT_COORDINATES', $coords);
126 $template->setVariable(
'COUNTER',
$counter);
127 $template->parseCurrentBlock();
130 $template->setCurrentBlock(
'areas');
131 $template->setVariable(
'TEXT_NAME',
$lng->
txt(
'ass_imap_hint'));
133 $template->setVariable(
'TEXT_POINTS',
$lng->
txt(
'points_checked'));
135 $template->setCurrentBlock(
'area_points_unchecked_head');
136 $template->setVariable(
'TEXT_POINTS_UNCHECKED',
$lng->
txt(
'points_unchecked'));
137 $template->parseCurrentBlock();
139 $template->setVariable(
'TEXT_POINTS',
$lng->
txt(
'points'));
141 $template->setVariable(
'TEXT_SHAPE',
$lng->
txt(
'shape'));
142 $template->setVariable(
'TEXT_COORDINATES',
$lng->
txt(
'coordinates'));
143 $template->setVariable(
'TEXT_COMMANDS',
$lng->
txt(
'actions'));
144 $template->parseCurrentBlock();
147 $template->setVariable(
'POST_VAR', $this->
getPostVar());
148 $template->setVariable(
'ID', $this->
getFieldId());
149 $template->setVariable(
'TXT_BROWSE',
$lng->
txt(
'select_file'));
150 $template->setVariable(
'TXT_MAX_SIZE',
$lng->
txt(
'file_notice') .
' ' .
151 $this->getMaxFileSizeString());
154 $a_tpl->
setVariable(
'PROP_GENERIC', $template->get());
setVariable($variable, $value='')
Sets a variable value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)