/** * Adds topic to database * Returns the ID of a new event on success, FALSE otherwise * * @global wpdb $wpdb * @param Event $event * @return int|boolean */ public static function addEvent($event) { global $wpdb; $duration = $event->getDuration() == null ? 'null' : $event->getDuration(); $bookedParticipants = $event->getBookedParticipants() == null ? 'null' : $event->getBookedParticipants(); $maxParticipants = $event->getMaxParticipants() == null ? 'null' : $event->getMaxParticipants(); $visibility = $event->getVisibility() == null ? 'null' : $event->getVisibility(); $query = "INSERT INTO `datr_Events` \n (`eventType`, `title_long`, `title_short`, \n `date_time`, `duration_min`, `invitation_text`,\n `lecturer_name`, `booked_participants`, `max_participants`,\n `topicID`, `mandantID`, `addressID`, event_visible) \n VALUES ('" . $event->getEventType() . "', '" . $event->getTitleLong() . "', '" . $event->getTitleShort() . "', '" . $event->getDateTime() . "', " . $duration . ", '" . $event->getInvitationText() . "', '" . $event->getLecturerName() . "', " . $bookedParticipants . ", " . $maxParticipants . ", " . $event->getTopicID() . ", " . $event->getMandantID() . ", " . $event->getAddressID() . ", " . $visibility . ")"; return $wpdb->query($query); }