ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCPlugged Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 init ()
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id, string $a_plugin_name, string $a_plugin_version)
 Create plugged node in xml. More...
 
 setProperties (array $a_properties)
 Set properties of plugged component. More...
 
 getProperties ()
 Get properties of plugged component. More...
 
 setPluginVersion (string $a_version)
 
 getPluginVersion ()
 
 setPluginName (string $a_name)
 
 getPluginName ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 getNewPageContentNode ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Protected Attributes

ilLanguage $lng
 
ilComponentRepository $component_repository = null
 
ilComponentFactory $component_factory = null
 
- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $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, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilPCPlugged Plugged content object (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ create()

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

Create plugged node in xml.

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

References ilPageContent\createInitialChildNode().

50  : void {
52  $a_hier_id,
53  $a_pc_id,
54  "Plugged",
55  ["PluginName" => $a_plugin_name, "PluginVersion" => $a_plugin_version]
56  );
57  }
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])
+ Here is the call graph for this function:

◆ getCssFiles()

ilPCPlugged::getCssFiles ( string  $a_mode)

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

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

373  : array
374  {
375  $css_files = array();
376 
377  foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
378  $plugin->setPageObj($this->getPage());
379  $pl_dir = $plugin->getDirectory();
380 
381  $pl_css_files = $plugin->getCssFiles($a_mode);
382  foreach ($pl_css_files as $pl_css_file) {
383  if (!is_int(strpos($pl_css_file, "//"))) {
384  $pl_css_file = $pl_dir . "/" . $pl_css_file;
385  }
386  if (!in_array($pl_css_file, $css_files)) {
387  $css_files[] = $pl_css_file;
388  }
389  }
390  }
391 
392  return $css_files;
393  }
+ Here is the call graph for this function:

◆ getJavascriptFiles()

ilPCPlugged::getJavascriptFiles ( string  $a_mode)

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

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

351  : array
352  {
353  $js_files = array();
354 
355  foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
356  $plugin->setPageObj($this->getPage());
357  $pl_dir = $plugin->getDirectory();
358 
359  $pl_js_files = $plugin->getJavascriptFiles($a_mode);
360  foreach ($pl_js_files as $pl_js_file) {
361  if (!is_int(strpos($pl_js_file, "//"))) {
362  $pl_js_file = $pl_dir . "/" . $pl_js_file;
363  }
364  if (!in_array($pl_js_file, $js_files)) {
365  $js_files[] = $pl_js_file;
366  }
367  }
368  }
369  //var_dump($js_files);
370  return $js_files;
371  }
+ Here is the call graph for this function:

◆ getPluginName()

ilPCPlugged::getPluginName ( )

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

References $DIC, ilPageContent\$dom_util, Vendor\Package\$e, ilPageContent\afterRepositoryCopy(), ilPageContent\getChildNode(), ilPageObject\getDomDoc(), ilComponentFactory\getPlugin(), ilComponentRepository\getPluginByName(), and null.

130  : string
131  {
132  if (is_object($this->getChildNode())) {
133  return $this->getChildNode()->getAttribute("PluginName");
134  }
135  return "";
136  }
+ Here is the call graph for this function:

◆ getPluginVersion()

ilPCPlugged::getPluginVersion ( )

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

References ilPageContent\getChildNode().

111  : string
112  {
113  if (is_object($this->getChildNode())) {
114  return $this->getChildNode()->getAttribute("PluginVersion");
115  }
116  return "";
117  }
+ Here is the call graph for this function:

◆ getProperties()

ilPCPlugged::getProperties ( )

Get properties of plugged component.

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

References $c, and ilPageContent\getChildNode().

84  : array
85  {
86  $properties = array();
87 
88  if (is_object($this->getChildNode())) {
89  foreach ($this->getChildNode()->childNodes as $c) {
90  if ($c->nodeName == "PluggedProperty") {
91  $properties[$c->getAttribute("Name")] =
92  $this->dom_util->getContent($c);
93  }
94  }
95  }
96 
97  return $properties;
98  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ init()

ilPCPlugged::init ( )

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

References $DIC, ILIAS\Repository\lng(), null, and ilPageContent\setType().

31  : void
32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  $this->setType("plug");
37  $this->component_repository = $DIC["component.repository"] ?? null;
38  $this->component_factory = $DIC["component.factory"] ?? null;
39  }
setType(string $a_type)
Set Type.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCPlugged::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

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

References $lng, $param, ilPageContent\getPage(), ILIAS\Repository\lng(), and ilLanguage\txt().

291  : string {
292  $lng = $this->lng;
293 
294  $end = 0;
295  $start = strpos($a_output, "{{{{{Plugged<pl");
296  //echo htmlentities($a_html)."-";
297  if (is_int($start)) {
298  $end = strpos($a_output, "}}}}}", $start);
299  }
300 
301  while ($end > 0) {
302  $param = substr($a_output, $start + 5, $end - $start - 5);
303  $param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
304  $param = explode("<pl/>", $param);
305  //var_dump($param); exit;
306  $plugin_name = $param[1];
307  $plugin_version = $param[2];
308  $properties = array();
309 
310  for ($i = 3; $i < count($param); $i += 2) {
311  $properties[$param[$i]] = $param[$i + 1];
312  }
313 
314  // get html from plugin
315  if ($a_mode == "edit") {
316  $plugin_html = '<div class="ilBox">' . $lng->txt("content_plugin_not_activated") . " (" . $plugin_name . ")</div>";
317  }
318 
319  $plugin_obj = self::getActivePluginByName($plugin_name);
320  $plugin_html = '';
321  if (is_object($plugin_obj)) {
322  $plugin_obj->setPageObj($this->getPage());
323  $gui_obj = $plugin_obj->getUIClassInstance();
324  $plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
325  } else {
326  if ($a_mode === "edit") {
327  $plugin_html = sprintf($this->lng->txt("copg_plugin_not_avail"), $plugin_name);
328  } else {
329  $plugin_html = " ";
330  }
331  }
332 
333  $a_output = substr($a_output, 0, $start) .
334  $plugin_html .
335  substr($a_output, $end + 5);
336 
337  if (strlen($a_output) > $start + 5) {
338  $start = strpos($a_output, "{{{{{Plugged<pl", $start + 5);
339  } else {
340  $start = false;
341  }
342  $end = 0;
343  if (is_int($start)) {
344  $end = strpos($a_output, "}}}}}", $start);
345  }
346  }
347 
348  return $a_output;
349  }
ilLanguage $lng
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$param
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ setPluginName()

ilPCPlugged::setPluginName ( string  $a_name)

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

References ilPageContent\getChildNode().

119  : void
120  {
121  if (!empty($a_name)) {
122  $this->getChildNode()->setAttribute("PluginName", $a_name);
123  } else {
124  if ($this->getChildNode()->hasAttribute("PluginName")) {
125  $this->getChildNode()->removeAttribute("PluginName");
126  }
127  }
128  }
+ Here is the call graph for this function:

◆ setPluginVersion()

ilPCPlugged::setPluginVersion ( string  $a_version)

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

References ilPageContent\getChildNode().

100  : void
101  {
102  if (!empty($a_version)) {
103  $this->getChildNode()->setAttribute("PluginVersion", $a_version);
104  } else {
105  if ($this->getChildNode()->hasAttribute("PluginVersion")) {
106  $this->getChildNode()->removeAttribute("PluginVersion");
107  }
108  }
109  }
+ Here is the call graph for this function:

◆ setProperties()

ilPCPlugged::setProperties ( array  $a_properties)

Set properties of plugged component.

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

References ilPageContent\getChildNode().

62  : void
63  {
64  if (!is_object($this->getChildNode())) {
65  return;
66  }
67 
68  // delete properties
69  $this->dom_util->deleteAllChilds($this->getChildNode());
70  // set properties
71  foreach ($a_properties as $key => $value) {
72  $prop_node = $this->dom_doc->createElement("PluggedProperty");
73  $prop_node = $this->getChildNode()->appendChild($prop_node);
74  $prop_node->setAttribute("Name", $key);
75  if ($value != "") {
76  $this->dom_util->setContent($prop_node, $value);
77  }
78  }
79  }
+ Here is the call graph for this function:

Field Documentation

◆ $component_factory

ilComponentFactory ilPCPlugged::$component_factory = null
protected

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

◆ $component_repository

ilComponentRepository ilPCPlugged::$component_repository = null
protected

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

◆ $lng

ilLanguage ilPCPlugged::$lng
protected

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

Referenced by modifyPageContentPostXsl().


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