<?
    
function quilt_information($id)
    {
        
$quilts mysql_query("SELECT * FROM quilts WHERE id = '" $id "'");
        if (
$quilts_row mysql_fetch_assoc($quilts))
        {
            
$count mysql_query("SELECT COUNT(*) AS count FROM tiles WHERE quilt_id = '" $quilts_row['id'] . "' AND visibility >= '0' AND deleted = '0'");
            
$count_row mysql_fetch_array($count);
            
$seconds mysql_query("SELECT SUM(seconds) AS count FROM tiles WHERE quilt_id = '" $quilts_row['id'] . "' AND visibility >= '0' AND deleted = '0'");
            
$seconds_row mysql_fetch_array($seconds);
            
$distinct mysql_query("SELECT COUNT(DISTINCT(user_id)) AS count FROM tiles WHERE quilt_id = '" $quilts_row['id'] . "' AND visibility >= '0' AND deleted = '0'");
            
$distinct_row mysql_fetch_array($distinct);
            echo 
'Started ' nice_date($quilts_row['posted_on'], 'F j, Y') . ' and last modified on ' .  nice_date($quilts_row['modified_on'], 'F j, Y') . '<br />' "\r\n";
               echo 
'Dimensions: (' $quilts_row['quilt_width'] . ' x ' $quilts_row['quilt_height'] . ') tiles @ (' $quilts_row['tile_width'] . ' x ' $quilts_row['tile_height'] . ') pixels.<br /><br />' "\r\n";
               echo 
'<table border="0" cellpadding="0" cellspacing="0">';
               echo 
'<tr>';
               echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Quilt Level:</td><td width="100">';
               echo 
$quilts_row['level'] == 'Beginner' '';
               echo 
$quilts_row['level'] == 'Intermediate' '';
               echo 
$quilts_row['level'] == 'Advanced' '';
               echo 
'</td>';
               echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Tiles Visible:</td><td width="200">';
               echo 
$quilts_row['show_all'] == 'When Neighbours Are Finished' '';
               echo 
$quilts_row['show_all'] == 'Instantely' '';
               echo 
$quilts_row['show_all'] == 'When Whole Quilt Is Complete' '';
               echo 
'</td>';               
               echo 
'</tr>';
               echo 
'<tr>';
               echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Side Pixels To Display:</td><td width="100">' $quilts_row['side_pixels'] . '</td>';
            echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Can Work On Tiles:</td><td width="200">' . ($quilts_row['work_on_all'] ? 'Even Ones Next To Your Own' 'Not Next To Your Own') . '</td>';
               echo 
'</tr>';
               echo 
'<tr>';
               echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Photographs Allowed:</td><td width="100">' . ($quilts_row['photographs_allowed'] ? 'Yes' 'No') . '</td>';
            echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Checkout Tile:</td><td width="200">' . ($quilts_row['start_anywhere'] ? 'Anywhere That\'s Available' 'Only Next To An Existing Tile') . '</td>';
               echo 
'</tr>';
               echo 
'<tr>';
               echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Edge Wrap:</td><td width="100">';
               echo 
$quilts_row['edge_wrap'] == 'No' '';
               echo 
$quilts_row['edge_wrap'] == 'Horizontal' '';
               echo 
$quilts_row['edge_wrap'] == 'Verticle' '';
               echo 
$quilts_row['edge_wrap'] == 'All Edges' '';
               echo 
'</td>';
            echo 
'<td width="150" align="right" style="padding-right: 5px;" nowrap>Moderated:</td><td width="200">' . ($quilts_row['moderated'] ? 'Yes' 'No') . '</td>';
               echo 
'</tr>';
            echo 
'</table><br />' "\r\n";
               echo 
$count_row['count'] . ' of ' $quilts_row['quilt_width'] * $quilts_row['quilt_height'] . ' (' round($count_row['count'] / ($quilts_row['quilt_width'] * $quilts_row['quilt_height']) * 1002) . '%) tiles completed, representing ' round($seconds_row['count'] / 36002) . ' hours of work by ' $distinct_row['count'] . ' artists.' "\r\n";
               if (
$quilts_row['finished'] == 0)
               {
                
$tiles_pending mysql_query("SELECT COUNT(*) AS count FROM tiles_pending WHERE quilt_id = '" $quilts_row['id'] . "'");
                
$tiles_pending_row mysql_fetch_array($tiles_pending);
                   echo 
'There ' . ($tiles_pending_row['count'] != 'are' 'is') . ' currently ' $tiles_pending_row['count'] . ' tile' . ($tiles_pending_row['count'] != 's' '') . ' checked out.';
               }
        }
    }
?>