ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilADTLocationPresentationBridge.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 {
23  protected string $width = '100%';
24  protected string $height = '200px';
25 
26  protected function isValidADT(ilADT $a_adt): bool
27  {
28  return ($a_adt instanceof ilADTLocation);
29  }
30 
34  public function setSize(string $a_width, string $a_height): void
35  {
36  $this->width = $a_width;
37  $this->height = $a_height;
38  }
39 
40  public function getHTML(): string
41  {
42  if (!$this->getADT()->isNull()) {
43  $map_gui = ilMapUtil::getMapGUI();
44  $map_gui->setMapId("map_" . uniqid()) // :TODO: sufficient entropy?
45  ->setLatitude((string) $this->getADT()->getLatitude())
46  ->setLongitude((string) $this->getADT()->getLongitude())
47  ->setZoom($this->getADT()->getZoom())
48  ->setEnableTypeControl(true)
49  ->setEnableLargeMapControl(true)
50  ->setEnableUpdateListener(false)
51  ->setEnableCentralMarker(true);
52 
53  if ($this->width) {
54  $map_gui->setWidth($this->width);
55  }
56  if ($this->height) {
57  $map_gui->setHeight($this->height);
58  }
59 
60  return $this->decorate($map_gui->getHtml());
61  }
62  return '';
63  }
64 
65  public function getList(): string
66  {
67  if (!$this->getADT()->isNull()) {
68  // :TODO: probably does not make much sense
69  return $this->getADT()->getLatitude() . "&deg;/" . $this->getADT()->getLongitude() . "&deg;";
70  }
71  return '';
72  }
73 
74  public function getSortable()
75  {
76  if (!$this->getADT()->isNull()) {
77  // :TODO: probably does not make much sense
78  return $this->getADT()->getLatitude() . ";" . $this->getADT()->getLongitude();
79  }
80  return '';
81  }
82 }
decorate($a_value)
Decorate value.
ADT base class.
Definition: class.ilADT.php:11
static getMapGUI()
Get an instance of the GUI class.
setSize(string $a_width, string $a_height)
Set size in strings of int + unit, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...