+/// \brief It returns an array of the "condition" (as number) and the date of the "most recent" report of the specified page (to decode as list($condition, $date);
+///
+/// If no condition is present, array(NULL, NULL) is returned
+function wrReportConditionRender($page_title) {
+ $dbr = wfGetDB(DB_SLAVE);
+ $res = $dbr->select('wrreport', array('max(wrreport.id) as max'), array('page_title' => $page_title, 'condition is not null', 'date_invalid > now()'));
+ // select condition, date_report from wrreport where id = (select max(wrreport.id) as max from wrreport where page_title='Birgitzer Alm (vom Adelshof)' and date_invalid > now() and condition is not null);
+ if ($res->numRows() <= 0) return array(NULL, NULL);
+ $row = $dbr->fetchObject($res);
+ $res = $dbr->select('wrreport', array('condition', 'date_report'), array('id' => $row->max));
+ if ($res->numRows() <= 0) return array(NULL, NULL);
+ $row = $dbr->fetchObject($res);
+ return array($row->condition, $row->date_report);
+}
+
+