aboutsummaryrefslogtreecommitdiff
path: root/mod/file/pages/file/owner.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-19 15:33:06 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-19 15:33:06 +0000
commite4bc53c61702b22c845cbbd22ba3335935ee2c9c (patch)
tree1434596c6c93e1975bcd31b6b48d18a72978be5e /mod/file/pages/file/owner.php
parentb5e2dbf292cddd56a8171b4c9cf1d9cf0fb45582 (diff)
downloadelgg-e4bc53c61702b22c845cbbd22ba3335935ee2c9c.tar.gz
elgg-e4bc53c61702b22c845cbbd22ba3335935ee2c9c.tar.bz2
Fixes #3176 replaced usage of index.php where appropriate
git-svn-id: http://code.elgg.org/elgg/trunk@8770 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/pages/file/owner.php')
-rw-r--r--mod/file/pages/file/owner.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/mod/file/pages/file/owner.php b/mod/file/pages/file/owner.php
new file mode 100644
index 000000000..617e4c7f4
--- /dev/null
+++ b/mod/file/pages/file/owner.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Individual's or group's files
+ *
+ * @package ElggFile
+ */
+
+// access check for closed groups
+group_gatekeeper();
+
+$owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('file'), "file/all");
+elgg_push_breadcrumb($owner->name);
+
+$params = array();
+
+if ($owner->guid == elgg_get_logged_in_user_guid()) {
+ // user looking at own files
+ $title = elgg_echo('file:yours');
+ $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 {
+ // group files
+ $title = elgg_echo("file:user", array($owner->name));
+ $params['filter'] = '';
+ if ($owner->isMember(elgg_get_logged_in_user_entity())) {
+ $url = "file/add/$owner->guid";
+ $vars = array(
+ 'href' => $url,
+ 'text' => elgg_echo("file:add"),
+ 'class' => 'elgg-button elgg-button-action',
+ );
+ $button = elgg_view('output/url', $vars);
+ $params['buttons'] = $button;
+ } else {
+ $params['buttons'] = '';
+ }
+}
+
+// List files
+$content = elgg_list_entities(array(
+ 'types' => 'object',
+ 'subtypes' => 'file',
+ 'container_guid' => $owner->guid,
+ 'limit' => 10,
+ 'full_view' => FALSE,
+));
+if (!$content) {
+ $content = elgg_echo("file:none");
+}
+
+$sidebar = file_get_type_cloud(elgg_get_page_owner_guid());
+if (elgg_instanceof($owner, 'user')) {
+ $sidebar .= elgg_view_latest_comments(elgg_get_page_owner_guid(), 'object', 'file');
+}
+
+$params['content'] = $content;
+$params['title'] = $title;
+$params['sidebar'] = $sidebar;
+
+$body = elgg_view_layout('content', $params);
+
+echo elgg_view_page($title, $body);