aboutsummaryrefslogtreecommitdiff
path: root/views/default/output
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-24 22:16:42 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-24 22:16:42 +0000
commit605d311eee2f4a225467f32652f4bec6c03474ee (patch)
tree61eac120694ae38854d74788e357bc5adb1a00be /views/default/output
parent6b5a3b2dfd0a20da1dfb46f42a7bc79dfe9377fc (diff)
downloadelgg-605d311eee2f4a225467f32652f4bec6c03474ee.tar.gz
elgg-605d311eee2f4a225467f32652f4bec6c03474ee.tar.bz2
Added output/access view for displaying entity access levels.
git-svn-id: http://code.elgg.org/elgg/trunk@6193 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/output')
-rw-r--r--views/default/output/access.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/views/default/output/access.php b/views/default/output/access.php
new file mode 100644
index 000000000..5490d3203
--- /dev/null
+++ b/views/default/output/access.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Displays HTML for entity access levels.
+ * Requires an entity because some special logic for containers is used.
+ *
+ * @uses int $vars['entity'] - The entity whose access ID to display.
+ */
+
+//sort out the access level for display
+if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) {
+ $access_id = $vars['entity']->access_id;
+ $access_class = 'access_level';
+ $access_id_string = get_readable_access_level($access_id);
+
+ // if within a group or shared access collection display group name and open/closed membership status
+ // @todo have a better way to do this instead of checking against subtype / class.
+ $container = get_entity($vars['entity']->container_guid);
+
+ if ($container instanceof ElggGroup) {
+ // we decided to show that the item is in a group, rather than its actual access level
+ // not required. Group ACLs are prepended with "Group: " when written.
+ //$access_id_string = elgg_echo('groups:group') . $container->name;
+ $membership = $is_group->membership;
+
+ if ($membership == ACCESS_PUBLIC) {
+ $access_class .= ' group_open';
+ } else {
+ $access_class .= ' group_closed';
+ }
+ } elseif ($container->getSubtype() == 'shared_access') {
+ $access_level .= ' shared_collection';
+ } elseif ($access_id == ACCESS_PRIVATE) {
+ $access_level .= ' private';
+ } else {
+ $access_level .= ' entity_access';
+ }
+
+ echo "<span class=\"$access_class\">$access_id_string</span>";
+} \ No newline at end of file