Index: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php |
— | — | @@ -61,15 +61,22 @@ |
62 | 62 | |
63 | 63 | $this->includeJS(); |
64 | 64 | |
65 | | - $isEventline = ( 'eventline' == $this->mFormat ); |
| 65 | + $isEventline = 'eventline' == $this->mFormat; |
66 | 66 | |
67 | 67 | if ( !$isEventline && ( $this->m_tlstart == '' ) ) { // seek defaults |
68 | 68 | foreach ( $res->getPrintRequests() as $pr ) { |
69 | 69 | if ( ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $pr->getTypeID() == '_dat' ) ) { |
70 | | - if ( method_exists ( $pr->getData(), 'getValueKey' ) ) { |
71 | | - $date_value = $pr->getData()->getValueKey(); |
72 | | - } else { |
73 | | - $date_value = $pr->getData()->getXSDValue(); |
| 70 | + $dataValue = $pr->getData(); |
| 71 | + |
| 72 | + // SMW >= 1.6 |
| 73 | + if ( method_exists ( $dataValue, 'getDataItem' ) ) { |
| 74 | + $date_value = $dataValue->getDataItem()->getLabel(); |
| 75 | + } // SMW 1.5.x |
| 76 | + elseif ( method_exists ( $dataValue, 'getValueKey' ) ) { |
| 77 | + $date_value = $dataValue->getValueKey(); |
| 78 | + } // SMW < 1.5 |
| 79 | + else { |
| 80 | + $date_value = $dataValue->getXSDValue(); |
74 | 81 | } |
75 | 82 | |
76 | 83 | if ( ( $this->m_tlend == '' ) && ( $this->m_tlstart != '' ) && |
— | — | @@ -166,13 +173,19 @@ |
167 | 174 | foreach ( $row as $field ) { // Loop over the returned properties |
168 | 175 | $first_value = true; |
169 | 176 | $pr = $field->getPrintRequest(); |
| 177 | + $dataValue = $pr->getData(); |
170 | 178 | |
171 | | - if ( $pr->getData() == '' ) { |
| 179 | + if ( $dataValue == '' ) { |
172 | 180 | $date_value = null; |
173 | | - } elseif ( method_exists ( $pr->getData(), 'getValueKey' ) ) { |
174 | | - $date_value = $pr->getData()->getValueKey(); |
175 | | - } else { |
176 | | - $date_value = $pr->getData()->getXSDValue(); |
| 181 | + } // SMW >= 1.6 |
| 182 | + elseif ( method_exists ( $dataValue, 'getDataItem' ) ) { |
| 183 | + $date_value = $dataValue->getDataItem()->getLabel(); |
| 184 | + } // SMW 1.5.x |
| 185 | + elseif ( method_exists ( $dataValue, 'getValueKey' ) ) { |
| 186 | + $date_value = $dataValue->getValueKey(); |
| 187 | + } // SMW < 1.5 |
| 188 | + else { |
| 189 | + $date_value = $dataValue->getXSDValue(); |
177 | 190 | } |
178 | 191 | |
179 | 192 | while ( ( $object = efSRFGetNextDV( $field ) ) !== false ) { // Loop over property values |
— | — | @@ -343,20 +356,22 @@ |
344 | 357 | } |
345 | 358 | |
346 | 359 | if ( $isEventline && ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $pr->getTypeID() == '_dat' ) && ( '' != $pr->getLabel() ) && ( $date_value != $this->m_tlstart ) && ( $date_value != $this->m_tlend ) ) { |
347 | | - if ( method_exists( $object, 'getValueKey' ) ) { |
348 | | - $event = array( |
349 | | - $object->getXMLSchemaDate(), |
350 | | - $pr->getLabel(), |
351 | | - $object->getValueKey() |
352 | | - ); |
353 | | - } |
| 360 | + // SMW >= 1.6 |
| 361 | + if ( method_exists ( $object, 'getDataItem' ) ) { |
| 362 | + $numericValue = $object->getDataItem()->getForCalendarModel( SMWDITime::CM_GREGORIAN ); |
| 363 | + } // SMW 1.5.x |
| 364 | + elseif ( method_exists ( $object, 'getValueKey' ) ) { |
| 365 | + $numericValue = $object->getValueKey(); |
| 366 | + } // SMW < 1.5 |
354 | 367 | else { |
355 | | - $event = array( |
356 | | - $object->getXMLSchemaDate(), |
357 | | - $pr->getLabel(), |
358 | | - $object->getNumericValue() |
359 | | - ); |
360 | | - } |
| 368 | + $numericValue = $object->getNumericValue(); |
| 369 | + } |
| 370 | + |
| 371 | + $event = array( |
| 372 | + $object->getXMLSchemaDate(), |
| 373 | + $pr->getLabel(), |
| 374 | + $numericValue |
| 375 | + ); |
361 | 376 | } |
362 | 377 | |
363 | 378 | return $event; |