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");
14 define(
"IL_LT_STRUCTURE",
"StructureObject");
15 define(
"IL_LT_PAGE",
"PageObject");
16 define(
"IL_LT_MEDIA",
"MediaObject");
17 define(
"IL_LT_GLITEM",
"GlossaryItem");
19 define(
"IL_TF_MEDIA",
"Media");
20 define(
"IL_TF_FAQ",
"FAQ");
21 define(
"IL_TF_GLOSSARY",
"Glossary");
22 define(
"IL_TF_NEW",
"New");
59 if ($a_item_id !=0 && $a_nr != 0)
74 $q =
"INSERT INTO map_area (item_id, nr, shape, ".
75 "coords, link_type, title, href, target, type, target_frame) ".
77 $ilDB->quote($this->
getItemId(),
"integer").
",".
78 $ilDB->quote($this->
getNr(),
"integer").
",".
79 $ilDB->quote($this->
getShape(),
"text").
",".
80 $ilDB->quote($this->
getCoords(),
"text").
",".
82 $ilDB->quote($this->
getTitle(),
"text").
",".
83 $ilDB->quote($this->
getHref(),
"text").
",".
84 $ilDB->quote($this->
getTarget(),
"text").
",".
85 $ilDB->quote($this->
getType(),
"text").
",".
87 $ilDB->manipulate($q);
101 $q =
"SELECT max(nr) AS max_nr FROM map_area WHERE item_id = ".
102 $ilDB->quote($a_item_id,
"integer");
103 $max_set = $ilDB->query($q);
104 $max_rec = $ilDB->fetchAssoc($max_set);
106 return $max_rec[
"max_nr"];
116 $q =
"SELECT * FROM map_area WHERE item_id = ".
117 $ilDB->quote($this->
getItemId(),
"integer").
118 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
119 $area_set = $ilDB->query($q);
120 $area_rec = $ilDB->fetchAssoc($area_set);
122 $this->
setShape($area_rec[
"shape"]);
124 $this->
setNr($area_rec[
"nr"]);
127 $this->
setTitle($area_rec[
"title"]);
128 $this->
setHref($area_rec[
"href"]);
130 $this->
setType($area_rec[
"type"]);
141 $q =
"UPDATE map_area SET shape = ".$ilDB->quote($this->
getShape(),
"text").
142 ", coords = ".$ilDB->quote($this->
getCoords(),
"text").
143 ", link_type = ".$ilDB->quote($this->
getLinkType(),
"text").
144 ", title = ".$ilDB->quote($this->
getTitle(),
"text").
145 ", href = ".$ilDB->quote($this->
getHref(),
"text").
146 ", target = ".$ilDB->quote($this->
getTarget(),
"text").
147 ", type = ".$ilDB->quote($this->
getType(),
"text").
148 ", target_frame = ".$ilDB->quote($this->
getTargetFrame(),
"text").
149 " WHERE item_id = ".$ilDB->quote($this->
getItemId(),
"integer").
150 " AND nr = ".$ilDB->quote($this->
getNr(),
"integer");
151 $ilDB->manipulate($q);
162 $q =
"SELECT * FROM map_area WHERE item_id = ".
163 $ilDB->quote($a_item_id,
"integer");
164 $area_set = $ilDB->query($q);
165 while ($area_rec = $ilDB->fetchAssoc($area_set))
167 $target = $area_rec[
"target"];
168 $type = $area_rec[
"type"];
170 $nr = $area_rec[
"nr"];
172 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (!is_int(strpos($target,
"__"))))
175 if ($new_target !==
false)
177 $query =
"UPDATE map_area SET ".
178 "target = ".$ilDB->quote($new_target,
"text").
" ".
179 "WHERE item_id = ".$ilDB->quote(
$item_id,
"integer").
180 " AND nr = ".$ilDB->quote(
$nr,
"integer");
181 $ilDB->manipulate(
$query);
196 $q =
"SELECT * FROM map_area WHERE item_id = ".
197 $ilDB->quote($a_item_id,
"integer");
198 $area_set = $ilDB->query($q);
202 while ($area_rec = $ilDB->fetchAssoc($area_set))
204 $target = $area_rec[
"target"];
205 $type = $area_rec[
"type"];
206 $targetframe = $area_rec[
"target_frame"];
208 if (($area_rec[
"link_type"] ==
IL_INT_LINK) && (is_int(strpos($target,
"__"))))
210 $links[$target.
":".
$type.
":".$targetframe] =
211 array(
"Target" => $target,
"Type" =>
$type,
212 "TargetFrame" => $targetframe);
225 $q =
"SELECT * FROM map_area WHERE ".
226 " link_type = ".$ilDB->quote($a_type,
"text").
227 " AND target = ".$ilDB->quote($a_target,
"text");
228 $set = $ilDB->query($q);
231 while($rec = $ilDB->fetchAssoc($set))
234 $mobs[$mob_id] = $mob_id;
247 $this->item_id = $a_item_id;
287 $this->shape = $a_shape;
307 $this->coords = $a_coords;
327 $this->title = $a_title;
337 $this->title.= $a_title_str;
357 $this->linktype = $a_link_type;
377 $this->xl_href = $a_href;
397 $this->xl_title = $a_title;
417 $this->il_target = $a_target;
429 if ((substr($target, 0, 4) ==
"il__") && $a_insert_inst)
431 $target =
"il_".IL_INST_ID.
"_".substr($target, 4, strlen($target) - 4);
445 $this->il_type = $a_type;
466 $this->il_target_frame = $a_target_frame;
485 function draw(&$a_image, $a_col1, $a_col2, $a_close_poly =
true,
486 $a_x_ratio = 1, $a_y_ratio = 1)
492 $a_x_ratio, $a_y_ratio);
497 $a_x_ratio, $a_y_ratio);
502 $a_x_ratio, $a_y_ratio);
518 function drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
520 imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
521 imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
522 imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
523 imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
524 imageline($im, $x1, $y1, $x2, $y2, $c2);
540 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
541 $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
542 $this->
drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
543 $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
544 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
545 $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
546 $this->
drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
547 $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
581 for($i=0; $i<$anz-$p; $i++)
583 $this->
drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
584 $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
585 $c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
602 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
603 ($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
604 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
605 ($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
606 imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
607 $c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
623 $coord_array = explode(
",", $c);
624 return (count($coord_array) / 2);