예제 #1
0
function eventsList()
{
    $current_user = wp_get_current_user();
    if (isset($_GET['eventaction'])) {
        $event_action = (int) $_GET['eventaction'];
        if (is_numeric($_GET['eventid'])) {
            switch ($event_action) {
                case 0:
                    EventDatabaseManager::signIn($current_user->ID, $_GET['eventid']);
                    MailNotifications::sendSignInMail($current_user->user_email, EventDatabaseManager::getEvent($_GET['eventid']));
                    wp_redirect(wp_get_referer());
                    break;
                case 1:
                    break;
                case 2:
                    EventDatabaseManager::signOut($current_user->ID, $_GET['eventid']);
                    MailNotifications::sendSignOutMail($current_user->user_email, EventDatabaseManager::getEvent($_GET['eventid']));
                    wp_redirect(wp_get_referer());
                    break;
                default:
                    break;
            }
        }
        $events_custom = EventDatabaseManager::getAvailableEventsForUser($current_user->ID);
        return View::outputEventListForUser($_GET['page_id'], $_GET['page_id'], $current_user->ID, $events_custom);
    } elseif (isset($_GET['eventID'])) {
        $event = EventDatabaseManager::getEvent($_GET['eventID']);
        return eventsInfo($event);
    } else {
        $events_custom = EventDatabaseManager::getAvailableEventsForUser($current_user->ID);
        return View::outputEventListForUser($_GET['page_id'], $_GET['page_id'], $current_user->ID, $events_custom);
    }
}
예제 #2
0
/**
 * Outputs the form for editing events
 */
function edit_event()
{
    View::linkToBack('manage_events');
    View::loadScripts();
    if (isset($_GET['eventID'])) {
        $eventID = mysql_real_escape_string($_GET['eventID']);
        $event = EventDatabaseManager::getEvent($eventID);
        View::eventFormOutput($event);
    }
}
 /**
  * Returns TRUE, if the user is signed up for any event on the specified event's topic
  * 
  * @param int $userID
  * @param int $eventID
  * @return boolean
  */
 public static function isSignedForEventsTopic($userID, $eventID)
 {
     $event = EventDatabaseManager::getEvent($eventID);
     return EventDatabaseManager::isSignedInForTopic($userID, $event->getTopicID());
 }