<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />

<!--jscript-->
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="javascript" src="../jscript/calendar.js"></script>

<?php
include('../include/session.php');
include ("../include/period_select_date.php");
	
	
$table_name2 = $_SESSION['db_prefix']."_error_log";
$alert_query = "SELECT * FROM $table_name2 WHERE  error_report_date >= '".$start."' AND error_report_date <= '".$end."' ORDER BY error_report_date DESC ";
$alert_result = mySQL_query($alert_query);
$alert_num = mysql_num_rows($alert_result);


?>
</head>

<body>
<?php
include ("../navigation/header.php");
$page_name = "AD-tracking";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>

<div class="main_frame">
<div class="page_head_frame">
        
        <table width="600" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="523">
              <label class="label_page_head">Error log</label>
            </td>
            <td width="287">&nbsp;</td>
          </tr>
        </table>
      </div>
<div class="page_middle_frame">
<?php
$page='error_log_list.php';
$reference_name='';
$reference='';
include('../include/period_select_block.php');
?>
  
<div class="page_inside_frame" >
<!--jscript-->
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "400px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 2, "desc" ]],
					"aoColumns": [
								{"bSortable": true},
								{"bSortable": false},
								{"iDataSort": 9},
                              	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": false},
								{"bSortable": false},
								{"bVisible": false}								
								 ]
								 
				} );
			} );
		</script>
<table width="700" id="scroll_table" class="data_display">
  <thead>
    <tr>
      <th>Error id</th>
      <th>&nbsp;</th>
      <th width="48">Date</th>
      <th width="61">Module</th>
      <th width="180">Error</th>
      <th width="100">Reported by</th>
      <th width="52">Status</th>
      <th width="69">Attend<br />
        date</th>
      <th width="39">&nbsp;</th>
      <th width="24">&nbsp;</th>
    </tr>
  </thead>
  <?php 

$i=0;

while ($i<$alert_num) {
    $b0  =  mysql_result($alert_result, $i, "error_id");
	$b1 =  mysql_result($alert_result, $i, "error_report_date");
	$b2 =  mysql_result($alert_result, $i, "error_title");
	$b3 =  mysql_result($alert_result, $i, "error_reported_by");
	$b4 =  mysql_result($alert_result, $i, "error_solved_date");
	$b5 =  mysql_result($alert_result, $i, "error_importance");
	$b6 =  mysql_result($alert_result, $i, "error_module");
	$b7 =  mysql_result($alert_result, $i, "error_solved");
	?>
  <tr>
    <td width="53" align="left"><a href="error_report.php?error_id=<?php echo $b0 ?>" onmouseover="ddrivetip('Click to view report', 150)"; onmouseout="hideddrivetip()"><?php echo $b0 ?></a></td>
    <td width="30" align="center"><?php if ($b5=='yes') {?>
      <img src="../images/exclamation.png" alt="" width="12" height="12" />
      <?php } ?></td>
    <td align="left"><?php echo date("d-m-Y", strtotime($b1 )) ?></td>
    <td align="left"><?php echo $b6 ?></td>
    <td align="left"><?php echo $b2 ?></td>
    <td align="left"><?php echo $b3 ?></td>
    <td align="center"><?php if ($b7=='yes') { ?>
      <img src="../images/check_mark_green.png" alt="" width="12" height="12" />
      <?php } ?>
      <?php if ($b7=='no') { ?>
      <img src="../images/check_mark_orange.png" alt="" width="12" height="12" />
      <?php } ?></td>
    <td align="left"><?php if ($b7!='') { echo date("d-m-Y, H:i", strtotime($b4)); } ?></td>
    <td align="left"><?php if ($_SESSION['username']=='huubvm') { ?>
      <a href="close_error_report.php?error_id=<?php echo $b0?>">Fix</a>
      <?php } ?></td>
    <td align="left"><a href="error_report.php?error_id=<?php echo $b0 ?>" onmouseover="ddrivetip('Click to view report', 150)"; onmouseout="hideddrivetip()"><?php echo $b1 ?></a></td>
  </tr>
  <?php
  $i++;
}
?>
</table>
<br />
</div>
</div>
</div>

<?php include ('../navigation/side_bar.php'); ?>

<?php } else { 
    $_SESSION['denied_return'] = "admin_module/user_list.php";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>
</body>
</html>