5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
35 $this->plug_node =& $a_node->first_child();
44 function create($a_pg_obj, $a_hier_id, $a_pc_id, $a_plugin_name,
49 $this->plug_node =& $this->dom->create_element(
"Plugged");
50 $this->plug_node =& $this->node->append_child($this->plug_node);
51 $this->plug_node->set_attribute(
"PluginName", $a_plugin_name);
52 $this->plug_node->set_attribute(
"PluginVersion", $a_plugin_version);
62 if (!is_object($this->plug_node))
68 $children = $this->plug_node->child_nodes();
69 for($i=0; $i<count($children); $i++)
71 $this->plug_node->remove_child($children[$i]);
74 foreach($a_properties as $key => $value)
76 $prop_node = $this->dom->create_element(
"PluggedProperty");
77 $prop_node = $this->plug_node->append_child($prop_node);
78 $prop_node->set_attribute(
"Name", $key);
81 $prop_node->set_content($value);
93 $properties = array();
95 if (is_object($this->plug_node))
98 $children = $this->plug_node->child_nodes();
99 for($i=0; $i<count($children); $i++)
101 if ($children[$i]->node_name() ==
"PluggedProperty")
103 $properties[$children[$i]->get_attribute(
"Name")] =
104 $children[$i]->get_content();
119 if (!empty($a_version))
121 $this->plug_node->set_attribute(
"PluginVersion", $a_version);
125 if ($this->plug_node->has_attribute(
"PluginVersion"))
127 $this->plug_node->remove_attribute(
"PluginVersion");
139 if (is_object($this->plug_node))
141 return $this->plug_node->get_attribute(
"PluginVersion");
154 $this->plug_node->set_attribute(
"PluginName", $a_name);
158 if ($this->plug_node->has_attribute(
"PluginName"))
160 $this->plug_node->remove_attribute(
"PluginName");
172 if (is_object($this->plug_node))
174 return $this->plug_node->get_attribute(
"PluginName");
186 global
$lng, $ilPluginAdmin;
189 $start = strpos($a_html,
"{{{{{Plugged<pl");
193 $end = strpos($a_html,
"}}}}}", $start);
199 $param = substr($a_html, $start + 5, $end - $start - 5);
200 $param = str_replace(
' xmlns:xhtml="http://www.w3.org/1999/xhtml"',
"", $param);
201 $param = explode(
"<pl/>", $param);
203 $plugin_name = $param[1];
204 $plugin_version = $param[2];
205 $properties = array();
207 for ($i = 3; $i < count($param); $i+=2)
209 $properties[$param[$i]] = $param[$i+1];
213 if ($a_mode ==
"edit")
215 $plugin_html =
'<div class="ilBox">'.$lng->txt(
"content_plugin_not_activated").
" (".$plugin_name.
")</div>";
217 if ($ilPluginAdmin->isActive(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name))
219 $plugin_obj = $ilPluginAdmin->getPluginObject(
IL_COMP_SERVICE,
"COPage",
220 "pgcp", $plugin_name);
221 $gui_obj = $plugin_obj->getUIClassInstance();
222 $plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
225 $a_html = substr($a_html, 0, $start).
227 substr($a_html, $end + 5);
229 if (strlen($a_html) > $start + 5)
231 $start = strpos($a_html,
"{{{{{Plugged<pl", $start + 5);
240 $end = strpos($a_html,
"}}}}}", $start);
252 global $ilPluginAdmin;
258 foreach ($pl_names as $pl_name)
261 "COPage",
"pgcp", $pl_name);
262 $pl_dir = $plugin->getDirectory();
264 $pl_js_files = $plugin->getJavascriptFiles();
265 foreach ($pl_js_files as $pl_js_file)
267 if (!is_int(strpos($pl_js_file,
"//")))
269 $pl_js_file = $pl_dir.
"/".$pl_js_file;
271 if (!in_array($pl_js_file, $js_files))
273 $js_files[] = $pl_js_file;
286 global $ilPluginAdmin;
288 $css_files = array();
292 foreach ($pl_names as $pl_name)
295 "COPage",
"pgcp", $pl_name);
296 $pl_dir = $plugin->getDirectory();
298 $pl_css_files = $plugin->getCssFiles();
299 foreach ($pl_css_files as $pl_css_file)
301 if (!is_int(strpos($pl_css_file,
"//")))
303 $pl_css_file = $pl_dir.
"/".$pl_css_file;
305 if (!in_array($pl_css_file, $css_files))
307 $css_files[] = $pl_css_file;