diff options
Diffstat (limited to 'mod/bookmarks/views')
13 files changed, 412 insertions, 341 deletions
diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php index 75d3686b9..bb2cf885e 100644 --- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php @@ -1,7 +1,7 @@ <?php /** * Elgg get bookmarks bookmarklet view - * + * * @package ElggBookmarks */ diff --git a/mod/bookmarks/views/default/bookmarks/css.php b/mod/bookmarks/views/default/bookmarks/css.php deleted file mode 100644 index 30df44744..000000000 --- a/mod/bookmarks/views/default/bookmarks/css.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Elgg bookmarks CSS - * - * @package ElggBookmarks - */ -?> - -.bookmark_note { - margin:0 0 0 5px; -} -.note { - margin-top:5px; -} - - -/* BOOKMARKS WIDGET -.collapsable_box_content .ContentWrapper.bookmarks { - margin-bottom:5px; - line-height:1.2em; -} -.collapsable_box_content .ContentWrapper.bookmarks .share_desc { - display:none; - line-height: 1.2em; -} -.collapsable_box_content .ContentWrapper.bookmarks .share_desc p { - margin:0 0 5px 0; -} -.collapsable_box_content .ContentWrapper.bookmarks .river_object_bookmarks_create p { - min-height:17px; - padding:0 0 0 17px; -} -.collapsable_box_content .ContentWrapper.bookmarks .shares_timestamp { - color:#666666; - margin:0; - padding:0 0 0 17px; -} -.collapsable_box_content .ContentWrapper.bookmarks .shares_title { - margin:0; - line-height: 1.1em; -} -.collapsable_box_content .ContentWrapper.bookmarks.more { - margin:0 10px; - padding:5px 10px; -} -*/ diff --git a/mod/bookmarks/views/default/bookmarks/form.php b/mod/bookmarks/views/default/bookmarks/form.php index 12cd76ba7..2131f7cd8 100644 --- a/mod/bookmarks/views/default/bookmarks/form.php +++ b/mod/bookmarks/views/default/bookmarks/form.php @@ -1,109 +1,133 @@ <?php /** - * Elgg bookmarks plugin form - * - * @package ElggBookmarks - */ +* Elgg bookmarks plugin form +* +* @package ElggBookmarks +*/ if(isset($vars['entity'])){ $guid = $vars['entity']->guid; $title = $vars['entity']->title; + $description = $vars['entity']->description; $address = $vars['entity']->address; - $access_id = $vars['entity']->access_id; $tags = $vars['entity']->tags; - $notes = $vars['entity']->description; - $owner = get_entity($vars['entity']->container_guid); - $url = "action/bookmarks/edit"; -}else{ - //set some variables - $guid = ''; + $access_id = $vars['entity']->access_id; + $shares = $vars['entity']->shares; + $owner = $vars['entity']->getOwnerEntity(); + $highlight = 'default'; + +} else { + $guid = 0; $title = get_input('title',""); $title = stripslashes($title); // strip slashes from URL encoded apostrophes + $description = ""; $address = get_input('address',""); - $notes = ''; + $highlight = 'all'; + if ($address == "previous") $address = $_SERVER['HTTP_REFERER']; $tags = array(); - if(elgg_get_page_owner_entity() instanceof ElggGroup){ - //if in a group, set the access level to default to the group - $access_id = elgg_get_page_owner_entity()->group_acl; - }else{ - $access_id = get_default_access(get_loggedin_user()); + + if (defined('ACCESS_DEFAULT')) { + $access_id = ACCESS_DEFAULT; + } else { + $access_id = 0; } - $owner = get_loggedin_user(); - $url = "action/bookmarks/add"; + $shares = array(); + $owner = page_owner_entity(); } + ?> -<form id="bookmark_edit_form" class="margin-top" action="<?php echo elgg_get_site_url() . $url; ?>" method="post"> - <?php echo elgg_view('input/securitytoken'); ?> - <p> - <label> - <?php echo elgg_echo('title'); ?> - <?php - echo elgg_view('input/text',array( - 'internalname' => 'title', - 'value' => $title, - )); - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('bookmarks:address'); ?> - <?php - echo elgg_view('input/url',array( - 'internalname' => 'address', - 'value' => $address, - )); - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('bookmarks:addnote'); ?> - <br /> - <?php - - echo elgg_view('input/text',array( - 'internalname' => 'notes', - 'value' => $notes, - )); - - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('tags'); ?> - <?php - echo elgg_view('input/tags',array( - 'internalname' => 'tags', - 'value' => $tags, - )); - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('access'); ?> - <?php - //if it is a group, pull out the group access view - if(elgg_get_page_owner_entity() instanceof ElggGroup){ - $access_options = group_access_options($owner); - echo elgg_view('input/access', array('internalname' => 'access', - 'value' => $access_id, - 'options' => $access_options)); - }else{ - echo elgg_view('input/access', array('internalname' => 'access', - 'value' => $access_id)); - } - ?> - </label> - </p> - <p> - <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?> - <input type="hidden" value="<?php echo $guid; ?>" name="guid" /> - <input type="submit" onfocus="blur()" value="<?php echo elgg_echo('save'); ?>" /> - </p> +<div class="contentWrapper"> +<form action="<?php echo $vars['url']; ?>action/bookmarks/add" method="post"> +<?php echo elgg_view('input/securitytoken'); ?> +<p> + <label> + <?php echo elgg_echo('title'); ?> + <?php + + echo elgg_view('input/text',array( + 'internalname' => 'title', + 'value' => $title, + )); + + ?> + </label> +</p> +<p> + <label> + <?php echo elgg_echo('bookmarks:address'); ?> + <?php + + echo elgg_view('input/url',array( + 'internalname' => 'address', + 'value' => $address, + )); + + ?> + </label> +</p> +<p class="longtext_editarea"> + <label> + <?php echo elgg_echo('description'); ?> + <br /> + <?php + + echo elgg_view('input/longtext',array( + 'internalname' => 'description', + 'value' => $description, + )); + + ?> + </label> +</p> +<p> + <label> + <?php echo elgg_echo('tags'); ?> + <?php + + echo elgg_view('input/tags',array( + 'internalname' => 'tags', + 'value' => $tags, + )); + + ?> + </label> +</p> + <?php + + //echo elgg_view('bookmarks/sharing',array('shares' => $shares, 'owner' => $owner)); + if ($friends = elgg_get_entities_from_relationship(array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'inverse_relationship' => FALSE, 'type' => 'user', 'limit' => 9999))) { +?> +<p> + <label><?php echo elgg_echo("bookmarks:with"); ?></label><br /> +<?php + echo elgg_view('friends/picker',array('entities' => $friends, 'internalname' => 'shares', 'highlight' => $highlight)); +?> +</p> +<?php + } + + ?> +<p> + <label> + <?php echo elgg_echo('access'); ?> + <?php + + echo elgg_view('input/access',array( + 'internalname' => 'access', + 'value' => $access_id, + )); + + ?> + </label> +</p> +<p> + <?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?> + <input type="hidden" name="bookmark_guid" value="<?php echo $guid; ?>" /> + <input type="submit" value="<?php echo elgg_echo('save'); ?>" /> +</p> + </form> +</div>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php b/mod/bookmarks/views/default/bookmarks/group_bookmarks.php deleted file mode 100755 index dd1b6aa9c..000000000 --- a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -//grab the groups bookmarks -$bookmarks = elgg_get_entities(array('type' => 'object', 'subtype' => 'bookmarks', - 'container_guids' => elgg_get_page_owner_guid(), 'limit' => 6)); -?> -<div class="group_tool_widget bookmarks"> -<span class="group_widget_link"><a href="<?php echo elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username; ?>"><?php echo elgg_echo('link:view:all')?></a></span> -<h3><?php echo elgg_echo('bookmarks:group') ?></h3> -<?php -if($bookmarks){ - foreach($bookmarks as $b){ - - //get the owner - $owner = $b->getOwnerEntity(); - - //get the time - $friendlytime = elgg_view_friendly_time($b->time_created); - - $info = "<div class='entity-listing-icon'>" . elgg_view('profile/icon',array('entity' => $b->getOwnerEntity(), 'size' => 'tiny')) . "</div>"; - - //get the bookmark entries body - $info .= "<div class='entity-listing-info'><p class='entity-title'><a href=\"{$b->address}\">{$b->title}</a></p>"; - - //get the user details - $info .= "<p class='entity-subtext'>{$friendlytime}</p>"; - $info .= "</div>"; - //display - echo "<div class='entity-listing clearfix'>" . $info . "</div>"; - } -} else { - $create_bookmark = elgg_get_site_url() . "pg/bookmarks/" . elgg_get_page_owner_entity()->username . "/add"; - echo "<p class='margin-top'><a href=\"{$create_bookmark}\">" . elgg_echo("bookmarks:new") . "</a></p>"; -} -echo "</div>";
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php b/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php new file mode 100644 index 000000000..ad8095d11 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/groupprofile_bookmarks.php @@ -0,0 +1,34 @@ +<?php + +/** + * List most recent bookmarks on group profile page + */ + +if ($vars['entity']->bookmarks_enable != 'no') { +?> + +<div class="group_widget"> +<h2><?php echo elgg_echo('bookmarks:group'); ?></h2> +<?php + $context = get_context(); + set_context('search'); + $content = elgg_list_entities(array('types' => 'object', + 'subtypes' => 'bookmarks', + 'container_guid' => $vars['entity']->guid, + 'limit' => 5, + 'full_view' => FALSE, + 'pagination' => FALSE)); + set_context($context); + + if ($content) { + echo $content; + + $more_url = "{$vars['url']}pg/bookmarks/owner/group:{$vars['entity']->guid}/"; + echo "<div class=\"forum_latest\"><a href=\"$more_url\">" . elgg_echo('bookmarks:more') . "</a></div>"; + } else { + echo "<div class=\"forum_latest\">" . elgg_echo("bookmarks:nogroup") . "</div>"; + } +?> +</div> +<?php +}
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/owner_block.php b/mod/bookmarks/views/default/bookmarks/owner_block.php new file mode 100644 index 000000000..654ff9152 --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/owner_block.php @@ -0,0 +1,10 @@ +<?php + +$label = elgg_echo('bookmarks:this'); +$user = get_loggedin_user(); +$url = "'" . $vars['url'] . "pg/bookmarks/add/{$user->username}?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"; + +?> +<div id="owner_block_bookmark_this"> +<a href="javascript:location.href=<?php echo $url; ?>"><?php echo $label ?></a> +</div> diff --git a/mod/bookmarks/views/default/bookmarks/sharing.php b/mod/bookmarks/views/default/bookmarks/sharing.php new file mode 100644 index 000000000..63738d94d --- /dev/null +++ b/mod/bookmarks/views/default/bookmarks/sharing.php @@ -0,0 +1,80 @@ +<?php + + $owner = $vars['owner']; + if ($friends = elgg_get_entities_from_relationship(array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'inverse_relationship' => FALSE, 'type' => 'user', 'limit' => 9999))) { + +?> + +<table border="0" cellspacing="0" cellpadding="0"> + +<?php + + $col = 0; + foreach($friends as $friend) { + + if ($col == 0) echo "<tr>"; + + $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny')); + $options[$label] = $friend->getGUID(); + +?> + + <td> + + <input type="checkbox" name="shares[]" value="<?php echo $options[$label]; ?>" /> + + </td> + + <td > + + <div style="width: 25px; margin-bottom: 15px;"> + <?php + + echo $label; + + ?> + </div> + </td> + <td style="width: 300px; padding: 5px;"> + <?php + + echo $friend->name; + + ?> + </td> +<?php + + + $col++; + + if ($col == 3) { + + $col = 0; + echo "</tr>"; + + } + + + } + if ($col != 3) { + echo "</tr>"; + } + + +?> + +</table> + +<?php + + /*echo elgg_view('input/checkboxes',array( + + 'internalname' => 'shares', + 'options' => $options, + 'value' => $vars['shares'], + + )); */ + + } + +?>
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/stats.php b/mod/bookmarks/views/default/bookmarks/stats.php deleted file mode 100755 index 77c3d703f..000000000 --- a/mod/bookmarks/views/default/bookmarks/stats.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php -/** - * All site bookmark stats - **/ - -echo "<h3>".elgg_echo('bookmarks:stats')."</h3>"; -echo "<p>". $vars['count'] . " " . elgg_echo('bookmarks:resources') .".</p>";
\ No newline at end of file diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index f90a2f355..ccb02457c 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -5,91 +5,108 @@ * @package ElggBookmarks */ -$owner = $vars['entity']->getOwnerEntity(); -$friendlytime = elgg_view_friendly_time($vars['entity']->time_created); -$address = $vars['entity']->address; - -// you used to be able to add without titles, which created unclickable bookmarks -// putting a fake title in so you can click on it. -if (!$title = $vars['entity']->title) { - $title = elgg_echo('bookmarks:no_title'); -} +$full = elgg_get_array_value('full', $vars, FALSE); +$bookmark = elgg_get_array_value('entity', $vars, FALSE); -$a_tag_visit = filter_tags("<a href=\"{$address}\">" . elgg_echo('bookmarks:visit') . "</a>"); -$a_tag_title = filter_tags("<a href=\"{$address}\">$title</a>"); - - -$parsed_url = parse_url($address); -$faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico"; - -//sort out the access level for display -$object_acl = get_readable_access_level($vars['entity']->access_id); -//files with these access level don't need an icon -$general_access = array('Public', 'Logged in users', 'Friends'); -//set the right class for access level display - need it to set on groups and shared access only -$is_group = get_entity($vars['entity']->container_guid); -if($is_group instanceof ElggGroup){ - //get the membership type open/closed - $membership = $is_group->membership; - //we decided to show that the item is in a group, rather than its actual access level - $object_acl = "Group: " . $is_group->name; - if($membership == 2) - $access_level = "class='access_level group_open'"; - else - $access_level = "class='access_level group_closed'"; -}elseif($object_acl == 'Private'){ - $access_level = "class='access_level private'"; -}else{ - if(!in_array($object_acl, $general_access)) - $access_level = "class='access_level shared_collection'"; - else - $access_level = "class='access_level entity_access'"; +if (!$bookmark) { + return; } -if($vars['entity']->description != '') - $view_notes = "<a class='link' onclick=\"elgg_slide_toggle(this,'.entity-listing','.note');\">note</a>"; -else - $view_notes = ''; -if (@file_exists($faviconurl)) { - $icon = "<img src=\"{$faviconurl}\" />"; +$owner = $bookmark->getOwnerEntity(); +$container = $bookmark->getContainerEntity(); +$categories = elgg_view('categories/view', $vars); + +$link = filter_tags(elgg_view('output/url', array('href' => $bookmark->address))); +$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl')); + +$owner_link = elgg_view('output/url', array( + 'href' => "pg/file/owner/$owner->username", + 'text' => $owner->name, +)); +$author_text = elgg_echo('blog:author_by_line', array($owner_link)); + +$tags = elgg_view('output/tags', array('tags' => $bookmark->tags)); +$date = elgg_view_friendly_time($bookmark->time_created); + +$comments_count = elgg_count_comments($bookmark); +//only display if there are commments +if ($comments_count != 0) { + $text = elgg_echo("comments") . " ($comments_count)"; + $comments_link = elgg_view('output/url', array( + 'href' => $bookmark->getURL() . '#comments', + 'text' => $text, + )); } else { - $icon = elgg_view("profile/icon", array('entity' => $owner,'size' => 'tiny',)); -} - - -//delete -if($vars['entity']->canEdit()){ - $delete .= "<span class='delete-button'>" . elgg_view('output/confirmlink',array( - 'href' => "action/bookmarks/delete?bookmark_guid=" . $vars['entity']->guid, - 'text' => elgg_echo("delete"), - 'confirm' => elgg_echo("bookmarks:delete:confirm"), - )) . "</span>"; -} - -$info = "<div class='entity-metadata'><span {$access_level}>{$object_acl}</span>"; - -// include a view for plugins to extend -$info .= elgg_view("bookmarks/options",array('entity' => $vars['entity'])); -$info .= elgg_view_likes($vars['entity']); // include likes - -//include edit and delete options -if($vars['entity']->canEdit()){ - $info .= "<span class='entity-edit'><a href=\"".elgg_get_site_url()."pg/bookmarks/{$owner->username}/edit/{$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></span>"; - $info .= $delete; + $comments_link = ''; } - $info .= "</div>"; +$metadata = elgg_view('layout/objects/list/metadata', array( + 'entity' => $bookmark, + 'handler' => 'bookmarks', +)); -$info .= "<p class='entity-title'>$a_tag_title</p>"; -$info .= "<p class='entity-subtext'>Bookmarked by <a href=\"".elgg_get_site_url()."pg/bookmarks/{$owner->username}\">{$owner->name}</a> {$friendlytime} {$view_notes}</p>"; +$subtitle = "$author_text $date $categories $comments_link"; -$tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); -if (!empty($tags)) { - $info .= '<p class="tags">' . $tags . '</p>'; -} -if($view_notes != ''){ - $info .= "<div class='note hidden'>". $vars['entity']->description . "</div>"; +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; } -//display -echo elgg_view_listing($icon, $info); +if ($full && !elgg_in_context('gallery')) { + $header = elgg_view_title($bookmark->title); + + $params = array( + 'entity' => $bookmark, + 'title' => false, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $tags, + ); + $bookmark_info = elgg_view('layout/objects/list/body', $params); + + echo <<<HTML +$header +$bookmark_info +<div class="bookmark elgg-content"> + <span class="elgg-icon elgg-icon-following"></span><h3 class="pbl">$link</h3> + $description +</div> +HTML; + +} elseif (elgg_in_context('gallery')) { + echo '<div class="bookmarks-gallery-item">'; + echo "<h3>" . $bookmark->title . "</h3>"; + echo "<p class='subtitle'>$owner_link $date</p>"; + echo '</div>'; +} else { + // brief view + $url = $bookmark->address; + $display_text = $url; + $excerpt = elgg_get_excerpt($bookmark->description); + + if (strlen($url) > 25) { + $bits = parse_url($url); + if (isset($bits['host'])) { + $display_text = $bits['host']; + } else { + $display_text = elgg_get_excerpt($url, 100); + } + } + + $link = filter_tags(elgg_view('output/url', array( + 'href' => $bookmark->address, + 'text' => $display_text + ))); + + $content = "<span class=\"elgg-icon elgg-icon-following\"></span>$link - $excerpt"; + + $params = array( + 'entity' => $bookmark, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $tags, + 'content' => $content, + ); + + echo elgg_view('layout/objects/list/body', $params); +}
\ No newline at end of file diff --git a/mod/bookmarks/views/default/river/object/bookmarks/annotate.php b/mod/bookmarks/views/default/river/object/bookmarks/annotate.php new file mode 100644 index 000000000..8db8a6581 --- /dev/null +++ b/mod/bookmarks/views/default/river/object/bookmarks/annotate.php @@ -0,0 +1,10 @@ +<?php +$statement = $vars['statement']; +$performed_by = $statement->getSubject(); +$object = $statement->getObject(); + +$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; +$string = sprintf(elgg_echo("bookmarks:river:annotate"),$url) . " "; +$string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("bookmarks:river:item") . "</a>"; + +echo $string;
\ No newline at end of file diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index bd07db089..82ea75af7 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -1,35 +1,10 @@ <?php -/** - * Bookmarks river view. - */ +$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); +$object = get_entity($vars['item']->object_guid); +$url = $object->getURL(); -$object = $vars['item']->getObjectEntity(); -$excerpt = strip_tags($object->description); -$excerpt = elgg_get_excerpt($excerpt); +$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; +$string = sprintf(elgg_echo("bookmarks:river:created"),$url) . " "; +$string .= "<a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; //elgg_echo("bookmarks:river:item") . "</a>"; -$params = array( - 'href' => $object->address, - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); - -$group_string = ''; -$container = $object->getContainerEntity(); -if ($container instanceof ElggGroup) { - $params = array( - 'href' => $container->getURL(), - 'text' => $container->name, - ); - $group_link = elgg_view('output/url', $params); - $group_string = elgg_echo('river:ingroup', array($group_link)); -} - -echo elgg_echo('bookmarks:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo $string; 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 diff --git a/mod/bookmarks/views/rss/object/bookmarks.php b/mod/bookmarks/views/rss/object/bookmarks.php index f17ae87d7..8e88485f1 100644 --- a/mod/bookmarks/views/rss/object/bookmarks.php +++ b/mod/bookmarks/views/rss/object/bookmarks.php @@ -4,19 +4,20 @@ * * @package ElggBookmarks */ - $title = $vars['entity']->title; - if (empty($title)) { - $title = substr($vars['entity']->description,0,32); - if (strlen($vars['entity']->description) > 32) - $title .= " ..."; - } + +$title = $vars['entity']->title; +if (empty($title)) { + $title = substr($vars['entity']->description,0,32); + if (strlen($vars['entity']->description) > 32) + $title .= " ..."; +} ?> - <item> - <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid> - <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate> - <link><?php echo $vars['entity']->address; ?></link> - <title><![CDATA[<?php echo $title; ?>]]></title> - <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description> - </item> +<item> + <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid> + <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate> + <link><?php echo $vars['entity']->address; ?></link> + <title><![CDATA[<?php echo $title; ?>]]></title> + <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description> +</item> |