source: trunk/Common/Form/Types/TimeDiff.php

Last change on this file was 924, checked in by chronos, 3 years ago
  • Fixed: Wrong float to int conversion.
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.