Changeset 887 for trunk/Modules/Map


Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (4 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
Location:
trunk/Modules/Map
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Map/Map.php

    r874 r887  
    55class PageNetworkMap extends Page
    66{
    7   var $FullTitle = 'Mapa sítě';
    8   var $ShortTitle = 'Mapa sítě';
    9   var $ParentClass = 'PagePortal';
     7  function __construct(System $System)
     8  {
     9    parent::__construct($System);
     10    $this->FullTitle = 'Mapa sítě';
     11    $this->ShortTitle = 'Mapa sítě';
     12    $this->ParentClass = 'PagePortal';
     13  }
    1014  //var $Load = 'initialize()';
    1115  //var $Unload = 'GUnload()';
    1216
    13   function Show()
    14   {
    15     if (!$this->System->User->CheckPermission('Map', 'Show'))
     17  function Show(): string
     18  {
     19    if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Map', 'Show'))
    1620      return 'Nemáte oprávnění';
    1721
     
    2327  }
    2428
    25   function ShowPosition()
     29  function ShowPosition(): string
    2630  {
    2731    $DbResult = $this->Database->select('MapPosition', '*', '`Id`='.$_GET['i']);
     
    4448  }
    4549
    46   function ShowMain()
     50  function ShowMain(): string
    4751  {
    4852    $Map = new MapOpenStreetMaps($this->System);
     
    242246class TypeMapPosition extends TypeString
    243247{
    244   function OnEdit($Item)
     248  function OnEdit(array $Item): string
    245249  {
    246250    $Output = parent::OnEdit($Item);
     
    255259class ModuleMap extends AppModule
    256260{
    257   function __construct($System)
     261  function __construct(System $System)
    258262  {
    259263    parent::__construct($System);
     
    263267    $this->License = 'GNU/GPL';
    264268    $this->Description = 'Show objects on Google maps';
    265     $this->Dependencies = array('Network');
     269    $this->Dependencies = array('Network', 'User');
    266270    $this->SupportedModels = array();
    267271  }
    268272
    269   function DoStart()
     273  function DoStart(): void
    270274  {
    271275    $this->System->Pages['map'] = 'PageNetworkMap';
     
    310314  }
    311315
    312   function DoInstall()
     316  function DoInstall(): void
    313317  {
    314318    $this->System->Database->query("CREATE TABLE IF NOT EXISTS `MapPosition` (
     
    320324  }
    321325
    322   function DoUninstall()
     326  function DoUninstall(): void
    323327  {
    324328    $this->Database->query('DROP TABLE `MapPosition`');
  • trunk/Modules/Map/MapAPI.php

    r874 r887  
    33class MapMarker
    44{
    5   var $Position;
    6   var $Text;
     5  public array $Position;
     6  public string $Text;
    77}
    88
    99class MapPolyLine
    1010{
    11   var $Points = array();
    12   var $Color = 'black';
     11  public array $Points = array();
     12  public string $Color = 'black';
    1313}
    1414
    1515class Map extends Model
    1616{
    17   var $Position;
    18   var $Zoom;
    19   var $Key;
     17  public array $Position;
     18  public int $Zoom;
     19  public string $Key;
    2020  var $OnClickObject;
    21   var $MarkerText;
    22   var $Markers;
    23   var $PolyLines;
     21  public string $MarkerText;
     22  public array $Markers;
     23  public array $PolyLines;
    2424
    25   function __construct($System)
     25  function __construct(System $System)
    2626  {
    2727    parent::__construct($System);
     
    3535  }
    3636
    37   function Show()
     37  function Show(): string
    3838  {
    3939    return '';
     
    4343class MapGoogle extends Map
    4444{
    45   function ShowPage($Page)
     45  function ShowPage(Page $Page): string
    4646  {
    4747    $Page->Load = 'initialize()';
     
    113113class MapOpenStreetMaps extends Map
    114114{
    115   function GetPageHeader()
     115  function GetPageHeader(): string
    116116  {
    117117    $Output = '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
     
    124124  }
    125125
    126   function ShowPage($Page)
     126  function ShowPage(Page $Page): string
    127127  {
    128128    $this->System->PageHeaders[] = array($this, 'GetPageHeader');
Note: See TracChangeset for help on using the changeset viewer.