24 require_once(
"./Services/COPage/classes/class.ilInternalLink.php");
26 define(
"IL_AREA_RECT",
"Rect");
27 define(
"IL_AREA_CIRCLE",
"Circle");
28 define(
"IL_AREA_POLY",
"Poly");
30 define(
"IL_INT_LINK",
"int");
31 define(
"IL_EXT_LINK",
"ext");
33 define(
"IL_LT_STRUCTURE",
"StructureObject");
34 define(
"IL_LT_PAGE",
"PageObject");
35 define(
"IL_LT_MEDIA",
"MediaObject");
36 define(
"IL_LT_GLITEM",
"GlossaryItem");
38 define(
"IL_TF_MEDIA",
"Media");
39 define(
"IL_TF_FAQ",
"FAQ");
40 define(
"IL_TF_GLOSSARY",
"Glossary");
41 define(
"IL_TF_NEW",
"New");
83 if ($a_item_id !=0 && $a_nr != 0)
98 $q =
"INSERT INTO map_area (item_id, nr, shape, ".
99 "coords, link_type, title, href, target, type, target_frame) ".
102 $ilDB->quote($this->
getNr()).
",".
103 $ilDB->quote($this->
getShape()).
",".
106 $ilDB->quote($this->
getTitle()).
",".
107 $ilDB->quote($this->
getHref()).
",".
109 $ilDB->quote($this->
getType()).
",".
125 $q =
"SELECT max(nr) AS max_nr FROM map_area WHERE item_id=".
126 $ilDB->quote($a_item_id);
127 $max_set = $ilDB->query($q);
130 return $max_rec[
"max_nr"];
140 $q =
"SELECT * FROM map_area WHERE item_id=".
142 " AND nr=".$ilDB->quote($this->
getNr());
143 $area_set = $ilDB->query($q);
146 $this->
setShape($area_rec[
"shape"]);
148 $this->
setNr($area_rec[
"nr"]);
151 $this->
setTitle($area_rec[
"title"]);
152 $this->
setHref($area_rec[
"href"]);
154 $this->
setType($area_rec[
"type"]);
165 $q =
"UPDATE map_area SET shape = ".$ilDB->quote($this->
getShape()).
166 ", coords = ".$ilDB->quote($this->
getCoords()).
167 ", link_type = ".$ilDB->quote($this->
getLinkType()).
168 ", title = ".$ilDB->quote($this->
getTitle()).
169 ", href = ".$ilDB->quote($this->
getHref()).
170 ", target = ".$ilDB->quote($this->
getTarget()).
171 ", type = ".$ilDB->quote($this->
getType()).
173 " WHERE item_id = ".$ilDB->quote($this->
getItemId()).
" AND nr = ".
174 $ilDB->quote($this->
getNr());
187 $q =
"SELECT * FROM map_area WHERE item_id=".$ilDB->quote($a_item_id);
188 $area_set = $ilDB->query($q);
191 $target = $area_rec[
"target"];
192 $type = $area_rec[
"type"];
194 $nr = $area_rec[
"nr"];
196 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (!is_int(strpos($target,
"__"))))
199 if ($new_target !==
false)
201 $query =
"UPDATE map_area SET target= ".$ilDB->quote($new_target).
" ".
202 "WHERE item_id= ".$ilDB->quote(
$item_id).
" AND nr=".$ilDB->quote(
$nr);
203 $ilDB->query($query);
218 $q =
"SELECT * FROM map_area WHERE item_id=".$ilDB->quote($a_item_id);
219 $area_set = $ilDB->query($q);
225 $target = $area_rec[
"target"];
226 $type = $area_rec[
"type"];
227 $targetframe = $area_rec[
"target_frame"];
229 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (is_int(strpos($target,
"__"))))
231 $links[$target.
":".$type.
":".$targetframe] =
232 array(
"Target" => $target,
"Type" => $type,
233 "TargetFrame" => $targetframe);
246 $q =
"SELECT * FROM map_area WHERE ".
247 " link_type = ".$ilDB->quote($a_type).
248 " AND target = ".$ilDB->quote($a_target);
249 $set = $ilDB->query($q);
255 $mobs[$mob_id] = $mob_id;
268 $this->item_id = $a_item_id;
308 $this->shape = $a_shape;
328 $this->coords = $a_coords;
348 $this->title = $a_title;
358 $this->title.= $a_title_str;
378 $this->linktype = $a_link_type;
398 $this->xl_href = $a_href;
418 $this->xl_title = $a_title;
438 $this->il_target = $a_target;
450 if ((substr($target, 0, 4) ==
"il__") && $a_insert_inst)
452 $target =
"il_".IL_INST_ID.
"_".substr($target, 4, strlen($target) - 4);
466 $this->il_type = $a_type;
487 $this->il_target_frame = $a_target_frame;
506 function draw(&$a_image, $a_col1, $a_col2, $a_close_poly =
true,
507 $a_x_ratio = 1, $a_y_ratio = 1)
513 $a_x_ratio, $a_y_ratio);
518 $a_x_ratio, $a_y_ratio);
523 $a_x_ratio, $a_y_ratio);
539 function drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
541 imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
542 imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
543 imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
544 imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
545 imageline($im, $x1, $y1, $x2, $y2, $c2);
561 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
562 $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
563 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
564 $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
565 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
566 $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
567 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
568 $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
602 for($i=0; $i<$anz-$p; $i++)
604 $this->
drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
605 $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
606 $c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
623 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
624 ($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
625 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
626 ($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
627 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
628 $c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
644 $coord_array = explode(
",", $c);
645 return (count($coord_array) / 2);