<?
  $id = $_GET["hid"];
?>
<?
  $qevent = "SELECT * FROM xoops_pc_remarkevent";
  $revent = mysql_query($qevent);
  $nevent = mysql_num_rows($revent);
  $i=0;
  while($i<$nevent){
    $teventid = mysql_result($revent,$i,"id");
    $tevent = mysql_result($revent,$i,"event");
	$arrEvent[$teventid]=$tevent;
    $i++;
  }
?>
<?
  $query = "SELECT * FROM xoops_pc_remarkrecord WHERE id='$id'";
  $result = mysql_query($query);
?>
<?
  $id = mysql_result($result,0,"id");
  $staffId = mysql_result($result,0,"staffId");
  $remarkDate = mysql_result($result,0,"remarkDate");
  $remarkDatetil = mysql_result($result,0,"remarkDatetil");
  $eventId = mysql_result($result,0,"eventId");
  $notice = mysql_result($result,0,"notice");
  $status = mysql_result($result,0,"status");
  $apvby = mysql_result($result,0,"apvby");
  $apvdate = mysql_result($result,0,"apvdate");
?>
<?
  $mytea = new CTEACHER($staffId);
  $teaCName = $mytea->cName;
  $teaEName = $mytea->eName;
  $teaName = $teaCName . " " . $teaEName;
  
  $arrStatus = array("PENDING","APPROVED","REJECT");

  if( strlen($notice) > 30){
    $noticeS = substr($notice,0,27) . "...";
  }else{
    $noticeS = $notice;
  }
?>
  <center>
  <form action="rmkapvup.php" method="post">
  <input type="hidden" name="hid" value="<?= $id ?>">
  <table style="font-family:Arial; font-size:15px " width="500" border="0">
    <tr>
	  <th bgcolor="#999999" style="color:#EEEEEE " colspan="2">APPROVE / REJECT REQUEST</th>
	</tr>
    <tr>
	  <th bgcolor="#999999" style="color:#EEEEEE ">APPLIER</th>
	  <td bgcolor="#EEEEEE">&nbsp;<?= $teaName ?></td>
	</tr>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE ">REQUEST DATE</th>
	  <td bgcolor="#DDDDDD">&nbsp;<?= $remarkDate . " ~ " . $remarkDatetil ?></td>
	</tr>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE ">EVENT</th>
	  <td bgcolor="#EEEEEE">&nbsp;<?= $arrEvent[$eventId] ?></td>
	</tr>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE ">NOTICE</th>
	  <td bgcolor="#DDDDDD">&nbsp;<abbr title="<?= $notice ?>"><?= $noticeS ?></abbr></td>
	</tr>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE ">STATUS</th>
	  <td bgcolor="#EEEEEE">&nbsp;<?= $arrStatus[$status] ?></td>
	</tr>
<?
  if($status=="2"){
    $strapp = "REJECTED";
  }else{
    $strapp = "APPROVED";
  }
  if($apvby!=""){
    $myapv = new CTEACHER($apvby);
    $apvby="(" . $myapv->id . ") " . $myapv->eName;
	$apvdate=$apvdate;
  }else{
    $apvby="-";
    $apvdate="-";
  }
?>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE "><?= $strapp ?> BY</th>
	  <td bgcolor="#DDDDDD">&nbsp;<?= $apvby ?></td>
	</tr>
	<tr>
	  <th bgcolor="#999999" style="color:#EEEEEE "><?= $strapp ?> ON</th>
	  <td bgcolor="#EEEEEE">&nbsp;<?= $apvdate ?></td>
	</tr>
	</tr>
    <tr>
	  <th bgcolor="#999999" style="color:#EEEEEE " colspan="2">
	  <input type="submit" name="submit" value="APPROVE">
	  <input type="submit" name="submit" value="REJECT">
	  </th>
	</tr>
  </table>
  </form>
  </center>