1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Jonah_View_DeliveryHtml extends Jonah_View_Base
13: {
14: 15: 16: 17: 18: 19: 20:
21: public function run()
22: {
23: extract($this->_params, EXTR_REFS);
24: $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
25:
26:
27: try {
28: $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
29: } catch (Exception $e) {
30: Horde::logMessage($e, 'ERR');
31: $notification->push(_("Invalid channel."), 'horde.error');
32: Horde::url('delivery/index.php', true)->redirect();
33: exit;
34: }
35:
36: $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
37:
38: $options = array();
39: foreach ($templates as $key => $info) {
40: $options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
41: }
42:
43: $template = new Horde_Template();
44: $template->setOption('gettext', 'true');
45: $template->set('url', Horde::selfUrl());
46: $template->set('session', Horde_Util::formInput());
47: $template->set('channel_id', $criteria['feed']);
48: $template->set('channel_name', $channel['channel_name']);
49: $template->set('format', $criteria['format']);
50: $template->set('options', $options);
51:
52:
53:
54: $template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
55: $template->set('menu', Horde::menu(array('menu_obj' => true)));
56:
57:
58: Horde::startBuffer();
59: $GLOBALS['notification']->notify(array('listeners' => 'status'));
60: $template->set('notify', Horde::endBuffer());
61:
62: require $registry->get('templates', 'horde') . '/common-header.inc';
63: echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
64: require $registry->get('templates', 'horde') . '/common-footer.inc';
65: }
66:
67: }