ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilPCPlugged Class Reference

Class ilPCPlugged Plugged content object (see ILIAS DTD) More...

+ Inheritance diagram for ilPCPlugged:
+ Collaboration diagram for ilPCPlugged:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set node. More...
 
 create ( $a_pg_obj, $a_hier_id, $a_pc_id, $a_plugin_name, $a_plugin_version)
 Create plugged node in xml. More...
 
 setProperties ($a_properties)
 Set properties of plugged component. More...
 
 getProperties ()
 Get properties of plugged component. More...
 
 setPluginVersion ($a_version)
 Set version of plugged component. More...
 
 getPluginVersion ()
 Get version of plugged component. More...
 
 setPluginName ($a_name)
 Set name of plugged component. More...
 
 getPluginName ()
 Get name of plugged component. More...
 
 modifyPageContentPostXsl ($a_html, $a_mode, $a_abstract_only=false)
 @inheritDoc More...
 
 getJavascriptFiles ($a_mode)
 Get javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode, $a_abstract_only=false)
 Modify page content after xsl. More...
 

Data Fields

 $dom
 
 $plug_node
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Protected Attributes

 $lng
 
 $plugin_admin
 
- Protected Attributes inherited from ilPageContent
 $profile_back_url
 
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Detailed Description

Class ilPCPlugged Plugged content object (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilPCPlugged.php.

Member Function Documentation

◆ create()

ilPCPlugged::create (   $a_pg_obj,
  $a_hier_id,
  $a_pc_id,
  $a_plugin_name,
  $a_plugin_version 
)

Create plugged node in xml.

Parameters
object$a_pg_objPage Object
string$a_hier_idHierarchical ID

Definition at line 58 of file class.ilPCPlugged.php.

64 {
65 $this->node = $this->createPageContentNode();
66 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
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);
71 }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

+ Here is the call graph for this function:

◆ getCssFiles()

ilPCPlugged::getCssFiles (   $a_mode)

Get css files.

Reimplemented from ilPageContent.

Definition at line 362 of file class.ilPCPlugged.php.

363 {
364 $ilPluginAdmin = $this->plugin_admin;
365
366 $css_files = array();
367
368 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
370 "COPage",
371 "pgcp"
372 );
373 foreach ($pl_names as $pl_name) {
374 $plugin = $ilPluginAdmin->getPluginObject(
376 "COPage",
377 "pgcp",
378 $pl_name
379 );
380 $plugin->setPageObj($this->getPage());
381 $pl_dir = $plugin->getDirectory();
382
383 $pl_css_files = $plugin->getCssFiles($a_mode);
384 foreach ($pl_css_files as $pl_css_file) {
385 if (!is_int(strpos($pl_css_file, "//"))) {
386 $pl_css_file = $pl_dir . "/" . $pl_css_file;
387 }
388 if (!in_array($pl_css_file, $css_files)) {
389 $css_files[] = $pl_css_file;
390 }
391 }
392 }
393
394 return $css_files;
395 }
const IL_COMP_SERVICE

References XapiProxy\$plugin, $plugin_admin, ilPageContent\getPage(), and IL_COMP_SERVICE.

+ Here is the call graph for this function:

◆ getJavascriptFiles()

ilPCPlugged::getJavascriptFiles (   $a_mode)

Get javascript files.

Reimplemented from ilPageContent.

Definition at line 324 of file class.ilPCPlugged.php.

325 {
326 $ilPluginAdmin = $this->plugin_admin;
327
328 $js_files = array();
329
330 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
332 "COPage",
333 "pgcp"
334 );
335 foreach ($pl_names as $pl_name) {
336 $plugin = $ilPluginAdmin->getPluginObject(
338 "COPage",
339 "pgcp",
340 $pl_name
341 );
342 $plugin->setPageObj($this->getPage());
343 $pl_dir = $plugin->getDirectory();
344
345 $pl_js_files = $plugin->getJavascriptFiles($a_mode);
346 foreach ($pl_js_files as $pl_js_file) {
347 if (!is_int(strpos($pl_js_file, "//"))) {
348 $pl_js_file = $pl_dir . "/" . $pl_js_file;
349 }
350 if (!in_array($pl_js_file, $js_files)) {
351 $js_files[] = $pl_js_file;
352 }
353 }
354 }
355 //var_dump($js_files);
356 return $js_files;
357 }

References XapiProxy\$plugin, $plugin_admin, ilPageContent\getPage(), and IL_COMP_SERVICE.

+ Here is the call graph for this function:

◆ getPluginName()

ilPCPlugged::getPluginName ( )

Get name of plugged component.

Returns
string name

Definition at line 172 of file class.ilPCPlugged.php.

173 {
174 if (is_object($this->plug_node)) {
175 return $this->plug_node->get_attribute("PluginName");
176 }
177 }

◆ getPluginVersion()

ilPCPlugged::getPluginVersion ( )

Get version of plugged component.

Returns
string version

Definition at line 144 of file class.ilPCPlugged.php.

145 {
146 if (is_object($this->plug_node)) {
147 return $this->plug_node->get_attribute("PluginVersion");
148 }
149 }

◆ getProperties()

ilPCPlugged::getProperties ( )

Get properties of plugged component.

Returns
string characteristic

Definition at line 105 of file class.ilPCPlugged.php.

106 {
107 $properties = array();
108
109 if (is_object($this->plug_node)) {
110 // delete properties
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();
116 }
117 }
118 }
119
120 return $properties;
121 }
$i
Definition: metadata.php:24

References $i.

◆ init()

ilPCPlugged::init ( )

Init page content component.

Reimplemented from ilPageContent.

Definition at line 34 of file class.ilPCPlugged.php.

35 {
36 global $DIC;
37
38 $this->lng = $DIC->language();
39 $this->plugin_admin = $DIC["ilPluginAdmin"];
40 $this->setType("plug");
41 }
setType($a_type)
Set Type.
$DIC
Definition: xapitoken.php:46

References $DIC, and ilPageContent\setType().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCPlugged::modifyPageContentPostXsl (   $a_html,
  $a_mode,
  $a_abstract_only = false 
)

@inheritDoc

Reimplemented from ilPageContent.

Definition at line 261 of file class.ilPCPlugged.php.

262 {
264 $ilPluginAdmin = $this->plugin_admin;
265
266 $c_pos = 0;
267 $start = strpos($a_html, "{{{{{Plugged<pl");
268 //echo htmlentities($a_html)."-";
269 if (is_int($start)) {
270 $end = strpos($a_html, "}}}}}", $start);
271 }
272 $i = 1;
273
274 while ($end > 0) {
275 $param = substr($a_html, $start + 5, $end - $start - 5);
276 $param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
277 $param = explode("<pl/>", $param);
278 //var_dump($param); exit;
279 $plugin_name = $param[1];
280 $plugin_version = $param[2];
281 $properties = array();
282
283 for ($i = 3; $i < count($param); $i += 2) {
284 $properties[$param[$i]] = $param[$i + 1];
285 }
286
287 // get html from plugin
288 if ($a_mode == "edit") {
289 $plugin_html = '<div class="ilBox">' . $lng->txt("content_plugin_not_activated") . " (" . $plugin_name . ")</div>";
290 }
291 if ($ilPluginAdmin->isActive(IL_COMP_SERVICE, "COPage", "pgcp", $plugin_name)) {
292 $plugin_obj = $ilPluginAdmin->getPluginObject(
294 "COPage",
295 "pgcp",
296 $plugin_name
297 );
298 $plugin_obj->setPageObj($this->getPage());
299 $gui_obj = $plugin_obj->getUIClassInstance();
300 $plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
301 }
302
303 $a_html = substr($a_html, 0, $start) .
304 $plugin_html .
305 substr($a_html, $end + 5);
306
307 if (strlen($a_html) > $start + 5) {
308 $start = strpos($a_html, "{{{{{Plugged<pl", $start + 5);
309 } else {
310 $start = false;
311 }
312 $end = 0;
313 if (is_int($start)) {
314 $end = strpos($a_html, "}}}}}", $start);
315 }
316 }
317
318 return $a_html;
319 }
$param
Definition: xapitoken.php:31

References $i, $lng, $param, $plugin_admin, ilPageContent\getPage(), and IL_COMP_SERVICE.

+ Here is the call graph for this function:

◆ setNode()

ilPCPlugged::setNode (   $a_node)

Set node.

Reimplemented from ilPageContent.

Definition at line 46 of file class.ilPCPlugged.php.

47 {
48 parent::setNode($a_node); // this is the PageContent node
49 $this->plug_node = $a_node->first_child(); // this is the Plugged node
50 }

◆ setPluginName()

ilPCPlugged::setPluginName (   $a_name)

Set name of plugged component.

Parameters
string$a_namename

Definition at line 156 of file class.ilPCPlugged.php.

157 {
158 if (!empty($a_name)) {
159 $this->plug_node->set_attribute("PluginName", $a_name);
160 } else {
161 if ($this->plug_node->has_attribute("PluginName")) {
162 $this->plug_node->remove_attribute("PluginName");
163 }
164 }
165 }

◆ setPluginVersion()

ilPCPlugged::setPluginVersion (   $a_version)

Set version of plugged component.

Parameters
string$a_versionversion

Definition at line 128 of file class.ilPCPlugged.php.

129 {
130 if (!empty($a_version)) {
131 $this->plug_node->set_attribute("PluginVersion", $a_version);
132 } else {
133 if ($this->plug_node->has_attribute("PluginVersion")) {
134 $this->plug_node->remove_attribute("PluginVersion");
135 }
136 }
137 }

◆ setProperties()

ilPCPlugged::setProperties (   $a_properties)

Set properties of plugged component.

Parameters
array$a_propertiescomponent properties

Definition at line 78 of file class.ilPCPlugged.php.

79 {
80 if (!is_object($this->plug_node)) {
81 return;
82 }
83
84 // delete properties
85 $children = $this->plug_node->child_nodes();
86 for ($i = 0; $i < count($children); $i++) {
87 $this->plug_node->remove_child($children[$i]);
88 }
89 // set properties
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);
94 if ($value != "") {
95 $prop_node->set_content($value);
96 }
97 }
98 }

References $i.

Field Documentation

◆ $dom

ilPCPlugged::$dom

Definition at line 28 of file class.ilPCPlugged.php.

◆ $lng

ilPCPlugged::$lng
protected

Definition at line 21 of file class.ilPCPlugged.php.

Referenced by modifyPageContentPostXsl().

◆ $plug_node

ilPCPlugged::$plug_node

Definition at line 29 of file class.ilPCPlugged.php.

◆ $plugin_admin

ilPCPlugged::$plugin_admin
protected

Definition at line 26 of file class.ilPCPlugged.php.

Referenced by getCssFiles(), getJavascriptFiles(), and modifyPageContentPostXsl().


The documentation for this class was generated from the following file: