|
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/eoffice/application/document/ |
Upload File : |
<?
session_start();
header("Last-Modified: ".gmdate( "D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("content-type: application/x-javascript; charset=TIS-620");
include("../../config/config.inc.php");
include("../../common/function.php");
include("../../common/eoffice.inc.php");
function Query1($sql){
global $dbname,$db_epm,$db_mode,$logon_mode,$table_staff,$table_groupmember,$table_staffgroup,$table_mainmenu,$profile_staffgroup,$profile_groupmember,$type;
// echo $sql;
$result = mysql_query($sql);
echo mysql_error();
$rs = mysql_fetch_array($result);
return $rs[0];
}
// echo "<pre>";
// print_r($_SESSION);
// die;
foreach($session_gid as $vid => $val){
foreach($val as $v1 => $v2){
$id=$v2;
}
}
$type=$_GET[type];
$report_title = "กลุ่มบุคลากร";
$msg = "";
if ($_SERVER[REQUEST_METHOD] == "POST"){
$type=$_POST[type];
if ($groupname == ""){
$msg = "กรุณาระบุชื่อของกลุ่มบุคลากร";
}else{
if ($action == "new" || $action == "addsubgroup"){
if($type=="profile"){
$sql = "insert into $table_staffgroup ( org_id,groupname,comment,owner_id,parent,staffid) values ('$org_id','$groupname','$comment','$owner_id','$parent','$session_staffid');";
}else{ //if($type=="system")
$sql = "insert into $table_staffgroup ( org_id,groupname,comment,owner_id,parent,refid_info) values ('$org_id','$groupname','$comment','$owner_id','$parent','$refid_info');";
}
}else if ($action == "edit"){
$sql = "update $table_staffgroup set groupname='$groupname',comment='$comment',org_id='$org_id',owner_id='$owner_id',refid_info='$refid_info' where gid = '$id'; ";
}else{
header("Location : ?org_id=$org_id&type=$type");
exit;
}
@mysql_query($sql);
if (mysql_errno() != 0){
$msg = "ไม่สามารถบันทึกลงฐานข้อมูลได้<BR>$sql<BR><BR>" . mysql_error() ;
}else{
// SUCCESS
if ($action == "new" || $action == "addsubgroup"){
$id = mysql_insert_id();
}
//จัดการ บุคลากรในกลุ่ม
mysql_query("delete from $table_groupmember where gid='$id';"); //ลบ
if ($_POST[member]){
foreach ($_POST[member] as $n => $staffid ){
mysql_query("insert into $table_groupmember (gid,staffid) values('$id','$staffid');"); //เพิ่มอันที่เลือก
}
}
//จัดการ สถานะกลุ่ม
mysql_query("delete from profile_permission where gid='$id';"); //ลบ
if ($_POST[permit]){
foreach ($_POST[permit] as $n => $pid ){
if(($n=="radio")&&($pid)) {$n="$pid";}
mysql_query("insert into profile_permission (gid,pid) values('$id','$n');"); //เพิ่มอันที่เลือก
}
}
echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว'); if (parent.leftFrame) {parent.leftFrame.location=parent.leftFrame.location;} location.href='?org_id=$org_id&type=$type';</script>";
// header("Location: ?org_id=$org_id");
exit;
}
// }
}
$action = "";
}else if ($action == "delete" && $id > ""){
if (Query1("select count(*) from $table_staffgroup where parent='$id';") > 0){
echo "<script>alert('ไม่สามารถลบข้อมูลได้ เพราะยังมีกลุ่มย่อยภายใต้กลุ่มนี้อยู่'); location.href='?org_id=$org_id&type=$type';</script>";
exit;
}
if (Query1("select count(*) from $table_groupmember where gid='$id';") > 0){
echo "<script>alert('ไม่สามารถลบข้อมูลได้ เพราะยังมี ผู้ใช้ที่สังกัดกลุ่มนี้อยู่'); location.href='?org_id=$org_id&type=$type';</script>";
exit;
}
$gname = Query1("select groupname from $table_staffgroup where gid='$id' order by trim($table_staffgroup.groupname) ASC ; ");
if ($gname != "Guest" && $gname != "Administrator") { //ห้ามลบ Gues และ Administrator
@mysql_query("delete from $table_staffgroup where gid='$id';");
if (mysql_errno() > 0){
$msg = "ไม่สามารถลบข้อมูลได้";
}else{
echo "<script>alert('ลบข้อมูลเรียบร้อยแล้ว'); if (parent.leftFrame) {parent.leftFrame.location=parent.leftFrame.location;} location.href='?org_id=$org_id&type=$type';</script>";
}
}
$action = "";
}
?>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=windows-874" />
<LINK href="../../common/style.css" rel="stylesheet" />
<TITLE>แก้ไขรายละเอียดต่าง ๆ</TITLE>
<STYLE>
.p_border{
border-bottom:2 solid #DADCED;
}
.shadetabs{
padding : 3px 0px ;
margin-left : 0;
margin-top : 1px;
margin-bottom : 0;
font : bold 12px tahoma;
list-style-type : none;
text-align : left; /*set to left, center, or right to align the menu as desired*/
}
.shadetabs li{
display : inline;
margin : 0;
background-color:#F2F4F7;
}
.shadetabs li a{
text-decoration : none;
padding : 3px 7px;
margin-right : 0px;
border : 1px solid #cccccc;
color : #666666;
text-decoration :underline;
}
.shadetabs li a:visited{
color : #666666;
}
.shadetabs li a:hover{
color : #666666;
}
.shadetabs li.selected{
position : relative;
top : 1px;
}
.shadetabs li.selected a{ /*selected main tab style */
background-color : #DADCED;
border-bottom-color : #DADCED;
}
.shadetabs li.selected a:hover{ /*selected main tab style */
text-decoration : none;
}
.contentstyle{
border : 1px solid #cccccc;
width : 700px;
margin-bottom : 1em;
padding : 10px;
background-color : #DADCED;
}
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
}
</STYLE>
<SCRIPT language="javascript" src="ajaxtabs.js"></SCRIPT>
</HEAD>
<BODY>
<FORM action="" method="POST" NAME="form1" >
<INPUT TYPE="hidden" NAME="id" VALUE="<?=$id?>" >
<INPUT TYPE="hidden" NAME="parent" VALUE="<?=$parent?>" >
<INPUT TYPE="hidden" NAME="org_id" VALUE="<?=$org_id?>" >
<INPUT TYPE="hidden" NAME="action" VALUE="<?=$action?>" >
<INPUT TYPE="hidden" NAME="type" VALUE="<?=$type?>" >
<TABLE border=0 align=center cellspacing=1 cellpadding=3 bgcolor="#808080" width="98%">
<TR bgcolor="#A3B2CC">
<TD colspan=2> <FONT COLOR="WHITE" style="font-size:14pt;"><B> ข้อมูลเลขหน่วยงาน </B></FONT></TD>
</TR>
<TR bgcolor=white valign=top>
<TD class="link_back">รูปแบบการ<BR>
ออกเลขทะเบียนหนังสือส่ง</TD>
<TD><?
$select_tag="";
$sql="
SELECT
ref_digit.id,
ref_digit.digit,
ref_digit.value,
ref_digit.`type`,
ref_digit.gid,
ref_type.`type` as name,
ref_type.`key` as varkey
FROM
ref_digit
Inner Join ref_type ON ref_type.id = ref_digit.`type`
where gid=$id
order by ref_digit.digit
";
$rst=mysql_query($sql);$i=0;
$row_rst=mysql_num_rows($rst);
$wording="";
if($row_rst){ echo "รูปแบบการออกเลขทะเบียนหนังสือในปัจจุบันของท่าน<br>";
while($var=mysql_fetch_assoc($rst)){$i++;
if( ($var[value])&&($var[varkey]!="autonumber") ){
$wording.=$var[value];
}elseif($var[varkey]=="autonumber"){
if($var[value]){
for($i=0;$i<$var[value];$i++){
$wording.="x";
}
}
}else{
$wording.=$var[varkey];
}
echo "หลักที่ $i ประเภท $var[name] ";
if($var[type]=='1'){echo " ประกอบด้วย [“<u>$var[value]</u>”] ";}
echo "<br>";
}
echo "<br>";
echo " ตัวอย่าง รูปแบบในปัจจุบันของท่าน <br>";
echo "<b>$wording</b>";
echo "<br>";
echo "<br>หากต้องการเปลี่ยนแปลงรูปแบบ เลือกเพิ่มจำนวนหลักเพื่อเปลี่ยนแปลงรูปแบบใหม่";
}
?>
<ul id="files-root"></ul>
<SPAN style="cursor:pointer;" onClick="addFile()"><IMG src="../../images/profile_plus.gif" width="9" height="9" />เพิ่มจำนวนหลักในกระบวนการออกเลขหนังสือรับ </SPAN>
</TD>
</TR>
<!--####################################################################-->
<TR bgcolor=white valign=top>
<TD class="link_back">รูปแบบการ<BR>
ออกเลขทะเบียนหนังสือเวียน</TD>
<TD>
<?
$select_tag="";
$sql="
SELECT
ref_digit_circular.id,
ref_digit_circular.digit,
ref_digit_circular.value,
ref_digit_circular.`type`,
ref_digit_circular.gid,
ref_type.`type` as name,
ref_type.`key` as varkey
FROM
ref_digit_circular
Inner Join ref_type ON ref_type.id = ref_digit_circular.`type`
where gid=$id
order by ref_digit_circular.digit
";
$rst=mysql_query($sql);$i=0;
$row_rst=mysql_num_rows($rst);
$wording="";
if($row_rst){ echo "รูปแบบการออกเลขทะเบียนหนังสือในปัจจุบันของท่าน<br>";
while($var=mysql_fetch_assoc($rst)){$i++;
if( ($var[value])&&($var[varkey]!="autonumber") ){
$wording.=$var[value];
}elseif($var[varkey]=="autonumber"){
if($var[value]){
for($i=0;$i<$var[value];$i++){
$wording.="x";
}
}
}else{
$wording.=$var[varkey];
}
echo "หลักที่ $i ประเภท $var[name] ";
if($var[type]=='1'){echo " ประกอบด้วย [“<u>$var[value]</u>”] ";}
echo "<br>";
}
echo "<br>";
echo " ตัวอย่าง รูปแบบในปัจจุบันของท่าน <br>";
echo "<b>$wording</b>";
echo "<br>";
echo "<br>หากต้องการเปลี่ยนแปลงรูปแบบ เลือกเพิ่มจำนวนหลักเพื่อเปลี่ยนแปลงรูปแบบใหม่";
}
$select_tag="";
$sql="select * from ref_type";
$rs=mysql_query($sql);
while($list=mysql_fetch_assoc($rs)){
if($list[id]=="2"){ $inner_code=" จำนวนหลัก : <input name=digit_char_cir['+(gFiles2)+'] type=text size=4 maxlength=2 >"; }else{ $inner_code="";}
$select_tag.=" <INPUT name=type_cir['+(gFiles2)+'] type=radio value=$list[id]> $list[type] $inner_code <br>";
}
?>
<ul id="files-root2"></ul>
<SPAN style="cursor:pointer;" onClick="addFile2()"><IMG src="../../images/profile_plus.gif" width="9" height="9" />เพิ่มจำนวนหลักในกระบวนการออกเลขหนังสือเวียน </SPAN>
</TD>
</TR>
<TR bgcolor="#888899" valign=top>
<TD colspan=2 align=right>
<INPUT TYPE="submit" VALUE=" บันทึก " CLASS=xbutton>
<INPUT TYPE="reset" VALUE=" ยกเลิก " class=xbutton ONCLICK="location.href='?org_id=<?=$org_id?>';"> </TD>
</TR>
</TABLE>
<BR>
<BR>
</FORM>
</BODY>
</HTML>