<?
include('auth.php');
include('common.php');


$lid= $_GET['lid'];		

$SQL="SELECT * FROM progressnotes 
WHERE learnergoal_id in (SELECT id FROM learnergoals WHERE learner_id =".$lid." AND alive=1) AND alive=1
 ORDER BY thedate DESC";
$results = llnb_query($SQL);

$i=0;
while($row = llnb_fetch_assoc($results))
{
	
	if ($i % 2)
		$odd= "class=\"odd\"";
	else
		$odd ="";
		
	if ( $row['note'] != "")	
		$x= "<a  href=\"javascript:changeClass('note".$i."')\" class=\"btnsml btn\">View&nbsp;Note</a>";
	else
		$x="";
		
	$TRs .="
	<tr ".$odd."\">
        <td class=\"datewidth\">".dispDate($row['thedate'])."</td>
        <td><a rel=\"{handler:'iframe',size:{x:550,y:400}}\"  href=\"learner_progressnotes_m.php?lid=".$lid."&mode=edit&frompg=learnerprogressnotes&pnid=".$row['id']."\" class=\"btnsml_m\">Edit</a></td>
        <td> <p class=\"goalnotes\">GOAL - ".fetchLearnerGoal($row['learnergoal_id']).":</p>".$row['note']."</td>
        <td><a  onClick=\"return confirm('Are you sure you want to delete?');\"  href=\"do_delete_learnerprogress.php?lid=".$lid."&pnid=".$row['id']."\" class=\"btnsml btn\">Delete</a></td>
      </tr>
      <tr ".$odd."\">
      	<td colspan=\"5\" style=\"display: none;\" id=\"note".$i."\">".$row['note']."</td>
	  </tr>";
	  
	$i++;
}

?>



<!doctype html>
<html class="no-js" lang="en"> 
<head>
  <meta charset="utf-8">

  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
       More info: h5bp.com/i/378 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>LLNB System</title>
  <meta name="description" content="">

  <!-- Mobile viewport optimized: h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width, maximum-scale=1.0">

  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
  <LINK REL="SHORTCUT ICON" HREF="favicon.ico">

  <link rel="stylesheet" href="css/style.css">
  <link rel="stylesheet" href="css/llnb-style.css">


  <script src="js/libs/modernizr-2.5.3.min.js"></script>

  <script src="js/libs/modernizr-2.5.3.min.js"></script>
   	<link href="scripts/SqueezeBox.css" rel="stylesheet" type="text/css" />
  	<script src="scripts/mootools.js" type="text/javascript" ></script>
	<script src="scripts/SqueezeBox.js" type="text/javascript"></script>
   
  
  
 <script language="javascript">
  function changeClass(theid)
  {
	 if (document.getElementById(theid).style.display == 'none')
	   document.getElementById(theid).style.display = '';
	 else
	   document.getElementById(theid).style.display = 'none';
	  
  }
  
  
window.addEvent('domready', function()
{
	SqueezeBox.assign($$('a.btnlfr_m'), {
		parse: 'rel'
	});
});

window.addEvent('domready', function()
{
	SqueezeBox.assign($$('a.btnsml_m'), {
		parse: 'rel'
	});
});  
</script>  

  
</head>
<body>
<div id="wrap">
  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
       chromium.org/developers/how-tos/chrome-frame-getting-started -->
  <!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
  <header><a href="index.php" class="btn lfr" style="position:relative; top: 15px; right: 0;">Logout</a>

	<h1>Laubach Literacy - <?=uType();?></h1> 
	<h3><?=fetchCouncilName($_SESSION['council_id']);?></h3>	

	<nav id="menu" class="clearfix navmenu">
	<a href="home.php" class="btn lfl">Home</a>
	<a href="learner_list.php" class="btn lfl">Learner List</a>
	<a href="learner_overview.php?lid=<?=$lid;?>" class="btn lfl">Learner Overview</a></nav>
  </header>
  <div role="main" id="main" class="clearfix">
  	<div id="location">
  	<a href="learner_progressnotes_m.php?frompg=learnerprogressnotes&lid=<?=$lid;?>" class="btnlfr_m" rel="{handler:'iframe',size:{x:550,y:450}}" style="position:relative; top: 0; right: 10px;">Add Progress Note</a>
      <H2><span>Learner:</span> <?= fetchLearnerName($lid); ?></H2>
    
    </div> <!-- end of location -->
    <div>
	<h2>Progress Notes</h2>
    <table  border="0" cellspacing="0" cellpadding="0" class="infotable" id="seesiontable">
      <tr>
        <th scope="col" class="datewidth">Date</th>
        <th scope="col" class="delwidth">Edit</th>
        <th scope="col">Notes</th>
        <th scope="col" class="delwidth">Delete</th>
      </tr>
<?=$TRs;?>

    </table>

    
    </div>
  </div> <!-- end of main -->
<aside>
</aside>
    <div style="clear:both;"></div>
<footer>
  <?php include('footer.php'); ?>
</footer>
</div>


</body>
</html>