📄 dept_edit.php
字号:
<?php
function my_dept_tree_no_self( $DEPT_ID, $DEPT_CHOOSE, $POST_OP, $NO_DEPT_ID )
{
global $DEEP_COUNT;
if ( $DEEP_COUNT == "" )
{
$DEEP_COUNT = "|";
}
$connection = openconnection( );
$query = "SELECT * from DEPARTMENT where DEPT_PARENT={$DEPT_ID} order by DEPT_NO";
$cursor = exequery( $connection, $query );
$OPTION_TEXT = "";
$DEEP_COUNT1 = $DEEP_COUNT;
$DEEP_COUNT .= " |";
while ( $ROW = mysql_fetch_array( $cursor ) )
{
++$COUNT;
$DEPT_ID = $ROW['DEPT_ID'];
$DEPT_NAME = $ROW['DEPT_NAME'];
$DEPT_PARENT = $ROW['DEPT_PARENT'];
if ( $DEPT_ID == $NO_DEPT_ID )
{
}
else
{
$DEPT_NAME = str_replace( "<", "<", $DEPT_NAME );
$DEPT_NAME = str_replace( ">", ">", $DEPT_NAME );
$DEPT_NAME = stripslashes( $DEPT_NAME );
if ( $POST_OP == 1 )
{
$DEPT_PRIV = is_dept_priv( $DEPT_ID );
}
else
{
$DEPT_PRIV = 1;
}
$OPTION_TEXT_CHILD = my_dept_tree_no_self( $DEPT_ID, $DEPT_CHOOSE, $POST_OP, $NO_DEPT_ID );
if ( $DEPT_PRIV == 1 )
{
$OPTION_TEXT .= "<option ";
if ( $DEPT_ID == $DEPT_CHOOSE )
{
$OPTION_TEXT .= "selected ";
}
$OPTION_TEXT .= "value={$DEPT_ID}>".$DEEP_COUNT1."─".$DEPT_NAME."</option>\n";
}
if ( $OPTION_TEXT_CHILD != "" )
{
$OPTION_TEXT .= $OPTION_TEXT_CHILD;
}
}
}
$DEEP_COUNT = $DEEP_COUNT1;
return $OPTION_TEXT;
}
include_once( "inc/utility_all.php" );
include_once( "inc/auth.php" );
echo "\r\n<html>\r\n<head>\r\n<title>部门/成员单位管理</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n\r\n";
echo "<s";
echo "cript Language=\"JavaScript\">\r\nfunction CheckForm()\r\n{\r\n if(document.form1.DEPT_NO.value==\"\")\r\n { alert(\"部门排序号不能为空!\");\r\n return (false);\r\n }\r\n\r\n if(document.form1.DEPT_NAME.value==\"\")\r\n { alert(\"部门名称不能为空!\");\r\n return (false);\r\n }\r\n}\r\n\r\nfunction delete_dept(DEPT_ID,DEPT_NAME)\r\n{\r\n\tvar objTmpid = document.getElementById(\"tmpCnt\");\r\n\tif (objTmpid.value>0){\r\n\t\tale";
echo "rt(\"此部门下有用户或下级部门,不能删除!\");\r\n\t\treturn false;\r\n\t}\r\n msg='确认要删除该部门!';\r\n if(window.confirm(msg))\r\n {\r\n url=\"delete.php?DEPT_ID=\"+DEPT_ID+\"&DEPT_NAME=\"+DEPT_NAME+\"\";\r\n location=url;\r\n\r\n }\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\" onload=\"document.form1.DEPT_NO.focus();\">\r\n <form action=\"update.php\" method=\"post\" name=\"form1\" onsubmit=\"return Check";
echo "Form();\">\r\n\r\n";
$query = "SELECT * from DEPARTMENT where DEPT_ID={$DEPT_ID}";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$DEPT_NAME = $ROW['DEPT_NAME'];
$TEL_NO = $ROW['TEL_NO'];
$FAX_NO = $ROW['FAX_NO'];
$DEPT_NO = $ROW['DEPT_NO'];
$DEPT_PARENT = $ROW['DEPT_PARENT'];
}
$query = "SELECT * from DEPARTMENT where DEPT_ID={$DEPT_ID} order by DEPT_NO";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$LOCATION_NAME = $ROW['DEPT_NAME'];
}
$sql = "SELECT COUNT(USER_ID) AS cnt FROM user WHERE DEPT_ID=".$DEPT_ID;
$rs = exequery( $connection, $sql );
$row = mysql_fetch_array( $rs );
$ucnt = $row['cnt'];
$sql = "SELECT COUNT(DEPT_ID) AS cnt FROM department WHERE DEPT_PARENT=".$DEPT_ID;
$rs = exequery( $connection, $sql );
$row = mysql_fetch_array( $rs );
$dcnt = $row['cnt'];
$cnt = $ucnt + $dcnt;
echo "<input type=\"hidden\" value=\"";
echo $cnt;
echo "\" name=\"tmpCnt\" id=\"tmpCnt\">\r\n<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"1\">\r\n <tr class=\"tablehead1\">\r\n <td> 编辑部门/成员单位 - [\r\n ";
echo $LOCATION_NAME;
echo " ]</td>\r\n </tr>\r\n</table>\r\n<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr class=\"tablehead2\">\r\n <td height=\"30\"><input name=\"image\" type=\"image\" src=\"../../../../images/button/saveedit.gif\" width=\"105\" height=\"20\" border=\"0\"> </td>\r\n </tr>\r\n</table>\r\n<br>\r\n<table border=\"0\" cellspacing=\"1\" width=\"100%\" class=\"small\" cellpadding=\"3\" align=\"center\" >\r\n <tr>\r\n <td width";
echo "=\"16%\" nowrap class=\"tableline2\">部门排序号:</td>\r\n <td width=\"84%\" nowrap class=\"tableline1\">\r\n <input type=\"text\" name=\"DEPT_NO\" class=\"BigInput\" size=\"10\" maxlength=\"200\" value=\"";
echo $DEPT_NO;
echo "\"> 用于处于同一层次部门的排序,以及用户列表的排序\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"tableline2\">部门名称:</td>\r\n <td nowrap class=\"tableline1\">\r\n <input type=\"text\" name=\"DEPT_NAME\" class=\"BigInput\" size=\"25\" maxlength=\"25\" value=\"";
echo $DEPT_NAME;
echo "\"> \r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"tableline2\">电话:</td>\r\n <td nowrap class=\"tableline1\">\r\n <input type=\"text\" name=\"TEL_NO\" class=\"BigInput\" size=\"25\" maxlength=\"25\" value=\"";
echo $TEL_NO;
echo "\"> \r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"tableline2\">传真:</td>\r\n <td nowrap class=\"tableline1\">\r\n <input type=\"text\" name=\"FAX_NO\" class=\"BigInput\" size=\"25\" maxlength=\"25\" value=\"";
echo $FAX_NO;
echo "\"> \r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"tableline2\">上级部门:</td>\r\n <td class=\"tableline1\">\r\n ";
echo "<s";
echo "elect name=\"DEPT_PARENT\" class=\"BigSelect\">\r\n <option value=\"0\">无</option>\r\n";
$DEPT_STR = my_dept_tree_no_self( 0, $DEPT_PARENT, 0, $DEPT_ID );
echo $DEPT_STR;
echo " </select>\r\n </td>\r\n </tr>\r\n \r\n <input type=\"hidden\" name=\"DEPT_ID\" value=\"";
echo $DEPT_ID;
echo "\">\r\n</table>\r\n<br>\r\n\r\n<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"3\">\r\n <tr>\r\n <td background=\"/images/dian1.gif\" width=\"100%\"></td>\r\n </tr>\r\n</table>\r\n\r\n<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" >\r\n <tr class=\"tablehead1\">\r\n <td><img src=\"/images/menu/system.gif\" align=\"absmiddle\">当前部门/成员单位 - 相关操作\r\n </td>\r\n </tr>\r\n</table>\r\n<table border=\"0\" wi";
echo "dth=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr class=\"tablehead2\">\r\n <td height=\"30\"><a href=\"#\" onClick=\"location='dept_new.php?DEPT_ID=";
echo $DEPT_ID;
echo "';\"><img src=\"../../../images/button/newxiaji.gif\" width=\"165\" height=\"20\" border=\"0\"></a><a href=\"#\" onClick=\"delete_dept('";
echo $DEPT_ID;
echo "','";
echo $DEPT_NAME;
echo "')\"><img src=\"../../../images/button/deletexiaji.gif\" width=\"165\" height=\"20\" border=\"0\"></a></td>\r\n </tr>\r\n</table>\r\n \r\n \r\n</body>\r\n</html>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -