<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'team-manager/lib/viewer_functions.php';
  $dirsToCheck = array('/home/drivetom/domains/charityrallies.org/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from 'accounts'
  list($accountsRecords, $accountsMetaData) = getRecords(array(
    'tableName'   => 'accounts',
    'loadUploads' => true,
    'allowSearch' => false,
  ));

  $detailRecord = @$accountsRecords[0]; // get first record
  if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found
  
  // load detail record from 'teams'
  list($teamsRecords, $teamsMetaData) = getRecords(array(
    'tableName'   => 'teams',
    'where'       => whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $detailRecord = @$teamsRecords[0]; // get first record
  if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found

?>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<style type="text/css">
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-yw4l{vertical-align:top}
</style>
</head>
<style type="text/css">
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-yw4l{vertical-align:top}
</style>


<table class="tg">
  <tr>
    <th class="tg-yw4l">
<table class="tg">
 <colgroup>
<col style="width: 175px">
<col style="width: 175px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
<col style="width: 50px">
</colgroup>
  <tr>
    <th class="tg-yw4l">Team Name</th>
    <th class="tg-yw4l">Team Lead</th>
    <th class="tg-yw4l">Team Prof.</th>
    <th class="tg-yw4l">Team Membs.</th>
    <th class="tg-yw4l">Vehicle</th>
    <th class="tg-yw4l">Fndrsng</th>
    <th class="tg-yw4l">Entry</th>
    <th class="tg-yw4l">Vehicle Aprvd</th>
    <th class="tg-yw4l">V. Passport</th>
    <th class="tg-yw4l">Completed </th>
    <th class="tg-yw4l"></th>
    <th class="tg-yw4l"></th>

  </tr>
      <?php foreach ($accountsRecords as $record): ?>
    <tr>
    <th class="tg-yw4l"><?php echo htmlencode($record['team_name']) ?></th>
    <th class="tg-yw4l"><?php echo htmlencode($record['fullname']) ?></th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES</th>
    <th class="tg-yw4l">YES </th>
    <th class="tg-yw4l"></th>
    <th class="tg-yw4l"></th>


  </tr> 
      <?php endforeach ?>
</table>


</th>
  </tr>
</table>
<body>
</body>
</html>
