]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
a simple function which returns a string version of an entity's access level
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Sep 2009 12:02:24 +0000 (12:02 +0000)
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Sep 2009 12:02:24 +0000 (12:02 +0000)
git-svn-id: https://code.elgg.org/elgg/trunk@3452 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/access.php

index 392c89a2ffddfeab39d03dc67c60a66ef12826f5..32b476a39585333873db50a04f9a9d76f9064387 100644 (file)
@@ -647,6 +647,27 @@ END;
                        return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
                }
                
+       /**
+        * Return a humanreadable version of an entity's access level
+        *
+        * @param $entity_accessid (int) The entity's access id
+        * @return string e.g. Public, Private etc
+        **/
+                
+               function get_readable_access_level($entity_accessid){   
+                       $access = (int) $entity_accessid;
+                       //get the access level for object in readable string
+                       $options = get_write_access_array();
+                       foreach($options as $key => $option) {
+                               if($key == $access){
+                                       $entity_acl = htmlentities($option, ENT_QUOTES, 'UTF-8');
+                                       return $entity_acl;
+                                       break;
+                               }
+                       }
+                       return false;
+               }
+               
                global $init_finished;
                $init_finished = false;