* Main method to calculate rss string from * status xml files or from cache */ $app->get('/', function (Request $request) use($app, $SERVER_ROOT, $SERVER_ROOT_SCRIPT) { $feed = new Feed(); $channel = new Channel(); $channel->title('Wurst update status'); $channel->description("Uni-Hamburg server"); $channel->url('http://zbh.uni-hamburg.de'); $channel->appendTo($feed); $transformerCategory = new RecordToCategoryTransformer(); $transformerTitle = new RecordToTitleTransformer($transformerCategory); $transformerDescription = new RecordToDescriptionTransformer($app['twig']); foreach ($app['wurst.history']->collection() as $id => $element) { $item = new Item(); $item->author("wurst update"); $item->url("http://{$SERVER_ROOT_SCRIPT}/details/{$id}"); $item->pubDate($element->getDate()); $item->title($transformerTitle->transform($element)); $item->category($transformerCategory->transform($element)); $item->description($transformerDescription->transform($element)); $item->appendTo($channel); } return new Response($feed, 200); }); /** * Method to show details for given record in rss stream * * @todo ids for all records are not unique, * @todo so it may be a problem but this situation is not so probable * @todo we can just ignore that, but it should be changed for good