diff --git a/schedule/.gitignore b/schedule/.gitignore deleted file mode 100644 index f3917d2..0000000 --- a/schedule/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cache -cache.json diff --git a/schedule/load.php b/schedule/load.php index 9c2c971..fc9c8af 100644 --- a/schedule/load.php +++ b/schedule/load.php @@ -1,7 +1,7 @@ 'events.json', @@ -12,15 +12,14 @@ $filenames = [ 'slots' => 'slots.json', ]; - $data = []; foreach ($filenames as $name => $filename) { - $curl = new SmartCurl($base_url, 'cache' . DIRECTORY_SEPARATOR .$CF['confid']); + $curl = new SmartCurl($base_url); $json = $curl->getUrl($filename); if ($json === false) { - echo 'get failed: ', $filename, ' ', $base_url, PHP_EOL; + echo 'get failed: ', $filename, PHP_EOL; exit; } @@ -32,13 +31,12 @@ foreach ($filenames as $name => $filename) { } $add = true; + switch ($name) { case 'halls': - $ret = array(); - foreach($decoded as $id => $hall) { - if (in_array($id, $CF['allowedhallids'])) $ret[$id] = $hall['name']; - } - $decoded = $ret; + $decoded = array_map(function($el) { + return $el['name']; + }, $decoded); break; case 'slots': $decoded = array_map(function($el) { @@ -65,6 +63,6 @@ uasort($data['slots'], function($a, $b) { return compareKeys($a, $b, 'starts_at') ?: compareKeys($a, $b, 'hall_id'); }); -//array_pop($data['halls']); +array_pop($data['halls']); return $data; diff --git a/schedule/parse.php b/schedule/parse.php index 6ab9345..4ef5deb 100644 --- a/schedule/parse.php +++ b/schedule/parse.php @@ -9,11 +9,7 @@ $data = require __DIR__ . DIRECTORY_SEPARATOR . 'load.php'; -/* no idea why do I have to write this, doesn't seem to exist in the system */ - -$languages = array('en' => array('name' => 'English', 'locale' => 'en_US.UTF8'), 'bg' => array ('name' => 'Български', 'locale' => 'bg_BG.UTF8')); - -$cut_len = 70; +$cut_len = 50; $cfp_url = 'http://cfp.openfest.org'; $time = 0; $date = 0; @@ -25,20 +21,13 @@ $hall_ids = array_keys($data['halls']); $first_hall_id = min($hall_ids); $last_hall_id = max($hall_ids); -/* 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[$CF['lang']]['locale']); - foreach ($data['slots'] as $slot_id => $slot) { - if (! in_array($slot['hall_id'], $CF['allowedhallids'])) continue; $slotTime = $slot['starts_at']; $slotDate = date('d', $slotTime); if ($slotDate !== $date) { - /* this seems to be the easiest way to localize the date */ - $localdate = strftime('%d %B - %A' ,$slotTime); $lines[] = '
' . $event['title'] . ' ' . $fulltalk_spkr . ''; $fulltalks[$eid] .= '
' . $event['abstract'] . '
'; - $fulltalks[$eid] .= ''; + $fulltalks[$eid] .= ''; if ($slot['event_id'] === $prev_event_id) { array_pop($lines); @@ -119,16 +108,6 @@ foreach ($data['slots'] as $slot_id => $slot) { } $lines[] = ''; -/* create the legend */ - -$legend = []; - -foreach($data['tracks'] as $track) { - $legend[] = '' . $speaker['biography'] . '
'; $fspk[] = ''; } $gspk[] = ''; -return array_merge($data, compact('lines', 'fulltalks', 'gspk', 'fspk', 'legend')); +return array_merge($data, compact('lines', 'fulltalks', 'gspk', 'fspk'));