r49846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49845‎ | r49846 | r49847 >
Date:22:30, 24 April 2009
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for multiple dates per page
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php
@@ -47,7 +47,8 @@
4848 $locations = array();
4949 // print all result rows
5050 while ( $row = $res->getNext() ) {
51 - $date = $title = $text = $color = "";
 51+ $dates = array();
 52+ $title = $text = $color = "";
5253
5354 if ($this->mTemplate != '') { // build template code
5455 $this->hasTemplates = true;
@@ -65,7 +66,7 @@
6667 $text .= $object->getShortText($outputmode, NULL);
6768 }
6869 if ($pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat') {
69 - $date = SRFCalendar::formatDateStr($object);
 70+ $dates[] = SRFCalendar::formatDateStr($object);
7071 }
7172 }
7273 }
@@ -89,14 +90,14 @@
9091 $text .= $pr->getHTMLText($skin) . " " . $object->getShortText($outputmode, $skin);
9192 }
9293 if ($pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat') {
93 - $date = SRFCalendar::formatDateStr($object);
 94+ $dates[] = SRFCalendar::formatDateStr($object);
9495 }
9596 }
9697 }
9798 if ($i > 1)
9899 $text .= ")";
99100 }
100 - if ($date != '') {
 101+ if (count($dates) > 0) {
101102 // handle the 'color=' value, whether it came
102103 // from a compound query or a regular one
103104 if (property_exists($row[0], 'display_options')) {
@@ -104,7 +105,8 @@
105106 $color = $row[0]->display_options['color'];
106107 } elseif (array_key_exists('color', $this->m_params))
107108 $color = $this->m_params['color'];
108 - $events[] = array($title, $text, $date, $color);
 109+ foreach ($dates as $date)
 110+ $events[] = array($title, $text, $date, $color);
109111 }
110112 }
111113

Status & tagging log