ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilPCLayoutTemplate Class Reference

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

+ Inheritance diagram for ilPCLayoutTemplate:
+ Collaboration diagram for ilPCLayoutTemplate:

Public Member Functions

 init ()
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id, int $a_tmpl)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 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...
 
 getNewPageContentNode ()
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
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...
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 
- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link = ''
 
string $fullscreen_link = ''
 
string $sourcecode_download_script = ''
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

Detailed Description

Layout templates are not existing in the page.

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ create()

ilPCLayoutTemplate::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id,
int  $a_tmpl 
)

Definition at line 34 of file class.ilPCLayoutTemplate.php.

References ilPageContent\$hier_id, ilPageContent\getDomDoc(), ilPageObjectFactory\getInstance(), ilPageContent\getPage(), and IL_INSERT_AFTER.

34  : void
35  {
36  $source_page = ilPageObjectFactory::getInstance("stys", $a_tmpl);
37  $source_page->buildDom();
38  $source_page->addHierIDs();
39  $hier_ids = $source_page->getHierIds();
40 
41  $copy_ids = array();
42  foreach ($hier_ids as $hier_id) {
43  // move top level nodes only
44  if (!is_int(strpos($hier_id, "_"))) {
45  if ($hier_id != "pg") {
46  $copy_ids[] = $hier_id;
47  }
48  }
49  }
50  arsort($copy_ids);
51 
52  foreach ($copy_ids as $copy_id) {
53  $source_content = $source_page->getContentObject($copy_id);
54 
55  $source_node = $source_content->getDomNode();
56  $clone_node = $source_node->cloneNode(true);
57  $this->log->debug($this->dom_util->dump($clone_node));
58  //$clone_node->unlink_node($clone_node);
59  $clone_node = $this->getPage()->getDomDoc()->importNode($clone_node, true);
60 
61  // insert cloned node at target
62  $source_content->setDomNode($clone_node);
63  $this->getPage()->insertContent($source_content, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
64 
65  $xpath = new DOMXpath($this->getPage()->getDomDoc());
66  if ($clone_node->getAttribute("PCID") != "") {
67  $clone_node->setAttribute("PCID", "");
68  }
69  $els = $xpath->query(".//*[@PCID]", $clone_node);
70  foreach ($els as $el) {
71  $el->setAttribute("PCID", "");
72  }
73  }
74 
75  $this->getPage()->update();
76  }
const IL_INSERT_AFTER
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
+ Here is the call graph for this function:

◆ init()

ilPCLayoutTemplate::init ( )

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

References ilPageContent\setType().

29  : void
30  {
31  $this->setType("lay");
32  }
setType(string $a_type)
Set Type.
+ Here is the call graph for this function:

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