<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
  require_once "/home/content/i/t/s/itsplanttech/html/cmsadmin/lib/viewer_functions.php";

	//SERVICES TABLE

   list($plant_training_servicesRecords, $plant_training_servicesMetaData) = getRecords(array(
    'tableName'   => 'plant_training_services',
	//'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $plant_training_servicesRecord = @$plant_training_servicesRecords[0]; // get first record
 

	//COURSES TABLE

  list($coursesRecords, $coursesMetaData) = getRecords(array(
    'tableName'   => 'courses',
  
  ));
	
	

?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>ITS Plant Tech - Macken Co. Fermanagh - <?php echo $plant_training_servicesRecord['name'] ?></title>
<link href="/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/pro_drop_1/pro_drop_1.css" />

<script src="/pro_drop_1/stuHover.js" type="text/javascript"></script>
<body>
<?php //print_r($plant_training_servicesRecords) ?> <br />

<div id="site_wrapper">
  <?php require_once('../includes/header.htm'); ?>
  <?php require_once('../includes/main.htm'); ?>

 
  <div id="main_wrapper">
  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
  
  <!-- DISPLAY SERVICE INFORMATION FROM SERVICES TABLE) -->
    <h1><?php echo $plant_training_servicesRecord['name'] ?></h1>
      <?php echo $plant_training_servicesRecord['content'] ?><br/>


      <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($plant_training_servicesRecord['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

          <?php elseif ($upload['isImage']): ?>
            <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

          <?php else: ?>
            <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          <?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads -->


      <hr/>
      <p>
        <?php if (!$plant_training_servicesRecord): ?>
      No record found!<br/>
      <br/>
      <?php endif ?>
      <!-- /STEP2: Display Records -->
    </p>
      <h2><strong>Courses Available</strong></h2>
      <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
      <table width="100%" bgcolor="#FFFFCC">
        <tr>
          <td width="31%" bgcolor="#CCCCCC"><strong>Course Title</strong></td>
          <td width="28%" bgcolor="#CCCCCC"><strong>Section</strong></td>
          <td width="23%" bgcolor="#CCCCCC"><strong>Start Date</strong></td>
          <td width="7%" bgcolor="#CCCCCC"><strong>Duration</strong></td>
          <td width="11%" bgcolor="#CCCCCC"><strong>Places
          </strong>            <div align="right"></div></td>
        </tr>
      </table>

     
	 <!-- DISPLAY COURSES THAT RELATE TO CURRENT SERVICE FROM THE COURSES TABLE) -->
	 <!-- THIS PART APPEARS TO WORK NOW THAT I HAVE ADDED SECTION= TO THE MENU URL) -->
	 
	 
 
        <?php foreach ($coursesRecords as $record): ?>
     
    <table width="100%" bgcolor="#FFFFCC">
  <tr>
    <td width="31%"><?php echo $record['title'] ?></td>
    <td width="28%"><?php echo $record['section'] ?></td>
    <td width="23%"><?php echo date("D, M jS, Y g:i:s a", strtotime($record['start_date'])) ?></td>
    <td width="6%"><?php echo $record['duration'] ?></td>
    <td width="8%"><?php echo $record['number_of_places'] ?></td>
    <td width="4%"><div align="right"><a href="<?php echo $record['_link'] ?>">More</a></div></td>
  </tr>
</table>

    <?php endforeach; ?>

    <?php if (!$coursesRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->

    <p>&nbsp;</p>
      <p>        <a href="<?php echo $plant_training_servicesMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a> - <a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
        
        
        
                </p>
  </div>
  <br clear="all" />
  <?php require_once('../includes/footer.htm'); ?>
<br clear="all" />
</div>
</body>
</html>





