$notify->add($lang->get('room'), $lang->get($couldseat)); } } $smarty->assign("remove_and_add_users", $room['eventid'] <= 0 ? false : $isallowedtoseatppl); // show room with id = roomid if ($isallowed) { $menu->addSubElement($mod, $lang->get('edit_items'), 'items', array('roomid' => $roomid)); $menu->addSubElement($mod, $lang->get('room_edit'), 'edit', array('roomid' => $roomid)); } $smarty->assign('path', $template_dir . "/room.tpl"); $breadcrumbs->addElement($room['title'], makeURL($mod, array('roomid' => $roomid))); $smarty->assign('room', $room); $items = $db->selectList($tbl_i, "*", "`roomid`=" . $roomid); $smarty->assign('items', $items); $allready_reserved = isSittingAlready($room['eventid'], 13, $userid); $allready_sitting = isSittingAlready($room['eventid'], 11, $userid); $smarty->assign('only_reserving', $isallowedtoreserve && !$isallowedtositdown); $smarty->assign('allow_sitting', $isallowedtositdown); $smarty->assign('sitting_allready', $allready_sitting); $smarty->assign('reserved_allready', $allready_reserved); $matrix = makeItemMatrix($items, $room['height'], $room['width']); $smarty->assign('matrix', $matrix); //check if there should be a grid $smarty->assign('grid_border', $config->get('room', 'show-grid')); //count seats if ($room['eventid'] != -1) { $smarty->assign('show_information', $config->get('room', 'show-information')); $smarty->assign('table_information', countSeats($room['eventid'], $room['roomid'])); } } }
function seatUser($roomid, $eventid, $x, $y, $userid) { global $db; $userid = $userid <= 0 ? -1 : $userid; $exists = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'users', "*", "userid=" . secureMySQL((int) $userid)); if (!$exists) { return "seating_nosuchuser"; } if (isSittingAlready($eventid, 11, $userid)) { standUp($userid, $eventid); } if (isSittingAlready($eventid, 13, $userid)) { undoReservation($userid, $eventid); } $event = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'events', "*", "eventid=" . (int) $eventid); $dummy = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'register', '*', "userid=" . (int) $userid . " AND eventid=" . (int) $eventid); $isallowedtoreserve = ($event['free'] == 1 or $dummy['payed'] > 0); $isallowedtositdown = $dummy['appeared'] != 0; if ($isallowedtositdown) { sitDown($userid, $roomid, $x, $y); return "seating_seated"; } elseif ($isallowedtoreserve) { makeReservation($userid, $roomid, $x, $y); return "seating_reserved"; } return "seating_notpayed"; }