r57692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57691‎ | r57692 | r57693 >
Date:00:30, 14 October 2009
Author:yaron
Status:deferred
Tags:
Comment:
Added support for SMW 1.5 in conjunction with Semantic Compound Queries
Modified paths:
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -142,7 +142,6 @@
143143
144144 }
145145 }
146 -
147146 }
148147
149148 /**
@@ -156,14 +155,20 @@
157156 $legend_labels = array();
158157
159158 // Look for display_options field, which can be set by Semantic Compound Queries
160 - if (property_exists($row[0], 'display_options')) {
161 - if (array_key_exists('icon', $row[0]->display_options)) {
162 - $icon = $row[0]->display_options['icon'];
 159+ // the location of this field changed in SMW 1.5
 160+ if (method_exists($row[0], 'getResultSubject')) // SMW 1.5+
 161+ $display_location = $row[0]->getResultSubject();
 162+ else
 163+ $display_location = $row[0];
 164+ if (property_exists($display_location, 'display_options') && is_array($display_location->display_options)) {
 165+ $display_options = $display_location->display_options;
 166+ if (array_key_exists('icon', $display_options)) {
 167+ $icon = $display_options['icon'];
163168
164169 // This is somewhat of a hack - if a legend label has been set, we're getting it for every point, instead of just once per icon
165 - if (array_key_exists('legend label', $row[0]->display_options)) {
 170+ if (array_key_exists('legend label', $display_options)) {
166171
167 - $legend_label = $row[0]->display_options['legend label'];
 172+ $legend_label = $display_options['legend label'];
168173
169174 if (! array_key_exists($icon, $legend_labels)) {
170175 $legend_labels[$icon] = $legend_label;

Status & tagging log