ILIAS  release_8 Revision v8.24
ilPCPlaceHolder Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCPlaceHolder:
+ Collaboration diagram for ilPCPlaceHolder:

Public Member Functions

 init ()
 Init object. More...
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setContentClass (string $a_class)
 
 getContentClass ()
 
 setHeight (string $a_height)
 
 getHeight ()
 
 getClass ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 @inheritDoc More...
 
 getCssFiles (string $a_mode)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 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...
 
 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...
 

Static Public Member Functions

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 Public Member Functions inherited from ilPageContent
static incEdId (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
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

php4DOMElement $q_node
 
string $content_class
 
string $height
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Additional Inherited Members

- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilPlaceHolder

List content object (see ILIAS DTD)

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

Member Function Documentation

◆ create()

ilPCPlaceHolder::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 47 of file class.ilPCPlaceHolder.php.

51 : void {
52 $this->createPageContentNode();
53 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
54 $this->q_node = $this->dom->create_element("PlaceHolder");
55 $this->q_node = $this->node->append_child($this->q_node);
56 }
const IL_INSERT_AFTER
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent

◆ getClass()

ilPCPlaceHolder::getClass ( )

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

88 : string
89 {
90 return "";
91 }

◆ getContentClass()

ilPCPlaceHolder::getContentClass ( )

Definition at line 65 of file class.ilPCPlaceHolder.php.

65 : string
66 {
67 if (is_object($this->q_node)) {
68 return $this->q_node->get_attribute("ContentClass");
69 }
70 return "";
71 }

◆ getCssFiles()

ilPCPlaceHolder::getCssFiles ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 165 of file class.ilPCPlaceHolder.php.

165 : array
166 {
168 }

References ilObjStyleSheet\getPlaceHolderStylePath().

+ Here is the call graph for this function:

◆ getHeight()

ilPCPlaceHolder::getHeight ( )

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

80 : string
81 {
82 if (is_object($this->q_node)) {
83 return $this->q_node->get_attribute("Height");
84 }
85 return "";
86 }

◆ getLangVars()

static ilPCPlaceHolder::getLangVars ( )
static

Get lang vars needed for editing.

Returns
string[] array of lang var keys

Reimplemented from ilPageContent.

Definition at line 93 of file class.ilPCPlaceHolder.php.

93 : array
94 {
95 return array("question_placeh","media_placeh","text_placeh",
96 "ed_insert_plach","question_placehl","media_placehl","text_placehl",
97 "verification_placeh", "verification_placehl");
98 }

◆ getModel()

ilPCPlaceHolder::getModel ( )

@inheritDoc

Reimplemented from ilPageContent.

Definition at line 158 of file class.ilPCPlaceHolder.php.

158 : ?stdClass
159 {
160 $model = new \stdClass();
161 $model->contentClass = $this->getContentClass();
162 return $model;
163 }

◆ handleCopiedContent()

static ilPCPlaceHolder::handleCopiedContent ( DOMDocument  $a_domdoc,
bool  $a_self_ass = true,
bool  $a_clone_mobs = false,
int  $new_parent_id = 0,
int  $obj_copy_id = 0 
)
static

Handle copied content.

This function must, e.g. create copies of objects referenced within the content (e.g. question objects)

Parameters
DOMDocument$a_domdoc
bool$a_self_ass
bool$a_clone_mobs
int$new_parent_id
int$obj_copy_id

Reimplemented from ilPageContent.

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

176 : void {
177 // remove question placholders
178 if (!$a_self_ass) {
179 // Get question IDs
180 $path = "//PlaceHolder[@ContentClass = 'Question']";
181 $xpath = new DOMXPath($a_domdoc);
182 $nodes = $xpath->query($path);
183
184 foreach ($nodes as $node) {
185 $parent = $node->parentNode;
186 $parent->parentNode->removeChild($parent);
187 }
188 }
189 }
php4DOMElement $node
$path
Definition: ltiservices.php:32

References $path.

◆ init()

ilPCPlaceHolder::init ( )

Init object.

This function must be overwritten and at least set the content type.

Reimplemented from ilPageContent.

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

32 : void
33 {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->lng = $DIC->language();
38 $this->setType("plach");
39 }
setType(string $a_type)
Set Type.
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilPageContent\setType().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCPlaceHolder::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

Modify page content after xsl.

Reimplemented from ilPageContent.

Definition at line 100 of file class.ilPCPlaceHolder.php.

104 : string {
106
107 //
108 // Note: this standard output is "overwritten", e.g. by ilPortfolioPageGUI::postOutputProcessing
109 //
110
111 $end = 0;
112 $start = strpos($a_output, "{{{{{PlaceHolder#");
113 if (is_int($start)) {
114 $end = strpos($a_output, "}}}}}", $start);
115 }
116 $i = 1;
117 while ($end > 0) {
118 $param = substr($a_output, $start + 17, $end - $start - 17);
119 $param = explode("#", $param);
120
121 $html = $param[2];
122 switch ($param[2]) {
123 case "Text":
124 $html = $lng->txt("cont_text_placeh");
125 break;
126
127 case "Media":
128 $html = $lng->txt("cont_media_placeh");
129 break;
130
131 case "Question":
132 $html = $lng->txt("cont_question_placeh");
133 break;
134
135 case "Verification":
136 $html = $lng->txt("cont_verification_placeh");
137 break;
138 }
139
140 $h2 = substr($a_output, 0, $start) .
141 $html .
142 substr($a_output, $end + 5);
143 $a_output = $h2;
144 $i++;
145
146 $start = strpos($a_output, "{{{{{PlaceHolder#", $start + 5);
147 $end = 0;
148 if (is_int($start)) {
149 $end = strpos($a_output, "}}}}}", $start);
150 }
151 }
152 return $a_output;
153 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$i
Definition: metadata.php:41
$param
Definition: xapitoken.php:46

◆ setContentClass()

ilPCPlaceHolder::setContentClass ( string  $a_class)

Definition at line 58 of file class.ilPCPlaceHolder.php.

58 : void
59 {
60 if (is_object($this->q_node)) {
61 $this->q_node->set_attribute("ContentClass", $a_class);
62 }
63 }

◆ setHeight()

ilPCPlaceHolder::setHeight ( string  $a_height)

Definition at line 73 of file class.ilPCPlaceHolder.php.

73 : void
74 {
75 if (is_object($this->q_node)) {
76 $this->q_node->set_attribute("Height", $a_height);
77 }
78 }

◆ setNode()

ilPCPlaceHolder::setNode ( php4DOMElement  $a_node)

Set xml node of page content.

Parameters
php4DOMElement$a_nodenode object

Reimplemented from ilPageContent.

Definition at line 41 of file class.ilPCPlaceHolder.php.

41 : void
42 {
43 parent::setNode($a_node); // this is the PageContent node
44 $this->q_node = $a_node->first_child(); //... and this the PlaceHolder
45 }

References php4DOMNode\first_child().

+ Here is the call graph for this function:

Field Documentation

◆ $content_class

string ilPCPlaceHolder::$content_class

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

◆ $ctrl

ilCtrl ilPCPlaceHolder::$ctrl
protected

Definition at line 26 of file class.ilPCPlaceHolder.php.

◆ $height

string ilPCPlaceHolder::$height

Definition at line 30 of file class.ilPCPlaceHolder.php.

◆ $lng

ilLanguage ilPCPlaceHolder::$lng
protected

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

◆ $q_node

php4DOMElement ilPCPlaceHolder::$q_node

Definition at line 28 of file class.ilPCPlaceHolder.php.


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