/** * Returns the data for event with corresponding ID * If no event with such ID is found, returns NULL * @global wpdb $wpdb * @param int $eventID * @return null|Event */ public static function getEvent($eventID) { global $wpdb; $query = "SELECT * FROM datr_Events WHERE eventID = {$eventID}"; $res = $wpdb->get_results($query, ARRAY_A); if (count($res) == 0) { return null; } $date = $res[0]['date_time']; $res[0]['date_time'] = Utils::getTime($date); $event = new Event($res[0]); $topic = EventDatabaseManager::getTopic($event->getTopicID()); $mandant = EventDatabaseManager::getMandant($event->getMandantID()); $address = EventDatabaseManager::getAddress($event->getAddressID()); $event->setMandant($mandant['company']); $event->setTopic($topic['Name']); $event->setAddress($address); return $event; }