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/DateTime.php

    r871 r887  
    55class TypeDateTime extends TypeBase
    66{
    7   var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     7  function __construct(FormManager $FormManager)
     8  {
     9    parent::__construct($FormManager);
     10    $this->DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     11  }
    812
    9   function OnView($Item)
     13  function OnView(array $Item): ?string
    1014  {
    11     global $MonthNames;
    12 
    1315    if ($Item['Value'] == 0) return '';
    1416    if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
     
    1921  }
    2022
    21   function OnEdit($Item)
     23  function OnEdit(array $Item): string
    2224  {
    2325    global $MonthNames;
     
    99101  }
    100102
    101   function OnLoad($Item)
     103  function OnLoad(array $Item): ?string
    102104  {
    103105    if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return null;
     
    106108  }
    107109
    108   function OnLoadDb($Item)
     110  function OnLoadDb(array $Item): ?string
    109111  {
    110112    return MysqlDateTimeToTime($Item['Value']);
    111113  }
    112114
    113   function OnSaveDb($Item)
     115  function OnSaveDb(array $Item): ?string
    114116  {
    115117    if ($Item['Value'] == null) return null;
     
    117119  }
    118120
    119   function DatabaseEscape($Value)
     121  function DatabaseEscape(string $Value): string
    120122  {
    121123    return '"'.addslashes($Value).'"';
Note: See TracChangeset for help on using the changeset viewer.