Exemplo n.º 1
0
 /**
  * Get the visibility flag associated with a caste.
  * This function only works for the session user.
  * @return Group associated with the visibility
  */
 public function casteVisibility(Caste $caste, Group $visibility = null)
 {
     if (!$this->isMe(S::user())) {
         return null;
     }
     if ($visibility !== null && self::rightsVisibilityIsPossible($caste->rights(), $visibility)) {
         XDB::execute('UPDATE  castes_users
                          SET  visibility = {?}
                        WHERE  uid = {?} AND cid = {?}', $visibility->id(), $this->id(), $caste->id());
         if ($this->cuvisibility == null) {
             $this->cuvisibility = array();
         }
         $this->cuvisibility[$caste->id()] = $visibility;
     }
     return empty($this->cuvisibility[$caste->id()]) ? null : $this->cuvisibility[$caste->id()];
 }