<?php set_include_path(get_include_path() . PATH_SEPARATOR . '../../'); require_once 'includes/common.php'; require_once 'includes/functions.seatingPlan.php'; use libAllure\Sanitizer; use libAllure\DatabaseFactory; use libAllure\Session; $eventId = Sanitizer::getInstance()->filterUint('event'); $seatChanges = array(); foreach (getSeats($eventId) as $seatSelection) { $seatChanges[] = getJsonSeatChange('set', $seatSelection['seat'], $seatSelection['username'], $seatSelection['usernameCss'], $seatSelection['seatCss']); } header('Content-Type: application/json'); echo json_encode($seatChanges); ?>
function getTableDetails($arrTable) { $arrTable['state'] = (int) $arrTable['state']; $arrTable['seats'] = getSeats(); if (!isset($arrPlayersBySeat[(int) $arrTable['current_seat']]) || '1' === $arrPlayersBySeat[(int) $arrTable['current_seat']]['sit_out'] || 'in' !== $arrPlayersBySeat[(int) $arrTable['current_seat']]['in_or_out']) { $arrTable['current_seat'] = db_select_one(TABLE_PLAYERS, 'seat', 'sit_out = \'0\' AND in_or_out = \'in\' AND table_id = ' . $arrTable['id'] . ' ORDER BY seat>=' . (int) $arrTable['current_seat'] . ' DESC, seat ASC'); db_update(TABLE_TABLES, 'current_seat = ' . (int) $arrTable['current_seat'], 'id = ' . $arrTable['id']); } if (!isset($arrPlayersBySeat[(int) $arrTable['dealer_seat']]) || '1' === $arrPlayersBySeat[(int) $arrTable['dealer_seat']]['sit_out']) { $arrTable['dealer_seat'] = db_select_one(TABLE_PLAYERS, 'seat', 'sit_out = \'0\' AND table_id = ' . $arrTable['id'] . ' ORDER BY seat>=' . (int) $arrTable['dealer_seat'] . ' DESC, seat ASC'); db_update(TABLE_TABLES, 'dealer_seat = ' . (int) $arrTable['dealer_seat'], 'id = ' . $arrTable['id']); } return $arrTable; }