diff --git a/schedule/index.php b/schedule/index.php index 43ca62a..6b9875c 100644 --- a/schedule/index.php +++ b/schedule/index.php @@ -2,7 +2,7 @@ error_reporting(~0); ini_set('display_errors', 1); -$lang = 'bg'; +define('SCHED_LANG', 'bg'); ?> @@ -23,7 +23,7 @@ $content = require __DIR__ . DIRECTORY_SEPARATOR . 'parse.php'; - + @@ -38,6 +38,15 @@ foreach ($content['lines'] as $line) {
+ + + + +
array( + 'name' => 'English', + 'locale' => 'en_US.UTF8' + ), + 'bg' => array( + 'name' => 'Български', + 'locale' => 'bg_BG.UTF8' + ) +); + +/* We need to set these so we actually parse properly the dates. WP fucks up both. */ +date_default_timezone_set('Europe/Sofia'); +setlocale(LC_TIME, $languages[SCHED_LANG]['locale']); + foreach ($data['slots'] as $slot_id => $slot) { $slotTime = $slot['starts_at']; $slotDate = date('d', $slotTime); if ($slotDate !== $date) { $lines[] = ''; - $lines[] = '' . date('d F - l', $slotTime) . ''; + $lines[] = '' . strftime('%d %B - %A', $slotTime) . ''; $lines[] = ' '; $lines[] = ''; @@ -114,6 +133,17 @@ foreach ($data['slots'] as $slot_id => $slot) { $lines[] = ''; +/* create the legend */ +$legend = []; + +foreach($data['tracks'] as $track) { + $legend[] = '' . $track['name'][SCHED_LANG] . ''; +} + +foreach ($languages as $code => $lang) { + $legend[] = '' . $lang['name'] . ''; +} + $gspk = []; $fspk = []; $types = []; @@ -150,4 +180,4 @@ foreach ($data['speakers'] as $speaker) { $gspk[] = ''; -return array_merge($data, compact('lines', 'fulltalks', 'gspk', 'fspk')); +return array_merge($data, compact('lines', 'fulltalks', 'gspk', 'fspk', 'legend'));