Changeset 229 for trunk/global.php
- Timestamp:
- Jun 21, 2009, 12:04:00 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/global.php
r228 r229 50 50 array('u', 'mikro', pow(10, -6)), 51 51 array('m', 'mili', pow(10, -3)), 52 array('', '', pow(10, 0) , pow(2, 0)),52 array('', '', pow(10, 0)), 53 53 array('k', 'kilo', pow(10, 3)), 54 54 array('M', 'mega', pow(10, 6)), … … 63 63 'Time' => array 64 64 ( 65 'BaseIndex' => 0,65 'BaseIndex' => 8, 66 66 'Definition' => array 67 67 ( … … 75 75 array('ms', 'milisekunda', pow(10, -3)), 76 76 array('s', 'sekunda', 1), 77 array('min ', 'minuta', 60),78 array('hod ', 'hodina', 60 * 60) ,79 array('d en', 'den', 24 * 60 * 60),80 array('týd ', 'týden', 7 * 24 * 60 * 60),81 array('měs ', 'měsíc', 30 * 24 * 60 * 60),82 array('rok ', 'rok', 364 * 24 * 60 * 60),83 array('des ', 'desetiletí', 10 * 364 * 24 * 60 * 60),84 array('sta ', 'staletí', 100 * 364 * 24 * 60 * 60),85 array('tis ', 'tisiciletí', 10000 * 364 * 24 * 60 * 60),77 array('minut', 'minuta', 60), 78 array('hodin', 'hodina', 60 * 60) , 79 array('dnů', 'den', 24 * 60 * 60), 80 array('týdnů', 'týden', 7 * 24 * 60 * 60), 81 array('měsíců', 'měsíc', 30 * 24 * 60 * 60), 82 array('roků', 'rok', 364 * 24 * 60 * 60), 83 array('desetiletí', 'desetiletí', 10 * 364 * 24 * 60 * 60), 84 array('stalatí', 'staletí', 100 * 364 * 24 * 60 * 60), 85 array('tisíciletí', 'tisiciletí', 10000 * 364 * 24 * 60 * 60), 86 86 ), 87 87 ), 88 88 ); 89 90 89 91 90 class System extends Module … … 137 136 function HumanDate($Time) 138 137 { 139 138 return(date('j.n.Y', $Time)); 140 139 } 141 140 … … 158 157 global $PrefixMultipliers; 159 158 160 if(($Unit == '') and ($PrefixType != 'Time')) return($this->TruncateDigits($Value, $Digits)); 159 $Negative = ($Value < 0); 160 $Value = abs($Value); 161 if(($Unit == '') and ($PrefixType != 'Time')) 162 return($this->TruncateDigits($Value, $Digits)); 163 161 164 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 162 if($Value > 0) $II = 1; 163 else if($Value < 0) $II = -1; 164 else $II = 0; 165 while((($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + $II][2]) > $II) and (($I + $II) >= 0) and (($I + $II) <= count($PrefixMultipliers[$PrefixType]['Definition']))) $I = $I + $II; 165 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 166 167 if($Value > 1) 168 { 169 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 170 $I = $I + 1; 171 } else 172 if($Value < 1) 173 { 174 while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1)) 175 $I = $I - 1; 176 } 166 177 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 167 178 168 179 // Truncate digits count 169 180 $Value = $this->TruncateDigits($Value, $Digits); 170 181 if($Negative) $Value = -$Value; 171 182 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 172 183 }
Note:
See TracChangeset
for help on using the changeset viewer.