<?php 
	include('/var/www/html/uclit/protected/common/login/check.php');
	include('/var/www/html/uclit/protected/common/css_login/css_head2.php');
	include('/var/www/html/uclit/protected/connections/db_comments.php');

	$today = "";
	$today = date("Y-m-d");

	//Select a database
	$db = mysql_select_db('comments', $commentsConn) or die("Couldn't select database. $db_comments");

	$comment_loc = $_POST['comment_loc'];
		
	//SQL Select statement
	$query1= "SELECT CardID, CommentDate, Location, Features, Response, Action, Rating FROM CommentCards WHERE (((Location='$comment_loc') and (Features is not null)) and (Action !='Resolved' or Action is null)) ORDER BY CommentDate Desc";
	$query2= "SELECT CardID, CommentDate, Location, Improvements, Response, Action, Rating FROM CommentCards WHERE ((Location='$comment_loc') and (Improvements is not null) and (Action!='Resolved' or Action is null)) ORDER BY CommentDate Desc";
	$query3= "SELECT CardID, CommentDate, Location, Comments, Response, Action, Rating FROM CommentCards WHERE ((Location='$comment_loc') and (Comments is not null) and (Action!='Resolved' or Action is null)) ORDER BY CommentDate Desc";

	$result1 = mysql_query($query1, $commentsConn) or die("Couldn't execute query.<p>$query</p>");
	$result2 = mysql_query($query2, $commentsConn) or die("Couldn't execute query.<p>$query</p>");
	$result3 = mysql_query($query3, $commentsConn) or die("Couldn't execute query.<p>$query</p>");

	while ($row = mysql_fetch_array($result1)) 
	{
		$CardID=$row['CardID'];
		$cdate = $row['CommentDate'];
		$cloc = $row['Location'];
		$cfeature = $row['Features'];
		$cresponse = $row['Response'];
		$caction = $row['Action'];
		$crating = $row['Rating'];
		
		$display_block1 .="<tr>
			   <td align='center'><a href='http://ul.uc.edu/uclit/protected/depthead/edit_comment.php?idnum=$CardID'><img src='/uclit/images/edit.gif'border='0'></a></td>
			   <td>$cdate</td>
			   <td>$cfeature</td>
			   <td>$cresponse</td>
			   <td>$caction</td>
			   <td>$crating</td>
			 </tr>";
	}
	
	while ($row = mysql_fetch_array($result2)) 
	{
		$CardID=$row['CardID'];
		$cdate = $row['CommentDate'];
		$cloc = $row['Location'];
		$cimprove = $row['Improvements'];
		$cresponse = $row['Response'];
		$caction = $row['Action'];
		$crating = $row['Rating'];
		
		$display_block2 .="

			<tr>
					<td align='center'><a href='http://ul.uc.edu/uclit/protected/depthead/edit_comment.php?idnum=$CardID'><img src='/uclit/images/edit.gif'border='0'></a></td>
			            <td>$cdate</td>
			            <td>$cimprove</td>
			            <td>$cresponse</td>
			            <td>$caction</td>
				    <td>$crating</td>
						</tr>";
	}

	while ($row = mysql_fetch_array($result3)) 
	{
		$CardID=$row['CardID'];
		$cdate = $row['CommentDate'];
		$cloc = $row['Location'];
		$ccomment = $row['Comments'];
		$cresponse = $row['Response'];
		$caction = $row['Action'];
		$crating = $row['Rating'];
			
		$display_block3 .="


			<tr>
					<td align='center'><a href='http://ul.uc.edu/uclit/protected/depthead/edit_comment.php?idnum=$CardID'><img src='/uclit/images/edit.gif'border='0'></a></td>
			            <td>$cdate</td>
			            <td>$ccomment</td>
			            <td>$cresponse</td>
			            <td>$caction</td>
				    <td>$crating</td>
						</tr>";
	}


echo"
<H1 align='center'>Comments by Service Point</H1>
<br>
<center>
<H2 align='left'>$comment_loc Features</H2>
<br>
<table width=95% border=1>
<tr>
          <td align=center><b>Edit</b></td>
		  <td align=center><b>Date</b></td>
		  <td align=center><b>Description</b></td>
		  <td align=center><b>Response</b></td>
		  <td align=center><b>Action</b></td>
		  <td align=center><b>Rating</b></td>
		
</tr>
$display_block1
</table> 
<br>
<H2 align='left'>$comment_loc Improvements</H2>
<br>
<table width=95% border=1>
<tr>
          <td align=center><b>Edit</b></td>
		  <td align=center><b>Date</b></td>
		  <td align=center><b>Description</b></td>
		  <td align=center><b>Response</b></td>
		  <td align=center><b>Action</b></td>
		  <td align=center><b>Rating</b></td>
</tr>
$display_block2
</table> 
<br>
<H2 align='left'>$comment_loc Comments</H2>
<br>
<table width=95% border=1>
<tr>
          <td align=center><b>Edit</b></td>
		  <td align=center><b>Date</b></td>
		  <td align=center><b>Description</b></td>
		  <td align=center><b>Response</b></td>
		  <td align=center><b>Action</b></td>
		  <td align=center><b>Rating</b></td>
		
</tr>
$display_block3
</table>";
?>
<script type="text/javascript">
<!-- Begin
if (window.print) 
{
	document.write('<form action="0">'
	+ '<input type=button name=print value="Print This Page" '
	+ 'onClick="javascript:window.print()"></form>');
}
// End -->
</script>
<?php
 	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>