<html> <head><title>Seating Matrix Planner for Speed Networking</title></head> <?php if ($_REQUEST[top] < 1) $_REQUEST[top] = 15; ?> <body> <h1>Speed Networking - meeting matrix<br> For <?= $_REQUEST[top] ?> people</h1> <?php
$html = "<table border=1>"; $html .= "<tr>"; $html .= "<td> </td>"; for ($k=1; $k<=$_REQUEST[top]; $k++) { if ($k == $_REQUEST[top] and $_REQUEST[top]%2 == 1) { $html .= "<th>Sitting out</th>"; } else { $kseat = ($_REQUEST[letters]) ? chr($k+64) : $k; $html .= "<th>Seat $kseat</th>"; } } $html .= "<tr>"; $seats = range(0,$_REQUEST[top]); for ($round = 1; $round <= $_REQUEST[top]+1; $round++) { $newseats = range(0,$_REQUEST[top]); $rn = "Round $round"; if ($_REQUEST[top]%2 == 0 and $round == $_REQUEST[top]) { $rn = "Completed"; } if ($_REQUEST[top]%2 == 1 and $round == $_REQUEST[top]+1) { $rn = "Completed"; } $html .= "<tr>"; $html .= "<td>$rn</td>"; for ($k=1; $k<=$_REQUEST[top]; $k++) { $html .= "<td>$seats[$k]</td>"; } $html .= "<tr>"; for ($k=1; $k <= $_REQUEST[top]; $k+=2) { if ($k == 1 and $_REQUEST[top]%2 == 0) { $newseats[1] = $seats[1]; $newseats[3] = $seats[2]; } elseif ($k == 1 and $_REQUEST[top]%2 != 0) { $newseats[3] = $seats[1]; $newseats[1] = $seats[2]; } elseif ($k > $_REQUEST[top]-1 and $_REQUEST[top]%2 != 0) { /* $newseats[$k] = $seats[$k-1]; */ $newseats[$k-1] = $seats[$k]; } elseif ($k > $_REQUEST[top]-2 and $_REQUEST[top]%2 == 0) { $newseats[$k+1] = $seats[$k]; $newseats[$k-1] = $seats[$k+1]; } else { $newseats[$k+2] = $seats[$k]; $newseats[$k-1] = $seats[$k+1]; } } $seats = $newseats; if ($rn == "Completed") break; } $html .= "</table>"; print $html; ?> <b>Look complicated? It isn't!</b> Each person moves one seat to the left each time - read all about how it works on <a href=http://www.wellho.net/mouth/1157_.html>The Horse's Mouth</a>. <hr> Copyright Well House Consultants.<br> graham@wellho.net, http://www.wellho.net, +44 (0) 1225 708225<hr> <?php if ($_REQUEST[silent] == 0) { ?> Want to see how this page works? Here's the source code:<br> <table border=1><tr><td> <?php highlight_file("$_SERVER[DOCUMENT_ROOT]/demo/nbm.html"); ?> </td></tr></table> <? } ?> </body> </html>
|