Document the "visibility" concept, add isVisible to profiles
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 21 Feb 2010 00:52:13 +0000 (01:52 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 2 Mar 2010 12:57:34 +0000 (13:57 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/profile.php

index 79372e7..1e69288 100644 (file)
@@ -213,6 +213,10 @@ class Profile
         return property_exists($this, $name) || isset($this->data[$name]);
     }
 
+    /** Sets the level of visibility of the profile
+     * Sets $this->visibility to a list of valid visibilities.
+     * @param one of the self::VISIBILITY_* values
+     */
     public function setVisibilityLevel($visibility)
     {
         if ($visibility != self::VISIBILITY_PRIVATE
@@ -226,6 +230,14 @@ class Profile
         }
     }
 
+    /** Determine whether an item with visibility $visibility can be displayed
+     * with the current level of visibility of the profile
+     * @param $visibility The level of visibility to be checked
+     */
+    public function isVisible($visibility)
+    {
+        return in_array($visibility, $this->visibility);
+    }
 
     /* Photo
      */