Viewing file: CalendaMont.php (7.54 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Configuration */
require_once( "./configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "./include/Function.php" );
require_once( "./calendar/check.php" );
require_once( "./calendar/cal_func.php" );
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "personal_tb";
$Username = $valid_user;
/*
$query = " SELECT * FROM $myTable WHERE Username='$Username' ";
$result = $dbObj->execQuery($query);
$rs = $dbObj->fetchObject($result);
$Teacher_code = $rs->Teacher_code;
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="./css/calendar.css" rel="stylesheet" type="text/css" />
<link href="./css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="./js/utilities.js"></script>
<title>ยินดีต้อนรับ - การขอใช้รถยนต์</title>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<?php
include( "templates/incHeader.php" );
?>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="203" align="left" valign="top" style="padding:10px 0px 0px 5px"><?php include( "templates/incMainMenuLeft.php" );?></td>
<td width="800" align="center" valign="top" style="padding:10px 0px 5px 10px"><fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="31" background="./images/background/bg-head-topic-w780.gif" class="PADDING-LEFT-10 PATRON11"><strong><a href="index.php">หน้าหลัก </a>»<strong><a href="DuraBleYear.php"> รายละเอียดการแจ้งซ่อมครุภัณฑ์รายปี</a></strong> »<span class="NOTE"> ปฏิทินการแจ้งซ่อมสิงของ/ครุภัณฑ์</span></strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><span class="PADDING-TOP-10"><img src="./images/icons/arrow-circle-225-left.png" width="16" height="16" border="0" align="absmiddle" /> <a href="javascript:;" onclick="window.history.back();"><strong>‹ ย้อนกลับ</strong></a></span></td>
</tr>
<tr>
<td height="341" align="center" valign="top"><table width="448" height="274" border="0">
<tr>
<td width="16" height="18"> </td>
<td width="403"> </td>
<td width="15"> </td>
</tr>
<tr>
<td height="28"> </td>
<td><table width="97%" height="31" border="0" align="center" cellpadding="1" cellspacing="1">
<tr bgcolor="#004080" class="title">
<td width="13%" height="29" align="center" bgcolor="#99CC00" class="title" ><a href="<?php echo "$PHP_SELF?Y=$cal_prev_year&m=$cal_prev_month&d=$cal_day" ?>"><<</a></td>
<td width="73%" align="center" bgcolor="#99CC00"><?php echo $_month_name[$cal_month]." ปี พ.ศ ".($cal_year+543);?> </td>
<td width="14%" align="center" bgcolor="#99CC00" class="title"><a href="<?php echo "$PHP_SELF?Y=".$cal_next_year."&m=".$cal_next_month."&d=".$cal_day;?>">>></a></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="195"> </td>
<td><table width="97%" height="198" border="0" align="center" cellpadding="1" cellspacing="1" class="overview" >
<tr>
<td height="25" align="center" bgcolor="#CC66FF" class="dayname">จันทร์</td>
<td width="16%" align="center" bgcolor="#CC66FF" class="dayname">อังคาร</td>
<td width="14%" align="center" bgcolor="#CC66FF" class="dayname">พุธ</td>
<td width="15%" align="center" bgcolor="#CC66FF" class="dayname">พฤหัสบดี</td>
<td width="14%" align="center" bgcolor="#CC66FF" class="dayname">ศุกร์</td>
<td width="12%" align="center" bgcolor="#CC66FF" class="dayname">เสาร์</td>
<td width="16%" align="center" bgcolor="#CC66FF" class="dayname">อาทิตย์</td>
</tr>
<?php
$sql = " SELECT add_updated from durable_tb ";
$rsCal = mysql_query($sql) or die(" Error").mysql_error();
$row = mysql_fetch_array($rsCal);
//เอาวันเริ่มและสิ้นสุดมาเก็บใน array เพื่อใช้ในการเปรียบเทียบ
$st=array();$ed=array();
$i=0;
do{
$st[$i]=$row['add_updated'];
$ed[$i]=$row['add_updated'];
$i++;}
while ($row = mysql_fetch_array($rsCal));
for($i=0;$i<count($st);$i++)
{
$ed[$i]=substr($ed[$i],0,4).substr($ed[$i],5,2).substr($ed[$i],8,2);
$st[$i]=substr($st[$i],0,4).substr($st[$i],5,2).substr($st[$i],8,2);
}
if ( ( $cal_year == $cur_year ) && ( $cal_month == $cur_month ) )
{
$today_day = $cur_day;
} else $today_day = 0;
//จำนวนวันในเดือนที่แล้ว จำนวนวันในเดือนนี้ หาค่าวันที่ 1 ของเดือนแบบสัปดาห์
$days_last_month = num_days( $cal_prev_year, $cal_prev_month );
$days_this_month = num_days( $cal_year, $cal_month );
$first_day_pos = date( "w", mktime( 0,0,0,$cal_month,1,$cal_year) );
//เปลี่ยนค่าที่ได้ถ้าเป็นวันอาทิตย์ให้เท่ากับ 7 แทน Mo=1 to Su=7
if ( $first_day_pos == 0 ) $first_day_pos = 7;
$day_num= $days_last_month - ($first_day_pos-2);
$class="last_month";
$p=array();
for ( $y=1; $y<=6; $y++ )
{
echo "<tr>";
for ( $x=1; $x<=7; $x++ )
{
if ( ($y==1) && ($x==$first_day_pos) )
{
$day_num = 1; $class="";
}
if ( ($y >1) && ($day_num>$days_this_month) )
{
$day_num = 1; $class="next_month";
}
if ( ($class=="") && ($day_num == $today_day) )
{
$id="today";
} else $id="";
if ( $class == "" ){
if($cal_month<=9)
$mm="0".$cal_month;
else $mm=$cal_month;
if($day_num<=9)
$dd="0".$day_num;
else $dd=$day_num;
$times=$cal_year."-".$mm."-".$dd;
}
$cur_day=$cal_year.$mm.$dd;
for($i=0;$i<count($st);$i++){
if(($cur_day>=$st[$i])&&($cur_day<=$ed[$i])){
$p[$day_num]=1;
}
}
if($p[$day_num]==1&&$class==""){
?>
<td width="13%" align="center" bgcolor=#FFCC66 class="<? echo $class; ?>" id="<? echo $id; ?>"><a href="#" onClick="MM_openBrWindow('Duracalendar.php?now_stamp=<? echo $times; ?>','','scrollbars=yes,width=550,height=550')"><? echo $day_num; ?></a></td><?
}else{ echo "<td class='".$class."' id='".$id."' bgcolor=#E9E9E9><div align='center'>".$day_num."</div></td>";
}
$day_num++;
}
echo "</tr>";
}
?>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="18"> </td>
<td>
</td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="top"> </td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
<?php include("./templates/incFooter.php"); ?>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|