The sledrun icon is now dependent on the sledrun condition.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.body.php
index e0f7d2ca380319678b93ff77873f3fe69afd9966..60fbf18295f739d3bbaa5ae0adc7a4e70b549370 100644 (file)
@@ -17,7 +17,7 @@ class WrMap {
 
                // Query database
                $dbr = wfGetDB(DB_SLAVE);
-               $res = $dbr->select('wrsledruncache', array('page_title', 'position_latitude', 'position_longitude'), array('show_in_overview', 'not under_construction'));
+               $res = $dbr->select(array('wrsledruncache', 'wrreportcache'), array('wrsledruncache.page_title', 'position_latitude', 'position_longitude', 'date_report', '`condition`'), array('show_in_overview', 'not under_construction'), __METHOD__, array(), array('wrreportcache' => array('left outer join', 'wrsledruncache.page_id=wrreportcache.page_id')));
                $sledruns = array();
                while ($sledrun = $dbr->fetchRow($res)) $sledruns[] = $sledrun;
                $dbr->freeResult($res);
@@ -34,7 +34,12 @@ class WrMap {
                        $lon = $sledrun['position_longitude'];
                        if (!$lat || !$lon) continue;
                        $title = Title::newFromText($sledrun['page_title']);
-                       $output .= "<p data-lon=\"$lon\" data-lat=\"$lat\" data-title=\"{$title->getText()}\" data-url=\"{$title->getLocalUrl()}\" />\n";
+                       $title_text = htmlspecialchars($title->getText());
+                       $title_url = htmlspecialchars($title->getLocalUrl());
+                       $output .= "<p data-lon=\"$lon\" data-lat=\"$lat\" data-title=\"$title_text\" data-url=\"$title_url\" ";
+                       if (!is_null($sledrun['date_report'])) $output .= "data-date_report=\"{$sledrun['date_report']}\" ";
+                       if (!is_null($sledrun['condition'])) $output .= "data-condition=\"{$sledrun['condition']}\" ";
+                       $output .= "/>\n";
                }
                $output .= "</div>\n";