<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

  // load viewer library
  $libraryPath = 'nptAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('C:/wamp/www/','','../','../../','../../../');
  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
  list($pdrRecords, $pdrMetaData) = getRecords(array(
    'tableName'   => 'pdr',
    'loadUploads' => '0',
  ));

  // load records
  list($accountsRecords, $accountsMetaData) = getRecords(array(
    'tableName'   => 'accounts',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $accountsRecord = @$accountsRecords[0]; // get first record


?>
<!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">
<html>
<head>
<title>PDR Database</title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <link rel="stylesheet" type="text/css" href="pdr.css" media="screen">

</head>
<body>
<div class="instructions">
<a href="http://mfa-hfx-qcms001/nptAdmin" target="_blank">Login</a><br />
<a href="http://mfa-hfx-qcms001/pdr/signup.php" target="_blank">User Registration</a><br />
<a href="http://mfa-hfx-qcms001/pdr/Instructions.pdf" target="_blank">Instructions</a><br />
<center><h1><?php echo $accountsRecord['position_title'] ?> - <?php echo $accountsRecord['position_number'] ?></h1></center>
<br />
<center><b>OPI</b>: <a href="mailto:<?php echo $accountsRecord['email'] ?>"><?php echo $accountsRecord['fullname'] ?></a></center>
</div>
<br />
<center>
<a href="<?php echo $pdrMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a>
<br />
<table>
	<th>Critical Task</th>
	<th>Expected Result</th>
	<th>Reference</th>
	<?php foreach ($pdrRecords as $record): ?>
	<tr>
		<td>
			<?php echo $record['critical_task'] ?>
		</td>
		<td>
			<?php echo $record['expected_result'] ?>
		</td>
		<td>
			<?php echo $record['reference'] ?>
		</td>
	</tr>
	<?php endforeach ?>

    <?php if (!$pdrRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
</table>
<br />
<a href="<?php echo $pdrMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a>
</center>
</body>
</html>