ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 setNode ($a_node)
 Set node (in fact this will never be called, since these types of nodes do not exist.
 create ($a_pg_obj, $a_hier_id, $a_pc_id, $a_page_templ)
 Insert content template.
- 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.
 setNode (&$a_node)
 Set xml node of page content.
& getNode ()
 Get xml node of page content.
 getJavascriptFiles ()
 Get Javascript files.
 getCssFiles ()
 Get css files.
 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)
 modifyPageContentPostXsl ($a_output, $a_mode)
 Modify page content after xsl.

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.
- Data Fields inherited from ilPageContent
 $hier_id
 $node
 $dom
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type.

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

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, and ilPageObjectFactory\getInstance().

{
$source_id = explode(":", $a_page_templ);
$source_page = ilPageObjectFactory::getInstance($source_id[1], $source_id[0]);
$source_page->buildDom();
$source_page->addHierIds();
$hier_ids = $source_page->getHierIds();
$copy_ids = array();
foreach ($hier_ids as $hier_id)
{
// move top level nodes only
if (!is_int(strpos($hier_id, "_")))
{
if ($hier_id != "pg" && $hier_id >= $a_hid)
{
$copy_ids[] = $hier_id;
}
}
}
asort($copy_ids);
// get the target parent node
$pos = explode("_", $a_pos);
array_pop($pos);
$parent_pos = implode($pos, "_");
if($parent_pos != "")
{
$target_parent = $a_pg_obj->getContentNode($parent_pos);
}
else
{
$target_parent = $a_pg_obj->getNode();
}
//$source_parent = $source_page->getContentNode("pg");
$curr_node = $a_pg_obj->getContentNode($a_hier_id, $a_pcid);
foreach ($copy_ids as $copy_id)
{
$source_node = $source_page->getContentNode($copy_id);
$new_node = $source_node->clone_node(true);
$new_node->unlink_node($new_node);
if ($succ_node = $curr_node->next_sibling())
{
$succ_node->insert_before($new_node, $succ_node);
}
else
{
//echo "movin doin append_child";
$target_parent->append_child($new_node);
}
//$xpc = xpath_new_context($a_pg_obj->getDomDoc());
$xpath = new DOMXpath($a_pg_obj->getDomDoc());
//var_dump($new_node->myDOMNode);
//echo "-".$new_node->get_attribute("PCID")."-"; exit;
if ($new_node->get_attribute("PCID") != "")
{
$new_node->set_attribute("PCID", "");
}
$els = $xpath->query(".//*[@PCID]", $new_node->myDOMNode);
foreach ($els as $el)
{
$el->setAttribute("PCID", "");
}
$curr_node = $new_node;
}
$a_pg_obj->update();
//$this->node = $this->createPageContentNode();
/*$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
$this->map_node =& $this->dom->create_element("Map");
$this->map_node =& $this->node->append_child($this->map_node);
$this->map_node->set_attribute("Latitude", "0");
$this->map_node->set_attribute("Longitude", "0");
$this->map_node->set_attribute("Zoom", "3");*/
}

+ Here is the call graph for this function:

ilPCContentTemplate::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

References ilPageContent\setType().

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

+ Here is the call graph for this function:

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.

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

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