Changeset 874 for trunk/Common/Form/Types/Time.php
- Timestamp:
- Apr 6, 2020, 11:56:19 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Types/Time.php
r873 r874 9 9 function OnView($Item) 10 10 { 11 if ($Item['Value'] == 0) return ('');11 if ($Item['Value'] == 0) return ''; 12 12 if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time(); 13 13 $TimeParts = getdate($Item['Value']); 14 14 15 15 $Output = sprintf('%02d', $TimeParts['hours']).':'.sprintf('%02d', $TimeParts['minutes']).':'.sprintf('%02d', $TimeParts['seconds']); 16 return ($Output);16 return $Output; 17 17 } 18 18 … … 67 67 } 68 68 $Output .= '</select>'; 69 return ($Output);69 return $Output; 70 70 } 71 71 72 72 function OnLoad($Item) 73 73 { 74 if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return (null);75 return (mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second']));74 if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return null; 75 return mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second']); 76 76 } 77 77 78 78 function OnLoadDb($Item) 79 79 { 80 return (MysqlTimeToTime($Item['Value']));80 return MysqlTimeToTime($Item['Value']); 81 81 } 82 82 83 83 function OnSaveDb($Item) 84 84 { 85 if ($Item['Value'] == null) return (null);86 else return (date('H:i:s', $Item['Value']));85 if ($Item['Value'] == null) return null; 86 else return date('H:i:s', $Item['Value']); 87 87 } 88 88 89 89 function DatabaseEscape($Value) 90 90 { 91 return ('"'.addslashes($Value).'"');91 return '"'.addslashes($Value).'"'; 92 92 } 93 93 }
Note:
See TracChangeset
for help on using the changeset viewer.