From 12beb0e6ca3d8c1a72855a7fd61481cf2f6db22b Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 4 Mar 2009 10:54:17 +0000 Subject: Improvements to elgg_view, plus river dashboard RSS feed git-svn-id: https://code.elgg.org/elgg/trunk@3053 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 21 ++++++----- .../views/rss/riverdashboard/container.php | 1 + views/rss/river/item/list.php | 42 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 mod/riverdashboard/views/rss/riverdashboard/container.php create mode 100644 views/rss/river/item/list.php 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 @@ + \ 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 @@ +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); + +?> + + + + + <![CDATA[<?php echo $title; ?>]]> + ]]> + += $vars['limit']) break; + + } + + } + + +?> \ No newline at end of file -- cgit v1.2.3