ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 setNode (&$a_node)
 Set node.
 create ($a_pg_obj, $a_hier_id, $a_pc_id, $a_plugin_name, $a_plugin_version)
 Create plugged node in xml.
 setProperties ($a_properties)
 Set properties of plugged component.
 getProperties ()
 Get properties of plugged component.
 setPluginVersion ($a_version)
 Set version of plugged component.
 getPluginVersion ()
 Get version of plugged component.
 setPluginName ($a_name)
 Set name of plugged component.
 getPluginName ()
 Get name of plugged component.
 modifyPageContentPostXsl ($a_html, $a_mode)
 Modify page content after xsl.
 getJavascriptFiles ()
 Get javascript files.
 getCssFiles ()
 Get css files.
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor.
 setPage ($a_val)
 Set page.
 getPage ()
 Get page.
 getType ()
 Get type of page content.
getNode ()
 Get xml node of page content.
 getOnloadCode ()
 Get on load code.
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure.
 getHierId ()
 Get hierarchical id.
 lookupHierId ()
 Get hierarchical id from dom.
 readHierId ()
 Read PC Id.
 setPcId ($a_pcid)
 Set PC Id.
 getPCId ()
 Get PC Id.
 readPCId ()
 Read PC Id.
 writePCId ($a_pc_id)
 Write pc id.
 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b.
 setEnabled ($value)
 Set Enabled value for page content component.
 enable ()
 Enable page content.
 disable ()
 Disable page content.
 isEnabled ()
 Check whether page content is enabled.
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element)

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

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

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.

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

{
$this->node = $this->createPageContentNode();
$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
$this->plug_node =& $this->dom->create_element("Plugged");
$this->plug_node =& $this->node->append_child($this->plug_node);
$this->plug_node->set_attribute("PluginName", $a_plugin_name);
$this->plug_node->set_attribute("PluginVersion", $a_plugin_version);
}

+ Here is the call graph for this function:

ilPCPlugged::getCssFiles ( )

Get css files.

Reimplemented from ilPageContent.

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

References IL_COMP_SERVICE.

{
global $ilPluginAdmin;
$css_files = array();
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
"COPage", "pgcp");
foreach ($pl_names as $pl_name)
{
$plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
"COPage", "pgcp", $pl_name);
$pl_dir = $plugin->getDirectory();
$pl_css_files = $plugin->getCssFiles();
foreach ($pl_css_files as $pl_css_file)
{
if (!is_int(strpos($pl_css_file, "//")))
{
$pl_css_file = $pl_dir."/".$pl_css_file;
}
if (!in_array($pl_css_file, $css_files))
{
$css_files[] = $pl_css_file;
}
}
}
return $css_files;
}
ilPCPlugged::getJavascriptFiles ( )

Get javascript files.

Reimplemented from ilPageContent.

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

References IL_COMP_SERVICE.

{
global $ilPluginAdmin;
$js_files = array();
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
"COPage", "pgcp");
foreach ($pl_names as $pl_name)
{
$plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
"COPage", "pgcp", $pl_name);
$pl_dir = $plugin->getDirectory();
$pl_js_files = $plugin->getJavascriptFiles();
foreach ($pl_js_files as $pl_js_file)
{
if (!is_int(strpos($pl_js_file, "//")))
{
$pl_js_file = $pl_dir."/".$pl_js_file;
}
if (!in_array($pl_js_file, $js_files))
{
$js_files[] = $pl_js_file;
}
}
}
//var_dump($js_files);
return $js_files;
}
ilPCPlugged::getPluginName ( )

Get name of plugged component.

Returns
string name

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

{
if (is_object($this->plug_node))
{
return $this->plug_node->get_attribute("PluginName");
}
}
ilPCPlugged::getPluginVersion ( )

Get version of plugged component.

Returns
string version

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

{
if (is_object($this->plug_node))
{
return $this->plug_node->get_attribute("PluginVersion");
}
}
ilPCPlugged::getProperties ( )

Get properties of plugged component.

Returns
string characteristic

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

{
$properties = array();
if (is_object($this->plug_node))
{
// delete properties
$children = $this->plug_node->child_nodes();
for($i=0; $i<count($children); $i++)
{
if ($children[$i]->node_name() == "PluggedProperty")
{
$properties[$children[$i]->get_attribute("Name")] =
$children[$i]->get_content();
}
}
}
return $properties;
}
ilPCPlugged::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

References ilPageContent\setType().

{
$this->setType("plug");
}

+ Here is the call graph for this function:

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.

References $lng, and IL_COMP_SERVICE.

{
global $lng, $ilPluginAdmin;
$c_pos = 0;
$start = strpos($a_html, "{{{{{Plugged<pl");
//echo htmlentities($a_html)."-";
if (is_int($start))
{
$end = strpos($a_html, "}}}}}", $start);
}
$i = 1;
while ($end > 0)
{
$param = substr($a_html, $start + 5, $end - $start - 5);
$param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
$param = explode("<pl/>", $param);
//var_dump($param); exit;
$plugin_name = $param[1];
$plugin_version = $param[2];
$properties = array();
for ($i = 3; $i < count($param); $i+=2)
{
$properties[$param[$i]] = $param[$i+1];
}
// get html from plugin
if ($a_mode == "edit")
{
$plugin_html = '<div class="ilBox">'.$lng->txt("content_plugin_not_activated")." (".$plugin_name.")</div>";
}
if ($ilPluginAdmin->isActive(IL_COMP_SERVICE, "COPage", "pgcp", $plugin_name))
{
$plugin_obj = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE, "COPage",
"pgcp", $plugin_name);
$gui_obj = $plugin_obj->getUIClassInstance();
$plugin_html = $gui_obj->getElementHTML($a_mode, $properties, $plugin_version);
}
$a_html = substr($a_html, 0, $start).
$plugin_html.
substr($a_html, $end + 5);
if (strlen($a_html) > $start + 5)
{
$start = strpos($a_html, "{{{{{Plugged<pl", $start + 5);
}
else
{
$start = false;
}
$end = 0;
if (is_int($start))
{
$end = strpos($a_html, "}}}}}", $start);
}
}
return $a_html;
}
ilPCPlugged::setNode ( $a_node)

Set node.

Reimplemented from ilPageContent.

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

{
parent::setNode($a_node); // this is the PageContent node
$this->plug_node =& $a_node->first_child(); // this is the Plugged node
}
ilPCPlugged::setPluginName (   $a_name)

Set name of plugged component.

Parameters
string$a_namename

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

{
if (!empty($a_name))
{
$this->plug_node->set_attribute("PluginName", $a_name);
}
else
{
if ($this->plug_node->has_attribute("PluginName"))
{
$this->plug_node->remove_attribute("PluginName");
}
}
}
ilPCPlugged::setPluginVersion (   $a_version)

Set version of plugged component.

Parameters
string$a_versionversion

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

{
if (!empty($a_version))
{
$this->plug_node->set_attribute("PluginVersion", $a_version);
}
else
{
if ($this->plug_node->has_attribute("PluginVersion"))
{
$this->plug_node->remove_attribute("PluginVersion");
}
}
}
ilPCPlugged::setProperties (   $a_properties)

Set properties of plugged component.

Parameters
array$a_propertiescomponent properties

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

{
if (!is_object($this->plug_node))
{
return;
}
// delete properties
$children = $this->plug_node->child_nodes();
for($i=0; $i<count($children); $i++)
{
$this->plug_node->remove_child($children[$i]);
}
// set properties
foreach($a_properties as $key => $value)
{
$prop_node = $this->dom->create_element("PluggedProperty");
$prop_node = $this->plug_node->append_child($prop_node);
$prop_node->set_attribute("Name", $key);
if ($value != "")
{
$prop_node->set_content($value);
}
}
}

Field Documentation

ilPCPlugged::$dom

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

ilPCPlugged::$plug_node

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


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