Viewing file: showdepttable.php (5.2 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../link/function.php";
include_once "../class/clsTable.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsPerson.php";
include_once "../class/clsEOpbri.php";
include_once "../link/function.php";
include_once "../class/clsdepttype.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EPERSON'], $GLOBALS['DBUSER_EPERSON'], $GLOBALS['DBPASS_EPERSON']);
$cC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDpT = new Department($oC);
$oDp = new Department($oC);
$oDP3 = new Department($oC);
$oDP2 = new Department($oC);
$oPS = new Person($oC);
$_SESSION['college'] = new EOpbri($cC);
$maxdate = $oDP3->MaxDate();
?>
<html>
<head>
<title>โครงสร้างหน่วยงานสารบรรณ</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="#F9FCFF">
<tr>
<td align="left" colspan="4" height="22" valign="top"> <a href="#" onClick="window.close()"><font size="2" face="Microsoft Sans Serif">[ปิดหน้าต่าง]</font></a></td>
</tr>
<tr><td align="right"><a href="printDeptTableHTML.php?deptDate=<? echo $deptDate; ?>" target="_blank"><img src="../picture/print.gif" width="15" height="14" border="0"></a> </td></tr>
</table>
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F9FCFF">
<tr>
<td valign="top"><br>
<label><div align="center">
<font size="2" color="<?=$GLOBALS['COLOR_FONT_4'];?>"><b>โครงสร้างหน่วยงานสารบรรณ <?php if($deptDate==$maxdate && $maxdate !='0000-00-00'){ echo "<br>วันที่ยืนยันการใช้งาน ".abbreDate(splitDateDb2($deptDate ,'/'))." (โครงสร้างปัจจุบัน)"; }else if($deptDate=='0000-00-00'){ echo "<br>(ยังไม่ยืนยันการใช้งานโครงสร้างนี้)"; }else{ echo "<br>วันที่ยืนยันการใช้งาน ".abbreDate(splitDateDb2($deptDate ,'/')); } ?></b></font>
<?php
$oT = new clsTable(array("ส่วนราชการภายใน","ประเภทของ<br>ส่วนราชการภายใน","รายละเอียด", "Host วิทยาลัย"));
$oT->bgColor="#CCCCCC";
$oT->align="center";
$oDpT->searchdeptDate2($deptDate);
$rw=0;
while ($oDpT->GetRecord()){
ShowDeptM($oDpT->deptId,$deptDate);
}
//$oT->rowStart("","#ffffff");
//$oT->addCell("");
//$oT->rowEnd();
echo "<form name=ps method=post>";
echo "<input type=hidden name=method value=''>";
echo "<input type=hidden name=startyear value=''>";
echo $oT->output();
echo "</form>";
//////////////////////////////////////////
function ShowDeptM($deptId,$deptDate){
global $oC, $oT, $Str, $rw;
$oDp = new Department($oC);
$oDpt= new Departmenttype($oC);
$oDp->SearchByKey($deptId);
$oDp->GetRecord();
//$_data = $oDp->SearchByKey($deptId);
//echo "<pre>"; print_r($oDp);
$_get_CollegeDetail = $_SESSION['college']->getCollegeDetail();
//echo "<pre>"; print_r($_get_CollegeDetail);
$_tag_select_college .= "<select id=\"$deptId\" name=\"$deptId\" onchange=\"updateDept(this);\">
<option =\"0\">---เลือก Host สำหรับ Mapping---</option>\n";
foreach($_get_CollegeDetail as $_key => $_val) {
$_selected = ($oDp->host_mapping==$_val['collegeHost']) ? " selected" : "";
$_tag_select_college .= "<option value='{\"deptId\":\"{$deptId}\", \"cID\":\"{$_val['cID']}\", \"collegeID\":\"{$_val['collegeID']}\", \"collegeHost\":\"{$_val['collegeHost']}\" }'$_selected>{$_val['collegeName']} [{$_val['collegeHost']}]</option>\n";
}
$_tag_select_college .= "</select>";
/////////////////////////////////////////////
if ($oDp->deptLevel%2==0){
$bs="<b>";
$be="</b>";
}
$lv = $oDp->deptLevel+1;
$oDpt->SearchByKey($oDp->depttypeId);
$oDpt->GetRecord();
$dt = $oDpt->depttypeName;
$det = $oDp->deptDesc;
$tag_select_college = (preg_match("/สบช|วิทยาลัยพยาบาล|สถาบันพระบรมราชชนก|วพ.|วพบ.|วสส|อภัยภูเบศร|วทก.|คณะพยาบาลศาสตร์|คณะสาธารณสุขศาสตร์|สบช.|วทก|อภัยภูเบศ|วิทยาลัยเทคโนโลยี|สาธารณสุขศาสตร์|วิทยาลัย/", $oDp->deptName)) ? $_tag_select_college : "";
$oT->addRow(array(str_repeat("<img src=../picture/blank.gif><img src=../picture/blank.gif><img src=../picture/blank.gif><img src=../picture/blank.gif><img src=../picture/blank.gif><img src=../picture/blank.gif>", $oDp->deptLevel*2). $bs ." ".$oDp->deptName." ". $be,$dt,$det, $tag_select_college));
$oDp->RSmenuByDeptParentdeptDate($deptId,$deptDate);
while ($oDp->GetRecord()){
ShowDeptM($oDp->deptId,$deptDate);
}
}
?>
</div></td>
</tr>
</table>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$( document ).ready(function() {
//console.log( "ready!" );
//alert('xxxx');
});
function updateDept(item) {
//alert(item.value)
$.post("ajaxservice.php?action=updateHost", {data: item.value}, function(result){
if(result==true) {
alert('Update host succeed!!!');
//var inst = $('[data-remodal-id=modal]').remodal();
//inst.open();
}
});
}
</script>
</body>
</html>
<?php
//showFooter();
?>
|