]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added activity ecml keyword.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 16 Apr 2010 15:25:18 +0000 (15:25 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 16 Apr 2010 15:25:18 +0000 (15:25 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5774 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/riverdashboard/languages/en.php
mod/riverdashboard/start.php
mod/riverdashboard/views/default/riverdashboard/ecml/activity.php [new file with mode: 0644]

index 864a8d7a9219f9b2d0a8d048f2cb664be1acbc41..1a3c96f2bc369524cd4ca6f257311fe4deedd4cf 100644 (file)
@@ -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
index 1377afc37f47c7ce8e230eb2c48d075416751c88..c57d88d80233b581d06799b65d3ba6a42d764892 100644 (file)
@@ -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 (file)
index 0000000..87c048e
--- /dev/null
@@ -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