<?
include('auth.php');
include('common.php');
$USERTYPE=4; //coord

$coordid= $_GET['coordid'];		

$SQL="SELECT * , HOUR(duration) AS thehours, MINUTE(duration) AS theminutes
FROM `volunteersession`
WHERE alive=1 AND user_id =".$coordid." AND user_type = ".$USERTYPE."
ORDER by thedate DESC, timestamp DESC";
$results = llnb_query($SQL);

$i=0;
while($row = llnb_fetch_assoc($results))
{
	
	if ($i % 2)
		$odd= "class=\"odd\"";
	else
		$odd ="";
	
		
	if ( $row['notes'] != "")	
		$x= "<a  href=\"javascript:changeClass('note".$i."')\" class=\"btnsml btn\">View Note</a>";
	else
		$x="";
	
	
	$TRs .="
	<tr ".$odd."\">
        <td>".dispDate($row['thedate'])."</td>
        <td><a rel=\"{handler:'iframe',size:{x:550,y:400}}\"  href=\"volunteer_add_time_m.php?utype=".$USERTYPE."&coordid=".$coordid."&mode=edit&frompg=coordinator_timelist&vsid=".$row['id']."\" class=\"btnsml_m\">Edit</a></td>
        <td>".$row['thehours']." hr ".$row['theminutes']." min</td>
        <td> ".$x."</td>
        <td><a onClick=\"return confirm('Are you sure you want to delete?');\" href=\"do_delete_volsession.php?frompg=coordinator_timelist&coordid=".$coordid."&vsid=".$row['id']."\" class=\"btnsml btn\">Delete</a></td>
      </tr>
        <tr ".$odd."\">
	       	<td colspan=\"5\" style=\"display: none;\" id=\"note".$i."\">".nl2br($row['notes'])."</td>
	  </tr>
		";
	  
	$i++;
}

?>

<!doctype html>
<html class="no-js" lang="en"> <!--<![endif]-->
<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">

  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->

  <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>

    <?
		//coords can ONLY see their council
		if ($_SESSION['ulevel'] == $_COORD || $_SESSION['ulevel'] == $_EXECDIR)
		{	$force_council = "?cid=".$_GET['cid'];
			
			if ($_SESSION['ulevel'] == $_EXECDIR)
				$subpage="";
			else
				$subpage="council_";
	
		}
	     echo "<a href=\"".$subpage."coordinator_list.php".$force_council."\" class=\"btn lfl\">Coordinator List</a>";
	    
	    
    ?>

	
	<a href="coordinator_overview.php?coordid=<?=$coordid;?>" class="btn lfl">Coordinator Overview</a></nav>
  </header>
  <div role="main" id="main" class="clearfix">
  	<div id="location">
  	
  	<a href="volunteer_add_time_m.php?frompg=coordinator_timelist&mode=new&utype=<?=$USERTYPE;?>&coordid=<?=$coordid;?>" class="btnlfr_m" rel="{handler:'iframe',size:{x:550,y:400}}"  style="position:relative; top: 0; right: 10px;">Add Time</a>
      <H2><span>Coordinator:</span> <?= fetchCoordName($coordid); ?></H2>
    
    </div> <!-- end of location -->
    <div>
	<h2>Time Information</h2>
    <p>List of volunteer times.
    <table  border="0" cellspacing="0" cellpadding="0" class="infotable">
      <tr>
      
                <th scope="col">Date</th>
	           <th scope="col">Edit</th>
	           <th scope="col">Amount</th>
	           <th scope="col">Notes</th>
        <th scope="col">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>