// Condition options
$condition_options = '';
- $condition_array = array(1 => 'Sehr gut', 2 => 'Gut', 3 => 'Mittelmäßig', 4 => 'Schlecht', 5 => 'Geht nicht');
- $condition_options .= '<option value="">(keine Beurteilung)</option>' . "\n";
- foreach ($condition_array as $condition_num => $condition_text) {
+ global $wrConditions; // $wrConditions = array(1 => 'Sehr gut', 2 => 'Gut', 3 => utf8_encode('Mittelmäßig'), 4 => 'Schlecht', 5 => 'Geht nicht');
+ $condition_options .= utf8_encode('<option value="">(keine Beurteilung)</option>') . "\n";
+ foreach ($wrConditions as $condition_num => $condition_text) {
$condition_options .= "<option value=\"$condition_num\"";
if ($condition == $condition_num) $condition_options .= ' selected="selected"';
- $condition_options .= '>' . htmlspecialchars(utf8_encode($condition_text)) . "</option>\n";
+ $condition_options .= '>' . htmlspecialchars($condition_text) . "</option>\n";
}
$description_html = htmlspecialchars($description);
$out = "<tr>";
if (!is_null($page_id)) $out .= '<td>' . $page_id . '</td>';
if (!is_null($page_title)) $out .= '<td>' . wrReportSandboxParse('[[' . $page_title . ']]') . '</td>';
+ $dayOfWeek = array('Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So');
+ $date_report = strtotime($date_report);
+ $date_report = $dayOfWeek[strftime('%u', $date_report)-1] . strftime(', %d.%m.', $date_report);
$out .= '<td>' . $date_report . '</td>';
if (!is_null($date_entry)) $out .= '<td>' . date('Y-m-d, H:i', strtotime($date_entry)) . '</td>';
if (!is_null($date_invalid)) $out .= '<td>' . date('Y-m-d, H:i', strtotime($date_invalid)) . '</td>';
- $out .= '<td>' . $condition . '</td>';
+ global $wrConditions;
+ $condition_text = '---';
+ if (isset($wrConditions[$condition])) $condition_text = $wrConditions[$condition];
+ $out .= '<td>' . htmlspecialchars($condition_text) . '</td>';
$out .= '<td class="wrreportdescription">' . wrReportSandboxParse($description) . '</td>';
$out .= '<td>' . htmlspecialchars($author_name) . '</td>';
$out .= "</tr>\n";
$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);
+ $date = $row->date_report;
+ if ($date) $date = strtotime($date);
+ return array($row->condition, $date);
}
function bahnbewertungParserHook($input, $args, &$parser) {
if (!$input) $input = $parser->getTitle()->getText();
list($condition, $date) = wrReportConditionRender($input);
- return "$condition ($date)";
+ if ($date) $date = strftime('%d.%m.', $date);
+ global $wrConditions;
+ global $wrNewReportSection; // = utf8_encode('Eintragen');
+ global $wrShowReportsSection; // = utf8_encode('Einträge');
+ if (isset($wrConditions[$condition])) return wrReportSandboxParse('[['. $input . '#' . $wrShowReportsSection . '|'. $wrConditions[$condition] . "]] <small>$date ''[[" . $input . '#' . $wrNewReportSection . "|Neu]]''</small>");
+ return wrReportSandboxParse("<small>''[[" . $input . '#' . $wrNewReportSection . "|Bitte eintragen]]''</small>");
}
// Purge cache
$title->invalidateCache();
// Show success message
- $wgOut->addWikiText(utf8_encode('<div class="successbox">Der Bahnbericht für [[') . $page_title . utf8_encode('#Einträge|') . $page_title . utf8_encode("]] wurde erfolgreich gespeichert.</div>\n"));
+ global $wrShowReportsSection;
+ $wgOut->addWikiText(utf8_encode('<div class="successbox">Der Bahnbericht für [[') . $page_title . '#' . $wrShowReportsSection . '|' . $page_title . utf8_encode("]] wurde erfolgreich gespeichert.</div>\n"));
// We could redirect to result with the following line but we don't want to.
// $wgOut->redirect($title->getFullURL() . '#Eintr.C3.A4ge');
}