diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-14 21:41:44 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-14 21:41:44 -0300 |
commit | 867e31999f3c8a77c01a1d4e881de593438b51b3 (patch) | |
tree | 9a3961a827243455e76d2ac53519f5109459e62d /mod/saravea_theme/views/default/output/access.php | |
parent | 65285c74f1ee92981aaf5570e4ba5075e0ad6d2f (diff) | |
parent | beaab428eb8b6e19ca6d413249f6307100d9b853 (diff) | |
download | elgg-867e31999f3c8a77c01a1d4e881de593438b51b3.tar.gz elgg-867e31999f3c8a77c01a1d4e881de593438b51b3.tar.bz2 |
Merge commit 'beaab428eb8b6e19ca6d413249f6307100d9b853' as 'mod/saravea_theme'
Diffstat (limited to 'mod/saravea_theme/views/default/output/access.php')
-rw-r--r-- | mod/saravea_theme/views/default/output/access.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/mod/saravea_theme/views/default/output/access.php b/mod/saravea_theme/views/default/output/access.php new file mode 100644 index 000000000..fdb8fe1a1 --- /dev/null +++ b/mod/saravea_theme/views/default/output/access.php @@ -0,0 +1,53 @@ +<?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 = 'elgg-access'; + $access_id_string = get_readable_access_level($access_id); + $access_id_string = htmlentities($access_id_string, ENT_QUOTES, 'UTF-8'); + + // 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 = $vars['entity']->getContainerEntity(); + + if ($container && $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 = $container->membership; + + if ($membership == ACCESS_PUBLIC) { + $access_class .= ' elgg-access-group-open'; + } else { + $access_class .= ' elgg-access-group-closed'; + } + } + + switch ($access_id) { + case ACCESS_PRIVATE: + $access_class .= ' elgg-access-private'; + break; + case ACCESS_FRIENDS: + $access_class .= ' elgg-access-friends'; + break; + case ACCESS_LOGGED_IN: + $access_class .= ' elgg-access-loggedin'; + break; + case ACCESS_PUBLIC: + $access_class .= ' elgg-access-public'; + break; + default: + $access_class .= ' elgg-access-group'; + } + + $help_text = elgg_echo('access:help'); + + echo "<span title=\"$help_text\" class=\"$access_class\">$access_id_string</span>"; +} |