<?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 = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/stockfsnv/www/stockpiledefensefsnv.com/','','../','../../','../../../');
  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 'classes'
  list($classesRecords, $classesMetaData) = getRecords(array(
    'tableName'   => 'classes',
    'loadUploads' => true,
    'allowSearch' => true,
     'joinTable'   => 'prices',

  ));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    body          { font-family: arial; }
    .instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
  </style>
 </head>
<body>
 


    
   <?php foreach ($classesRecords as $record): ?>    
      Date: <?php echo htmlencode($record['day']) ?>:<?php echo htmlencode($record['name']) ?><br/>
      Type: <?php echo $record['type'] ?><br/>
      
<a target=_blank href="<?php echo $record['description'] ?>">Info</a><br/>
      <hr/>
    <?php endforeach ?>
 


    <?php if (!$classesRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>

	<form id="form" action="classlist.php?day_name"> 
 <select name="day_match" class="dropdown" id="type" size="1" style="font-family: Verdana; color: #821789; font-size: 10pt"> 
<option selected value="day">Select A Day</option>
 <?php
$tablename = $options['classes'];
$fieldname = 'day';
$schema = loadSchema($tablename);
$fieldSchema = $schema[$fieldname];
$fieldOptions = getListOptionsFromSchema($fieldSchema);

foreach ($fieldOptions as $valueAndLabel) {
list($value, $label) = $valueAndLabel;
$encodedValue = htmlspecialchars($value);
$encodedLabel = htmlspecialchars($label);
print "<option value='$encodedValue'>$encodedLabel</option>\n";
}
?>
</select>
<input type="submit" name="submit" value="Click to Search" >

</form>



</body>
</html>