⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.php

📁 通达OA3.0源代码
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");

if($INTEL!=2)
{
  for($PRCS_ID_I=1;$PRCS_ID_I<=$PRCS_ID;$PRCS_ID_I++)
  {
      $query = "SELECT * from FLOW_RUN_PRCS where RUN_ID=$RUN_ID and PRCS_ID=$PRCS_ID_I";
      $cursor= exequery($connection,$query);
      $USER_NAME_STR="";
      while($ROW=mysql_fetch_array($cursor))
      {
         $USER_ID=$ROW["USER_ID"];
         if(!find_id($HISTORY_USER_ID,$USER_ID))
             $HISTORY_USER_ID.=$USER_ID.",";
      }
  }
}

//---------- 经办权限 ------------
$query = "SELECT * from FLOW_PROCESS where FLOW_ID=$FLOW_ID and PRCS_ID=$PRCS_ID_NEXT";
$cursor= exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
{
   $PRCS_USER=$ROW["PRCS_USER"];
   $PRCS_DEPT=$ROW["PRCS_DEPT"];
   $PRCS_PRIV=$ROW["PRCS_PRIV"];
}

$QUERY_PRIV=" and (1=2 ";
if($PRCS_USER!="")
{
   if(substr($PRCS_USER,-1)==",")
      $PRCS_USER=substr($PRCS_USER,0,-1);
   $PRCS_USER="'".str_replace(",","','",$PRCS_USER)."'";
   $QUERY_PRIV.= " or USER.USER_ID in($PRCS_USER)";
}

if($PRCS_DEPT!="")
{
   if(substr($PRCS_DEPT,-1)==",")
      $PRCS_DEPT=substr($PRCS_DEPT,0,-1);
   $QUERY_PRIV.= " or DEPT_ID in($PRCS_DEPT)";
}

if($PRCS_PRIV!="")
{
	 if(substr($PRCS_PRIV,-1)==",")
      $PRCS_PRIV=substr($PRCS_PRIV,0,-1);
   $QUERY_PRIV.= " or USER.USER_PRIV in($PRCS_PRIV)";
}
$QUERY_PRIV.=") ";
?>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.menulines{}
</style>

<script Language="JavaScript">
var parent_window = parent.dialogArguments;

<?
   $TO_ID="PRCS_USER";
   $TO_NAME="PRCS_USER_NAME";
?>

function click_user(user_id)
{
  TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
  OP_VAL=parent_window.form1.PRCS_OP_USER.value;

  targetelement=document.getElementById(user_id);
  user_name=targetelement.name;

  if(TO_VAL.indexOf(","+user_id+",")>0 || TO_VAL.indexOf(user_id+",")==0)
  {
    if(TO_VAL.indexOf(user_id+",")==0)
    {
       parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(user_id+",","");
       parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(user_name+",","");
    }
    if(TO_VAL.indexOf(","+user_id+",")>0)
    {
       parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(","+user_id+",",",");
       parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(","+user_name+",",",");
    }

    if(OP_VAL==user_id)
    {
    	 parent_window.form1.PRCS_OP_USER.value="";
       parent_window.form1.PRCS_OP_USER_NAME.value="";
       targetelement=document.getElementById(user_id+"_op");
    }
  }
  else
  {
    parent_window.form1.<?=$TO_ID?>.value+=user_id+",";
    parent_window.form1.<?=$TO_NAME?>.value+=user_name+",";
  }
  begin_set();
}

function click_op(op_id)
{
  TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
  OP_VAL=parent_window.form1.PRCS_OP_USER.value;
  targetelement=document.getElementById(op_id);
  user_id=op_id.substr(0,op_id.length-3);
  user_name=targetelement.name;

  if(OP_VAL==user_id)
  {
     parent_window.form1.PRCS_OP_USER.value="";
     parent_window.form1.PRCS_OP_USER_NAME.value="";
  }
  else
  {
    parent_window.form1.PRCS_OP_USER.value=user_id;
    parent_window.form1.PRCS_OP_USER_NAME.value=user_name;
    if(!(TO_VAL.indexOf(","+user_id+",")>0 || TO_VAL.indexOf(user_id+",")==0))
      click_user(user_id);
  }
  begin_set();
}

function borderize_on(targetelement)
{
 color="#003FBF";
 targetelement.style.borderColor="black";
 targetelement.style.backgroundColor=color;
 targetelement.style.color="white";
 targetelement.style.fontWeight="bold";
}

function borderize_off(targetelement)
{
  targetelement.style.backgroundColor="";
  targetelement.style.borderColor="";
  targetelement.style.color="";
  targetelement.style.fontWeight="";
}

function begin_set()
{

  TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
  OP_VAL=parent_window.form1.PRCS_OP_USER.value;

  for (step_i=0; step_i<document.all.length; step_i++)
  {
    if(document.all(step_i).className=="menulines")
    {
       user_id=document.all(step_i).id;
       if(TO_VAL.indexOf(","+user_id+",")>0 || TO_VAL.indexOf(user_id+",")==0)
          borderize_on(document.all(step_i));
       else
       	  borderize_off(document.all(step_i));
    }
    else if(document.all(step_i).className=="menulines_op")
    {
       user_id=document.all(step_i).id.substr(0,document.all(step_i).id.length-3);
       if(OP_VAL==user_id)
          borderize_on(document.all(step_i));
       else
       	  borderize_off(document.all(step_i));
    }
  }
}

function add_all()
{
  TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
  for (step_i=0; step_i<document.all.length; step_i++)
  {
    if(document.all(step_i).className=="menulines")
    {
       user_id=document.all(step_i).id;
       user_name=document.all(step_i).name;

       if(TO_VAL.indexOf(","+user_id+",")<0 && TO_VAL.indexOf(user_id+",")!=0)
       {
         parent_window.form1.<?=$TO_ID?>.value+=user_id+",";
         parent_window.form1.<?=$TO_NAME?>.value+=user_name+",";
         borderize_on(document.all(step_i));
       }
    }
  }
}

function del_all()
{
  OP_VAL=parent_window.form1.PRCS_OP_USER.value;
  for (step_i=0; step_i<document.all.length; step_i++)
  {
    TO_VAL=parent_window.form1.<?=$TO_ID?>.value;
    if(document.all(step_i).className=="menulines")
    {
       user_id=document.all(step_i).id;
       user_name=document.all(step_i).name;
       if(user_id==OP_VAL)
       {
          parent_window.form1.PRCS_OP_USER.value="";
          parent_window.form1.PRCS_OP_USER_NAME.value="";
       }

       if(TO_VAL.indexOf(user_id+",")==0)
       {
          parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(user_id+",","");
          parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(user_name+",","");
          borderize_off(document.all(step_i));
       }

       if(TO_VAL.indexOf(","+user_id+",")>0)
       {
          parent_window.form1.<?=$TO_ID?>.value=parent_window.form1.<?=$TO_ID?>.value.replace(","+user_id+",",",");
          parent_window.form1.<?=$TO_NAME?>.value=parent_window.form1.<?=$TO_NAME?>.value.replace(","+user_name+",",",");
          borderize_off(document.all(step_i));
       }
    }
  }
  begin_set();
}
</script>
</head>

<body class="bodycolor" topmargin="1" leftmargin="0" onload="begin_set()">

<?
if($INTEL=="2")
{
?>
<table border="1" cellspacing="0" width="100%" class="small" cellpadding="3"  bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr class="TableHeader">
  <td colspan="2" align="center"><b>按流程选择</b></td>
</tr>
<?
  $USER_COUNT=0;
  for($PRCS_ID_I=1;$PRCS_ID_I<=$PRCS_ID;$PRCS_ID_I++)
  {
     $query = "SELECT * from FLOW_RUN_PRCS,USER where FLOW_RUN_PRCS.USER_ID=USER.USER_ID and RUN_ID=$RUN_ID and PRCS_ID=$PRCS_ID_I ";
     $query.= " and DEPT_ID!=0 and NOT_LOGIN!='1' ".$QUERY_PRIV." order by PRCS_FLAG desc,PRCS_TIME";
     $cursor= exequery($connection,$query);
     $PRCS_COUNT=0;
     while($ROW=mysql_fetch_array($cursor))
     {
        $USER_COUNT++;
        $PRCS_COUNT++;
        $USER_ID=$ROW["USER_ID"];
        $USER_NAME=$ROW["USER_NAME"];
        $FLOW_PRCS=$ROW["FLOW_PRCS"];
        $DEPT_ID=$ROW["DEPT_ID"];
        $DEPT_LONG_NAME=dept_long_name($DEPT_ID);

        if($USER_COUNT==1)
        {
?>
<tr class="TableContent">
  <td onclick="javascript:add_all();" style="cursor:hand" align="center" colspan="2">全部添加</td>
</tr>
<tr class="TableContent">
  <td onclick="javascript:del_all();" style="cursor:hand" align="center" colspan="2">全部删除</td>
</tr>
<?
        }

        if($PRCS_COUNT==1)
        {
    	     $query1 = "SELECT * from FLOW_PROCESS where FLOW_ID=$FLOW_ID and PRCS_ID=$FLOW_PRCS";
           $cursor1= exequery($connection,$query1);
           if($ROW=mysql_fetch_array($cursor1))
              $PRCS_NAME=$ROW["PRCS_NAME"];
?>
          <tr class="TableHeader">
             <td colspan="2" align="center"><b><?=$PRCS_ID_I?>:<?=$PRCS_NAME?></b></td>
          </tr>
<?
        }
?>
<tr class="TableControl" title="设为主办人">
  <td class="menulines_op" id="<?=$USER_ID?>_op" name="<?=$USER_NAME?>" width="50" align="center" onclick="javascript:click_op('<?=$USER_ID?>_op')" style="cursor:hand">
  主办人
  </td>
  <td title="<?=$DEPT_LONG_NAME?>" class="menulines" id="<?=$USER_ID?>" name="<?=$USER_NAME?>"   align="center" onclick="javascript:click_user('<?=$USER_ID?>')" style="cursor:hand">
  <font color=red><?=$USER_NAME?></font>
  </td>
</tr>
<?

     }//while
  }//for

  if($USER_COUNT==0)
  {
?>
<tr class="TableControl">
  <td align="center">无符合条件的用户</td>
</tr>
<?
  }
  exit;
}
elseif($INTEL=="1")
{
   $query = "SELECT * from USER,USER_PRIV where DEPT_ID!=0 and NOT_LOGIN!='1' and USER.USER_PRIV=USER_PRIV.USER_PRIV ".$QUERY_PRIV." order by PRIV_NO,USER_NO,USER_NAME";
   $TITLE="全部经办人";
}
elseif($DEPT_ID!="")
{
   $query = "SELECT * from USER,USER_PRIV where DEPT_ID=$DEPT_ID and NOT_LOGIN!='1' and USER.USER_PRIV=USER_PRIV.USER_PRIV ".$QUERY_PRIV." order by PRIV_NO,USER_NO,USER_NAME";
   $query1 = "select * from DEPARTMENT where DEPT_ID=$DEPT_ID";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $TITLE=$ROW["DEPT_NAME"];
}
elseif($USER_PRIV!="")
{
   $query = "SELECT * from USER where USER_PRIV='$USER_PRIV' and DEPT_ID!=0 and NOT_LOGIN!='1' ".$QUERY_PRIV." order by USER_NO,USER_NAME";
   $query1 = "select * from USER_PRIV where USER_PRIV='$USER_PRIV'";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $TITLE=$ROW["PRIV_NAME"];
}
?>

<table border="1" cellspacing="0" width="100%" class="small" cellpadding="3"  bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr class="TableHeader">
  <td colspan="2" align="center"><b><?=$TITLE?></b></td>
</tr>

<?
$cursor= exequery($connection,$query);
$USER_COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
   $USER_COUNT++;
   $USER_ID=$ROW["USER_ID"];
   $DEPT_ID=$ROW["DEPT_ID"];
   $USER_NAME=$ROW["USER_NAME"];
   $DEPT_LONG_NAME=dept_long_name($DEPT_ID);

   if(find_id($HISTORY_USER_ID,$USER_ID))
      $USER_NAME_DESC="<font color=red>".$USER_NAME."</font>";
   else
      $USER_NAME_DESC=$USER_NAME;

   if($USER_COUNT==1)
   {
?>
<tr class="TableContent">
 <td onclick="javascript:add_all();" style="cursor:hand" align="center" colspan="2">全部添加</td>
</tr>
<tr class="TableContent">
 <td onclick="javascript:del_all();" style="cursor:hand" align="center" colspan="2">全部删除</td>
</tr>
<?
   }
?>

<tr class="TableControl" title="设为主办人">
  <td class="menulines_op" id="<?=$USER_ID?>_op" name="<?=$USER_NAME?>" width="50" align="center" onclick="javascript:click_op('<?=$USER_ID?>_op')" style="cursor:hand">
  主办人
  </td>
  <td title="<?=$DEPT_LONG_NAME?>" class="menulines" id="<?=$USER_ID?>" name="<?=$USER_NAME?>"   align="center" onclick="javascript:click_user('<?=$USER_ID?>')" style="cursor:hand">
  <?=$USER_NAME_DESC?>
  </td>
</tr>

<?
}//while

if($USER_PRIV!="")
{
   $query = "SELECT * from USER where (USER_PRIV_OTHER like '$USER_PRIV,%' or USER_PRIV_OTHER like '%,$USER_PRIV,%') and USER_PRIV!='$USER_PRIV' and DEPT_ID!=0 and NOT_LOGIN!='1' ".$QUERY_PRIV." order by USER_NO,USER_NAME";
   $cursor= exequery($connection,$query);
   $USER_COUNT1=0;
   while($ROW=mysql_fetch_array($cursor))
   {
      $USER_COUNT++;
      $USER_COUNT1++;
      $USER_ID=$ROW["USER_ID"];
      $USER_NAME=$ROW["USER_NAME"];

      if(find_id($HISTORY_USER_ID,$USER_ID))
         $USER_NAME_DESC="<font color=red>".$USER_NAME."</font>";
      else
         $USER_NAME_DESC=$USER_NAME;

      if($USER_COUNT1==1)
      {
?>
<tr class="TableHeader">
  <td colspan="2" align="center"><b>辅助角色</b></td>
</tr>
<?
      }
?>

<tr class="TableControl" title="设为主办人">
  <td class="menulines_op" id="<?=$USER_ID?>_op" name="<?=$USER_NAME?>" width="50" align="center" onclick="javascript:click_op('<?=$USER_ID?>_op')" style="cursor:hand">
  主办人
  </td>
  <td title="<?=$DEPT_LONG_NAME?>" class="menulines" id="<?=$USER_ID?>" name="<?=$USER_NAME?>"   align="center" onclick="javascript:click_user('<?=$USER_ID?>')" style="cursor:hand">
  <?=$USER_NAME_DESC?>
  </td>
</tr>

<?
   }//while
}//if

if($USER_COUNT==0)
{
?>
<tr class="TableControl">
  <td align="center">无符合条件的用户</td>
</tr>
<?
}
?>

</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -