Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | protected $m_jd = 0; //numerical time representation similiar to Julian Day; for ancient times, a more compressed number is used (preserving ordering of time points) |
113 | 113 | protected $m_format = false; // number of parts of the date that were specified |
114 | 114 | protected $m_outformat = false; // A special code governing printout formats. |
115 | | - protected $m_timeoffset; //contains offset (e.g. timezone) |
| 115 | + protected $m_timeoffset; //contains offset (e.g. timezone) |
116 | 116 | protected $m_timeannotation; //contains am or pm |
117 | 117 | protected $m_dayj = false; // Julian day, remains false if unspecified |
118 | 118 | protected $m_monthj = false; // Julian month, remains false if unspecified |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | if ($this->m_caption === false) { // Store the caption now. |
165 | 165 | $this->m_caption = $value; |
166 | 166 | } |
167 | | - |
| 167 | + |
168 | 168 | // if the value is a number, and it has at least six places left of decimal, we know |
169 | 169 | // it's not a year, so treat it as a Julian day, but leave it as the caption and wikivalue. |
170 | 170 | if (is_numeric($value) && $value >= 100000) { |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | $this->m_wikivalue = $value; |
175 | 175 | return true; |
176 | 176 | } |
177 | | - |
| 177 | + |
178 | 178 | $this->m_wikivalue = $value; |
179 | 179 | $filteredvalue = $value; //value without time definition and further abbreviations like PM or BC |
180 | 180 | |
— | — | @@ -185,14 +185,14 @@ |
186 | 186 | } |
187 | 187 | |
188 | 188 | //browse string in advance for timezone monikers ("EST", "WET", "MESZ", etc.) |
189 | | - $regexptz = "/A[CEKW]?[DS]T|BST|CXT|[CEW]([DES]|E[DS])T|" . |
| 189 | + $regexptz = "/A[CEKW]?[DS]T|BST|CXT|[CEW]([DES]|E[DS])T|" . |
190 | 190 | "GMT|H(A[DS]T|[AN][ACEPRTY])|IST|M(DT|E(S)?Z|S[DKT])|N[DFS]T|P[DS]T|UTC/u"; |
191 | 191 | if(preg_match($regexptz, $filteredvalue, $match)) { |
192 | 192 | // Retrieve the offset and store it as the initial time offset value. |
193 | 193 | $this->m_timeoffset = $this->m_timeoffset + self::$m_tz[$match[0]]/24; |
194 | 194 | $regexp = "/(\040|T){0,1}".str_replace("+", "\+", $match[0])."(\040){0,1}/u"; //delete tz moniker and preceding and following chars |
195 | 195 | $filteredvalue = preg_replace($regexp,'', $filteredvalue); //value without the tz moniker |
196 | | - } |
| 196 | + } |
197 | 197 | |
198 | 198 | //browse string for special abbreviations referring to year like AD, BC, and OS |
199 | 199 | $is_yearbc = false; |
— | — | @@ -303,7 +303,7 @@ |
304 | 304 | $globalvar = 'm_'.$globalvar; // (for searching this file) this is one of: m_year, m_month, m_day |
305 | 305 | if($prelimModel == 'Jl') { |
306 | 306 | $globalvar = $globalvar . 'j'; |
307 | | - } |
| 307 | + } |
308 | 308 | if (!$this->$globalvar) $this->$globalvar = intval($array[$i]); |
309 | 309 | $i++; |
310 | 310 | } |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | if ($this->m_pref == 'OS') { |
337 | 337 | if(($this->m_monthj < 3) || (($this->m_monthj == 3) && ($this->m_dayj < 25))) { |
338 | 338 | $this->m_yearj++; |
339 | | - } |
| 339 | + } |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Handle BC: the year is negative. |
— | — | @@ -445,7 +445,7 @@ |
446 | 446 | |
447 | 447 | protected function parseDBkeys($args) { |
448 | 448 | $this->m_caption = false; |
449 | | - $this->m_pref = array_key_exists(1,$args)?$args[1]:''; |
| 449 | + $this->m_pref = array_key_exists(2,$args)?$args[2]:''; |
450 | 450 | list($date,$this->m_time) = explode('T',$args[0],2); |
451 | 451 | $d = explode('/',$date,3); |
452 | 452 | if (count($d)==3) list($this->m_year,$this->m_month,$this->m_day) = $d; |
— | — | @@ -488,7 +488,7 @@ |
489 | 489 | } |
490 | 490 | |
491 | 491 | public function getShortHTMLText($linker = NULL) { |
492 | | - return $this->getShortWikiText($linker); // should be save (based on xsdvalue) |
| 492 | + return $this->getShortWikiText($linker); // should be safe (based on xsdvalue) |
493 | 493 | } |
494 | 494 | |
495 | 495 | public function getLongWikiText($linked = NULL) { |
— | — | @@ -509,19 +509,21 @@ |
510 | 510 | if ($this->m_xsdvalue === false) { |
511 | 511 | $this->m_xsdvalue = $this->m_year."/".$this->m_month."/".$this->m_day."T".$this->m_time; |
512 | 512 | } |
513 | | - return array($this->m_xsdvalue, $this->m_pref); |
| 513 | + return array($this->m_xsdvalue, $this->m_jd, $this->m_pref); |
514 | 514 | } |
515 | 515 | |
516 | | - public function getNumericValue() { |
517 | | - $this->unstub(); |
518 | | - return $this->m_jd; |
| 516 | + public function getSignature() { |
| 517 | + return 'tfu'; |
519 | 518 | } |
520 | 519 | |
521 | | - public function getUnit() { |
522 | | - $values = $this->getDBkeys(); |
523 | | - return $values[1]; |
| 520 | + public function getValueIndex() { |
| 521 | + return 1; |
524 | 522 | } |
525 | 523 | |
| 524 | + public function getLabelIndex() { |
| 525 | + return 0; |
| 526 | + } |
| 527 | + |
526 | 528 | public function getWikiValue(){ |
527 | 529 | $this->unstub(); |
528 | 530 | return $this->m_wikivalue; |
— | — | @@ -742,7 +744,7 @@ |
743 | 745 | * (JD) is computed. The JD has the form XXXX.YYYY where XXXX is the number of days having elapsed since |
744 | 746 | * noon on 1 January 4713 BC and YYYY is the elapsed time of the day as fraction of 1. |
745 | 747 | * See http://en.wikipedia.org/wiki/Julian_day |
746 | | - * If the year is before -4713, then the computed number XXXX.YYYY has the following form: XXXX is |
| 748 | + * If the year is before -4713, then the computed number XXXX.YYYY has the following form: XXXX is |
747 | 749 | * the number of years BC and YYYY represents the elapsed days of the year as fraction of 1. This |
748 | 750 | * enables even large negative dates using 32bit floats. |
749 | 751 | * |
— | — | @@ -832,7 +834,7 @@ |
833 | 835 | $this->m_month = 1; |
834 | 836 | $this->m_year++; |
835 | 837 | } |
836 | | - } |
| 838 | + } |
837 | 839 | } |
838 | 840 | |
839 | 841 | /// Convert Julian Day back to a Julian date. |
— | — | @@ -848,4 +850,3 @@ |
849 | 851 | $this->m_dayj = ($this->m_format == 3) ? ($b - $d - intval(30.6001 * $e)) : false; |
850 | 852 | } |
851 | 853 | } |
852 | | - |
\ No newline at end of file |