ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilPCContentInclude Class Reference

Class ilPCContentInclude. More...

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

Public Member Functions

 init ()
 Init page content component. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setContentId (int $a_id)
 Set content id. More...
 
 getContentId ()
 Get content id. More...
 
 setContentType (string $a_type)
 Set content type. More...
 
 getContentType ()
 Get content type. More...
 
 setInstId (string $a_id)
 Set installation id. More...
 
 getInstId ()
 Get installation id. More...
 
 getContentIncludeAttribute (string $a_attr)
 Get content include tag attribute. More...
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
- 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...
 

Static Public Member Functions

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

Protected Member Functions

 setContentIncludeAttribute (string $a_attr, string $a_value)
 Set attribute of content include tag. More...
 
- 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

ilLanguage $lng
 
 ilAccessHandler$access
 
- 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
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 

Detailed Description

Class ilPCContentInclude.

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

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

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

Member Function Documentation

◆ afterPageHistoryEntry()

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

After page history entry has been created.

Reimplemented from ilPageContent.

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

159 : void {
160 self::saveContentIncludeUsage($a_page, $a_old_domdoc, $a_old_nr);
161 }
static saveContentIncludeUsage(ilPageObject $a_page, DOMDocument $a_domdoc, int $a_old_nr=0)
save content include usages

◆ afterPageUpdate()

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

After page has been updated (or created)

Reimplemented from ilPageContent.

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

138 : void {
139 // pc content include
140 self::saveContentIncludeUsage($a_page, $a_domdoc);
141 }

◆ beforePageDelete()

static ilPCContentInclude::beforePageDelete ( ilPageObject  $a_page)
static

Before page is being deleted.

Reimplemented from ilPageContent.

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

146 : void
147 {
148 ilPageContentUsage::deleteAllUsages("incl", $a_page->getParentType() . ":pg", $a_page->getId(), 0, $a_page->getLanguage());
149 }
static deleteAllUsages(string $a_pc_type, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")

References ilPageContentUsage\deleteAllUsages(), ilPageObject\getId(), ilPageObject\getLanguage(), and ilPageObject\getParentType().

+ Here is the call graph for this function:

◆ collectContentIncludes()

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

get all content includes that are used within the page

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

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

Referenced by ilPageObjectGUI\showPage(), and PCContentIncludeTest\testCollectContentIncludes().

+ Here is the caller graph for this function:

◆ create()

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

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

51 : void {
52 $this->createInitialChildNode($a_hier_id, $a_pc_id, "ContentInclude");
53 }
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])

◆ deleteHistoryLowerEqualThan()

static ilPCContentInclude::deleteHistoryLowerEqualThan ( string  $parent_type,
int  $page_id,
string  $lang,
int  $delete_lower_than_nr 
)
static

Overwrite in derived classes, if old history entries are being deleted.

Reimplemented from ilPageContent.

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

289 : void {
290 global $DIC;
291
292 $usage_repo = $DIC->copage()
293 ->internal()
294 ->repo()
295 ->usage();
296
297 $usage_repo->deleteHistoryUsagesLowerEqualThan(
298 "incl",
299 $parent_type . ":pg",
300 $page_id,
301 $delete_lower_than_nr,
302 $lang
303 );
304 }
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25

◆ getContentId()

ilPCContentInclude::getContentId ( )

Get content id.

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

66 : int
67 {
68 return (int) $this->getContentIncludeAttribute("ContentId");
69 }
getContentIncludeAttribute(string $a_attr)
Get content include tag attribute.

◆ getContentIncludeAttribute()

ilPCContentInclude::getContentIncludeAttribute ( string  $a_attr)

Get content include tag attribute.

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

122 : string
123 {
124 if (is_object($this->getChildNode())) {
125 return $this->getChildNode()->getAttribute($a_attr);
126 }
127 return "";
128 }

◆ getContentType()

ilPCContentInclude::getContentType ( )

Get content type.

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

82 : string
83 {
84 return $this->getContentIncludeAttribute("ContentType");
85 }

◆ getInstId()

ilPCContentInclude::getInstId ( )

Get installation id.

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

98 : string
99 {
100 return $this->getContentIncludeAttribute("InstId");
101 }

◆ init()

ilPCContentInclude::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

37 : void
38 {
39 global $DIC;
40
41 $this->lng = $DIC->language();
42 $this->setType("incl");
43 $this->access = $DIC->access();
44 }
setType(string $a_type)
Set Type.

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

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

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

Modify page content after xsl.

Reimplemented from ilPageContent.

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

213 : string {
215
216 $end = 0;
217 $start = strpos($a_output, "{{{{{ContentInclude;");
218 if (is_int($start)) {
219 $end = strpos($a_output, "}}}}}", $start);
220 }
221 $i = 1;
222 $parent_lang = $this->getPage()->getLanguage();
223 if ($parent_lang == "-" && $this->getPage()->getConcreteLang() != "") {
224 $parent_lang = $this->getPage()->getConcreteLang();
225 }
226 while ($end > 0) {
227 $param = substr($a_output, $start + 20, $end - $start - 20);
228 $param = explode(";", $param);
229
230 if ($param[0] == "mep" && is_numeric($param[1])) {
231 $html = "";
232 $snippet_lang = $parent_lang;
233 if (!ilPageObject::_exists("mep", (int) $param[1], $snippet_lang)) {
234 $snippet_lang = "-";
235 }
236 if (($param[2] <= 0 || $param[2] == IL_INST_ID) && ilPageObject::_exists("mep", (int) $param[1])) {
237 $page_gui = new ilMediaPoolPageGUI((int) $param[1], 0, true, $snippet_lang);
238 if ($a_mode != "offline") {
239 $page_gui->setFileDownloadLink($this->getFileDownloadLink());
240 $page_gui->setProfileBackUrl($this->getProfileBackUrl());
241 $page_gui->setFullscreenLink($this->getFullscreenLink() . "&pg_type=mep");
242 $page_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadScript());
243 } else {
244 $page_gui->setOutputMode(ilPageObjectGUI::OFFLINE);
245 }
246
247 $html = $page_gui->getRawContent();
248 if ($a_mode == "edit") {
249 $par_id = $page_gui->getPageObject()->getParentId();
250 $info = "";
251 foreach (ilObject::_getAllReferences($par_id) as $ref_id) {
252 if ($this->access->checkAccess("write", "", $ref_id)) {
253 $info = " " . $lng->txt("title") . ": " . ilMediaPoolItem::lookupTitle($page_gui->getPageObject()->getId()) .
254 ", " . $lng->txt("obj_mep") . ": <a href='" . ilLink::_getLink($ref_id) . "'>" . ilObject::_lookupTitle($par_id) . "</a>";
255 }
256 }
257 $html = '<p class="small light">' . $lng->txt("copg_snippet_cannot_be_edited") . $info . '</p>' . $html;
258 }
259 } else {
260 if ($a_mode == "edit") {
261 if ($param[2] <= 0) {
262 $html = "// " . $lng->txt("cont_missing_snippet") . " //";
263 } else {
264 $html = "// " . $lng->txt("cont_snippet_from_another_installation") . " //";
265 }
266 }
267 }
268 $h2 = substr($a_output, 0, $start) .
269 $html .
270 substr($a_output, $end + 5);
271 $a_output = $h2;
272 $i++;
273 }
274
275 $start = strpos($a_output, "{{{{{ContentInclude;", $start + 5);
276 $end = 0;
277 if (is_int($start)) {
278 $end = strpos($a_output, "}}}}}", $start);
279 }
280 }
281 return $a_output;
282 }
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...
static lookupTitle(int $a_id)
Class ilMediaPoolPage GUI class.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
const IL_INST_ID
Definition: constants.php:40
$info
Definition: entry_point.php:21
$ref_id
Definition: ltiauth.php:66
$param
Definition: xapitoken.php:46

◆ saveContentIncludeUsage()

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

save content include usages

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

170 : void {
171 $ci_ids = self::collectContentIncludes($a_page, $a_domdoc);
172 ilPageContentUsage::deleteAllUsages("incl", $a_page->getParentType() . ":pg", $a_page->getId(), $a_old_nr, $a_page->getLanguage());
173 foreach ($ci_ids as $ci_id) {
174 if ((int) $ci_id["inst_id"] <= 0 || $ci_id["inst_id"] == IL_INST_ID) {
176 "incl",
177 (int) $ci_id["id"],
178 $a_page->getParentType() . ":pg",
179 $a_page->getId(),
180 $a_old_nr,
181 $a_page->getLanguage()
182 );
183 }
184 }
185 }
static collectContentIncludes(ilPageObject $a_page, DOMDocument $a_domdoc)
get all content includes that are used within the page
static saveUsage(string $a_pc_type, int $a_pc_id, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")

◆ setContentId()

ilPCContentInclude::setContentId ( int  $a_id)

Set content id.

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

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

◆ setContentIncludeAttribute()

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

Set attribute of content include tag.

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

109 : void {
110 if (!empty($a_value)) {
111 $this->getChildNode()->setAttribute($a_attr, $a_value);
112 } else {
113 if ($this->getChildNode()->hasAttribute($a_attr)) {
114 $this->getChildNode()->removeAttribute($a_attr);
115 }
116 }
117 }

◆ setContentType()

ilPCContentInclude::setContentType ( string  $a_type)

Set content type.

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

74 : void
75 {
76 $this->setContentIncludeAttribute("ContentType", $a_type);
77 }

◆ setInstId()

ilPCContentInclude::setInstId ( string  $a_id)

Set installation id.

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

90 : void
91 {
92 $this->setContentIncludeAttribute("InstId", $a_id);
93 }

Field Documentation

◆ $lng

ilLanguage ilPCContentInclude::$lng
protected

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

◆ ilAccessHandler$access

ilPCContentInclude::ilAccessHandler$access
protected

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


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