Changeset 887 for trunk/Common/Form/Types/GPS.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Types/GPS.php
r874 r887 5 5 class TypeGPS extends TypeBase 6 6 { 7 function OnView( $Item)7 function OnView(array $Item): ?string 8 8 { 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']); 12 10 if ($DbResult->num_rows > 0) 13 11 { … … 20 18 } 21 19 22 function OnEdit( $Item)20 function OnEdit(array $Item): string 23 21 { 24 global $Database;25 26 22 if ($Item['Value'] != '') 27 23 { 28 $DbResult = $ Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);24 $DbResult = $this->Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']); 29 25 if ($DbResult->num_rows > 0) 30 26 { … … 43 39 } 44 40 45 function OnLoad( $Item)41 function OnLoad(array $Item): ?string 46 42 { 47 global $Database;48 49 43 $Latitude = $this->Implode($_POST[$Item['Name'].'-lat-deg'], $_POST[$Item['Name'].'-lat-min'], $_POST[$Item['Name'].'-lat-sec']); 50 44 $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; 53 47 } 54 48 55 function Explode( $Float)49 function Explode(float $Float): array 56 50 { 57 51 $Degrees = intval($Float); … … 64 58 } 65 59 66 function Implode($Degrees, $Minutes, $Seconds) 60 function Implode($Degrees, $Minutes, $Seconds): float 67 61 { 68 62 if ($Degrees < 0) return -(abs($Degrees) + ($Minutes + $Seconds / 60) / 60);
Note:
See TracChangeset
for help on using the changeset viewer.