| [ Index ] |
PHP Cross Reference of Akelos Framework |
[Summary view] [Print] [Text view]
1 <?php 2 class AkNumber extends AkType 3 { 4 5 var $_default_date_format = 'Y-m-d H:i:s'; 6 7 8 function years() 9 { 10 return $this->year(); 11 } 12 function year() 13 { 14 return new AkNumber(365*24*60*60*$this->value); 15 } 16 function months() 17 { 18 return $this->month(); 19 } 20 function month() 21 { 22 return new AkNumber(30*24*60*60*$this->value); 23 } 24 function weeks() 25 { 26 return $this->week(); 27 } 28 29 function fortnights() 30 { 31 return $this->fortnight(); 32 } 33 34 function fortnight() 35 { 36 return new AkNumber(14*24*60*60*$this->value); 37 } 38 39 function week() 40 { 41 return new AkNumber(7*24*60*60*$this->value); 42 } 43 function second() 44 { 45 return new AkNumber($this->value); 46 } 47 function ordinalize() 48 { 49 return AkInflector::ordinalize($this->value); 50 } 51 function seconds() 52 { 53 return $this->second(); 54 } 55 function minutes() 56 { 57 return $this->minute(); 58 } 59 function minute() 60 { 61 return new AkNumber(60*$this->value); 62 } 63 function hours() 64 { 65 return $this->hour(); 66 } 67 function hour() 68 { 69 return new AkNumber(60*60*$this->value); 70 } 71 function days() 72 { 73 return $this->day(); 74 } 75 function day() 76 { 77 return new AkNumber(24*60*60*$this->value); 78 } 79 function ago() 80 { 81 return new AkTime(time()-$this->value); 82 } 83 function fromNow() 84 { 85 return new AkTime(time()+$this->value); 86 } 87 function until($date_string) 88 { 89 $val = strtotime($date_string)-$this->value; 90 return new AkTime($val); 91 } 92 function since($date_string) 93 { 94 return new AkTime(strtotime($date_string)+$this->value); 95 } 96 function toDate() 97 { 98 return date($this->_default_date_format,$this->value); 99 } 100 101 102 function bytes() 103 { 104 return $this->byte(); 105 } 106 function byte() 107 { 108 return new AkNumber($this->value); 109 } 110 function kilobytes() 111 { 112 return $this->kilobyte(); 113 } 114 function kilobyte() 115 { 116 return new AkNumber(1024*$this->value); 117 } 118 function megabytes() 119 { 120 return $this->megabyte(); 121 } 122 function megabyte() 123 { 124 $val = $this->kilobyte(); 125 $val = $val->getValue(); 126 return new AkNumber(1024*$val); 127 } 128 function gigabytes() 129 { 130 return $this->gigabyte(); 131 } 132 function gigabyte() 133 { 134 $val = $this->megabyte(); 135 $val = $val->getValue(); 136 return new AkNumber(1024*$val); 137 } 138 function terabytes() 139 { 140 return $this->terabyte(); 141 } 142 function terabyte() 143 { 144 $val = $this->gigabyte(); 145 $val = $val->getValue(); 146 return new AkNumber(1024*$val); 147 } 148 function petabytes() 149 { 150 return $this->petabyte(); 151 } 152 function petabyte() 153 { 154 $val = $this->terabyte(); 155 $val = $val->getValue(); 156 return new AkNumber(1024*$val); 157 } 158 function exabytes() 159 { 160 return $this->exabyte(); 161 } 162 function exabyte() 163 { 164 $val = $this->exabyte(); 165 $val = $val->getValue(); 166 return new AkNumber(1024*$val); 167 } 168 function now() 169 { 170 return new AkNumber(time()); 171 } 172 173 function quantify($item) 174 { 175 if ($this->value==1) { 176 return $this->value.' '.Ak::t(AkInflector::singularize($item)); 177 } else { 178 return $this->value.' '.Ak::t(AkInflector::pluralize($item)); 179 } 180 } 181 182 } 183 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Oct 27 12:43:49 2008 | Cross-referenced by PHPXref 0.6 |