<?
  if($myuser->administrator>8){
    $exquery = " id!='admin'";
	$readonly = "";
	$disabled = "";
  }else{
    $exquery = " id='" . $myuser->id . "'";
	$readonly = "READONLY";
	$disabled = "DISABLED";
  }
  $qtea = "SELECT * FROM xoops_adm_teacher WHERE $exquery";
  $rtea = mysql_query($qtea);
  $ntea = mysql_num_rows($rtea);
  $i=0;
  while($i<$ntea){
  
    $id = mysql_result($rtea,$i,"id");
    $ename = mysql_result($rtea,$i,"ename");
	if( strlen($ename)>20 ){
	  $ename = substr($ename,0,19) . "...";
	}
    $cname = mysql_result($rtea,$i,"cname");
  
    $arrTea[$id] = $cname . " " . $ename;
  
    $i++;
  }
?>
<?
  $qevent = "SELECT * FROM xoops_pc_remarkevent";
  $revent = mysql_query($qevent);
  $nevent = mysql_num_rows($revent);
  $i=0;
  while($i<$nevent){
  
    $id = mysql_result($revent,$i,"id");
	$event = mysql_result($revent,$i,"event");
	$arrEvent[$id] = $event;
  
    $i++;
  }
?>
<style type="text/css">@import url(calendar-win2k-1.css);</style>
<script type="text/javascript" src="calendar.js"></script>
<script type="text/javascript" src="calendar-en.js"></script>
<script type="text/javascript" src="calendar-setup.js"></script>

<center>
<form action="rmkrequp.php" method="post">
<table cellspacing="1" style=" font-family:Arial; font-size:14px " width="500">
<tr>
  <th bgcolor="#999999" style="color:#EEEEEE " colspan="2">REQUEST REMARK</th>
</tr>
<tr bgcolor="#CCCCCC">
<?
  //------ teacher id part -----------------
?>
  <td bgcolor="#999999" style="color:#EEEEEE ">REQUEST BY </td>
  <td>&nbsp;
      <select name="selTea">
<?
  foreach($arrTea as $teaid=>$teaname){
    if($teaid==$_SESSION["userid"]){
	  $selected = "SELECTED";
	}else{
	  $selected = "";
	}
    echo "<option value='$teaid' $selected>$teaname</option>";
  }
?>      
      </select>
  </td>
</tr>
<?
  //------ date part -------------------------
?>
<tr>
  <td bgcolor="#999999" style="color:#EEEEEE ">DATE </td>
  <td bgcolor="#CCCCCC">&nbsp;
	<input type="text" id="txtDatefrom" name="txtDatefrom" size="9" value="<?= $today_date ?>" <?= $readonly ?>>
	<button id="btnDatefrom" name="btnDatefrom" <?= $disabled ?>>...</button>
	<script type='text/javascript'>
      Calendar.setup({
		inputField : "txtDatefrom",  //ID of the input field
		ifFormat   : "%Y-%m-%d",    //the date format
		button     : "btnDatefrom"   //ID of the button
		});
	</script>
    <?
	~			
	<input type="text" id="txtDatetil" name="txtDatetil" size="9" value="<?= $today_date ?>">
	<button id="btnDatetil" name="btnDatetil">...</button>
	<script type='text/javascript'>
	  Calendar.setup({
		inputField : "txtDatetil",  //ID of the input field
		ifFormat   : "%Y-%m-%d",   //the date format
		button     : "btnDatetil"   //ID of the button
	    });
	</script>
  </td>
</tr>
<?
  //------ event part -------------------------
?>
<tr>
  <td bgcolor="#999999" style="color:#EEEEEE ">EVENT</td>
  <td bgcolor="#CCCCCC">&nbsp;
    <select name="selEvent">
<?
  foreach($arrEvent as $id=>$event){
    echo "<option value='$id'>$event</option>";
  }
?>
    </select>
  </td>
</tr>
<?
  //------ desc part -------------------------
?>
<tr>
  <td bgcolor="#999999" style="color:#EEEEEE ">DESCRIPTION</td>
  <td bgcolor="#CCCCCC">&nbsp;
    <textarea name="txtDesc" rows="3" cols="30"></textarea>
  </td>
</tr>
<?
  //------ submit part -------------------------
?>
<tr bgcolor="#999999">
  <td align="center" colspan="2">
    <input type="submit" value="REQUEST">
  </td>
</tr>
</table>
</form>
</center>