aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views/default/widgets
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-03 03:25:25 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-03 03:25:25 +0000
commitd4e4268d11612408e4989a5c57f69fcb2febe8aa (patch)
tree2b3b041a5f4e17bea674a44f07c3df5c7f3811dd /mod/bookmarks/views/default/widgets
parentb232f52a5273a44e28de239cbacc1e4e4b8cc8b3 (diff)
downloadelgg-d4e4268d11612408e4989a5c57f69fcb2febe8aa.tar.gz
elgg-d4e4268d11612408e4989a5c57f69fcb2febe8aa.tar.bz2
Refs #2680: First pass at porting the 1.7 bookmarks to 1.8. Functional, but code is still messy.
git-svn-id: http://code.elgg.org/elgg/trunk@7998 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views/default/widgets')
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/view.php86
1 files changed, 47 insertions, 39 deletions
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php
index 6babbcd20..f9bbf5488 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/view.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/view.php
@@ -1,57 +1,65 @@
+
+<script type="text/javascript">
+$(document).ready(function () {
+ $('a.share_more_info').click(function () {
+ $(this.parentNode).children("[class=share_desc]").slideToggle("fast");
+ return false;
+ });
+}); /* end document ready function */
+</script>
+
<?php
-/**
- * Elgg bookmark widget view
- *
- * @package ElggBookmarks
- */
//get the num of shares the user want to display
$num = $vars['entity']->num_display;
-$options = array(
- 'type' => 'object',
- 'subtype' => 'bookmarks',
- 'container_guid' => $vars['entity']->owner_guid,
- 'limit' => $num,
-);
-$bookmarks = elgg_get_entities($options);
-
-$options['count'] = true;
-$num_bookmarks = elgg_get_entities($options);
-
+//if no number has been set, default to 4
+if(!$num)
+ $num = 4;
+
+//grab the users bookmarked items
+$shares = elgg_get_entities(array('types' => 'object', 'subtypes' => 'bookmarks', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'offset' => 0));
-if ($bookmarks) {
-
- foreach ($bookmarks as $b) {
+if($shares){
+ foreach($shares as $s){
+
//get the owner
- $owner = $b->getOwnerEntity();
+ $owner = $s->getOwnerEntity();
//get the time
- $friendlytime = elgg_view_friendly_time($b->time_created);
+ $friendlytime = elgg_view_friendly_time($s->time_created);
- //get the bookmark title
- $info = "<div class='river_object_bookmarks_create'><p class=\"shares_title\"><a href=\"{$b->address}\">{$b->title}</a></p></div>";
+ //get the user icon
+ $icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $owner,
+ 'size' => 'tiny',
+ )
+ );
+ //get the bookmark title
+ $info = "<p class=\"shares_title\"><a href=\"{$s->getURL()}\">{$s->title}</a></p>";
+
//get the user details
- $info .= "<p class=\"shares_timestamp\"><small>{$friendlytime} ";
+ $info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>";
//get the bookmark description
- if ($b->description) {
- $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">" . elgg_echo('bookmarks:more') . "</a></small></p><div class=\"share_desc\"><p>{$b->description}</p></div>";
- } else {
- $info .= "</small></p>";
- }
-
- //display
- echo "<div class='ContentWrapper bookmarks'>";
- echo "<div class='shares_widget-content'>" . $info . "</div></div>";
- }
+ if($s->description)
+ $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('bookmarks:more')."</a><br /><div class=\"share_desc\"><p>{$s->description}</p></div>";
+
+ //display
+ echo "<div class=\"shares_widget_wrapper\">";
+ echo "<div class=\"shares_widget_icon\">" . $icon . "</div>";
+ echo "<div class=\"shares_widget_content\">" . $info . "</div>";
+ echo "</div>";
- if ($num_bookmarks > $num) {
- $user_inbox = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username;
- echo "<div class='ContentWrapper bookmarks more'><a href=\"{$user_inbox}\">" . elgg_echo('bookmarks:read') . "</a></div>";
}
-} else {
- echo "<div class='ContentWrapper'>" . elgg_echo("bookmarks:widget:description") . "</div>";
+
+ $user_inbox = $vars['url'] . "pg/bookmarks/owner/" . page_owner_entity()->username;
+ echo "<div class=\"widget_more_wrapper\"><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:morebookmarks')."</a></div>";
+
}
+
+
+?> \ No newline at end of file