ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 setNode (php4DOMElement $a_node)
 
 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)
 
- 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 handleCaptionInput (string $a_text)
 
static handleCaptionFormOutput (string $a_text)
 
- 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 $map_node
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 

Additional Inherited Members

- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 
- 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 = ""
 

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 39 of file class.ilPCMap.php.

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

43  : void {
44  $this->node = $this->createPageContentNode();
45 
46  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
47  $this->map_node = $this->dom->create_element("Map");
48  $this->map_node = $this->node->append_child($this->map_node);
49  $this->map_node->set_attribute("Latitude", "0");
50  $this->map_node->set_attribute("Longitude", "0");
51  $this->map_node->set_attribute("Zoom", "3");
52  }
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
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) ...
+ Here is the call graph for this function:

◆ getCaption()

ilPCMap::getCaption ( )

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

188  : string
189  {
190  if (is_object($this->map_node)) {
191  $childs = $this->map_node->child_nodes();
192  foreach ($childs as $child) {
193  if ($child->node_name() == "MapCaption") {
194  return $child->get_content();
195  }
196  }
197  }
198  return "";
199  }

◆ getHeight()

ilPCMap::getHeight ( )

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

References ILIAS\Repository\int().

145  : ?int
146  {
147  if (is_object($this->map_node)) {
148  $childs = $this->map_node->child_nodes();
149  foreach ($childs as $child) {
150  if ($child->node_name() == "Layout") {
151  $h = $child->get_attribute("Height")
152  ? (int) $child->get_attribute("Height")
153  : null;
154  return $h;
155  }
156  }
157  }
158  return null;
159  }
+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCMap::getHorizontalAlign ( )

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

161  : string
162  {
163  if (is_object($this->map_node)) {
164  $childs = $this->map_node->child_nodes();
165  foreach ($childs as $child) {
166  if ($child->node_name() == "Layout") {
167  return $child->get_attribute("HorizontalAlign");
168  }
169  }
170  }
171  return "";
172  }

◆ getLatitude()

ilPCMap::getLatitude ( )

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

65  : ?float
66  {
67  if (is_object($this->map_node)) {
68  return (float) $this->map_node->get_attribute("Latitude");
69  }
70  return null;
71  }

◆ getLongitude()

ilPCMap::getLongitude ( )

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

84  : ?float
85  {
86  if (is_object($this->map_node)) {
87  return (float) $this->map_node->get_attribute("Longitude");
88  }
89  return null;
90  }

◆ getWidth()

ilPCMap::getWidth ( )

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

References ILIAS\Repository\int().

129  : ?int
130  {
131  if (is_object($this->map_node)) {
132  $childs = $this->map_node->child_nodes();
133  foreach ($childs as $child) {
134  if ($child->node_name() == "Layout") {
135  $w = $child->get_attribute("Width")
136  ? (int) $child->get_attribute("Width")
137  : null;
138  return $w;
139  }
140  }
141  }
142  return null;
143  }
+ Here is the call graph for this function:

◆ getZoom()

ilPCMap::getZoom ( )

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

103  : ?int
104  {
105  if (is_object($this->map_node)) {
106  return (int) $this->map_node->get_attribute("Zoom");
107  }
108  return null;
109  }

◆ handleCaptionFormOutput()

static ilPCMap::handleCaptionFormOutput ( string  $a_text)
static

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

Referenced by ilPCMapGUI\getValues().

213  : string {
214  $a_text = str_replace("<br />", "\n", $a_text);
215  $a_text = str_replace("<br/>", "\n", $a_text);
216 
217  return $a_text;
218  }
+ Here is the caller graph for this function:

◆ handleCaptionInput()

static ilPCMap::handleCaptionInput ( string  $a_text)
static

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

203  : string {
204  $a_text = str_replace(chr(13) . chr(10), "<br />", $a_text);
205  $a_text = str_replace(chr(13), "<br />", $a_text);
206  $a_text = str_replace(chr(10), "<br />", $a_text);
207 
208  return $a_text;
209  }

◆ init()

ilPCMap::init ( )

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

References ilPageContent\setType().

28  : void
29  {
30  $this->setType("map");
31  }
setType(string $a_type)
Set Type.
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

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

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

References $i, $param, and ilMapUtil\getMapGUI().

224  : string {
225  $end = 0;
226  $start = strpos($a_output, "[[[[[Map;");
227  if (is_int($start)) {
228  $end = strpos($a_output, "]]]]]", $start);
229  }
230  $i = 1;
231  while ($end > 0) {
232  $param = substr($a_output, $start + 9, $end - $start - 9);
233 
234  $param = explode(";", $param);
235  if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2])) {
236  $map_gui = ilMapUtil::getMapGUI();
237  $map_gui->setMapId("map_" . $i)
238  ->setLatitude($param[0])
239  ->setLongitude($param[1])
240  ->setZoom($param[2])
241  ->setWidth($param[3] . "px")
242  ->setHeight($param[4] . "px")
243  ->setEnableTypeControl(true)
244  ->setEnableNavigationControl(true)
245  ->setEnableCentralMarker(true);
246  $h2 = substr($a_output, 0, $start) .
247  $map_gui->getHtml() .
248  substr($a_output, $end + 5);
249  $a_output = $h2;
250  $i++;
251  }
252  $start = strpos($a_output, "[[[[[Map;", $start + 5);
253  $end = 0;
254  if (is_int($start)) {
255  $end = strpos($a_output, "]]]]]", $start);
256  }
257  }
258 
259  return $a_output;
260  }
static getMapGUI()
Get an instance of the GUI class.
$param
Definition: xapitoken.php:46
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setCaption()

ilPCMap::setCaption ( string  $a_caption)

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

References ilDOMUtil\setFirstOptionalElement().

174  : void
175  {
176  if (is_object($this->map_node)) {
178  $this->dom,
179  $this->map_node,
180  "MapCaption",
181  array(),
182  $a_caption,
183  array()
184  );
185  }
186  }
static setFirstOptionalElement(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes, bool $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...
+ Here is the call graph for this function:

◆ setLatitude()

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

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

54  : void
55  {
56  if (!is_null($a_lat)) {
57  $this->map_node->set_attribute("Latitude", (string) $a_lat);
58  } else {
59  if ($this->map_node->has_attribute("Latitude")) {
60  $this->map_node->remove_attribute("Latitude");
61  }
62  }
63  }

◆ setLayout()

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

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

References ilDOMUtil\setFirstOptionalElement().

115  : void {
116  if (is_object($this->map_node)) {
118  $this->dom,
119  $this->map_node,
120  "Layout",
121  array("MapCaption"),
122  "",
123  array("Width" => (string) $a_width,
124  "Height" => (string) $a_height, "HorizontalAlign" => $a_horizontal_align)
125  );
126  }
127  }
static setFirstOptionalElement(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes, bool $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...
+ Here is the call graph for this function:

◆ setLongitude()

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

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

73  : void
74  {
75  if (!is_null($a_long)) {
76  $this->map_node->set_attribute("Longitude", $a_long);
77  } else {
78  if ($this->map_node->has_attribute("Longitude")) {
79  $this->map_node->remove_attribute("Longitude");
80  }
81  }
82  }

◆ setNode()

ilPCMap::setNode ( php4DOMElement  $a_node)

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

References php4DOMNode\first_child().

33  : void
34  {
35  parent::setNode($a_node); // this is the PageContent node
36  $this->map_node = $a_node->first_child(); // this is the Map node
37  }
+ Here is the call graph for this function:

◆ setZoom()

ilPCMap::setZoom ( ?int  $a_zoom)

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

92  : void
93  {
94  //if (!empty($a_zoom)) {
95  $this->map_node->set_attribute("Zoom", (int) $a_zoom);
96  /*} else {
97  if ($this->map_node->has_attribute("Zoom")) {
98  $this->map_node->remove_attribute("Zoom");
99  }
100  }*/
101  }

Field Documentation

◆ $map_node

php4DOMElement ilPCMap::$map_node

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


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