5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
35 $this->map_node =& $a_node->first_child();
44 function create(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
49 $this->map_node =& $this->dom->create_element(
"Map");
50 $this->map_node =& $this->node->append_child($this->map_node);
51 $this->map_node->set_attribute(
"Latitude",
"0");
52 $this->map_node->set_attribute(
"Longitude",
"0");
53 $this->map_node->set_attribute(
"Zoom",
"3");
65 $this->map_node->set_attribute(
"Latitude", $a_lat);
69 if ($this->map_node->has_attribute(
"Latitude"))
71 $this->map_node->remove_attribute(
"Latitude");
83 if (is_object($this->map_node))
85 return $this->map_node->get_attribute(
"Latitude");
98 $this->map_node->set_attribute(
"Longitude", $a_long);
102 if ($this->map_node->has_attribute(
"Longitude"))
104 $this->map_node->remove_attribute(
"Longitude");
116 if (is_object($this->map_node))
118 return $this->map_node->get_attribute(
"Longitude");
131 $this->map_node->set_attribute(
"Zoom", $a_zoom);
135 if ($this->map_node->has_attribute(
"Zoom"))
137 $this->map_node->remove_attribute(
"Zoom");
149 if (is_object($this->map_node))
151 return $this->map_node->get_attribute(
"Zoom");
162 function setLayout($a_width, $a_height, $a_horizontal_align)
164 if (is_object($this->map_node))
166 ilDomUtil::setFirstOptionalElement($this->dom, $this->map_node,
167 "Layout", array(
"MapCaption"),
"", array(
"Width" => $a_width,
168 "Height" => $a_height,
"HorizontalAlign" => $a_horizontal_align));
179 if (is_object($this->map_node))
181 $childs = $this->map_node->child_nodes();
182 foreach($childs as $child)
184 if ($child->node_name() ==
"Layout")
186 return $child->get_attribute(
"Width");
199 if (is_object($this->map_node))
201 $childs = $this->map_node->child_nodes();
202 foreach($childs as $child)
204 if ($child->node_name() ==
"Layout")
206 return $child->get_attribute(
"Height");
219 if (is_object($this->map_node))
221 $childs = $this->map_node->child_nodes();
222 foreach($childs as $child)
224 if ($child->node_name() ==
"Layout")
226 return $child->get_attribute(
"HorizontalAlign");
239 if (is_object($this->map_node))
241 ilDomUtil::setFirstOptionalElement($this->dom, $this->map_node,
242 "MapCaption", array(), $a_caption, array());
253 if (is_object($this->map_node))
255 $childs = $this->map_node->child_nodes();
256 foreach($childs as $child)
258 if ($child->node_name() ==
"MapCaption")
260 return $child->get_content();
268 $a_text = str_replace(chr(13).chr(10),
"<br />",$a_text);
269 $a_text = str_replace(chr(13),
"<br />", $a_text);
270 $a_text = str_replace(chr(10),
"<br />", $a_text);
277 $a_text = str_replace(
"<br />",
"\n", $a_text);
278 $a_text = str_replace(
"<br/>",
"\n", $a_text);
292 $start = strpos($a_html,
"[[[[[Map;");
295 $end = strpos($a_html,
"]]]]]", $start);
300 $param = substr($a_html, $start + 9, $end - $start - 9);
302 $param = explode(
";", $param);
303 if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2]))
305 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
307 $map_gui->setMapId(
"map_".$i)
308 ->setLatitude($param[0])
309 ->setLongitude($param[1])
311 ->setWidth($param[3].
"px")
312 ->setHeight($param[4].
"px")
313 ->setEnableTypeControl(
true)
314 ->setEnableNavigationControl(
true)
315 ->setEnableCentralMarker(
true);
316 $h2 = substr($a_html, 0, $start).
318 substr($a_html, $end + 5);
322 $start = strpos($a_html,
"[[[[[Map;", $start + 5);
326 $end = strpos($a_html,
"]]]]]", $start);