/** * Check if an user is in the group * * @param USVN_Db_Table_Row_User User * @return boolean */ public function isInGroup($group) { if ($this->_cleanData === array()) { return false; } $user_groups = new USVN_Db_Table_UsersToGroups(); $res = $user_groups->fetchRow(array("groups_id = ?" => $group->groups_id, "users_id = ?" => $this->id)); if ($res === NULL) { return false; } return true; }
public function isLeaderOrAdmin($user) { if ($user) { $user_groups = new USVN_Db_Table_UsersToGroups(); $res = $user_groups->fetchRow(array("groups_id = ?" => $this->id, "users_id = ?" => $user->id)); if ($res) { if ($res->is_leader == 1) { return 1; } } if ($user->is_admin == 1) { return 1; } return 0; } }