source: trunk/Packages/FormManager/Types/TimeDiff.php

Last change on this file was 8, checked in by chronos, 18 months ago
  • Modified: Updated Common package.
  • Modified: Form types made as separate FormManager package.
  • Fixed: PHP 8.1 support.
File size: 523 bytes
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Base.php');
4
5class TypeTimeDiff extends TypeInteger
6{
7 function OnView(array $Item): ?string
8 {
9 if ($Item['Value'] == null) $Output = '';
10 else {
11 $Output = sprintf('%02d', floor($Item['Value'] / 3600) % 24).':'.
12 sprintf('%02d', floor($Item['Value'] / 60) % 60).':'.
13 sprintf('%02d', floor($Item['Value']) % 60);
14 $Days = floor($Item['Value'] / (60 * 60 * 24));
15 if ($Days > 0) $Output = $Days.' dnů '.$Output;
16 }
17 return $Output;
18 }
19}
Note: See TracBrowser for help on using the repository browser.