ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPageContent Class Reference

Class ilPageContent. More...

+ Inheritance diagram for ilPageContent:
+ Collaboration diagram for ilPageContent:

Public Member Functions

 __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...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 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, $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model. More...
 

Static Public Member Functions

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

 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Protected Member Functions

 setType ($a_type)
 Set Type. More...
 

Protected Attributes

 $profile_back_url
 
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Detailed Description

Class ilPageContent.

Content object of ilPageObject (see ILIAS DTD). Every concrete object should be an instance of a class derived from ilPageContent (e.g. ilParagraph, ilMediaObject, ...)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilPageContent.php.

Constructor & Destructor Documentation

◆ __construct()

ilPageContent::__construct (   $a_pg_obj)
final

Constructor.

All initialisation in derived classes should go to the init() function

Definition at line 52 of file class.ilPageContent.php.

53 {
54 $this->log = ilLoggerFactory::getLogger('copg');
55 $this->setPage($a_pg_obj);
56 $this->dom = $a_pg_obj->getDom();
57 $this->init();
58 if ($this->getType() == "") {
59 die("Error: ilPageContent::init() did not set type");
60 }
61 }
static getLogger($a_component_id)
Get component logger.
init()
Init object.
getType()
Get type of page content.
setPage($a_val)
Set page.

References ilLoggerFactory\getLogger(), getType(), init(), and setPage().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterPageHistoryEntry()

static ilPageContent::afterPageHistoryEntry (   $a_page,
DOMDocument  $a_old_domdoc,
  $a_old_xml,
  $a_old_nr 
)
static

After page history entry has been created.

Parameters
object$a_pagepage object
DOMDocument$a_old_domdocold dom document
string$a_old_xmlold xml
integer$a_old_nrhistory number

Reimplemented in ilPCContentInclude, ilPCFileList, ilPCMediaObject, ilPCParagraph, ilPCSkills, and ilPCLearningHistory.

Definition at line 506 of file class.ilPageContent.php.

507 {
508 }

◆ afterPageUpdate()

static ilPageContent::afterPageUpdate (   $a_page,
DOMDocument  $a_domdoc,
  $a_xml,
  $a_creation 
)
static

After page has been updated (or created)

Parameters
object$a_pagepage object
DOMDocument$a_domdocdom document
string$a_xmlxml
bool$a_creationtrue on creation, otherwise false

Reimplemented in ilPCContentInclude, ilPCFileList, ilPCMediaObject, ilPCParagraph, ilPCQuestion, ilPCSection, ilPCSkills, and ilPCLearningHistory.

Definition at line 485 of file class.ilPageContent.php.

486 {
487 }

◆ beforePageDelete()

static ilPageContent::beforePageDelete (   $a_page)
static

Before page is being deleted.

Parameters
object$a_pagepage object

Reimplemented in ilPCContentInclude, ilPCFileList, ilPCMediaObject, ilPCParagraph, ilPCQuestion, ilPCSkills, and ilPCLearningHistory.

Definition at line 494 of file class.ilPageContent.php.

495 {
496 }

◆ createPageContentNode()

◆ decEdId()

static ilPageContent::decEdId (   $ed_id)
staticfinal

Decreases an hierarchical editing id at lowest level (last number)

Parameters
string$ed_idhierarchical ID
Returns
string hierarchical ID (decreased)

Definition at line 328 of file class.ilPageContent.php.

329 {
330 $id = explode("_", $ed_id);
331 $id[count($id) - 1]--;
332
333 return implode("_", $id);
334 }

◆ disable()

ilPageContent::disable ( )

Disable page content.

Definition at line 412 of file class.ilPageContent.php.

413 {
414 $this->setEnabled("False");
415 }
setEnabled($value)
Set Enabled value for page content component.

References setEnabled().

+ Here is the call graph for this function:

◆ enable()

ilPageContent::enable ( )

Enable page content.

Definition at line 404 of file class.ilPageContent.php.

405 {
406 $this->setEnabled("True");
407 }

References setEnabled().

+ Here is the call graph for this function:

◆ getCssFiles()

ilPageContent::getCssFiles (   $a_mode)

Get css files.

Reimplemented in ilPCGrid, ilPCMediaObject, ilPCPlaceHolder, ilPCPlugged, ilPCQuestion, and ilPCTabs.

Definition at line 141 of file class.ilPageContent.php.

142 {
143 return [];
144 }

◆ getFileDownloadLink()

ilPageContent::getFileDownloadLink ( )

Get file download link.

Returns
string

Definition at line 228 of file class.ilPageContent.php.

229 {
231 }

References $file_download_link.

Referenced by ilPCContentInclude\modifyPageContentPostXsl().

+ Here is the caller graph for this function:

◆ getFullscreenLink()

ilPageContent::getFullscreenLink ( )

Get fullscreen link.

Returns
string

Definition at line 258 of file class.ilPageContent.php.

259 {
261 }

References $fullscreen_link.

Referenced by ilPCContentInclude\modifyPageContentPostXsl().

+ Here is the caller graph for this function:

◆ getHierId()

◆ getJavascriptFiles()

ilPageContent::getJavascriptFiles (   $a_mode)

Get Javascript files.

Reimplemented in ilPCGrid, ilPCMediaObject, ilPCParagraph, ilPCPlugged, ilPCQuestion, and ilPCTabs.

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

134 {
135 return array();
136 }

◆ getLangVars()

static ilPageContent::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

Reimplemented in ilPCConsultationHours, ilPCMyCourses, ilPCAMDPageList, ilPCFileList, ilPCGrid, ilPCLoginPageElement, ilPCMediaObject, ilPCPlaceHolder, ilPCProfile, ilPCQuestion, ilPCResources, ilPCSection, ilPCSourceCode, ilPCTable, ilPCTabs, ilPCVerification, and ilPCLearningHistory.

Definition at line 449 of file class.ilPageContent.php.

450 {
451 return array();
452 }

◆ getModel()

ilPageContent::getModel ( )

Get model.

Returns
null|\stdClass

Reimplemented in ilPCParagraph, ilPCPlaceHolder, and ilPCTable.

Definition at line 514 of file class.ilPageContent.php.

515 {
516 return null;
517 }

◆ getNode()

◆ getOnloadCode()

ilPageContent::getOnloadCode (   $a_mode)

Get on load code.

Reimplemented in ilPCParagraph, and ilPCQuestion.

Definition at line 149 of file class.ilPageContent.php.

150 {
151 return array();
152 }

◆ getPage()

◆ getPCId()

ilPageContent::getPCId ( )

Get PC Id.

Returns
string PC Id

Definition at line 208 of file class.ilPageContent.php.

209 {
210 return $this->pcid;
211 }

◆ getProfileBackUrl()

ilPageContent::getProfileBackUrl ( )

Definition at line 238 of file class.ilPageContent.php.

239 {
241 }

References $profile_back_url.

Referenced by ilPCContentInclude\modifyPageContentPostXsl().

+ Here is the caller graph for this function:

◆ getSourcecodeDownloadScript()

ilPageContent::getSourcecodeDownloadScript ( )

Get sourcecode download script.

Returns
string

Definition at line 278 of file class.ilPageContent.php.

References $sourcecode_download_script.

Referenced by ilPCContentInclude\modifyPageContentPostXsl().

+ Here is the caller graph for this function:

◆ getType()

ilPageContent::getType ( )

Get type of page content.

Returns
string Type as defined by the page content component

Reimplemented in ilPCParagraph.

Definition at line 104 of file class.ilPageContent.php.

105 {
106 return $this->type;
107 }
$type

References $type.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ handleCopiedContent()

static ilPageContent::handleCopiedContent ( DOMDocument  $a_domdoc,
  $a_self_ass = true,
  $a_clone_mobs = false 
)
static

Handle copied content.

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

Parameters
DOMDocument$a_domdocdom document

Reimplemented in ilPCAMDPageList, and ilPCTable.

Definition at line 460 of file class.ilPageContent.php.

461 {
462 }

◆ haveSameContainer()

static ilPageContent::haveSameContainer (   $ed_id1,
  $ed_id2 
)
staticfinal

Check, if two ids are in same container.

Parameters
string$ed_id1hierachical ID 1
string$ed_id2hierachical ID 2
Returns
boolean true/false

Definition at line 344 of file class.ilPageContent.php.

345 {
346 $id1 = explode("_", $ed_id1);
347 $id2 = explode("_", $ed_id1);
348 if (count($id1) == count($id2)) {
349 array_pop($id1);
350 array_pop($id2);
351 foreach ($id1 as $key => $id) {
352 if ($id != $id2[$key]) {
353 return false;
354 }
355 }
356 return true;
357 }
358 return false;
359 }

◆ incEdId()

static ilPageContent::incEdId (   $ed_id)
staticfinal

Increases an hierarchical editing id at lowest level (last number)

Parameters
string$ed_idhierarchical ID
Returns
string hierarchical ID (increased)

Definition at line 313 of file class.ilPageContent.php.

314 {
315 $id = explode("_", $ed_id);
316 $id[count($id) - 1]++;
317
318 return implode("_", $id);
319 }

Referenced by ilPageObject\addHierIDs().

+ Here is the caller graph for this function:

◆ init()

◆ isEnabled()

ilPageContent::isEnabled ( )
final

Check whether page content is enabled.

Returns
boolean true/false

Definition at line 422 of file class.ilPageContent.php.

423 {
424 if (is_object($this->node) && $this->node->has_attribute("Enabled")) {
425 $compare = $this->node->get_attribute("Enabled");
426 } else {
427 $compare = "True";
428 }
429
430 return strcasecmp($compare, "true") == 0;
431 }

◆ isGreaterHierId()

static ilPageContent::isGreaterHierId (   $a,
  $b 
)
static

Check whether Hier ID $a is greater than Hier ID $b.

Definition at line 374 of file class.ilPageContent.php.

375 {
376 $a_arr = explode("_", $a);
377 $b_arr = explode("_", $b);
378 for ($i = 0; $i < count($a_arr); $i++) {
379 if ((int) $a_arr[$i] > (int) $b_arr[$i]) {
380 return true;
381 } elseif ((int) $a_arr[$i] < (int) $b_arr[$i]) {
382 return false;
383 }
384 }
385 return false;
386 }
$i
Definition: metadata.php:24
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, and $i.

◆ lookupHierId()

ilPageContent::lookupHierId ( )

Get hierarchical id from dom.

Definition at line 176 of file class.ilPageContent.php.

177 {
178 return $this->node->get_attribute("HierId");
179 }

◆ modifyPageContentPostXsl()

ilPageContent::modifyPageContentPostXsl (   $a_output,
  $a_mode,
  $a_abstract_only = false 
)

Modify page content after xsl.

Parameters
$a_output
$a_mode
bool$a_abstract_only
Returns
string

Reimplemented in ilPCAMDPageList, ilPCContentInclude, ilPCMap, ilPCMediaObject, ilPCPlaceHolder, ilPCPlugged, ilPCLearningHistory, ilPCQuestion, ilPCSection, and ilPCSourceCode.

Definition at line 472 of file class.ilPageContent.php.

473 {
474 return $a_output;
475 }

◆ readHierId()

ilPageContent::readHierId ( )

Read PC Id.

Returns
string PC Id

Definition at line 186 of file class.ilPageContent.php.

187 {
188 if (is_object($this->node)) {
189 return $this->node->get_attribute("HierId");
190 }
191 }

Referenced by ilPCParagraph\getParagraphSequenceContent(), and ilPCInteractiveImage\setNode().

+ Here is the caller graph for this function:

◆ readPCId()

ilPageContent::readPCId ( )

Read PC Id.

Returns
string PC Id

Definition at line 289 of file class.ilPageContent.php.

290 {
291 if (is_object($this->node)) {
292 return $this->node->get_attribute("PCID");
293 }
294 }

Referenced by ilPCParagraph\getParagraphSequenceContent(), and ilPCInteractiveImage\setNode().

+ Here is the caller graph for this function:

◆ setEnabled()

ilPageContent::setEnabled (   $value)

Set Enabled value for page content component.

Parameters
string$value"True" | "False"

Definition at line 394 of file class.ilPageContent.php.

395 {
396 if (is_object($this->node)) {
397 $this->node->set_attribute("Enabled", $value);
398 }
399 }

Referenced by disable(), and enable().

+ Here is the caller graph for this function:

◆ setFileDownloadLink()

ilPageContent::setFileDownloadLink (   $a_download_link)

Set file download link.

Parameters
string$a_download_linkdownload link

Definition at line 218 of file class.ilPageContent.php.

219 {
220 $this->file_download_link = $a_download_link;
221 }

◆ setFullscreenLink()

ilPageContent::setFullscreenLink (   $a_fullscreen_link)

Set fullscreen link.

Parameters
string$a_download_linkdownload link

Definition at line 248 of file class.ilPageContent.php.

249 {
250 $this->fullscreen_link = $a_fullscreen_link;
251 }

◆ setHierId()

ilPageContent::setHierId (   $a_hier_id)

Set hierarchical ID in xml structure.

Parameters
string$a_hier_idHierarchical ID.

Reimplemented in ilPCMediaObject.

Definition at line 159 of file class.ilPageContent.php.

160 {
161 $this->hier_id = $a_hier_id;
162 }

◆ setNode()

◆ setPage()

ilPageContent::setPage (   $a_val)

Set page.

Parameters
object$a_valpage object

Definition at line 68 of file class.ilPageContent.php.

69 {
70 $this->pg_obj = $a_val;
71 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPcId()

ilPageContent::setPcId (   $a_pcid)

Set PC Id.

Parameters
string$a_pcidPC Id

Definition at line 198 of file class.ilPageContent.php.

199 {
200 $this->pcid = $a_pcid;
201 }

◆ setProfileBackUrl()

ilPageContent::setProfileBackUrl (   $url)

Definition at line 233 of file class.ilPageContent.php.

234 {
235 $this->profile_back_url = $url;
236 }
$url

References $url.

◆ setSourcecodeDownloadScript()

ilPageContent::setSourcecodeDownloadScript (   $script_name)

Set sourcecode download script.

Parameters
string$script_name

Definition at line 268 of file class.ilPageContent.php.

269 {
270 $this->sourcecode_download_script = $script_name;
271 }

◆ setType()

◆ sortHierIds()

static ilPageContent::sortHierIds (   $a_array)
static

Sort an array of Hier IDS in ascending order.

Definition at line 364 of file class.ilPageContent.php.

365 {
366 uasort($a_array, array("ilPageContent", "isGreaterHierId"));
367
368 return $a_array;
369 }

Referenced by ilPageObject\copyContents().

+ Here is the caller graph for this function:

◆ writePCId()

ilPageContent::writePCId (   $a_pc_id)

Write pc id.

Definition at line 299 of file class.ilPageContent.php.

300 {
301 if (is_object($this->node)) {
302 $this->node->set_attribute("PCID", $a_pc_id);
303 }
304 }

Field Documentation

◆ $dom

ilPageContent::$dom

Definition at line 23 of file class.ilPageContent.php.

◆ $file_download_link

ilPageContent::$file_download_link
protected

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

Referenced by getFileDownloadLink().

◆ $fullscreen_link

ilPageContent::$fullscreen_link
protected

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

Referenced by getFullscreenLink().

◆ $hier_id

◆ $log

ilPageContent::$log
protected

◆ $node

◆ $page_lang

ilPageContent::$page_lang

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

◆ $profile_back_url

ilPageContent::$profile_back_url
protected

Definition at line 20 of file class.ilPageContent.php.

Referenced by getProfileBackUrl().

◆ $sourcecode_download_script

ilPageContent::$sourcecode_download_script
protected

Definition at line 39 of file class.ilPageContent.php.

Referenced by getSourcecodeDownloadScript().


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