aboutsummaryrefslogtreecommitdiff
path: root/mod/file/index.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 15:47:41 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 15:47:41 +0000
commitcc8554abadc047469087fcd4f8f469ba733fceb0 (patch)
treea9837273d0142dfc649feb2b031158db4105a4f9 /mod/file/index.php
parent24ef7261d523155ee1c58e8297516e726b4ce80b (diff)
downloadelgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.gz
elgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.bz2
file index page now working for both users and groups
git-svn-id: http://code.elgg.org/elgg/trunk@7790 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/index.php')
-rw-r--r--mod/file/index.php54
1 files changed, 39 insertions, 15 deletions
diff --git a/mod/file/index.php b/mod/file/index.php
index 3706f65b3..bdda62786 100644
--- a/mod/file/index.php
+++ b/mod/file/index.php
@@ -5,6 +5,8 @@
* @package ElggFile
*/
+elgg_set_page_owner_guid(get_input('guid'));
+
// access check for closed groups
group_gatekeeper();
@@ -13,21 +15,44 @@ $owner = elgg_get_page_owner();
elgg_push_breadcrumb(elgg_echo('file'), "pg/file/all/");
elgg_push_breadcrumb($owner->name);
+$params = array();
-//set the title
-if (elgg_get_page_owner_guid() == get_loggedin_userid()) {
+if ($owner->guid == get_loggedin_userid()) {
+ // user looking at own files
$title = elgg_echo('file:yours');
- $area1 = elgg_view('page/elements/content_header', array('context' => "mine", 'type' => 'file'));
+ $params['filter_context'] = 'mine';
+} else if (elgg_instanceof($owner, 'user')) {
+ // someone else's files
+ $title = elgg_echo("file:user", array($owner()->name));
+ // do not show button or select a tab when viewing someone else's posts
+ $params['filter_context'] = 'none';
+ $params['buttons'] = '';
} else {
- $title = elgg_echo("file:user",array(elgg_get_page_owner()->name));
- $area1 = elgg_view('page/elements/content_header', array('context' => "friends", 'type' => 'file'));
+ // group files
+ $title = elgg_echo("file:user", array($owner->name));
+ $params['filter'] = '';
+ if ($owner->isMember(get_loggedin_user())) {
+ $url = "pg/file/new/$owner->guid";
+ $vars = array(
+ 'href' => $url,
+ 'text' => elgg_echo("file:new"),
+ 'class' => 'elgg-action-button',
+ );
+ $button = elgg_view('output/url', $vars);
+ $params['buttons'] = $button;
+ } else {
+ $params['buttons'] = '';
+ }
}
// Get objects
-elgg_push_context('search');
-$offset = (int)get_input('offset', 0);
-$content = elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'container_guid' => elgg_get_page_owner_guid(), 'limit' => 10, 'offset' => $offset, 'full_view' => FALSE));
-elgg_pop_context();
+$content = elgg_list_entities(array(
+ 'types' => 'object',
+ 'subtypes' => 'file',
+ 'container_guid' => $owner->guid,
+ 'limit' => 10,
+ 'full_view' => FALSE,
+));
$get_filter = get_filetype_cloud(elgg_get_page_owner_guid());
if ($get_filter) {
@@ -40,10 +65,9 @@ if ($get_filter) {
$comments = get_annotations(0, "object", "file", "generic_comment", "", 0, 4, 0, "desc",0,0,elgg_get_page_owner_guid());
$area3 = elgg_view('comments/latest', array('comments' => $comments));
-$body = elgg_view_layout('content', array(
- 'filter_context' => 'mine',
- 'content' => $content,
- 'title' => $title,
-));
+$params['content'] = $content;
+$params['title'] = $title;
+
+$body = elgg_view_layout('content', $params);
-echo elgg_view_page($title, $body); \ No newline at end of file
+echo elgg_view_page($title, $body);