ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 Modify page content after xsl. More...
 
 getJavascriptFiles ()
 Get javascript files. More...
 
 getCssFiles ()
 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 ()
 Get Javascript files. More...
 
 getCssFiles ()
 Get css files. More...
 
 getOnloadCode ()
 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...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. 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)
 Modify page content after xsl. More...
 

Data Fields

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

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 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 44 of file class.ilPCPlugged.php.

46 {
47 $this->node = $this->createPageContentNode();
48 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
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);
53 }
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 ( )

Get css files.

Reimplemented from ilPageContent.

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

285 {
286 global $ilPluginAdmin;
287
288 $css_files = array();
289
290 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
291 "COPage", "pgcp");
292 foreach ($pl_names as $pl_name)
293 {
294 $plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
295 "COPage", "pgcp", $pl_name);
296 $pl_dir = $plugin->getDirectory();
297
298 $pl_css_files = $plugin->getCssFiles();
299 foreach ($pl_css_files as $pl_css_file)
300 {
301 if (!is_int(strpos($pl_css_file, "//")))
302 {
303 $pl_css_file = $pl_dir."/".$pl_css_file;
304 }
305 if (!in_array($pl_css_file, $css_files))
306 {
307 $css_files[] = $pl_css_file;
308 }
309 }
310 }
311
312 return $css_files;
313 }
const IL_COMP_SERVICE

References IL_COMP_SERVICE.

◆ getJavascriptFiles()

ilPCPlugged::getJavascriptFiles ( )

Get javascript files.

Reimplemented from ilPageContent.

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

251 {
252 global $ilPluginAdmin;
253
254 $js_files = array();
255
256 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
257 "COPage", "pgcp");
258 foreach ($pl_names as $pl_name)
259 {
260 $plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
261 "COPage", "pgcp", $pl_name);
262 $pl_dir = $plugin->getDirectory();
263
264 $pl_js_files = $plugin->getJavascriptFiles();
265 foreach ($pl_js_files as $pl_js_file)
266 {
267 if (!is_int(strpos($pl_js_file, "//")))
268 {
269 $pl_js_file = $pl_dir."/".$pl_js_file;
270 }
271 if (!in_array($pl_js_file, $js_files))
272 {
273 $js_files[] = $pl_js_file;
274 }
275 }
276 }
277//var_dump($js_files);
278 return $js_files;
279 }

References IL_COMP_SERVICE.

◆ getPluginName()

ilPCPlugged::getPluginName ( )

Get name of plugged component.

Returns
string name

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

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

◆ getPluginVersion()

ilPCPlugged::getPluginVersion ( )

Get version of plugged component.

Returns
string version

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

138 {
139 if (is_object($this->plug_node))
140 {
141 return $this->plug_node->get_attribute("PluginVersion");
142 }
143 }

◆ getProperties()

ilPCPlugged::getProperties ( )

Get properties of plugged component.

Returns
string characteristic

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

92 {
93 $properties = array();
94
95 if (is_object($this->plug_node))
96 {
97 // delete properties
98 $children = $this->plug_node->child_nodes();
99 for($i=0; $i<count($children); $i++)
100 {
101 if ($children[$i]->node_name() == "PluggedProperty")
102 {
103 $properties[$children[$i]->get_attribute("Name")] =
104 $children[$i]->get_content();
105 }
106 }
107 }
108
109 return $properties;
110 }

◆ init()

ilPCPlugged::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

25 {
26 $this->setType("plug");
27 }
setType($a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCPlugged::modifyPageContentPostXsl (   $a_html,
  $a_mode 
)

Modify page content after xsl.

Parameters
string$a_output
Returns
string

Reimplemented from ilPageContent.

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

185 {
186 global $lng, $ilPluginAdmin;
187
188 $c_pos = 0;
189 $start = strpos($a_html, "{{{{{Plugged<pl");
190//echo htmlentities($a_html)."-";
191 if (is_int($start))
192 {
193 $end = strpos($a_html, "}}}}}", $start);
194 }
195 $i = 1;
196
197 while ($end > 0)
198 {
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);
202//var_dump($param); exit;
203 $plugin_name = $param[1];
204 $plugin_version = $param[2];
205 $properties = array();
206
207 for ($i = 3; $i < count($param); $i+=2)
208 {
209 $properties[$param[$i]] = $param[$i+1];
210 }
211
212 // get html from plugin
213 if ($a_mode == "edit")
214 {
215 $plugin_html = '<div class="ilBox">'.$lng->txt("content_plugin_not_activated")." (".$plugin_name.")</div>";
216 }
217 if ($ilPluginAdmin->isActive(IL_COMP_SERVICE, "COPage", "pgcp", $plugin_name))
218 {
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);
223 }
224
225 $a_html = substr($a_html, 0, $start).
226 $plugin_html.
227 substr($a_html, $end + 5);
228
229 if (strlen($a_html) > $start + 5)
230 {
231 $start = strpos($a_html, "{{{{{Plugged<pl", $start + 5);
232 }
233 else
234 {
235 $start = false;
236 }
237 $end = 0;
238 if (is_int($start))
239 {
240 $end = strpos($a_html, "}}}}}", $start);
241 }
242 }
243
244 return $a_html;
245 }
global $lng
Definition: privfeed.php:40

References $lng, and IL_COMP_SERVICE.

◆ setNode()

ilPCPlugged::setNode ( $a_node)

Set node.

Reimplemented from ilPageContent.

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

33 {
34 parent::setNode($a_node); // this is the PageContent node
35 $this->plug_node =& $a_node->first_child(); // this is the Plugged node
36 }

◆ setPluginName()

ilPCPlugged::setPluginName (   $a_name)

Set name of plugged component.

Parameters
string$a_namename

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

151 {
152 if (!empty($a_name))
153 {
154 $this->plug_node->set_attribute("PluginName", $a_name);
155 }
156 else
157 {
158 if ($this->plug_node->has_attribute("PluginName"))
159 {
160 $this->plug_node->remove_attribute("PluginName");
161 }
162 }
163 }

◆ setPluginVersion()

ilPCPlugged::setPluginVersion (   $a_version)

Set version of plugged component.

Parameters
string$a_versionversion

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

118 {
119 if (!empty($a_version))
120 {
121 $this->plug_node->set_attribute("PluginVersion", $a_version);
122 }
123 else
124 {
125 if ($this->plug_node->has_attribute("PluginVersion"))
126 {
127 $this->plug_node->remove_attribute("PluginVersion");
128 }
129 }
130 }

◆ setProperties()

ilPCPlugged::setProperties (   $a_properties)

Set properties of plugged component.

Parameters
array$a_propertiescomponent properties

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

61 {
62 if (!is_object($this->plug_node))
63 {
64 return;
65 }
66
67 // delete properties
68 $children = $this->plug_node->child_nodes();
69 for($i=0; $i<count($children); $i++)
70 {
71 $this->plug_node->remove_child($children[$i]);
72 }
73 // set properties
74 foreach($a_properties as $key => $value)
75 {
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);
79 if ($value != "")
80 {
81 $prop_node->set_content($value);
82 }
83 }
84 }

Field Documentation

◆ $dom

ilPCPlugged::$dom

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

◆ $plug_node

ilPCPlugged::$plug_node

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


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