r24080 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24079‎ | r24080 | r24081 >
Date:09:38, 14 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Fixed bug with timeline queries without results.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinters.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinters.php
@@ -480,19 +480,21 @@
481481 $curcolor = ($curcolor + 1) % 10;
482482 }
483483 }
484 - ksort($positions);
485 - $positions = array_values($positions);
486 - switch ($this->m_tlpos) {
487 - case 'start':
488 - $result .= '<span class="smwtlposition">' . $positions[0] . '</span>';
489 - break;
490 - case 'end':
491 - $result .= '<span class="smwtlposition">' . $positions[count($positions)-1] . '</span>';
492 - break;
493 - case 'today': break; // default
494 - case 'middle': default:
495 - $result .= '<span class="smwtlposition">' . $positions[ceil(count($positions)/2)-1] . '</span>';
496 - break;
 484+ if (count($positions) > 0) {
 485+ ksort($positions);
 486+ $positions = array_values($positions);
 487+ switch ($this->m_tlpos) {
 488+ case 'start':
 489+ $result .= '<span class="smwtlposition">' . $positions[0] . '</span>';
 490+ break;
 491+ case 'end':
 492+ $result .= '<span class="smwtlposition">' . $positions[count($positions)-1] . '</span>';
 493+ break;
 494+ case 'today': break; // default
 495+ case 'middle': default:
 496+ $result .= '<span class="smwtlposition">' . $positions[ceil(count($positions)/2)-1] . '</span>';
 497+ break;
 498+ }
497499 }
498500 }
499501 //no further results displayed ...

Status & tagging log