diff options
-rw-r--r-- | engine/lib/elgglib.php | 21 | ||||
-rw-r--r-- | mod/riverdashboard/views/rss/riverdashboard/container.php | 1 | ||||
-rw-r--r-- | views/rss/river/item/list.php | 42 |
3 files changed, 55 insertions, 9 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 379c4e543..8f3196482 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -228,10 +228,11 @@ * @param string $view The name and location of the view to use * @param array $vars Any variables that the view requires, passed as an array * @param boolean $bypass If set to true, elgg_view will bypass any specified alternative template handler; by default, it will hand off to this if requested (see set_template_handler) - * @param boolean $debug If set to true, the viewer will complain if it can't find a view + * @param boolean $debug If set to true, the viewer will complain if it can't find a view
+ * @param string $viewtype If set, forces the viewtype for the elgg_view call to be this value (default: standard detection) * @return string The HTML content */ - function elgg_view($view, $vars = "", $bypass = false, $debug = false) { + function elgg_view($view, $vars = "", $bypass = false, $debug = false, $viewtype = '') { global $CONFIG; static $usercache; @@ -286,8 +287,9 @@ } - // Get the current viewtype - $viewtype = elgg_get_viewtype(); + // Get the current viewtype
+ if (empty($viewtype)) + $viewtype = elgg_get_viewtype(); // Set up any extensions to the requested view if (isset($CONFIG->views->extensions[$view])) { @@ -313,7 +315,6 @@ foreach($viewlist as $priority => $view) { $view_location = elgg_get_view_location($view); - if (file_exists($view_location . "{$viewtype}/{$view}.php") && !include($view_location . "{$viewtype}/{$view}.php")) { $success = false; @@ -352,15 +353,17 @@ /** * Returns whether the specified view exists * - * @param string $view The view name + * @param string $view The view name
+ * @param string $viewtype If set, forces the viewtype * @return true|false Depending on success */ - function elgg_view_exists($view) { + function elgg_view_exists($view, $viewtype = '') { global $CONFIG; - // Detect view type - $viewtype = elgg_get_viewtype(); + // Detect view type
+ if (empty($viewtype)) + $viewtype = elgg_get_viewtype(); if (!isset($CONFIG->views->locations[$viewtype][$view])) { if (!isset($CONFIG->viewpath)) { diff --git a/mod/riverdashboard/views/rss/riverdashboard/container.php b/mod/riverdashboard/views/rss/riverdashboard/container.php new file mode 100644 index 000000000..871a6cc7e --- /dev/null +++ b/mod/riverdashboard/views/rss/riverdashboard/container.php @@ -0,0 +1 @@ +<?php echo $vars['body']; ?>
\ No newline at end of file diff --git a/views/rss/river/item/list.php b/views/rss/river/item/list.php new file mode 100644 index 000000000..4bc715048 --- /dev/null +++ b/views/rss/river/item/list.php @@ -0,0 +1,42 @@ +<?php
+
+ if (isset($vars['items']) && is_array($vars['items'])) {
+
+ $i = 0;
+ if (!empty($vars['items']))
+ foreach($vars['items'] as $item) {
+
+ // echo elgg_view_river_item($item);
+ if (elgg_view_exists($item->view,'default')) {
+ $body = elgg_view($item->view,array(
+ 'item' => $item
+ ),false,false,'default');
+ $time = date("r",$item->posted);
+ if ($entity = get_entity($item->object_guid)) {
+ $url = $entity->getURL();
+ } else {
+ $url = $vars['url'];
+ }
+ $title = strip_tags($body);
+
+?>
+ <item>
+ <guid isPermaLink='true'><?php echo $url; ?></guid>
+ <pubDate><?php echo $time; ?></pubDate>
+ <link><?php echo $url; ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo (autop($body)); ?>]]></description>
+ </item>
+<?php
+
+ }
+
+ $i++;
+ if ($i >= $vars['limit']) break;
+
+ }
+
+ }
+
+
+?>
\ No newline at end of file |