/**
  * Returns TRUE if the event is available to the user (see comment for getAvailableEventsForUser)
  * 
  * @global wpdb $wpdb
  * @param int $userID
  * @param int $eventID
  * @return boolean
  */
 public static function isEventAvailable($userID, $eventID)
 {
     global $wpdb;
     $mandantID = EventDatabaseManager::getMandantID($userID);
     $query = "SELECT count(*) AS total FROM datr_Events JOIN datr_User_has_Topics \n            ON datr_Events.topicID = datr_User_has_Topics.topicID \n            JOIN datr_Addresses ON datr_Addresses.addressID = datr_Events.addressID \n            JOIN datr_User_has_Locations ON datr_User_has_Locations.locationID = datr_Addresses.locationID \n            AND datr_User_has_Locations.userID = datr_User_has_Topics.userID \n            WHERE datr_User_has_Topics.userID = {$userID} AND mandantID = {$mandantID} AND eventID = {$eventID} AND (date_time > NOW() OR eventType = 'elearning') AND event_visible = 1";
     $res = $wpdb->get_results($query, ARRAY_A);
     return $res[0]['total'] != 0;
 }