ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables 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 ()
 
 setNode (php4DOMElement $a_node)
 
 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)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 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...
 
 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...
 

Data Fields

php4DOMElement $plug_node
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 

Protected Attributes

ilLanguage $lng
 
ilComponentRepository $component_repository
 
ilComponentFactory $component_factory
 
- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static incEdId (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
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...
 
- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 

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

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

57  : void {
58  $this->node = $this->createPageContentNode();
59  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
60  $this->plug_node = $this->dom->create_element("Plugged");
61  $this->plug_node = $this->node->append_child($this->plug_node);
62  $this->plug_node->set_attribute("PluginName", $a_plugin_name);
63  $this->plug_node->set_attribute("PluginVersion", $a_plugin_version);
64  }
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
const IL_INSERT_AFTER
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ Here is the call graph for this function:

◆ getCssFiles()

ilPCPlugged::getCssFiles ( string  $a_mode)

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

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

383  : array
384  {
385  $css_files = array();
386 
387  foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
388  $plugin->setPageObj($this->getPage());
389  $pl_dir = $plugin->getDirectory();
390 
391  $pl_css_files = $plugin->getCssFiles($a_mode);
392  foreach ($pl_css_files as $pl_css_file) {
393  if (!is_int(strpos($pl_css_file, "//"))) {
394  $pl_css_file = $pl_dir . "/" . $pl_css_file;
395  }
396  if (!in_array($pl_css_file, $css_files)) {
397  $css_files[] = $pl_css_file;
398  }
399  }
400  }
401 
402  return $css_files;
403  }
+ Here is the call graph for this function:

◆ getJavascriptFiles()

ilPCPlugged::getJavascriptFiles ( string  $a_mode)

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

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

361  : array
362  {
363  $js_files = array();
364 
365  foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
366  $plugin->setPageObj($this->getPage());
367  $pl_dir = $plugin->getDirectory();
368 
369  $pl_js_files = $plugin->getJavascriptFiles($a_mode);
370  foreach ($pl_js_files as $pl_js_file) {
371  if (!is_int(strpos($pl_js_file, "//"))) {
372  $pl_js_file = $pl_dir . "/" . $pl_js_file;
373  }
374  if (!in_array($pl_js_file, $js_files)) {
375  $js_files[] = $pl_js_file;
376  }
377  }
378  }
379  //var_dump($js_files);
380  return $js_files;
381  }
+ Here is the call graph for this function:

◆ getPluginName()

ilPCPlugged::getPluginName ( )

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

References $DIC, Vendor\Package\$e, $ilPluginAdmin, $name, ilPageContent\$node, ilPageContent\afterRepositoryCopy(), ilComponentFactory\getPlugin(), and ilComponentRepository\getPluginByName().

142  : string
143  {
144  if (is_object($this->plug_node)) {
145  return $this->plug_node->get_attribute("PluginName");
146  }
147  return "";
148  }
+ Here is the call graph for this function:

◆ getPluginVersion()

ilPCPlugged::getPluginVersion ( )

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

123  : string
124  {
125  if (is_object($this->plug_node)) {
126  return $this->plug_node->get_attribute("PluginVersion");
127  }
128  return "";
129  }

◆ getProperties()

ilPCPlugged::getProperties ( )

Get properties of plugged component.

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

References $i.

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

◆ init()

ilPCPlugged::init ( )

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

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

32  : void
33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  $this->setType("plug");
38  $this->component_repository = $DIC["component.repository"];
39  $this->component_factory = $DIC["component.factory"];
40  }
setType(string $a_type)
Set Type.
global $DIC
Definition: feed.php:28
+ 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 296 of file class.ilPCPlugged.php.

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

300  : string {
301  $lng = $this->lng;
302 
303  $end = 0;
304  $start = strpos($a_output, "{{{{{Plugged<pl");
305  //echo htmlentities($a_html)."-";
306  if (is_int($start)) {
307  $end = strpos($a_output, "}}}}}", $start);
308  }
309 
310  while ($end > 0) {
311  $param = substr($a_output, $start + 5, $end - $start - 5);
312  $param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
313  $param = explode("<pl/>", $param);
314  //var_dump($param); exit;
315  $plugin_name = $param[1];
316  $plugin_version = $param[2];
317  $properties = array();
318 
319  for ($i = 3; $i < count($param); $i += 2) {
320  $properties[$param[$i]] = $param[$i + 1];
321  }
322 
323  // get html from plugin
324  if ($a_mode == "edit") {
325  $plugin_html = '<div class="ilBox">' . $lng->txt("content_plugin_not_activated") . " (" . $plugin_name . ")</div>";
326  }
327 
328  $plugin_info = $this->component_repository->getPluginByName($plugin_name);
329  $plugin_html = '';
330  if ($plugin_info->isActive()) {
331  $plugin_obj = $this->component_factory->getPlugin($plugin_info->getId());
332  $plugin_obj->setPageObj($this->getPage());
333  $gui_obj = $plugin_obj->getUIClassInstance();
334  $plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
335  } else {
336  if ($a_mode === "edit") {
337  $plugin_html = sprintf($this->lng->txt("copg_plugin_not_avail"), $plugin_name);
338  } else {
339  $plugin_html = " ";
340  }
341  }
342 
343  $a_output = substr($a_output, 0, $start) .
344  $plugin_html .
345  substr($a_output, $end + 5);
346 
347  if (strlen($a_output) > $start + 5) {
348  $start = strpos($a_output, "{{{{{Plugged<pl", $start + 5);
349  } else {
350  $start = false;
351  }
352  $end = 0;
353  if (is_int($start)) {
354  $end = strpos($a_output, "}}}}}", $start);
355  }
356  }
357 
358  return $a_output;
359  }
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
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setNode()

ilPCPlugged::setNode ( php4DOMElement  $a_node)

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

References php4DOMNode\first_child().

42  : void
43  {
44  parent::setNode($a_node); // this is the PageContent node
45  $this->plug_node = $a_node->first_child(); // this is the Plugged node
46  }
+ Here is the call graph for this function:

◆ setPluginName()

ilPCPlugged::setPluginName ( string  $a_name)

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

131  : void
132  {
133  if (!empty($a_name)) {
134  $this->plug_node->set_attribute("PluginName", $a_name);
135  } else {
136  if ($this->plug_node->has_attribute("PluginName")) {
137  $this->plug_node->remove_attribute("PluginName");
138  }
139  }
140  }

◆ setPluginVersion()

ilPCPlugged::setPluginVersion ( string  $a_version)

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

112  : void
113  {
114  if (!empty($a_version)) {
115  $this->plug_node->set_attribute("PluginVersion", $a_version);
116  } else {
117  if ($this->plug_node->has_attribute("PluginVersion")) {
118  $this->plug_node->remove_attribute("PluginVersion");
119  }
120  }
121  }

◆ setProperties()

ilPCPlugged::setProperties ( array  $a_properties)

Set properties of plugged component.

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

References $i, and ILIAS\LTI\ToolProvider\$key.

69  : void
70  {
71  if (!is_object($this->plug_node)) {
72  return;
73  }
74 
75  // delete properties
76  $children = $this->plug_node->child_nodes();
77  for ($i = 0; $i < count($children); $i++) {
78  $this->plug_node->remove_child($children[$i]);
79  }
80  // set properties
81  foreach ($a_properties as $key => $value) {
82  $prop_node = $this->dom->create_element("PluggedProperty");
83  $prop_node = $this->plug_node->append_child($prop_node);
84  $prop_node->set_attribute("Name", $key);
85  if ($value != "") {
86  $prop_node->set_content($value);
87  }
88  }
89  }
string $key
Consumer key/client ID value.
Definition: System.php:193
$i
Definition: metadata.php:41

Field Documentation

◆ $component_factory

ilComponentFactory ilPCPlugged::$component_factory
protected

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

◆ $component_repository

ilComponentRepository ilPCPlugged::$component_repository
protected

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

◆ $lng

ilLanguage ilPCPlugged::$lng
protected

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

Referenced by modifyPageContentPostXsl().

◆ $plug_node

php4DOMElement ilPCPlugged::$plug_node

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


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