<?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',
//    'where'       => whereRecordNumberInUrl(1),
    'loadUploads' => '0',
    'limit'       => '1',
  ));
  $pdrRecord = @$pdrRecords[0]; // get first record


    // load records
    list($accountsRecords, $accountsMetaData) = getRecords(array(
      'tableName'   => 'accounts',
      'loadUploads' => '0',
    ));

?>
<!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>NTO Job Description 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>NTO Job Description Database</h1></center>
<br />
<center><b>OPI</b>: <a href="mailto:Mark.mckiel@forces.gc.ca">LCdr Mark McKeil</a><br />(613) 992-6898 - D Mar Pers 3-2</center>
</div>
<br />
<center>
    <table>
    	<th><a href="index.php?orderBy=<?php echo (@$_REQUEST['orderBy']!="organization")? "organization" : "organization DESC" ?>">Organization</a></th>
		<th><a href="index.php?orderBy=<?php echo (@$_REQUEST['orderBy']!="position_title")? "position_title" : "position_title DESC" ?>">Position Title</a></th>
    	<th><a href="index.php?orderBy=<?php echo (@$_REQUEST['orderBy']!="position_number")? "position_number" : "position_number DESC" ?>">Position Number</a></th>
    	<?php foreach ($accountsRecords as $record): ?>
    	<tr>
    		<td>
    			<?php echo $record['organization'] ?>
			</td>
      		<td>
      			<?php echo $record['position_title'] ?>
      		</td>
      		<td>
      			<a href="<?php echo $record['_link'] ?>"><?php echo $record['position_number'] ?></a>
      		</td>
		</tr>

        <?php endforeach ?>
	</table>
</center>
<?php if ($accountsMetaData['invalidPageNum']): ?>
      Results page '<?php echo $accountsMetaData['page']?>' not found, <a href="<?php echo $pdrMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
    <?php elseif (!$accountsRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>


   <?php if ($accountsMetaData['prevPage']): ?>
      <a href="<?php echo $accountsMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $accountsMetaData['page'] ?> of <?php echo $accountsMetaData['totalPages'] ?> -

    <?php if ($accountsMetaData['nextPage']): ?>
      <a href="<?php echo $accountsMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>





</body>
</html>