aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 12:11:10 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 12:11:10 +0000
commit7565c12bcdc87184298743c36c5b8a4ab09bcda7 (patch)
tree4da1a6d9957094328a164953714183d3932de991 /mod/bookmarks/views
parent4e80f7476e20887f1a8f43fd0c0bf70a031c774b (diff)
downloadelgg-7565c12bcdc87184298743c36c5b8a4ab09bcda7.tar.gz
elgg-7565c12bcdc87184298743c36c5b8a4ab09bcda7.tar.bz2
updated bookmarks widget to use 1.7 APIs
git-svn-id: http://code.elgg.org/elgg/trunk@7346 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views')
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php4
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/view.php61
2 files changed, 37 insertions, 28 deletions
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index deba1c012..edb6afdf2 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -5,6 +5,10 @@
* @package ElggBookmarks
*/
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
+}
?>
<p>
<?php echo elgg_echo('bookmarks:numbertodisplay'); ?>:
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php
index b401f86ad..cbd0012bb 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/view.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/view.php
@@ -1,52 +1,57 @@
<?php
+
/**
* Elgg bookmark widget view
- *
+ *
* @package ElggBookmarks
*/
-
//get the num of shares the user want to display
$num = $vars['entity']->num_display;
-
-//if no number has been set, default to 4
-if(!$num)
- $num = 4;
-
-//grab the users bookmarked items
-$bookmarks = elgg_get_entities('object', 'bookmarks',$vars['entity']->owner_guid, "", $num, 0, false);
-
-if($bookmarks){
-
- foreach($bookmarks as $b){
-
+
+$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 ($bookmarks) {
+
+ foreach ($bookmarks as $b) {
+
//get the owner
$owner = $b->getOwnerEntity();
//get the time
- $friendlytime = elgg_view_friendly_time($s->time_created);
+ $friendlytime = elgg_view_friendly_time($b->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 details
$info .= "<p class=\"shares_timestamp\"><small>{$friendlytime} ";
//get the bookmark description
- if($s->description)
- $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">".elgg_echo('bookmarks:more')."</a></small></p><div class=\"share_desc\"><p>{$s->description}</p></div>";
- else
+ 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
+ }
+
+ //display
echo "<div class='ContentWrapper bookmarks'>";
echo "<div class='shares_widget_content'>" . $info . "</div></div>";
+ }
- }
-
- $user_inbox = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner()->username;
- if (get_entities('object', 'bookmarks', $vars['entity']->container_guid, '', '', '', true) > $num)
- echo "<div class='ContentWrapper bookmarks more'><a href=\"{$user_inbox}\">".elgg_echo('bookmarks:read')."</a></div>";
-
+ if ($num_bookmarks > $num) {
+ $user_inbox = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner()->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>";
-} \ No newline at end of file
+}