Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Types/GPS.php

    r874 r887  
    55class TypeGPS extends TypeBase
    66{
    7   function OnView($Item)
     7  function OnView(array $Item): ?string
    88  {
    9     global $Database;
    10 
    11     $DbResult = $Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
     9    $DbResult = $this->Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
    1210    if ($DbResult->num_rows > 0)
    1311    {
     
    2018  }
    2119
    22   function OnEdit($Item)
     20  function OnEdit(array $Item): string
    2321  {
    24     global $Database;
    25 
    2622    if ($Item['Value'] != '')
    2723    {
    28       $DbResult = $Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
     24      $DbResult = $this->Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
    2925      if ($DbResult->num_rows > 0)
    3026      {
     
    4339  }
    4440
    45   function OnLoad($Item)
     41  function OnLoad(array $Item): ?string
    4642  {
    47     global $Database;
    48 
    4943    $Latitude = $this->Implode($_POST[$Item['Name'].'-lat-deg'], $_POST[$Item['Name'].'-lat-min'], $_POST[$Item['Name'].'-lat-sec']);
    5044    $Longitude = $this->Implode($_POST[$Item['Name'].'-lon-deg'], $_POST[$Item['Name'].'-lon-min'], $_POST[$Item['Name'].'-lon-sec']);
    51     $Database->query('INSERT INTO SystemGPS (`Latitude`, `Longitude`) VALUES ("'.$Latitude.'", "'.$Longitude.'")');
    52     return $Database->insert_id;
     45    $this->Database->query('INSERT INTO SystemGPS (`Latitude`, `Longitude`) VALUES ("'.$Latitude.'", "'.$Longitude.'")');
     46    return $this->Database->insert_id;
    5347  }
    5448
    55   function Explode($Float)
     49  function Explode(float $Float): array
    5650  {
    5751    $Degrees = intval($Float);
     
    6458  }
    6559
    66   function Implode($Degrees, $Minutes, $Seconds)
     60  function Implode($Degrees, $Minutes, $Seconds): float
    6761  {
    6862    if ($Degrees < 0) return -(abs($Degrees) + ($Minutes + $Seconds / 60) / 60);
Note: See TracChangeset for help on using the changeset viewer.