|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/pathumthani_eoffice/application/event_calendar/public/ |
Upload File : |
<?
header ("Content-Type: text/html; charset=tis-620");
include("../chk_permission.php");
include("../../../config/config.inc.php");
include("../libary/function.php");
echo'<link href="style_detail.css" rel="stylesheet" type="text/css">';
$arr_month = array('','มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม');
function show_xdat($intD){
switch ($intD) {
case 0:
$shday= "วันอาทิตย์ ";
return $shday;
break;
case 1:
$shday= "วันจันทร์ ";
return $shday;
break;
case 2:
$shday= "วันอังคาร ";
return $shday;
break;
case 3:
$shday= "วันพุธ ";
return $shday;
break;
case 4:
$shday= "วันพฤหัสบดี ";
return $shday;
break;
case 5:
$shday= "วันศุกร์ ";
return $shday;
break;
case 6:
$shday= "วันเสาร์ ";
return $shday;
break;
}
}
?>
<script language="javascript1.1">
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
function showall2(parameter){
url='public/detail.php?'+parameter
//MM_openBrWindow(url , '','status=yes,scrollbars=no,width=640,height=525')
}
</script>
<?
$dayname=array(
"monday"=>1,
"tuesday"=>2,
"wednesday"=>3,
"thursday"=>4,
"friday"=>5,
"saturday"=>6,
"sunday"=>7
);
if(isset($_GET['action'])){$limit= $_GET['action']; } else{$limit= "" ;}
if(isset($_GET['edate'])){$edate= $_GET['edate']; } else{$edate= "" ;}
if(isset($_GET['view'])){$view= $_GET['view']; } else{$view= "D" ;}
$parameter="action=all&view=".$view."&edate=".$edate;
$arr_d=explode("/",$edate);
if(count($arr_d)>0){
$show_yeng = trim($arr_d[2]);
$show_yth = $arr_d[2]+543;
$show_m = trim($arr_d[1]);
$show_d = trim($arr_d[0]);
if($view=="D"){
$daystart=$show_d;
$dayend =$show_d;
}elseif($view=="W"){
$xdate=mktime(0,0,0,$show_m,$show_d,$show_yeng);
$x= $dayname[ strtolower( date("l",$xdate)) ] ;
$xdiv=($x-1) ;
$daystart= date("d",$xdate-(( 60 * 60 * 24 )*$xdiv));
// $daystart=1;
$dayend=7 ;
}elseif($view=="M"){
$daystart=1;
$dayend=cal_days_in_month(CAL_GREGORIAN, $show_m, $show_yeng) ;
}
for ($icount=intval($daystart);$icount<=$dayend;$icount++){
$xdate1=mktime(0,0,0,$show_m,$show_d,$show_yeng);
date("d",$xdate1);
$defday ="";
$defmonth ="";
$defyear ="";
$show_date =add_zero($icount)." เดือน " .$arr_month[ intval($show_m)]." พ.ศ. $show_yth ";
$conedate =$show_yeng."-".$show_m."-".add_zero($icount);
$sqlhead="SELECT distinct epm_staff.staffid ,epm_staff.prename, epm_staff.staffname, epm_staff.staffsurname ,epm_staff.title ,emp_staff_priority.indexid
FROM epm_staff INNER JOIN function_mgr ON (epm_staff.staffid = function_mgr.staffid)
INNER JOIN emp_staff_priority ON (epm_staff.staffid = emp_staff_priority.staffid)
WHERE (function_mgr.edate ='$conedate')ORDER BY emp_staff_priority.indexid ASC ";
//echo $sqlhead;
$result_h = mysql_query($sqlhead)or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
if(mysql_num_rows($result_h)>0){
echo"<div class='contaner'><br>";
echo"<div class='texttead'>ปฏิทิน นัดหมายผู้บริหารวันที่ $show_date </div>";
while($rs_h = mysql_fetch_assoc($result_h)){
echo"<ul>$rs_h[title] ";
if ($limit=='limit'||$limit=='limit2'){
$xvallimit= 4-intval($rs_h[indexid]);
if($xvallimit<1){$xvallimit=1;}
$limitdetail="LIMIT 0,".$xvallimit;
}
$sqldetail=" SELECT function_mgr.stime, function_mgr.etime , function_mgr.event_name
FROM epm_staff INNER JOIN function_mgr ON (epm_staff.staffid = function_mgr.staffid)
WHERE (function_mgr.edate ='$conedate') and (epm_staff.staffid='$rs_h[staffid]')
ORDER BY function_mgr.etime ASC ".$limitdetail;
$result_detail = mysql_query($sqldetail)or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
while($rs_detail = mysql_fetch_assoc($result_detail)){
echo"<li> $rs_detail[stime] - $rs_detail[etime] งาน $rs_detail[event_name] </li>";
}
mysql_free_result($result_detail);
echo"</ul>";
}
mysql_free_result($result_h );
}
}
if ($limit=='limit'){
echo"<br><br><div class=\"showall\"><a href=\"#\" onclick=\"showall('$parameter')\">ดูทั้งหมด</a><div>";
}elseif ($limit=='limit2'){
echo"<br><br><div class=\"showall\"><a href=\"detail.php?$parameter' \">ดูทั้งหมด</a><div>";
}
echo"</div>";
}
else {echo"error";}
?>
<title>ปฏิทิน นัดหมายผู้บริหาร</title>