4 require_once(
"./Services/COPage/classes/class.ilInternalLink.php");
6 define(
"IL_AREA_RECT",
"Rect");
7 define(
"IL_AREA_CIRCLE",
"Circle");
8 define(
"IL_AREA_POLY",
"Poly");
9 define(
"IL_AREA_WHOLE_PICTURE",
"WholePicture");
11 define(
"IL_INT_LINK",
"int");
12 define(
"IL_EXT_LINK",
"ext");
13 define(
"IL_NO_LINK",
"no");
15 define(
"IL_LT_STRUCTURE",
"StructureObject");
16 define(
"IL_LT_PAGE",
"PageObject");
17 define(
"IL_LT_MEDIA",
"MediaObject");
18 define(
"IL_LT_GLITEM",
"GlossaryItem");
20 define(
"IL_TF_MEDIA",
"Media");
21 define(
"IL_TF_FAQ",
"FAQ");
22 define(
"IL_TF_GLOSSARY",
"Glossary");
23 define(
"IL_TF_NEW",
"New");
67 if ($a_item_id !=0 && $a_nr != 0)
82 $q =
"INSERT INTO map_area (item_id, nr, shape, ".
83 "coords, link_type, title, href, target, type, highlight_mode, highlight_class, target_frame) ".
85 $ilDB->quote($this->
getItemId(),
"integer").
",".
86 $ilDB->quote($this->
getNr(),
"integer").
",".
87 $ilDB->quote($this->
getShape(),
"text").
",".
88 $ilDB->quote($this->
getCoords(),
"text").
",".
90 $ilDB->quote($this->
getTitle(),
"text").
",".
91 $ilDB->quote($this->
getHref(),
"text").
",".
92 $ilDB->quote($this->
getTarget(),
"text").
",".
93 $ilDB->quote($this->
getType(),
"text").
",".
97 $ilDB->manipulate($q);
111 $q =
"SELECT max(nr) AS max_nr FROM map_area WHERE item_id = ".
112 $ilDB->quote($a_item_id,
"integer");
113 $max_set = $ilDB->query($q);
114 $max_rec = $ilDB->fetchAssoc($max_set);
116 return $max_rec[
"max_nr"];
126 $q =
"SELECT * FROM map_area WHERE item_id = ".
127 $ilDB->quote($this->
getItemId(),
"integer").
128 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
129 $area_set = $ilDB->query($q);
130 $area_rec = $ilDB->fetchAssoc($area_set);
132 $this->
setShape($area_rec[
"shape"]);
134 $this->
setNr($area_rec[
"nr"]);
137 $this->
setTitle($area_rec[
"title"]);
138 $this->
setHref($area_rec[
"href"]);
140 $this->
setType($area_rec[
"type"]);
154 $q =
"UPDATE map_area SET shape = ".$ilDB->quote($this->
getShape(),
"text").
155 ", coords = ".$ilDB->quote($this->
getCoords(),
"text").
156 ", link_type = ".$ilDB->quote($this->
getLinkType(),
"text").
157 ", title = ".$ilDB->quote($this->
getTitle(),
"text").
158 ", href = ".$ilDB->quote($this->
getHref(),
"text").
159 ", target = ".$ilDB->quote($this->
getTarget(),
"text").
160 ", type = ".$ilDB->quote($this->
getType(),
"text").
163 ", target_frame = ".$ilDB->quote($this->
getTargetFrame(),
"text").
164 " WHERE item_id = ".$ilDB->quote($this->
getItemId(),
"integer").
165 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
166 $ilDB->manipulate($q);
177 $q =
"SELECT * FROM map_area WHERE item_id = ".
178 $ilDB->quote($a_item_id,
"integer");
179 $area_set = $ilDB->query($q);
180 while ($area_rec = $ilDB->fetchAssoc($area_set))
182 $target = $area_rec[
"target"];
183 $type = $area_rec[
"type"];
185 $nr = $area_rec[
"nr"];
187 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (!is_int(strpos($target,
"__"))))
190 if ($new_target !==
false)
192 $query =
"UPDATE map_area SET ".
193 "target = ".$ilDB->quote($new_target,
"text").
" ".
194 "WHERE item_id = ".$ilDB->quote(
$item_id,
"integer").
195 " AND nr = ".$ilDB->quote(
$nr,
"integer");
196 $ilDB->manipulate(
$query);
211 $q =
"SELECT * FROM map_area WHERE item_id = ".
212 $ilDB->quote($a_item_id,
"integer");
213 $area_set = $ilDB->query($q);
217 while ($area_rec = $ilDB->fetchAssoc($area_set))
219 $target = $area_rec[
"target"];
220 $type = $area_rec[
"type"];
221 $targetframe = $area_rec[
"target_frame"];
223 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (is_int(strpos($target,
"__"))))
225 $links[$target.
":".$type.
":".$targetframe] =
226 array(
"Target" => $target,
"Type" => $type,
227 "TargetFrame" => $targetframe);
240 $q =
"SELECT * FROM map_area WHERE ".
241 " link_type = ".$ilDB->quote($a_type,
"text").
242 " AND target = ".$ilDB->quote($a_target,
"text");
243 $set = $ilDB->query($q);
246 while($rec = $ilDB->fetchAssoc($set))
249 $mobs[$mob_id] = $mob_id;
266 self::HL_NONE => $lng->txt(
"cont_none"),
267 self::HL_HOVER => $lng->txt(
"cont_hover"),
268 self::HL_ALWAYS => $lng->txt(
"cont_always")
281 $this->highlight_mode = $a_val;
291 return $this->highlight_mode;
305 self::HLCL_ACCENTED => $lng->txt(
"cont_accented"),
306 self::HLCL_LIGHT => $lng->txt(
"cont_light"),
307 self::HLCL_DARK => $lng->txt(
"cont_dark"),
318 $this->highlight_class = $a_val;
328 return $this->highlight_class;
338 $this->item_id = $a_item_id;
378 $this->shape = $a_shape;
398 $this->coords = $a_coords;
418 $this->title = $a_title;
428 $this->title.= $a_title_str;
448 $this->linktype = $a_link_type;
468 $this->xl_href = $a_href;
488 $this->xl_title = $a_title;
508 $this->il_target = $a_target;
520 if ((substr($target, 0, 4) ==
"il__") && $a_insert_inst)
522 $target =
"il_".IL_INST_ID.
"_".substr($target, 4, strlen($target) - 4);
536 $this->il_type = $a_type;
557 $this->il_target_frame = $a_target_frame;
576 function draw(&$a_image, $a_col1, $a_col2, $a_close_poly =
true,
577 $a_x_ratio = 1, $a_y_ratio = 1)
583 $a_x_ratio, $a_y_ratio);
588 $a_x_ratio, $a_y_ratio);
593 $a_x_ratio, $a_y_ratio);
609 function drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
611 imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
612 imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
613 imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
614 imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
615 imageline($im, $x1, $y1, $x2, $y2, $c2);
631 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
632 $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
633 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
634 $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
635 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
636 $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
637 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
638 $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
672 for($i=0; $i<$anz-$p; $i++)
674 $this->
drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
675 $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
676 $c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
693 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
694 ($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
695 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
696 ($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
697 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
698 $c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
714 $coord_array = explode(
",", $c);
715 return (count($coord_array) / 2);