Changeset 442 for trunk/Common/Types
- Timestamp:
- Oct 14, 2012, 9:27:26 PM (12 years ago)
- Location:
- trunk/Common/Types
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Types/Base.php
r428 r442 26 26 } 27 27 28 function OnLoadDb($Item) 29 { 30 return($Item['Value']); 31 } 32 33 function OnSaveDb($Item) 34 { 35 return($Item['Value']); 36 } 37 28 38 function DatabaseEscape($Value) 29 39 { -
trunk/Common/Types/Date.php
r428 r442 11 11 global $MonthNames; 12 12 13 $Parts = explode('-', $Item['Value']); 13 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 14 $Parts = getdate($Item['Value']); 14 15 15 $Output = ($Parts[2] * 1).'.'.$MonthNames[$Parts[1] * 1].' '.$Parts[0];16 $Output = $Parts['mday'].'. '.$MonthNames[$Parts['mon']].' '.$Parts['year']; 16 17 return($Output); 17 18 } … … 20 21 { 21 22 global $MonthNames; 22 23 $Parts = explode('-', $Item['Value']); 23 24 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 25 $Parts = getdate($Item['Value']); 24 26 25 27 // Day … … 27 29 for($I = 1; $I <= 31; $I++) 28 30 { 29 if($Parts[ 2] == $I) $Selected = ' selected="1"'; else $Selected = '';31 if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 30 32 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 31 33 } … … 35 37 for($I = 1; $I <= 12; $I++) 36 38 { 37 if($Parts[ 1] == $I) $Selected = ' selected="1"'; else $Selected = '';39 if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 38 40 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 39 41 } … … 43 45 for($I = 1900; $I < 2100; $I++) 44 46 { 45 if($Parts[ 0] == $I) $Selected = ' selected="1"'; else $Selected = '';47 if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 46 48 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 47 49 } … … 52 54 function OnLoad($Item) 53 55 { 54 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day']); 56 return(mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 57 } 58 59 function OnLoadDb($Item) 60 { 61 return(MysqlDateToTime($Item['Value'])); 62 } 63 64 function OnSaveDb($Item) 65 { 66 return(date('Y-m-d', $Item['Value'])); 55 67 } 56 68 -
trunk/Common/Types/DateTime.php
r428 r442 11 11 global $MonthNames; 12 12 13 if($Item['Value'] != '') 14 { 15 $ValueParts = explode(' ', $Item['Value']); 16 $DateParts = explode('-', $ValueParts[0]); 17 $TimeParts = explode(':', $ValueParts[1]); 18 19 $Output = ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.$DateParts[0].' '.$TimeParts[0].':'.$TimeParts[1].':'.$TimeParts[2]; 20 } else $Output = ''; 13 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 14 $Parts = getdate($Item['Value']); 15 $Output = $Parts['mday'].'.'.$Parts['mon'].'.'.$Parts['year'].' '. 16 $Parts['hours'].':'.$Parts['minutes'].':'.$Parts['seconds']; 21 17 return($Output); 22 18 } … … 26 22 global $MonthNames; 27 23 28 $ValueParts = explode(' ', $Item['Value']); 29 $DateParts = explode('-', $ValueParts[0]); 30 $TimeParts = explode(':', $ValueParts[1]); 24 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 25 $Parts = getdate($Item['Value']); 31 26 32 27 // Hour … … 34 29 for($I = 1; $I <= 24; $I++) 35 30 { 36 if($ TimeParts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';31 if($Parts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 37 32 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 38 33 } … … 42 37 for($I = 1; $I <= 60; $I++) 43 38 { 44 if($ TimeParts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';39 if($Parts['minutes'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 45 40 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 46 41 } … … 50 45 for($I = 1; $I <= 60; $I++) 51 46 { 52 if($ TimeParts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';47 if($Parts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 53 48 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 54 49 } … … 58 53 for($I = 1; $I <= 31; $I++) 59 54 { 60 if($ DateParts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';55 if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 61 56 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 62 57 } … … 66 61 for($I = 1; $I <= 12; $I++) 67 62 { 68 if($ DateParts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';63 if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 69 64 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 70 65 } … … 74 69 for($I = 1900; $I < 2100; $I++) 75 70 { 76 if($ DateParts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';71 if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 77 72 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 78 73 } … … 83 78 function OnLoad($Item) 84 79 { 85 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day'].' '. 86 $_POST[$Item['Name'].'-hour'].':'.$_POST[$Item['Name'].'-minute'].':'.$_POST[$Item['Name'].'-second']); 80 return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'], 81 $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 82 } 83 84 function OnLoadDb($Item) 85 { 86 return(MysqlDateTimeToTime($Item['Value'])); 87 } 88 89 function OnSaveDb($Item) 90 { 91 return(date('Y-m-d H:i:s', $Item['Value'])); 87 92 } 88 93 -
trunk/Common/Types/OneToMany.php
r430 r442 30 30 { 31 31 if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = ''; 32 $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow[' Name'].'</option>';32 $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Id'].': '.$DbRow['Name'].'</option>'; 33 33 } 34 34 $Output .= '</select>'; -
trunk/Common/Types/Password.php
r428 r442 41 41 return($Result); 42 42 } 43 44 function OnLoadDb($Item) 45 { 46 return(''); 47 } 43 48 } 44 49 -
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.