diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-16 15:25:18 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-16 15:25:18 +0000 |
commit | c32f43bcac8ff4493ce387b078a57ba4fdd57063 (patch) | |
tree | e03ac4a5dfa832e5bcc0948619db7b0c2fb15e36 | |
parent | 6562e3311d64e5ddbe7183188d4dafddb3080e62 (diff) | |
download | elgg-c32f43bcac8ff4493ce387b078a57ba4fdd57063.tar.gz elgg-c32f43bcac8ff4493ce387b078a57ba4fdd57063.tar.bz2 |
Added activity ecml keyword.
git-svn-id: http://code.elgg.org/elgg/trunk@5774 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/riverdashboard/languages/en.php | 16 | ||||
-rw-r--r-- | mod/riverdashboard/start.php | 35 | ||||
-rw-r--r-- | mod/riverdashboard/views/default/riverdashboard/ecml/activity.php | 29 |
3 files changed, 70 insertions, 10 deletions
diff --git a/mod/riverdashboard/languages/en.php b/mod/riverdashboard/languages/en.php index 864a8d7a9..1a3c96f2b 100644 --- a/mod/riverdashboard/languages/en.php +++ b/mod/riverdashboard/languages/en.php @@ -5,10 +5,10 @@ $english = array( 'riverdashboard:useasdashboard' => "Replace the default dashboard with this activity river?", 'activity' => 'Activity', 'riverdashboard:recentmembers' => 'Recent members', - - /** - * Site messages - **/ + + /** + * Site messages + **/ 'sitemessages:announcements' => "Site announcements", 'sitemessages:posted' => "Posted", @@ -16,7 +16,7 @@ $english = array( 'sitemessages:river:create' => "posted a new site wide message", 'sitemessages:add' => "Add a site-wide message to the river page", 'sitemessage:deleted' => "Site message deleted", - + 'river:widget:noactivity' => 'We could not find any activity.', 'river:widget:title' => "Activity", 'river:all' => "All activity", @@ -35,6 +35,10 @@ $english = array( 'riverdashboard:avataricon' => "Would you like to use user avatars or icons on your site activity stream?", 'option:icon' => 'Icons', 'option:avatar' => 'Avatars', + + // ecml + 'riverdashboard:ecml:desc:activity' => 'Recent Activity', + 'riverdashboard:ecml:desc:usage' => '[activity user=username limit=limit type=type subtype=subtype]' ); - + add_translation("en",$english);
\ No newline at end of file diff --git a/mod/riverdashboard/start.php b/mod/riverdashboard/start.php index 1377afc37..c57d88d80 100644 --- a/mod/riverdashboard/start.php +++ b/mod/riverdashboard/start.php @@ -1,6 +1,8 @@ <?php /** * Elgg river dashboard plugin + * + * @package RiverDashboard */ function riverdashboard_init() { @@ -11,12 +13,16 @@ function riverdashboard_init() { } else { // Activity main menu add_menu(elgg_echo('activity'), $CONFIG->wwwroot . "mod/riverdashboard/"); - } + } // Page handler register_page_handler('riverdashboard','riverdashboard_page_handler'); elgg_extend_view('css','riverdashboard/css'); + + // add an activity stream ECML keyword + // we'll restrict it to use in sitepages's custom_frontpage + register_plugin_hook('get_keywords', 'ecml', 'riverdashboard_ecml_keywords_hook'); } - + /** * Page handler for riverdash * @@ -27,7 +33,7 @@ function riverdashboard_page_handler($page){ include(dirname(__FILE__) . "/index.php"); return true; } - + function riverdashboard_dashboard() { include(dirname(__FILE__) . '/index.php'); } @@ -48,4 +54,25 @@ function elgg_make_river_comment($entity){ } } -register_elgg_event_handler('init','system','riverdashboard_init'); + +/** + * Register activity keyword. + * + * @param unknown_type $hook + * @param unknown_type $type + * @param unknown_type $value + * @param unknown_type $params + * @return unknown_type + */ +function riverdashboard_ecml_keywords_hook($hook, $type, $value, $params) { + $value['activity'] = array( + 'view' => "riverdashboard/ecml/activity", + 'description' => elgg_echo('riverdashboard:ecml:desc:activity'), + 'usage' => elgg_echo('riverdashboard:ecml:usage:activity'), + 'restricted' => array('sitepages/custom_frontpage') + ); + + return $value; +} + +register_elgg_event_handler('init', 'system', 'riverdashboard_init');
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php b/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php new file mode 100644 index 000000000..87c048ea5 --- /dev/null +++ b/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php @@ -0,0 +1,29 @@ +<?php +/** + * ECML activity support + * + * @package ECML + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$user = (isset($vars['user'])) ? $vars['user'] : NULL; +$type = (isset($vars['type'])) ? $vars['type'] : NULL; +$subtype = (isset($vars['subtype'])) ? $vars['subtype'] : NULL; +$limit = (isset($vars['limit'])) ? $vars['limit'] : 10; + +// resolve usernames to guids +if (!is_numeric($user)) { + if ($user_obj = get_user_by_username($user)) { + $user = $user_obj->getGUID(); + } +} + +$river = elgg_view_river_items($user, NULL, NULL, $type, $subtype, '', $limit, 0, 0, true, false) . "</div>"; + +// Replacing callback calls in the nav with something meaningless +$river = str_replace('callback=true','replaced=88,334',$river); + +echo $river;
\ No newline at end of file |