<?php
  include "include/dbcon.php";
//  include "include/lang.php";
//  include "include/cfunction.php";
  include "include/CSYSTEM.php";
?>
<?php
  global $conn;
  $mysys = new CSYSTEM();
?>
<?php
  //----- teacher -----------------
  $qteat = "SELECT * FROM punchsys_staff WHERE id NOT IN ('admin','pejabat') AND userID<>'1' ORDER BY repPrint, CAST(id as SIGNED)";
  $rteat = mysqli_query($conn,$qteat);
  $nteat = mysqli_num_rows($rteat);
  $i=0;
  while($myrow = mysqli_fetch_array($rteat)){
  
    $tid = $myrow["id"];
    $tename = $myrow["eName"];
    $tcname = $myrow["cName"];
	$tadmin = $myrow["administrator"];
	$tjwt = $myrow["position"];
	$tsec = $myrow["section"];
	
	$arrTeaename[$tid] = $tename;
	$arrTeacname[$tid] = $tcname;
	$arrAdmim[$tid] = $tadmin;
	$arrJwt[$tid] = $tjwt;
    $arrSec[$tid] = $tsec;
	  
	$arrSecid[$tsec] = $tsec;
	
    $i++;
  }
  $strSec = "'".implode("','",$arrSecid)."'";
?>
<?php
$qsec = "SELECT * FROM punchsys_section WHERE id IN ($strSec) ORDER BY id";
$rsec = mysqli_query($conn,$qsec);
while($myrow = mysqli_fetch_array($rsec)){
  
  $tid = $myrow["id"];
  $tname = $myrow["name"];
  $arrSection[$tid] = $tname;
  
}
?>


<html>
<head>
<style>

.myh1{
  font-size:16px;
  font-family:Arial;
}
.myh2{
  font-size:14px;
  font-family:Arial;
  font-weight:100;
}
.td1{
  padding-left: 10px;
}
.ipt1{
font-family:Arial;
font-size:12px;
text-align:center;
}
.lsttable{
font-family:Arial;
border-collapse:collapse;
margin: 5px 5px 5px 5px ;
}
.div_desc{
margin: 10px 10px 10px 10px;
font-family:Arial;
font-style:italic;
font-size:12px;
text-align:left;
width:600px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>

<center>
<table width="800px" border="0">
<tr>
  <th rowspan="2">
    <img src="img/<?= $mysys->imgPath ?>" height="50px" />
  </th>
  <th class="myh1">STAFF LIST OF <?= strtoupper($mysys->schName)  ?></th>
    </tr>
  </th>
</table>

<hr width="800px" />

<table class="lsttable" width="800px"  border="1">
  <tr style="font-size:14px">
    <th></th>
    <th>STAFF NAME</th>
    <th>STAFF ID</th>
    <th>POSITION</th>
	<th>SECTION</th>
  </tr>
<?php
  $i=1;
  foreach($arrTeaename as $tid => $tename){
    //if($arrAdmim[$tid]>7){
//	  $tadmin = " * ";
//	}else{
//	  $tadmin = "";
//	}
?>
  <tr class="myh2">
    <td align="center"><?= $i ?></td>
    <td class="td1"><?= $arrTeaename[$tid] . " " . $arrTeacname[$tid] ?></td>
    <td align="center"><?= $tid ?></td>
    <td class="td1"><?= $arrJwt[$tid] ?></td>
    <td align="center"><?= $arrSection[$arrSec[$tid]] ?></td>
  </tr>
<?php
    $i++;
  }
?>
</table>

	
</body>
</html>