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");
10 define(
"IL_INT_LINK",
"int");
11 define(
"IL_EXT_LINK",
"ext");
13 define(
"IL_LT_STRUCTURE",
"StructureObject");
14 define(
"IL_LT_PAGE",
"PageObject");
15 define(
"IL_LT_MEDIA",
"MediaObject");
16 define(
"IL_LT_GLITEM",
"GlossaryItem");
18 define(
"IL_TF_MEDIA",
"Media");
19 define(
"IL_TF_FAQ",
"FAQ");
20 define(
"IL_TF_GLOSSARY",
"Glossary");
21 define(
"IL_TF_NEW",
"New");
63 if ($a_item_id !=0 && $a_nr != 0)
78 $q =
"INSERT INTO map_area (item_id, nr, shape, ".
79 "coords, link_type, title, href, target, type, target_frame) ".
81 $ilDB->quote($this->
getItemId(),
"integer").
",".
82 $ilDB->quote($this->
getNr(),
"integer").
",".
83 $ilDB->quote($this->
getShape(),
"text").
",".
84 $ilDB->quote($this->
getCoords(),
"text").
",".
86 $ilDB->quote($this->
getTitle(),
"text").
",".
87 $ilDB->quote($this->
getHref(),
"text").
",".
88 $ilDB->quote($this->
getTarget(),
"text").
",".
89 $ilDB->quote($this->
getType(),
"text").
",".
91 $ilDB->manipulate(
$q);
105 $q =
"SELECT max(nr) AS max_nr FROM map_area WHERE item_id = ".
106 $ilDB->quote($a_item_id,
"integer");
107 $max_set = $ilDB->query(
$q);
108 $max_rec = $ilDB->fetchAssoc($max_set);
110 return $max_rec[
"max_nr"];
120 $q =
"SELECT * FROM map_area WHERE item_id = ".
121 $ilDB->quote($this->
getItemId(),
"integer").
122 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
123 $area_set = $ilDB->query(
$q);
124 $area_rec = $ilDB->fetchAssoc($area_set);
126 $this->
setShape($area_rec[
"shape"]);
128 $this->
setNr($area_rec[
"nr"]);
131 $this->
setTitle($area_rec[
"title"]);
132 $this->
setHref($area_rec[
"href"]);
134 $this->
setType($area_rec[
"type"]);
145 $q =
"UPDATE map_area SET shape = ".$ilDB->quote($this->
getShape(),
"text").
146 ", coords = ".$ilDB->quote($this->
getCoords(),
"text").
147 ", link_type = ".$ilDB->quote($this->
getLinkType(),
"text").
148 ", title = ".$ilDB->quote($this->
getTitle(),
"text").
149 ", href = ".$ilDB->quote($this->
getHref(),
"text").
150 ", target = ".$ilDB->quote($this->
getTarget(),
"text").
151 ", type = ".$ilDB->quote($this->
getType(),
"text").
152 ", target_frame = ".$ilDB->quote($this->
getTargetFrame(),
"text").
153 " WHERE item_id = ".$ilDB->quote($this->
getItemId(),
"integer").
154 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
155 $ilDB->manipulate(
$q);
166 $q =
"SELECT * FROM map_area WHERE item_id = ".
167 $ilDB->quote($a_item_id,
"integer");
168 $area_set = $ilDB->query(
$q);
169 while ($area_rec = $ilDB->fetchAssoc($area_set))
171 $target = $area_rec[
"target"];
172 $type = $area_rec[
"type"];
174 $nr = $area_rec[
"nr"];
176 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (!is_int(strpos($target,
"__"))))
179 if ($new_target !==
false)
181 $query =
"UPDATE map_area SET ".
182 "target = ".$ilDB->quote($new_target,
"text").
" ".
183 "WHERE item_id = ".$ilDB->quote(
$item_id,
"integer").
184 " AND nr = ".$ilDB->quote(
$nr,
"integer");
185 $ilDB->manipulate(
$query);
200 $q =
"SELECT * FROM map_area WHERE item_id = ".
201 $ilDB->quote($a_item_id,
"integer");
202 $area_set = $ilDB->query(
$q);
206 while ($area_rec = $ilDB->fetchAssoc($area_set))
208 $target = $area_rec[
"target"];
209 $type = $area_rec[
"type"];
210 $targetframe = $area_rec[
"target_frame"];
212 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (is_int(strpos($target,
"__"))))
214 $links[$target.
":".
$type.
":".$targetframe] =
215 array(
"Target" => $target,
"Type" =>
$type,
216 "TargetFrame" => $targetframe);
229 $q =
"SELECT * FROM map_area WHERE ".
230 " link_type = ".$ilDB->quote($a_type,
"text").
231 " AND target = ".$ilDB->quote($a_target,
"text");
232 $set = $ilDB->query(
$q);
235 while($rec = $ilDB->fetchAssoc($set))
238 $mobs[$mob_id] = $mob_id;
251 $this->item_id = $a_item_id;
291 $this->shape = $a_shape;
311 $this->coords = $a_coords;
331 $this->title = $a_title;
341 $this->title.= $a_title_str;
361 $this->linktype = $a_link_type;
381 $this->xl_href = $a_href;
401 $this->xl_title = $a_title;
421 $this->il_target = $a_target;
433 if ((substr($target, 0, 4) ==
"il__") && $a_insert_inst)
435 $target =
"il_".IL_INST_ID.
"_".substr($target, 4, strlen($target) - 4);
449 $this->il_type = $a_type;
470 $this->il_target_frame = $a_target_frame;
489 function draw(&$a_image, $a_col1, $a_col2, $a_close_poly =
true,
490 $a_x_ratio = 1, $a_y_ratio = 1)
496 $a_x_ratio, $a_y_ratio);
501 $a_x_ratio, $a_y_ratio);
506 $a_x_ratio, $a_y_ratio);
522 function drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
524 imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
525 imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
526 imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
527 imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
528 imageline($im, $x1, $y1, $x2, $y2, $c2);
544 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
545 $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
546 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
547 $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
548 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
549 $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
550 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
551 $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
585 for($i=0; $i<$anz-$p; $i++)
587 $this->
drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
588 $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
589 $c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
606 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
607 ($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
608 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
609 ($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
610 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
611 $c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
627 $coord_array = explode(
",", $c);
628 return (count($coord_array) / 2);