Stripping CVS keywords
[project/views.git] / modules / aggregator / views_plugin_row_aggregator_rss.inc
1 <?php
2 /**
3 * @file
4 * Contains the Aggregator Item RSS row style plugin.
5 */
6
7 /**
8 * Plugin which loads an aggregator item and formats it as an RSS item.
9 */
10 class views_plugin_row_aggregator_rss extends views_plugin_row {
11 function option_definition() {
12 $options = parent::option_definition();
13
14 $options['item_length'] = array('default' => 'default');
15
16 return $options;
17 }
18
19 function options_form(&$form, &$form_state) {
20 $form['item_length'] = array(
21 '#type' => 'select',
22 '#title' => t('Display type'),
23 '#options' => array(
24 'fulltext' => t('Full text'),
25 'teaser' => t('Title plus teaser'),
26 'title' => t('Title only'),
27 'default' => t('Use default RSS settings'),
28 ),
29 '#default_value' => $this->options['item_length'],
30 );
31 }
32
33 function render($row) {
34 $sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, ";
35 $sql .= "ai.timestamp, ai.guid, af.title AS feed_title, ai.link AS feed_LINK ";
36 $sql .= "FROM {aggregator_item} ai LEFT JOIN {aggregator_feed} af ON ai.fid = af.fid ";
37 $sql .= "WHERE ai.iid = %d";
38
39 $item = db_fetch_object(db_query($sql, $row->iid));
40
41 $item->elements = array(
42 array('key' => 'pubDate', 'value' => gmdate('r', $item->timestamp)),
43 array(
44 'key' => 'dc:creator',
45 'value' => $item->author,
46 'namespace' => array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/'),
47 ),
48 array(
49 'key' => 'guid',
50 'value' => $item->guid,
51 'attributes' => array('isPermaLink' => 'false')
52 ),
53 );
54
55 foreach ($item->elements as $element) {
56 if (isset($element['namespace'])) {
57 $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $element['namespace']);
58 }
59 }
60
61 return theme($this->theme_functions(), $this->view, $this->options, $item);
62 }
63 }
64