5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
38 $this->lng = $DIC->language();
39 $this->plugin_admin = $DIC[
"ilPluginAdmin"];
48 parent::setNode($a_node);
49 $this->plug_node = $a_node->first_child();
67 $this->plug_node = $this->dom->create_element(
"Plugged");
68 $this->plug_node = $this->node->append_child($this->plug_node);
69 $this->plug_node->set_attribute(
"PluginName", $a_plugin_name);
70 $this->plug_node->set_attribute(
"PluginVersion", $a_plugin_version);
80 if (!is_object($this->plug_node)) {
85 $children = $this->plug_node->child_nodes();
86 for (
$i=0;
$i<count($children);
$i++) {
87 $this->plug_node->remove_child($children[
$i]);
90 foreach ($a_properties as
$key => $value) {
91 $prop_node = $this->dom->create_element(
"PluggedProperty");
92 $prop_node = $this->plug_node->append_child($prop_node);
93 $prop_node->set_attribute(
"Name",
$key);
95 $prop_node->set_content($value);
107 $properties =
array();
109 if (is_object($this->plug_node)) {
111 $children = $this->plug_node->child_nodes();
112 for (
$i=0;
$i<count($children);
$i++) {
113 if ($children[
$i]->node_name() ==
"PluggedProperty") {
114 $properties[$children[
$i]->get_attribute(
"Name")] =
115 $children[
$i]->get_content();
130 if (!empty($a_version)) {
131 $this->plug_node->set_attribute(
"PluginVersion", $a_version);
133 if ($this->plug_node->has_attribute(
"PluginVersion")) {
134 $this->plug_node->remove_attribute(
"PluginVersion");
146 if (is_object($this->plug_node)) {
147 return $this->plug_node->get_attribute(
"PluginVersion");
158 if (!empty($a_name)) {
159 $this->plug_node->set_attribute(
"PluginName", $a_name);
161 if ($this->plug_node->has_attribute(
"PluginName")) {
162 $this->plug_node->remove_attribute(
"PluginName");
174 if (is_object($this->plug_node)) {
175 return $this->plug_node->get_attribute(
"PluginName");
189 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
192 $nodes = $xpath->query(
"//Plugged");
195 foreach ($nodes as
$node) {
196 $plugin_name = $node->getAttribute(
'PluginName');
197 $plugin_version = $node->getAttribute(
'PluginVersion');
199 if ($ilPluginAdmin->isActive(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name)) {
201 $plugin_obj = $ilPluginAdmin->getPluginObject(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name);
202 $plugin_obj->setPageObj($a_page);
204 $properties =
array();
206 foreach ($node->childNodes as $child) {
207 $properties[$child->getAttribute(
'Name')] = $child->nodeValue;
212 $plugin_obj->onClone($properties, $plugin_version);
214 foreach ($node->childNodes as $child) {
215 $node->removeChild($child);
217 foreach ($properties as
$name => $value) {
218 $child =
new DOMElement(
'PluggedProperty', $value);
219 $node->appendChild($child);
220 $child->setAttribute(
'Name',
$name);
236 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
238 $plugin_name = $a_node->getAttribute(
'PluginName');
239 $plugin_version = $a_node->getAttribute(
'PluginVersion');
241 if ($ilPluginAdmin->isActive(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name)) {
243 $plugin_obj = $ilPluginAdmin->getPluginObject(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name);
244 $plugin_obj->setPageObj($a_page);
246 $properties =
array();
248 foreach ($a_node->childNodes as $child) {
249 $properties[$child->getAttribute(
'Name')] = $child->nodeValue;
253 $plugin_obj->onDelete($properties, $plugin_version);
270 $start = strpos($a_html,
"{{{{{Plugged<pl");
272 if (is_int($start)) {
273 $end = strpos($a_html,
"}}}}}", $start);
278 $param = substr($a_html, $start + 5,
$end - $start - 5);
279 $param = str_replace(
' xmlns:xhtml="http://www.w3.org/1999/xhtml"',
"", $param);
280 $param = explode(
"<pl/>", $param);
282 $plugin_name = $param[1];
283 $plugin_version = $param[2];
284 $properties =
array();
286 for (
$i = 3;
$i < count($param);
$i+=2) {
287 $properties[$param[
$i]] = $param[
$i+1];
291 if ($a_mode ==
"edit") {
292 $plugin_html =
'<div class="ilBox">' .
$lng->txt(
"content_plugin_not_activated") .
" (" . $plugin_name .
")</div>";
294 if ($ilPluginAdmin->isActive(
IL_COMP_SERVICE,
"COPage",
"pgcp", $plugin_name)) {
295 $plugin_obj = $ilPluginAdmin->getPluginObject(
301 $plugin_obj->setPageObj($this->
getPage());
302 $gui_obj = $plugin_obj->getUIClassInstance();
303 $plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
306 $a_html = substr($a_html, 0, $start) .
308 substr($a_html,
$end + 5);
310 if (strlen($a_html) > $start + 5) {
311 $start = strpos($a_html,
"{{{{{Plugged<pl", $start + 5);
316 if (is_int($start)) {
317 $end = strpos($a_html,
"}}}}}", $start);
333 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
338 foreach ($pl_names as $pl_name) {
339 $plugin = $ilPluginAdmin->getPluginObject(
345 $plugin->setPageObj($this->
getPage());
346 $pl_dir = $plugin->getDirectory();
348 $pl_js_files = $plugin->getJavascriptFiles($a_mode);
349 foreach ($pl_js_files as $pl_js_file) {
350 if (!is_int(strpos($pl_js_file,
"//"))) {
351 $pl_js_file = $pl_dir .
"/" . $pl_js_file;
353 if (!in_array($pl_js_file, $js_files)) {
354 $js_files[] = $pl_js_file;
369 $css_files =
array();
371 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
376 foreach ($pl_names as $pl_name) {
377 $plugin = $ilPluginAdmin->getPluginObject(
383 $plugin->setPageObj($this->
getPage());
384 $pl_dir = $plugin->getDirectory();
386 $pl_css_files = $plugin->getCssFiles($a_mode);
387 foreach ($pl_css_files as $pl_css_file) {
388 if (!is_int(strpos($pl_css_file,
"//"))) {
389 $pl_css_file = $pl_dir .
"/" . $pl_css_file;
391 if (!in_array($pl_css_file, $css_files)) {
392 $css_files[] = $pl_css_file;
setProperties($a_properties)
Set properties of plugged component.
getCssFiles($a_mode)
Get css files.
create( $a_pg_obj, $a_hier_id, $a_pc_id, $a_plugin_name, $a_plugin_version)
Create plugged node in xml.
init()
Init page content component.
modifyPageContentPostXsl($a_html, $a_mode)
Modify page content after xsl.
getProperties()
Get properties of plugged component.
Class ilPCPlugged Plugged content object (see ILIAS DTD)
setType($a_type)
Set Type.
getPluginVersion()
Get version of plugged component.
setPluginVersion($a_version)
Set version of plugged component.
getPluginName()
Get name of plugged component.
setPluginName($a_name)
Set name of plugged component.
Create styles array
The data for the language used.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
getJavascriptFiles($a_mode)
Get javascript files.
setNode($a_node)
Set node.