Viewing file: ProjectMont.php (7.05 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if( !session_is_registered("valid_user") && !session_is_registered("Priority") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** 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;
} # else
?>
<!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>
</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("./_incMainMenu.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="30" background="../images/background/bg-head-topic-w780.gif" class="PADDING-LEFT-10 PATRON11"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="370" align="center" valign="top"><table width="448" height="279" border="0">
<tr>
<td width="28" height="28"> </td>
<td width="391"> </td>
<td width="15"> </td>
</tr>
<tr>
<td height="28"> </td>
<td><table width="101%" height="31" border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#004080" class="title">
<td width="13%" height="29" align="center" bgcolor="#CCCCCC" 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="#CCCCCC"><?php echo $_month_name[$cal_month]." ปี พ.ศ ".($cal_year+543);?> </td>
<td width="14%" align="center" bgcolor="#CCCCCC" 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="163"> </td>
<td><table width="101%" height="193" border="1" cellpadding="0" cellspacing="1" class="overview" >
<tr>
<td width="13%" height="20" align="center" class="dayname">จ</td>
<td width="16%" align="center" class="dayname">อ</td>
<td width="15%" align="center" class="dayname">พ</td>
<td width="16%" align="center" class="dayname">พฤ</td>
<td width="12%" align="center" class="dayname">ศ</td>
<td width="14%" align="center" class="dayname">ส</td>
<td width="14%" align="center" class="dayname">อา</td>
</tr>
<?php
$sql = " SELECT Date From project_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['Date']-543);
$ed[$i]=($row['Date']-543);
$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 align="center" bgcolor=#E9FFE9 class="<? echo $class; ?>" id="<? echo $id; ?>"><a href="#" onClick="MM_openBrWindow('ProjectCalendar.php?Date_start=<? 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> </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);
?>
|