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

📄 show_reader.php

📁 通达的部分源代码大家研究一下吧
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
?>

<html>
<head>
<title>公告通知查阅情况</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function delete_reader(NOTIFY_ID)
{
 msg='确认要清空查阅情况么?';
 if(window.confirm(msg))
 {
  URL="delete_reader.php?NOTIFY_ID=" + NOTIFY_ID;
  window.location=URL;
 }
}
</script>
</head>

<?
 $query = "SELECT * from NOTIFY where NOTIFY_ID=$NOTIFY_ID";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
 {
     $SUBJECT=$ROW["SUBJECT"];
     $TO_ID=$ROW["TO_ID"];
     $TO_ID_REAL=$ROW["TO_ID"];
     $PRIV_ID=$ROW["PRIV_ID"];
     $USER_ID_TO=$ROW["USER_ID"];
     $READERS=$ROW["READERS"];
 }

 if($TO_ID!="ALL_DEPT")
 {
    $TOK=strtok($PRIV_ID,",");
    while($TOK!="")
    {
       $query1 = "SELECT * from USER where USER_PRIV='$TOK'";
       $cursor1= exequery($connection,$query1);
       while($ROW=mysql_fetch_array($cursor1))
       {
          $DEPT_ID=$ROW["DEPT_ID"];
          if(!find_id($TO_ID,$DEPT_ID))
             $TO_ID.=$DEPT_ID.",";
       }

       $TOK=strtok(",");
    }
 }

 if($TO_ID!="ALL_DEPT")
 {
   $TOK=strtok($USER_ID_TO,",");
   while($TOK!="")
   {
      $query1 = "SELECT * from USER where USER_ID='$TOK'";
      $cursor1= exequery($connection,$query1);
      if($ROW=mysql_fetch_array($cursor1))
      {
         $DEPT_ID=$ROW["DEPT_ID"];
         if(!find_id($TO_ID,$DEPT_ID))
            $TO_ID.=$DEPT_ID.",";
      }
      $TOK=strtok(",");
   }
 }
?>

<body class="bodycolor" topmargin="5">
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/notify.gif" align="absmiddle"><span class="big3"> 查阅情况 - <?=$SUBJECT?></span>
      &nbsp;&nbsp;&nbsp;<input type="button" value="清空查阅情况" class="SmallButton" onclick="delete_reader(<?=$NOTIFY_ID?>);">
    </td>
    </tr>
</table>
<br>
<?
function child_in_toid($TO_ID,$DEPT_ID)
{
   $connection=OpenConnection();
   $query = "SELECT * from DEPARTMENT where DEPT_PARENT=$DEPT_ID";
   $cursor= exequery($connection,$query);
   while($ROW=mysql_fetch_array($cursor))
   {
      $DEPT_ID=$ROW["DEPT_ID"];
      if(find_id($TO_ID,$DEPT_ID))
         return 1;
      else
         $VALUE=child_in_toid($TO_ID,$DEPT_ID);
   }

   return $VALUE;
}

//------ 递归显示部门列表,支持按管理范围显示 --------
function dept_tree_list($DEPT_ID,$PRIV_OP)
{
  global $DEEP_COUNT,$READERS,$TO_ID,$READ_COUNT,$UN_READ_COUNT,$USER_ID_TO,$PRIV_ID,$TO_ID_REAL;

  $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"];
      $TEL_NO=$ROW["TEL_NO"];
      $FAX_NO=$ROW["FAX_NO"];
      $DEPT_FUNC=$ROW["DEPT_FUNC"];

      if($TO_ID!="ALL_DEPT" && !find_id($TO_ID,$DEPT_ID) && !child_in_toid($TO_ID,$DEPT_ID))
         continue;

      $DEPT_NAME=str_replace("<","&lt",$DEPT_NAME);
      $DEPT_NAME=str_replace(">","&gt",$DEPT_NAME);
      $DEPT_NAME=stripslashes($DEPT_NAME);

      $DEPT_PRIV=1;

      $OPTION_TEXT_CHILD=dept_tree_list($DEPT_ID,$PRIV_OP);

      $UN_USER="";
      $USER_NAME_STR="";
      if($TO_ID=="ALL_DEPT" || find_id($TO_ID,$DEPT_ID))
      {
         $query="select * from USER where DEPT_ID=$DEPT_ID order by USER_NO,USER_NAME";
         $cursor1= exequery($connection,$query);
         while($ROW1=mysql_fetch_array($cursor1))
         {
            $USER_ID=$ROW1["USER_ID"];
            $USER_PRIV=$ROW1["USER_PRIV"];
            $USER_NAME=$ROW1["USER_NAME"];
            if(find_id($READERS,$USER_ID))
            {
               $USER_NAME_STR.=$USER_NAME.",";
               $READ_COUNT++;
            }
            else
            {
            	 if(($TO_ID=="ALL_DEPT") || find_id($TO_ID_REAL,$DEPT_ID) || child_in_toid($TO_ID_REAL,$DEPT_ID)|| find_id($PRIV_ID,$USER_PRIV) || find_id($USER_ID_TO,$USER_ID))
            	 {
                  $UN_USER.=$USER_NAME.",";
                  $UN_READ_COUNT++;
               }
            }
         }
         $USER_NAME_STR=substr($USER_NAME_STR,0,-2);
         $UN_USER=substr($UN_USER,0,-2);
      }

      if($DEPT_PRIV==1)
      {
      	 $OPTION_TEXT.="
  <tr class=TableData>
    <td class=\"TableContent\">".$DEEP_COUNT1."├".$DEPT_NAME."</td>
    <td style=\"cursor:hand\" title=\"$USER_NAME_STR\">".csubstr(strip_tags($USER_NAME_STR),0,30).(strlen($USER_NAME_STR)>30?"...":"")."</td>
    <td style=\"cursor:hand\" title=\"$UN_USER\">".csubstr(strip_tags($UN_USER),0,30).(strlen($UN_USER)>30?"...":"")."</td>
  </tr>";
      }

      if($OPTION_TEXT_CHILD!="")
         $OPTION_TEXT.=$OPTION_TEXT_CHILD;

  }//while

  $DEEP_COUNT=$DEEP_COUNT1;
  return $OPTION_TEXT;
}

$READ_COUNT=$UN_READ_COUNT=0;
$OPTION_TEXT=dept_tree_list(0,0);

if($OPTION_TEXT=="")
   Message("提示","无人查阅");
else
 {
?>
  <table border="0" align="center" cellspacing="1" width="100%" class="small" bgcolor="#000000" cellpadding="3">
    <tr class="TableHeader">
      <td nowrap align="center">部门/成员单位</td>
      <td nowrap align="center">已读人员</td>
      <td nowrap align="center">未读人员</td>
    </tr>
    <?=$OPTION_TEXT?>
    <tr class="TableControl">
      <td nowrap align="center"><b>合计:</b></td>
      <td nowrap align="center"><b><?=$READ_COUNT?></b></td>
      <td nowrap align="center"><b><?=$UN_READ_COUNT?></b></td>
    </tr>
  </table>
<?
 }
?>

</body>
</html>

⌨️ 快捷键说明

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