<?php require_once 'setup.php'; $app = new \Slim\Slim(); /* GET USER LOGIN INFO */ $app->get('/user/:email/:password', function ($email, $password) { $user = getLoginInfo($email, $password); if ($user != null) { echo json_encode($user); } }); /* GET USER INFO FOR ONE EVENT */ $app->get('/user/:email/events/:eventId', function ($email, $eventId) { $user = getUserEventInfo($email, $eventId); if ($user != null) { echo json_encode($user); } }); /* GET ALL EVENTS */ $app->get('/events/all', function () { echo json_encode(getAllEvents()); }); /* USERS */ $app->post('/user', function () { $body = http_get_request_body(); if ($body != null) { $typeCheck = json_decode($body); switch ($typeCheck->type) { /* CREATE A USER */ case USER: $inUser = $typeCheck->obj;
function getBasicUserInfoWithClasses($userIds, $eventId) { if ($userIds == null) { return null; } $users = array(); foreach ($userIds as $key => $value) { $user = R::load(USER, $value->id); if (!$user->id) { continue; } $userInfo = loadBasicUserInfo($user); $userEventInfo = getUserEventInfo($user->email, $eventId); if ($userEventInfo) { $userInfo[DIVISION_CLASSES] = $userEventInfo[DIVISION_CLASSES]; } $users[] = $userInfo; } return $users; }