diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 03:25:25 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 03:25:25 +0000 |
commit | d4e4268d11612408e4989a5c57f69fcb2febe8aa (patch) | |
tree | 2b3b041a5f4e17bea674a44f07c3df5c7f3811dd /mod/bookmarks/pages | |
parent | b232f52a5273a44e28de239cbacc1e4e4b8cc8b3 (diff) | |
download | elgg-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/pages')
-rw-r--r-- | mod/bookmarks/pages/add.php | 36 | ||||
-rw-r--r-- | mod/bookmarks/pages/all.php | 36 | ||||
-rw-r--r-- | mod/bookmarks/pages/friends.php | 33 | ||||
-rw-r--r-- | mod/bookmarks/pages/inbox.php | 28 | ||||
-rw-r--r-- | mod/bookmarks/pages/owner.php | 39 | ||||
-rw-r--r-- | mod/bookmarks/pages/view.php | 36 |
6 files changed, 208 insertions, 0 deletions
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php new file mode 100644 index 000000000..17e1e6fa4 --- /dev/null +++ b/mod/bookmarks/pages/add.php @@ -0,0 +1,36 @@ +<?php + +/** + * Elgg bookmarks plugin add bookmark page + * + * @package ElggBookmarks + */ + +gatekeeper(); + +// Get the current page's owner +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} +if ($page_owner instanceof ElggGroup) + $container = $page_owner->guid; + +$area2 .= elgg_view_title(elgg_echo('bookmarks:this'), false); + +// If we've been given a bookmark to edit, grab it +if ($this_guid = get_input('bookmark',0)) { + $entity = get_entity($this_guid); + if ($entity->canEdit()) { + $area2 .= elgg_view('bookmarks/form',array('entity' => $entity, 'container_guid' => $container)); + } +} else { + $area2 .= elgg_view('bookmarks/form', array('container_guid' => $container)); +} + +// Format page +$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + +// Draw it +page_draw(elgg_echo('bookmarks:add'),$body); diff --git a/mod/bookmarks/pages/all.php b/mod/bookmarks/pages/all.php new file mode 100644 index 000000000..2bde462ba --- /dev/null +++ b/mod/bookmarks/pages/all.php @@ -0,0 +1,36 @@ +<?php +/** + * Elgg bookmarks plugin everyone page + * + * @package ElggBookmarks + */ + +elgg_push_context('bookmarks'); +elgg_push_breadcrumb(elgg_echo('bookmarks')); + +$page_owner = elgg_get_page_owner_entity(); +if (!$page_owner) { + $page_owner = get_loggedin_userid(); + elgg_set_page_owner_guid($page_owner); +} + +$offset = (int)get_input('offset', 0); +$content .= elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'bookmarks', + 'limit' => 10, + 'offset' => $offset, + 'full_view' => false, + 'view_toggle_type' => false +)); + +$title = elgg_echo('bookmarks:everyone'); + +$body = elgg_view_layout('content', array( + 'filter_context' => 'all', + 'content' => $content, + 'title' => $title +)); + +echo elgg_view_page($title, $body); +elgg_pop_context();
\ No newline at end of file diff --git a/mod/bookmarks/pages/friends.php b/mod/bookmarks/pages/friends.php new file mode 100644 index 000000000..5c930434b --- /dev/null +++ b/mod/bookmarks/pages/friends.php @@ -0,0 +1,33 @@ +<?php +/** + * Elgg bookmarks plugin friends page + * + * @package ElggBookmarks + */ +$guid = get_input('guid'); + +elgg_set_page_owner_guid($guid); +$owner = elgg_get_page_owner_entity(); + +elgg_push_context('bookmarks'); +elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all'); +elgg_push_breadcrumb($owner->name, "pg/bookmarks/owner/$owner->username"); +elgg_push_breadcrumb(elgg_echo('friends')); + +$title = elgg_echo('bookmarks:friends'); + +$content = list_user_friends_objects($owner->guid, 'bookmarks', 10, false); +if (!$content) { + $content = elgg_echo('bookmarks:none'); +} + +$params = array( + 'filter_context' => 'friends', + 'content' => $content, + 'title' => $title, +); + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); +elgg_pop_context();
\ No newline at end of file diff --git a/mod/bookmarks/pages/inbox.php b/mod/bookmarks/pages/inbox.php new file mode 100644 index 000000000..061a51e18 --- /dev/null +++ b/mod/bookmarks/pages/inbox.php @@ -0,0 +1,28 @@ +<?php + + /** + * Elgg bookmarks plugin inbox page + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + // Start engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + // List bookmarks + $area2 = elgg_view_title(elgg_echo('bookmarks:inbox')); + set_context('search'); + $area2 .= list_entities_from_relationship('share',page_owner(),true,'object','bookmarks'); + set_context('bookmarks'); + + // Format page + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + // Draw it + page_draw(elgg_echo('bookmarks:inbox'),$body); + +?>
\ No newline at end of file diff --git a/mod/bookmarks/pages/owner.php b/mod/bookmarks/pages/owner.php new file mode 100644 index 000000000..1e45bc518 --- /dev/null +++ b/mod/bookmarks/pages/owner.php @@ -0,0 +1,39 @@ +<?php +/** + * Elgg bookmarks plugin everyone page + * + * @package ElggBookmarks + */ + +elgg_push_context('bookmarks'); +elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all'); + +$page_owner = elgg_get_page_owner_entity(); +if (!$page_owner) { + $page_owner = get_loggedin_userid(); + elgg_set_page_owner_guid($page_owner); +} + +elgg_push_breadcrumb($page_owner->name, "pg/bookmarks/owner/$page_owner->username"); + +$offset = (int)get_input('offset', 0); +$content .= elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'bookmarks', + 'owner_guid' => $page_owner->guid, + 'limit' => 10, + 'offset' => $offset, + 'full_view' => false, + 'view_toggle_type' => false +)); + +$title = elgg_echo('bookmarks:owner', array($page_owner->name)); + +$body = elgg_view_layout('content', array( + 'filter_context' => 'mine', + 'content' => $content, + 'title' => $title +)); + +echo elgg_view_page($title, $body); +elgg_pop_context();
\ No newline at end of file diff --git a/mod/bookmarks/pages/view.php b/mod/bookmarks/pages/view.php new file mode 100644 index 000000000..6b4b839b1 --- /dev/null +++ b/mod/bookmarks/pages/view.php @@ -0,0 +1,36 @@ +<?php +/** + * View a bookmark + * + * @package ElggBookmarks + */ + +$bookmark = get_entity(get_input('guid')); + +elgg_set_page_owner_guid($bookmark->getContainerGUID()); +$owner = elgg_get_page_owner_entity(); + +elgg_push_breadcrumb(elgg_echo('bookmarks'), 'pg/bookmarks/all'); + +$crumbs_title = elgg_echo('blog:owned_blogs', array($owner->name)); +if (elgg_instanceof($owner, 'group')) { + elgg_push_breadcrumb($crumbs_title, "pg/bookmarks/group/$owner->guid/owner"); +} else { + elgg_push_breadcrumb($crumbs_title, "pg/bookmarks/owner/$owner->username"); +} + +$title = $bookmark->title; + +elgg_push_breadcrumb($title); + +$content = elgg_view_entity($bookmark, true); +$content .= elgg_view_comments($bookmark); + +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', + 'header' => '', +)); + +echo elgg_view_page($title, $body); |