<?
  class CTIMETABLE{
  
    var $id,$secid,$wkDay,$pcInTime,$pcOutTime;
  
    function __construct($pid){
      global $conn;
	  $query = "SELECT * FROM punchsys_timetable WHERE secid='$pid' ORDER BY wkDay";
	  $result = mysqli_query($conn, $query);
	  while($myrow = mysqli_fetch_array($result)){
          $this->id = $myrow["id"];
          $this->secid = $myrow["secid"];
          $this->wkDay = $myrow["wkDay"];
          $this->pcInTime = $myrow["pcInTime"];
          $this->pcOutTime = $myrow["pcOutTime"];
      }
	}
  
  }
?>
<?
  function getTimeTableList(){
    global $conn;
    $query = "SELECT * FROM punchsys_timetable";
	$result = mysqli_query($conn,$query);
	$num = mysqli_num_rows($result);
	
	if($num>0){
	while($myrow = mysqli_fetch_array($result)){
        
	  $tsecid = $myrow["secid"];
	  $twkDay = $myrow["wkDay"];
	  $tpcInTime = $myrow["pcInTime"];
	  $tpcOutTime = $myrow["pcOutTime"];
	  
	  $arrOutput[$tsecid][$twkDay]["IN"] = $tpcInTime;
	  $arrOutput[$tsecid][$twkDay]["OUT"] = $tpcOutTime;
        
    }
    }

	return $arrOutput;
  }
?>