Example #1
0
 /**
  * Check if user is in project
  * 
  * @param unknown $id : user's id
  * @return boolean : true if is in, false otherwhise
  */
 static function isProjetParticipant($id)
 {
     $items = new self();
     $userId = Session::getLoginUserID();
     $groupUser = new Group_User();
     $groups = $groupUser->find("`users_id` = " . $userId);
     if ($items->getFromDBbyProjetAndItem($id, $userId, "User")) {
         return true;
     } else {
         if (!empty($groups)) {
             foreach ($groups as $grp) {
                 if ($items->getFromDBbyProjetAndItem($id, $grp['groups_id'], "Group")) {
                     return true;
                 }
             }
         }
     }
     return false;
 }