ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCContentTemplate Class Reference

Content templates are not existing in the page. More...

+ Inheritance diagram for ilPCContentTemplate:
+ Collaboration diagram for ilPCContentTemplate:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set node (in fact this will never be called, since these types of nodes do not exist. More...
 
 create ($a_pg_obj, $a_hier_id, $a_pc_id, $a_page_templ)
 Insert content template. 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 ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 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...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. 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...
 

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 isGreaterHierId ($a, $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, $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 inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 
- Protected Attributes inherited from ilPageContent
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Detailed Description

Content templates are not existing in the page.

Once they are inserted into a page all content elements of the template are inserted instead.

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.ilPCContentTemplate.php.

Member Function Documentation

◆ create()

ilPCContentTemplate::create (   $a_pg_obj,
  $a_hier_id,
  $a_pc_id,
  $a_page_templ 
)

Insert content template.

Parameters
ilPageObject$a_pg_objpage object
string$a_hier_idHierarchical ID
string$a_pc_idpc id
int$a_page_templtemplate page id

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

References ilPageContent\$hier_id, array, and ilPageObjectFactory\getInstance().

43  {
44  $source_id = explode(":", $a_page_templ);
45  $source_page = ilPageObjectFactory::getInstance($source_id[1], $source_id[0]);
46  $source_page->buildDom();
47  $source_page->addHierIds();
48  $hier_ids = $source_page->getHierIds();
49 
50  $copy_ids = array();
51  foreach ($hier_ids as $hier_id)
52  {
53  // move top level nodes only
54  if (!is_int(strpos($hier_id, "_")))
55  {
56  if ($hier_id != "pg" && $hier_id >= $a_hid)
57  {
58  $copy_ids[] = $hier_id;
59  }
60  }
61  }
62  asort($copy_ids);
63 
64  // get the target parent node
65  $pos = explode("_", $a_pos);
66  array_pop($pos);
67  $parent_pos = implode($pos, "_");
68  if($parent_pos != "")
69  {
70  $target_parent = $a_pg_obj->getContentNode($parent_pos);
71  }
72  else
73  {
74  $target_parent = $a_pg_obj->getNode();
75  }
76 
77  //$source_parent = $source_page->getContentNode("pg");
78 
79  $curr_node = $a_pg_obj->getContentNode($a_hier_id, $a_pcid);
80 
81  foreach ($copy_ids as $copy_id)
82  {
83  $source_node = $source_page->getContentNode($copy_id);
84  $new_node = $source_node->clone_node(true);
85  $new_node->unlink_node($new_node);
86 
87  if ($succ_node = $curr_node->next_sibling())
88  {
89  $succ_node->insert_before($new_node, $succ_node);
90  }
91  else
92  {
93 //echo "movin doin append_child";
94  $target_parent->append_child($new_node);
95  }
96 
97  //$xpc = xpath_new_context($a_pg_obj->getDomDoc());
98  $xpath = new DOMXpath($a_pg_obj->getDomDoc());
99 //var_dump($new_node->myDOMNode);
100 //echo "-".$new_node->get_attribute("PCID")."-"; exit;
101  if ($new_node->get_attribute("PCID") != "")
102  {
103  $new_node->set_attribute("PCID", "");
104  }
105  $els = $xpath->query(".//*[@PCID]", $new_node->myDOMNode);
106  foreach ($els as $el)
107  {
108  $el->setAttribute("PCID", "");
109  }
110  $curr_node = $new_node;
111  }
112 
113  $a_pg_obj->update();
114 
115  //$this->node = $this->createPageContentNode();
116 
117  /*$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
118  $this->map_node =& $this->dom->create_element("Map");
119  $this->map_node =& $this->node->append_child($this->map_node);
120  $this->map_node->set_attribute("Latitude", "0");
121  $this->map_node->set_attribute("Longitude", "0");
122  $this->map_node->set_attribute("Zoom", "3");*/
123  }
Create styles array
The data for the language used.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
+ Here is the call graph for this function:

◆ init()

ilPCContentTemplate::init ( )

Init page content component.

Definition at line 21 of file class.ilPCContentTemplate.php.

References ilPageContent\setType().

22  {
23  $this->setType("templ");
24  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

◆ setNode()

ilPCContentTemplate::setNode (   $a_node)

Set node (in fact this will never be called, since these types of nodes do not exist.

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

30  {
31  parent::setNode($a_node); // this is the PageContent node
32  }

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