Changeset 442 for trunk/Common/Types/Time.php
- Timestamp:
- Oct 14, 2012, 9:27:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Types/Time.php
r428 r442 9 9 function OnView($Item) 10 10 { 11 $TimeParts = explode(':', $Item['Value']); 11 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 12 $TimeParts = getdate($Item['Value']); 12 13 13 $Output = $TimeParts[ 0].':'.$TimeParts[1].':'.$TimeParts[2];14 $Output = $TimeParts['hours'].':'.$TimeParts['minutes'].':'.$TimeParts['seconds']; 14 15 return($Output); 15 16 } … … 17 18 function OnEdit($Item) 18 19 { 19 $TimeParts = explode(':', $Item['Value']); 20 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 21 $TimeParts = getdate($Item['Value']); 20 22 21 23 // Hour … … 23 25 for($I = 1; $I <= 24; $I++) 24 26 { 25 if($TimeParts[ 2] == $I) $Selected = ' selected="1"'; else $Selected = '';27 if($TimeParts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 26 28 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 27 29 } … … 31 33 for($I = 1; $I <= 60; $I++) 32 34 { 33 if($TimeParts[ 1] == $I) $Selected = ' selected="1"'; else $Selected = '';35 if($TimeParts['month'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 34 36 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 35 37 } … … 39 41 for($I = 1; $I <= 60; $I++) 40 42 { 41 if($TimeParts[ 0] == $I) $Selected = ' selected="1"'; else $Selected = '';43 if($TimeParts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 42 44 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 43 45 } … … 48 50 function OnLoad($Item) 49 51 { 50 return($_POST[$Item['Name'].'-hour'].':'.$_POST[$Item['Name'].'-minute'].':'.$_POST[$Item['Name'].'-second']); 52 return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'])); 53 } 54 55 function OnLoadDb($Item) 56 { 57 return(MysqlTimeToTime($Item['Value'])); 58 } 59 60 function OnSaveDb($Item) 61 { 62 return(date('H:i:s', $Item['Value'])); 51 63 } 52 64
Note:
See TracChangeset
for help on using the changeset viewer.