aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views/default/widgets
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-16 22:00:32 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-16 22:00:32 +0000
commite45c0d4a62e6bc0f5aa2cd0522987123a9b457c7 (patch)
tree06644a4bd5a764c8dda28cec6125ac5ead486e11 /mod/bookmarks/views/default/widgets
parent851b6f87d426ff60d21eeafd6d63ff241bb18b82 (diff)
downloadelgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.gz
elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.bz2
Refs #2680. Bookmarks revamp, part 2.
git-svn-id: http://code.elgg.org/elgg/trunk@8264 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/views/default/widgets')
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/content.php31
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php32
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/view.php65
3 files changed, 45 insertions, 83 deletions
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/content.php b/mod/bookmarks/views/default/widgets/bookmarks/content.php
new file mode 100644
index 000000000..5f9f469d1
--- /dev/null
+++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Elgg bookmarks widget
+ *
+ * @package Bookmarks
+ */
+
+$max = (int) $vars['entity']->num_display;
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'bookmarks',
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $max,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_list_entities($options);
+
+echo $content;
+
+if ($content) {
+ $url = "pg/bookmarks/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('bookmarks:more'),
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('bookmarks:none');
+}
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index edb6afdf2..f31b7660f 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -1,28 +1,24 @@
<?php
/**
* Elgg bookmark widget edit view
- *
- * @package ElggBookmarks
+ *
+ * @package Bookmarks
*/
// set default value
-if (!isset($vars['entity']->num_display)) {
- $vars['entity']->num_display = 4;
+if (!isset($vars['entity']->max_display)) {
+ $vars['entity']->max_display = 4;
}
-?>
-<p>
- <?php echo elgg_echo('bookmarks:numbertodisplay'); ?>:
- <select name="params[num_display]">
-<?php
-for ($i=1; $i<=10; $i++) {
- $selected = '';
- if ($vars['entity']->num_display == $i) {
- $selected = "selected='selected'";
- }
+$params = array(
+ 'name' => 'params[max_display]',
+ 'value' => $vars['entity']->max_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
- echo " <option value='{$i}' $selected >{$i}</option>\n";
-}
?>
- </select>
-</p> \ No newline at end of file
+<div>
+ <?php echo elgg_echo('bookmarks:max_display'); ?>:
+ <?php echo $dropdown; ?>
+</div>
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php
deleted file mode 100644
index 6a5c7476a..000000000
--- a/mod/bookmarks/views/default/widgets/bookmarks/view.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php //@todo JS 1.8: Remove inline JS, use elgg-toggle ?>
-<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
-
-//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
-$shares = elgg_get_entities(array('types' => 'object', 'subtypes' => 'bookmarks', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'offset' => 0));
-
-if($shares){
-
- foreach($shares as $s){
-
- //get the owner
- $owner = $s->getOwnerEntity();
-
- //get the time
- $friendlytime = elgg_view_friendly_time($s->time_created);
-
- //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><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>";
-
- //get the bookmark description
- 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>";
-
- }
-
- $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