ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilPCMap 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 ilPCMap:
+ Collaboration diagram for ilPCMap:

Public Member Functions

 init ()
 Init object. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setLatitude (?float $a_lat=null)
 
 getLatitude ()
 
 setLongitude (?float $a_long=null)
 
 getLongitude ()
 
 setZoom (?int $a_zoom)
 
 getZoom ()
 
 setLayout (?int $a_width, ?int $a_height, string $a_horizontal_align)
 
 getWidth ()
 
 getHeight ()
 
 getHorizontalAlign ()
 
 setCaption (string $a_caption)
 
 getCaption ()
 
 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 handleCaptionInput (string $a_text)
 
static handleCaptionFormOutput (string $a_text)
 
- 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...
 

Additional Inherited Members

- 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

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 ilPCMap Map content object (see ILIAS DTD)

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

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

Member Function Documentation

◆ create()

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

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

35 : void {
37 $a_hier_id,
38 $a_pc_id,
39 "Map",
40 ["Latitude" => "0","Longitude" => "0","Zoom" => "3"]
41 );
42 }
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])

◆ getCaption()

ilPCMap::getCaption ( )

Definition at line 174 of file class.ilPCMap.php.

174 : string
175 {
176 if (is_object($this->getChildNode())) {
177 foreach ($this->getChildNode()->childNodes as $child) {
178 if ($child->nodeName == "MapCaption") {
179 return $this->dom_util->getContent($child);
180 }
181 }
182 }
183 return "";
184 }

◆ getHeight()

ilPCMap::getHeight ( )

Definition at line 134 of file class.ilPCMap.php.

134 : ?int
135 {
136 if (is_object($this->getChildNode())) {
137 foreach ($this->getChildNode()->childNodes as $child) {
138 if ($child->nodeName == "Layout") {
139 $h = $child->getAttribute("Height")
140 ? (int) $child->getAttribute("Height")
141 : null;
142 return $h;
143 }
144 }
145 }
146 return null;
147 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCMap::getHorizontalAlign ( )

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

149 : string
150 {
151 if (is_object($this->getChildNode())) {
152 foreach ($this->getChildNode()->childNodes as $child) {
153 if ($child->nodeName == "Layout") {
154 return $child->getAttribute("HorizontalAlign");
155 }
156 }
157 }
158 return "";
159 }

◆ getLatitude()

ilPCMap::getLatitude ( )

Definition at line 55 of file class.ilPCMap.php.

55 : ?float
56 {
57 if (is_object($this->getChildNode())) {
58 return (float) $this->getChildNode()->getAttribute("Latitude");
59 }
60 return null;
61 }

◆ getLongitude()

ilPCMap::getLongitude ( )

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

74 : ?float
75 {
76 if (is_object($this->getChildNode())) {
77 return (float) $this->getChildNode()->getAttribute("Longitude");
78 }
79 return null;
80 }

◆ getWidth()

ilPCMap::getWidth ( )

Definition at line 119 of file class.ilPCMap.php.

119 : ?int
120 {
121 if (is_object($this->getChildNode())) {
122 foreach ($this->getChildNode()->childNodes as $child) {
123 if ($child->nodeName == "Layout") {
124 $w = $child->getAttribute("Width")
125 ? (int) $child->getAttribute("Width")
126 : null;
127 return $w;
128 }
129 }
130 }
131 return null;
132 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getZoom()

ilPCMap::getZoom ( )

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

93 : ?int
94 {
95 if (is_object($this->getChildNode())) {
96 return (int) $this->getChildNode()->getAttribute("Zoom");
97 }
98 return null;
99 }

◆ handleCaptionFormOutput()

static ilPCMap::handleCaptionFormOutput ( string  $a_text)
static

Definition at line 196 of file class.ilPCMap.php.

198 : string {
199 $a_text = str_replace("<br />", "\n", $a_text);
200 $a_text = str_replace("<br/>", "\n", $a_text);
201
202 return $a_text;
203 }

Referenced by ilPCMapGUI\getValues().

+ Here is the caller graph for this function:

◆ handleCaptionInput()

static ilPCMap::handleCaptionInput ( string  $a_text)
static

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

188 : string {
189 $a_text = str_replace(chr(13) . chr(10), "<br />", $a_text);
190 $a_text = str_replace(chr(13), "<br />", $a_text);
191 $a_text = str_replace(chr(10), "<br />", $a_text);
192
193 return $a_text;
194 }

◆ init()

ilPCMap::init ( )

Init object.

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

Reimplemented from ilPageContent.

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

26 : void
27 {
28 $this->setType("map");
29 }
setType(string $a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

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

Modify page content after xsl.

Reimplemented from ilPageContent.

Definition at line 205 of file class.ilPCMap.php.

209 : string {
210 $end = 0;
211 $start = strpos($a_output, "[[[[[Map;");
212 if (is_int($start)) {
213 $end = strpos($a_output, "]]]]]", $start);
214 }
215 $i = 1;
216 while ($end > 0) {
217 $param = substr($a_output, $start + 9, $end - $start - 9);
218
219 $param = explode(";", $param);
220 if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2])) {
221 $width = is_numeric($param[3] ?? null) ? $param[3] . "px" : "100%";
222 $height = is_numeric($param[4] ?? null) ? $param[4] . "px" : "100%";
223 $map_gui = ilMapUtil::getMapGUI();
224 $map_gui->setMapId("map_" . $i)
225 ->setLatitude($param[0])
226 ->setLongitude($param[1])
227 ->setZoom($param[2])
228 ->setWidth($width)
229 ->setHeight($height)
230 ->setEnableTypeControl(true)
231 ->setEnableNavigationControl(true)
232 ->setEnableCentralMarker(true);
233 $h2 = substr($a_output, 0, $start) .
234 $map_gui->getHtml() .
235 substr($a_output, $end + 5);
236 $a_output = $h2;
237 $i++;
238 }
239 $start = strpos($a_output, "[[[[[Map;", $start + 5);
240 $end = 0;
241 if (is_int($start)) {
242 $end = strpos($a_output, "]]]]]", $start);
243 }
244 }
245
246 return $a_output;
247 }
static getMapGUI()
Get an instance of the GUI class.
$param
Definition: xapitoken.php:44

◆ setCaption()

ilPCMap::setCaption ( string  $a_caption)

Definition at line 161 of file class.ilPCMap.php.

161 : void
162 {
163 if (is_object($this->getChildNode())) {
164 $this->dom_util->setFirstOptionalElement(
165 $this->getChildNode(),
166 "MapCaption",
167 array(),
168 $a_caption,
169 array()
170 );
171 }
172 }

◆ setLatitude()

ilPCMap::setLatitude ( ?float  $a_lat = null)

Definition at line 44 of file class.ilPCMap.php.

44 : void
45 {
46 if (!is_null($a_lat)) {
47 $this->getChildNode()->setAttribute("Latitude", (string) $a_lat);
48 } else {
49 if ($this->getChildNode()->hasAttribute("Latitude")) {
50 $this->getChildNode()->removeAttribute("Latitude");
51 }
52 }
53 }

◆ setLayout()

ilPCMap::setLayout ( ?int  $a_width,
?int  $a_height,
string  $a_horizontal_align 
)

Definition at line 101 of file class.ilPCMap.php.

105 : void {
106 if (is_object($this->getChildNode())) {
107 $this->dom_util->setFirstOptionalElement(
108 $this->getChildNode(),
109 "Layout",
110 array("MapCaption"),
111 "",
112 array("Width" => $a_width !== null ? (string) $a_width : null,
113 "Height" => $a_height !== null ? (string) $a_height : null,
114 "HorizontalAlign" => $a_horizontal_align)
115 );
116 }
117 }

◆ setLongitude()

ilPCMap::setLongitude ( ?float  $a_long = null)

Definition at line 63 of file class.ilPCMap.php.

63 : void
64 {
65 if (!is_null($a_long)) {
66 $this->getChildNode()->setAttribute("Longitude", $a_long);
67 } else {
68 if ($this->getChildNode()->hasAttribute("Longitude")) {
69 $this->getChildNode()->removeAttribute("Longitude");
70 }
71 }
72 }

◆ setZoom()

ilPCMap::setZoom ( ?int  $a_zoom)

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

82 : void
83 {
84 //if (!empty($a_zoom)) {
85 $this->getChildNode()->setAttribute("Zoom", (int) $a_zoom);
86 /*} else {
87 if ($this->map_node->has_attribute("Zoom")) {
88 $this->map_node->remove_attribute("Zoom");
89 }
90 }*/
91 }

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