diff options
-rw-r--r-- | engine/lib/access.php | 15 | ||||
-rw-r--r-- | languages/en.php | 2 | ||||
-rw-r--r-- | views/default/output/access.php | 5 |
3 files changed, 12 insertions, 10 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index 08b9283cd..7be92fbfc 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -838,7 +838,7 @@ function elgg_list_entities_from_access_id(array $options = array()) { * * @param int $entity_access_id The entity's access id * - * @return string 'Public', 'Private', etc. or false if error. + * @return string 'Public', 'Private', etc. * @since 1.7.0 * @todo I think this probably wants get_access_array() instead of get_write_access_array(), * but those two functions return different types of arrays. @@ -849,15 +849,12 @@ function get_readable_access_level($entity_access_id) { //get the access level for object in readable string $options = get_write_access_array(); - //@todo Really? Use array_key_exists() - foreach ($options as $key => $option) { - if ($key == $access) { - $entity_acl = htmlentities($option, ENT_QUOTES, 'UTF-8'); - return $entity_acl; - break; - } + if (array_key_exists($access, $options)) { + return $options[$access]; } - return false; + + // return 'Limited' if the user does not have access to the access collection + return elgg_echo('access:limited:label'); } /** diff --git a/languages/en.php b/languages/en.php index 2f8ab41c9..acc8e0bc0 100644 --- a/languages/en.php +++ b/languages/en.php @@ -270,6 +270,8 @@ $english = array( 'PUBLIC' => "Public", 'access:friends:label' => "Friends", 'access' => "Access", + 'access:limited:label' => "Limited", + 'access:help' => "The access level", /** * Dashboard and widgets diff --git a/views/default/output/access.php b/views/default/output/access.php index 811948323..91c5c721e 100644 --- a/views/default/output/access.php +++ b/views/default/output/access.php @@ -11,6 +11,7 @@ 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. @@ -35,5 +36,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { $access_class .= ' elgg-access-private'; } - echo "<span class=\"$access_class\">$access_id_string</span>"; + $help_text = elgg_echo('access:help'); + + echo "<span title=\"$help_text\" class=\"$access_class\">$access_id_string</span>"; } |