ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPCContentInclude Class Reference

Class ilPCContentInclude. More...

+ Inheritance diagram for ilPCContentInclude:
+ Collaboration diagram for ilPCContentInclude:

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="")
 Create content include node in xml. More...
 
 setContentId ($a_id)
 Set content id. More...
 
 getContentId ()
 Get content id. More...
 
 setContentType ($a_type)
 Set content type. More...
 
 getContentType ()
 Get content type. More...
 
 setInstId ($a_id)
 Set installation id. More...
 
 getInstId ()
 Get installation id. More...
 
 getContentIncludeAttribute ($a_attr)
 Get content include tag attribute. 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...
 

Static Public Member Functions

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...
 
static saveContentIncludeUsage ($a_page, $a_domdoc, $a_old_nr=0)
 save content include usages More...
 
static collectContentIncludes ($a_page, $a_domdoc)
 get all content includes that are used within the page More...
 
- 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...
 

Data Fields

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

Protected Member Functions

 setContentIncludeAttribute ($a_attr, $a_value)
 Set attribute of content include tag. More...
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Detailed Description

Class ilPCContentInclude.

Content include object (see ILIAS DTD). Inserts content snippets from other source (e.g. media pool)

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

Definition at line 17 of file class.ilPCContentInclude.php.

Member Function Documentation

◆ afterPageHistoryEntry()

static ilPCContentInclude::afterPageHistoryEntry (   $a_page,
DOMDocument  $a_old_domdoc,
  $a_old_xml,
  $a_old_nr 
)
static

After page history entry has been created.

Parameters
object$a_pagepage object
DOMDocument$a_old_domdocold dom document
string$a_old_xmlold xml
integer$a_old_nrhistory number

Reimplemented from ilPageContent.

Definition at line 168 of file class.ilPCContentInclude.php.

169 {
170 self::saveContentIncludeUsage($a_page, $a_old_domdoc, $a_old_nr);
171 }
static saveContentIncludeUsage($a_page, $a_domdoc, $a_old_nr=0)
save content include usages

References saveContentIncludeUsage().

+ Here is the call graph for this function:

◆ afterPageUpdate()

static ilPCContentInclude::afterPageUpdate (   $a_page,
DOMDocument  $a_domdoc,
  $a_xml,
  $a_creation 
)
static

After page has been updated (or created)

Parameters
object$a_pagepage object
DOMDocument$a_domdocdom document
string$a_xmlxml
bool$a_creationtrue on creation, otherwise false

Reimplemented from ilPageContent.

Definition at line 143 of file class.ilPCContentInclude.php.

144 {
145 // pc content include
146 self::saveContentIncludeUsage($a_page, $a_domdoc);
147 }

References saveContentIncludeUsage().

+ Here is the call graph for this function:

◆ beforePageDelete()

static ilPCContentInclude::beforePageDelete (   $a_page)
static

Before page is being deleted.

Parameters
object$a_pagepage object

Reimplemented from ilPageContent.

Definition at line 154 of file class.ilPCContentInclude.php.

155 {
156 include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
157 ilPageContentUsage::deleteAllUsages("incl", $a_page->getParentType().":pg", $a_page->getId(), false, $a_page->getLanguage());
158 }
static deleteAllUsages($a_pc_type, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
Delete all usages.

References ilPageContentUsage\deleteAllUsages().

+ Here is the call graph for this function:

◆ collectContentIncludes()

static ilPCContentInclude::collectContentIncludes (   $a_page,
  $a_domdoc 
)
static

get all content includes that are used within the page

Definition at line 194 of file class.ilPCContentInclude.php.

195 {
196 $xpath = new DOMXPath($a_domdoc);
197 $nodes = $xpath->query('//ContentInclude');
198
199 $ci_ids = array();
200 foreach ($nodes as $node)
201 {
202 $type = $node->getAttribute("ContentType");
203 $id = $node->getAttribute("ContentId");
204 $inst_id = $node->getAttribute("InstId");
205 $ci_ids[$type.":".$id.":".$inst_id] = array(
206 "type" => $type, "id" => $id, "inst_id" => $inst_id);
207 }
208
209 return $ci_ids;
210 }

References ilPageContent\$node.

Referenced by saveContentIncludeUsage(), and ilPageObjectGUI\showPage().

+ Here is the caller graph for this function:

◆ create()

ilPCContentInclude::create ( $a_pg_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Create content include node in xml.

Parameters
object$a_pg_objPage Object
string$a_hier_idHierarchical ID

Definition at line 45 of file class.ilPCContentInclude.php.

46 {
47 $this->node = $this->createPageContentNode();
48 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
49 $this->incl_node =& $this->dom->create_element("ContentInclude");
50 $this->incl_node =& $this->node->append_child($this->incl_node);
51 }
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:

◆ getContentId()

ilPCContentInclude::getContentId ( )

Get content id.

Definition at line 64 of file class.ilPCContentInclude.php.

65 {
66 return $this->getContentIncludeAttribute("ContentId");
67 }
getContentIncludeAttribute($a_attr)
Get content include tag attribute.

References getContentIncludeAttribute().

+ Here is the call graph for this function:

◆ getContentIncludeAttribute()

ilPCContentInclude::getContentIncludeAttribute (   $a_attr)

Get content include tag attribute.

Returns
string attribute name

Definition at line 127 of file class.ilPCContentInclude.php.

128 {
129 if (is_object($this->incl_node))
130 {
131 return $this->incl_node->get_attribute($a_attr);
132 }
133 }

Referenced by getContentId(), getContentType(), and getInstId().

+ Here is the caller graph for this function:

◆ getContentType()

ilPCContentInclude::getContentType ( )

Get content type.

Definition at line 80 of file class.ilPCContentInclude.php.

81 {
82 return $this->getContentIncludeAttribute("ContentType");
83 }

References getContentIncludeAttribute().

+ Here is the call graph for this function:

◆ getInstId()

ilPCContentInclude::getInstId ( )

Get installation id.

Definition at line 96 of file class.ilPCContentInclude.php.

97 {
98 return $this->getContentIncludeAttribute("InstId");
99 }

References getContentIncludeAttribute().

+ Here is the call graph for this function:

◆ init()

ilPCContentInclude::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

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

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ saveContentIncludeUsage()

static ilPCContentInclude::saveContentIncludeUsage (   $a_page,
  $a_domdoc,
  $a_old_nr = 0 
)
static

save content include usages

Definition at line 176 of file class.ilPCContentInclude.php.

177 {
178 include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
179 $ci_ids = self::collectContentIncludes($a_page, $a_domdoc);
180 ilPageContentUsage::deleteAllUsages("incl", $a_page->getParentType().":pg", $a_page->getId(), $a_old_nr, $a_page->getLanguage());
181 foreach($ci_ids as $ci_id)
182 {
183 if ((int) $ci_id["inst_id"] <= 0 || $ci_id["inst_id"] == IL_INST_ID)
184 {
185 ilPageContentUsage::saveUsage("incl", $ci_id["id"], $a_page->getParentType().":pg", $a_page->getId(), $a_old_nr,
186 $a_page->getLanguage());
187 }
188 }
189 }
static collectContentIncludes($a_page, $a_domdoc)
get all content includes that are used within the page
static saveUsage($a_pc_type, $a_pc_id, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
Save usages.

References collectContentIncludes(), ilPageContentUsage\deleteAllUsages(), and ilPageContentUsage\saveUsage().

Referenced by afterPageHistoryEntry(), and afterPageUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentId()

ilPCContentInclude::setContentId (   $a_id)

Set content id.

Definition at line 56 of file class.ilPCContentInclude.php.

57 {
58 $this->setContentIncludeAttribute("ContentId", $a_id);
59 }
setContentIncludeAttribute($a_attr, $a_value)
Set attribute of content include tag.

References setContentIncludeAttribute().

+ Here is the call graph for this function:

◆ setContentIncludeAttribute()

ilPCContentInclude::setContentIncludeAttribute (   $a_attr,
  $a_value 
)
protected

Set attribute of content include tag.

Parameters
stringattribute name
stringattribute value

Definition at line 107 of file class.ilPCContentInclude.php.

108 {
109 if (!empty($a_value))
110 {
111 $this->incl_node->set_attribute($a_attr, $a_value);
112 }
113 else
114 {
115 if ($this->incl_node->has_attribute($a_attr))
116 {
117 $this->incl_node->remove_attribute($a_attr);
118 }
119 }
120 }

Referenced by setContentId(), setContentType(), and setInstId().

+ Here is the caller graph for this function:

◆ setContentType()

ilPCContentInclude::setContentType (   $a_type)

Set content type.

Definition at line 72 of file class.ilPCContentInclude.php.

73 {
74 $this->setContentIncludeAttribute("ContentType", $a_type);
75 }

References setContentIncludeAttribute().

+ Here is the call graph for this function:

◆ setInstId()

ilPCContentInclude::setInstId (   $a_id)

Set installation id.

Definition at line 88 of file class.ilPCContentInclude.php.

89 {
90 $this->setContentIncludeAttribute("InstId", $a_id);
91 }

References setContentIncludeAttribute().

+ Here is the call graph for this function:

◆ setNode()

ilPCContentInclude::setNode ( $a_node)

Set node.

Reimplemented from ilPageContent.

Definition at line 33 of file class.ilPCContentInclude.php.

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

Field Documentation

◆ $dom

ilPCContentInclude::$dom

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

◆ $incl_node

ilPCContentInclude::$incl_node

Definition at line 20 of file class.ilPCContentInclude.php.


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