<?
    $GLOBALS
['highlight'] = 'quilts';

    require_once(
'include/functions/tile_get_sides.php');
    require_once(
'include/functions/tile_is_available.php');

    
$quilts mysql_query("SELECT * FROM quilts WHERE id = '" $_id "'");
    if (
$quilts_row mysql_fetch_array($quilts))
    {
        list(
$available$display$output) = tile_is_available($_id$_x$_y);
        if (
$available)
        {
            
$datetime date('Y-m-d H:i:s');
            
mysql_query("INSERT INTO tiles_pending SET quilt_id = '" $_id "', matrix_x = '" $_x "', matrix_y = '" $_y "', user_id = '" $GLOBALS['auth']['id'] . "', started_on = '" $datetime "', due_date = '" nice_date($datetime$params 'Y-m-d H:i:s'$quilts_row['timelimit']) . "', borders = '" tile_get_sides($_id$_x$_y) . "'");
        }
        else
        {
            
header('Location: ./?s=quilt&i=' $_id);
            die;
        }
    }
    else
    {
        
header('Location: ./?s=quilts');
        die;
    }

    include(
'include/parts/header.php');
?>

<div class="header">Checkout</div>

<div class="content">
<table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top">
<?
    
echo '<img src="?g=tile_sides&i=' $_id '&x=' $_x '&y=' $_y '" width = "' . ($quilts_row['tile_width'] + $quilts_row['side_pixels'] * 2) . '" height = "' . ($quilts_row['tile_height'] + $quilts_row['side_pixels'] * 2) . '" border = "0">' "\r\n";
?>
</td><td valign="top" style="padding-left: 10px;">
You have checked out the tile to the left.<br />
<div style="padding: 10px 0px 0px 0px;"></div>
To begin working on it, save the image to your hard drive, open it in your favorite art app, and go to work!<br />
<div style="padding: 10px 0px 0px 0px;"></div>
When you are ready to check the tile back in, or if you wish to cancel your checked out tile, you will find a listing of all your checked out tiles in the "Tiles Pending" link from the top bar or on the actualy quilt page itself..<br />
<div style="padding: 10px 0px 0px 0px;"></div>
Your tile should be saved as a 24-bit PNG file before checking it in.<br />
<div style="padding: 10px 0px 0px 0px;"></div>
<?
    
echo 'Return To Quilt: <a href="?s=quilt&i=' $_id '">' $quilts_row['name'] . '</a><br />' "\r\n";
?>
</td></tr></table>
</div>

<?
    
include('include/parts/footer.php');
?>