diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 12:49:29 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 12:49:29 +0000 |
commit | 9026d48d405ba43dc6218ecfe34f6dfeb7b16104 (patch) | |
tree | fa6c03fea00993fc4e9635b2a6acef3e27b8a665 | |
parent | 5893eaf6588ce7b6823fa78f54c0042983389162 (diff) | |
download | elgg-9026d48d405ba43dc6218ecfe34f6dfeb7b16104.tar.gz elgg-9026d48d405ba43dc6218ecfe34f6dfeb7b16104.tar.bz2 |
Fixed #50: River widgets
http://trac.elgg.org/elgg/ticket/50
git-svn-id: https://code.elgg.org/elgg/trunk@992 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/river.php | 10 | ||||
-rw-r--r-- | languages/en.php | 11 | ||||
-rw-r--r-- | mod/river/start.php | 23 | ||||
-rw-r--r-- | mod/river/views/default/widgets/river_widget/edit.php | 11 | ||||
-rw-r--r-- | mod/river/views/default/widgets/river_widget/view.php | 17 | ||||
-rw-r--r-- | mod/river/views/default/widgets/river_widget_friends/edit.php | 11 | ||||
-rw-r--r-- | mod/river/views/default/widgets/river_widget_friends/view.php | 17 | ||||
-rw-r--r-- | views/default/river/dashboard.php | 10 |
8 files changed, 100 insertions, 10 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php index b9ab5c5e9..7461a4f60 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -29,7 +29,7 @@ * @param string $relationship Limit return results to only those users who $by_user has $relationship with. * @param int $limit Maximum number of events to show * @param int $offset An offset - * @return array + * @return array of river entities rendered with the appropriate view. */ function get_river_entries($by_user = "", $relationship = "", $limit = 10, $offset = 0) { @@ -44,16 +44,16 @@ // River objects $river = array(); - + do { $log_events = get_system_log($by_user, "","", $cnt, $off); - + if (!$log_events) $exit = true; else { - + foreach ($log_events as $log) { // See if we have access to the object we're talking about @@ -71,7 +71,7 @@ (!$relationship) || ( ($relationship) && - (check_entity_relationship($by_user, $relationship, $log->getObjectOwnerGUID())) + (check_entity_relationship($by_user, $relationship, $tmp->getObjectOwnerGUID())) ) ) { diff --git a/languages/en.php b/languages/en.php index 17604be64..23d7577f5 100644 --- a/languages/en.php +++ b/languages/en.php @@ -378,8 +378,15 @@ Alternatively, you can enter your database settings below and we will try and do /** * River - */
- 'river:relationship:friend' => 'is now friends with',
+ */ + 'river:widget:noactivity' => 'User has no visible activity.', + 'river:widget:title' => "%s activity.", + 'river:widget:description' => "Show your latest activity.", + 'river:widget:title:friends' => "%s friends activity.", + 'river:widget:description:friends' => "Show what your friends are up to.", +
+ 'river:relationship:friend' => 'is now friends with', +
);
add_translation("en",$english);
diff --git a/mod/river/start.php b/mod/river/start.php new file mode 100644 index 000000000..a745bc699 --- /dev/null +++ b/mod/river/start.php @@ -0,0 +1,23 @@ +<?php + /** + * Elgg river plugin. + * This function + * + * @package ElggRiver + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + /** + * Initialise the river system and add a widget. + */ + function river_init() + { + add_widget_type('river_widget',sprintf(elgg_echo('river:widget:title'), 'Your'), elgg_echo('river:widget:description')); + add_widget_type('river_widget_friends',sprintf(elgg_echo('river:widget:title:friends'), 'Your'), elgg_echo('river:widget:description:friends')); + } + + register_elgg_event_handler('init','system','river_init'); +?>
\ No newline at end of file diff --git a/mod/river/views/default/widgets/river_widget/edit.php b/mod/river/views/default/widgets/river_widget/edit.php new file mode 100644 index 000000000..77d0594b6 --- /dev/null +++ b/mod/river/views/default/widgets/river_widget/edit.php @@ -0,0 +1,11 @@ +<?php + /** + * Edit the widget + * + * @package ElggRiver + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ +?>
\ No newline at end of file diff --git a/mod/river/views/default/widgets/river_widget/view.php b/mod/river/views/default/widgets/river_widget/view.php new file mode 100644 index 000000000..38507c625 --- /dev/null +++ b/mod/river/views/default/widgets/river_widget/view.php @@ -0,0 +1,17 @@ +<?php + /** + * View the widget + * + * @package ElggRiver + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + $owner = page_owner_entity(); +?> +<h1><?php echo sprintf(elgg_echo('river:widget:title'), $owner->name . "'s") ?></h1> +<?php + echo elgg_view_river($owner->guid); +?>
\ No newline at end of file diff --git a/mod/river/views/default/widgets/river_widget_friends/edit.php b/mod/river/views/default/widgets/river_widget_friends/edit.php new file mode 100644 index 000000000..77d0594b6 --- /dev/null +++ b/mod/river/views/default/widgets/river_widget_friends/edit.php @@ -0,0 +1,11 @@ +<?php + /** + * Edit the widget + * + * @package ElggRiver + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ +?>
\ No newline at end of file diff --git a/mod/river/views/default/widgets/river_widget_friends/view.php b/mod/river/views/default/widgets/river_widget_friends/view.php new file mode 100644 index 000000000..5b0b3c137 --- /dev/null +++ b/mod/river/views/default/widgets/river_widget_friends/view.php @@ -0,0 +1,17 @@ +<?php + /** + * View the widget + * + * @package ElggRiver + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + $owner = page_owner_entity(); +?> +<h1><?php echo sprintf(elgg_echo('river:widget:title:friends'), $owner->name . "'s") ?></h1> +<?php + echo elgg_view_friend_river($owner->guid); +?>
\ No newline at end of file diff --git a/views/default/river/dashboard.php b/views/default/river/dashboard.php index 152923f66..b1c0e614a 100644 --- a/views/default/river/dashboard.php +++ b/views/default/river/dashboard.php @@ -13,9 +13,13 @@ $river = $vars['river']; ?> <div id="river"> - <h1><?php echo elgg_echo('river'); ?></h1> <? - foreach ($river as $r) - echo "<div>$r</div>"; + if (($river) && (count($river)>0)) + { + foreach ($river as $r) + echo "<div>$r</div>"; + } + else + echo elgg_echo('river:widget:noactivity'); ?> </div>
\ No newline at end of file |