예제 #1
0
function getClassParticipants($participationIds)
{
    if ($participationIds == null) {
        return;
    }
    $participations = array();
    foreach ($participationIds as $key => $value) {
        $participation = R::load(PARTICIPATION, $value['id']);
        if (!$participation->id) {
            continue;
        }
        $rider = R::load(USER, $participation->rider_id);
        $participations[] = array(ID => $participation->id, PARTICIPATION_RIDER => $rider->id ? loadBasicUserInfo($rider) : null, PARTICIPATION_HORSE => $participation->horse, PARTICIPATION_RANK => $participation->rank);
    }
    return $participations;
}
예제 #2
0
function getBarnStalls($stallIds)
{
    if ($stallIds == null) {
        return null;
    }
    $stalls = array();
    foreach ($stallIds as $key => $value) {
        $stall = R::load(STALL, $value->id);
        if (!$stall->id) {
            continue;
        }
        $occupant = R::load(USER, $stall->occupant_id);
        $stalls[] = array(ID => $stall->id, STALL_NAME => $stall->name, STALL_OCCUPANT => $occupant->id ? loadBasicUserInfo($occupant) : null);
    }
    return $stalls;
}
예제 #3
0
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;
}
예제 #4
0
function getEventInfo($userId, $eventId)
{
    $event = R::load(EVENT, $eventId);
    if (!$event->id) {
        return null;
    }
    $admin = R::load(USER, $event->admin_id);
    return array(ID => $event->id, EVENT_NAME => $event->name, EVENT_START_DATE => $event->startdate, EVENT_END_DATE => $event->enddate, EVENT_ADMIN => $admin->id ? loadBasicUserInfo($admin) : null, EVENT_BARNS => getEventBarns($event->ownBarn), EVENT_DIVISIONS => getEventDivisions($event->ownDivision), EVENT_CONTACTS => getEventContacts($event->ownContact), EVENT_PARTICIPANTS => $userId == $event->admin_id ? getBasicUserInfoWithClasses(rem_array($event->sharedUser, $event->admin_id), $eventId) : null);
}