ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\COPage\PC\Paragraph\ParagraphManager Class Reference
+ Collaboration diagram for ILIAS\COPage\PC\Paragraph\ParagraphManager:

Public Member Functions

 __construct ()
 
 send (\DOMDocument $dom, string $par_id, string $filename)
 
 getFirstParagraphText (\ilPageObject $page)
 
 getParagraphForPCID (\ilPageObject $page, string $pcid)
 

Protected Attributes

ILIAS Repository HTTP HTTPUtil $http_util
 
ILIAS COPage Dom DomUtil $dom_util
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\PC\Paragraph\ParagraphManager::__construct ( )

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

32 {
33 global $DIC;
34 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
35 $this->http_util = $DIC->copage()->internal()->gui()->httpUtil();
36 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ getFirstParagraphText()

ILIAS\COPage\PC\Paragraph\ParagraphManager::getFirstParagraphText ( \ilPageObject  $page)

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

66 : string
67 {
68 $dom = $page->getDomDoc();
69 if ($dom) {
70 $path = "//Paragraph[1]";
71 $nodes = $this->dom_util->path($dom, $path);
72 if (count($nodes) > 0) {
73 $cont_node = $nodes->item(0)->parentNode;
74 $par = new \ilPCParagraph($page);
75 $par->setDomNode($cont_node);
76 $text = $par->getText();
77 return $text;
78 }
79 }
80 return "";
81 }
$path
Definition: ltiservices.php:30

References $path, and ilPageObject\getDomDoc().

+ Here is the call graph for this function:

◆ getParagraphForPCID()

ILIAS\COPage\PC\Paragraph\ParagraphManager::getParagraphForPCID ( \ilPageObject  $page,
string  $pcid 
)

Definition at line 83 of file class.ParagraphManager.php.

84 {
85 $dom = $page->getDomDoc();
86 if ($dom) {
87 $path = "//PageContent[@PCID='" . $pcid . "']/Paragraph[1]";
88 $nodes = $this->dom_util->path($dom, $path);
89 if (count($nodes) > 0) {
90 $cont_node = $nodes->item(0)->parentNode;
91 $par = new \ilPCParagraph($page);
92 $par->setDomNode($cont_node);
93 return $par;
94 }
95 }
96 return null;
97 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $path, and ilPageObject\getDomDoc().

+ Here is the call graph for this function:

◆ send()

ILIAS\COPage\PC\Paragraph\ParagraphManager::send ( \DOMDocument  $dom,
string  $par_id,
string  $filename 
)

Definition at line 38 of file class.ParagraphManager.php.

42 : void {
43 $content = "";
44 $path = "/descendant::Paragraph[position() = $par_id]";
45 $nodes = $this->dom_util->path(
46 $dom,
47 $path
48 );
49 if (count($nodes) != 1) {
50 throw new \ilCOPageException("Paragraph not found.");
51 }
52
53 $context_node = $nodes->item(0);
54 foreach ($context_node->childNodes as $child) {
55 $content .= $this->dom_util->dump($child);
56 }
57
58 $content = str_replace("<br />", "\n", $content);
59 $content = str_replace("<br/>", "\n", $content);
60
61 $plain_content = html_entity_decode($content);
62
63 $this->http_util->deliverString($plain_content, $filename);
64 }
$filename
Definition: buildRTE.php:78

Field Documentation

◆ $dom_util

ILIAS COPage Dom DomUtil ILIAS\COPage\PC\Paragraph\ParagraphManager::$dom_util
protected

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

◆ $http_util

ILIAS Repository HTTP HTTPUtil ILIAS\COPage\PC\Paragraph\ParagraphManager::$http_util
protected

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


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