<?php
 /*********************************************************      
 程序说明：         
    功能说明：操作员列表
              
    调用关系：调用: header.inc,connectdb_billing.inc     
              被调用:       
 
    变量说明：
    作者：崔体存    2005-11-14      
      
修改注释：      
NO.1      
姓名：            
时间：      
修改说明：      
*********************************************************/
require("../../inc/header.inc");
$confUser=$_REQUEST['confUser'];

?>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php
adjust_head();
adjust_title_head();
$helpId="2.60";
$DEBUG	= 0; 
$initial_record = $_REQUEST['initial_record'];
$number_of_records = $_REQUEST['number_of_records'];
$privilegeRemark	= array(
	"1" => "Status",
	"2" => "Status/Performance/Log",
	"3" => "Status/Performance/Log/Configuration/Account/Maintenance",
	"4" => "Status/Performance/Log/Configuration/Account/Maintenance/Advanced",
	"5" => "Status/Performance/Log/Configuration/Account/Maintenance/Advanced/Template"
);
$userInfo = $_SESSION['userInfo'];

if($DEBUG)
	{
	  echo "userInfo[privilege] = $userInfo[privilege]<br>";
	  echo "userInfo[ID] = $userInfo[ID]<br>";
    }
 $table_name = 'sysUser'; 
 $sort_field = 'privilege,userName,updateTime'; 
 $sort_direction = 'ASC'; 
 $number_records_to_display = 200; 
 $pubConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], "OMC_PUB");
 if (!$initial_record)
	 { 
       $initial_record = 0; 
       $str_sql_all ="SELECT  count(*) as number_of_records	FROM $table_name ";
       $result = @mysqli_query($pubConn,$str_sql_all); 
     //$record = @mysqli_fetch_object($result); 
	   $record = mysqli_fetch_assoc($result); 
    $number_of_records = $record['number_of_records']; 
     } 
 
  if ($number_of_records >= 1) 
	  {  
       //下面是控制分页显示，传递变量  
       $next_index = $initial_record + $number_records_to_display;  //本页的结束数目  
       if ($next_index > $number_of_records)
		   {  
               $next_index = $number_of_records;  
           }  
       $t1 = $initial_record + 1;  
       $prev_index = $initial_record - $number_records_to_display;  
       if ($prev_index < 0) 
		   {  
               $prev_index = 0;  
           }   
      }  
   
  $str_sql="SELECT * 
            FROM $table_name
	        ORDER BY $sort_field $sort_direction 
            LIMIT $initial_record, $number_records_to_display"; 
	
  //echo "<br>str_sql=$str_sql";
  $result = mysqli_query($pubConn,$str_sql); 
  $myrows = mysqli_fetch_array($result); 
  if(!$myrows)
	  {
	    echo "$strNotFindRecord";
	    exit();
      }

  ?>

<?php 
	echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
	echo "<tr>";
	echo "<td width=\"50%\" align=\"left\">";
	echo "Advanced > Administrator";
	echo "</td>";
	echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "</table>";
adjust_title_tail();
adjust_content_head();
echo "<br>";
?>

<td align="left" width="10%">
<nobr>
<a href="./userList.php">
<IMG align=absBottom border=0 src="../../images/list.gif" ><?php echo "$strList"; ?>
</a>
</nobr>

</td>
<td align="left" width="10%">
<nobr>
<a href="./userConf.php?confMode=add">
<IMG align=absBottom border=0 src="../../images/add.gif" ><?php echo "$strAdd"; ?>
</a>
</nobr>
</td>

  <form method="POST" name=confForm action="./userConf.php" >
   <table border="1" width="100%"  cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF">
   <tr>
   <td colspan="2">
   <!--统计操作员的数量-->
   <?php       
   echo "$strDisplayRecords:<FONT color=#0000ff>&nbsp;$initial_record - $next_index</FONT>, ($strTotalRecords:<font color=#0000ff> $number_of_records</font> ) &nbsp;&nbsp;";
   ?>
    </td>
  </tr>
  </table> 
  <br>
<table border="1" width="100%"  cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF"> 
    <tr bgcolor="#E6E6E6"> 
      <td align="center"><?php echo $strAccountName; ?></td> 
      <td align="center"><?php echo $strRealName; ?></td>   
      <td align="center"><?php echo "Privilege"; ?></td> 
      <td align="center"><?php echo "Access menu"; ?></td>
      <td align="center">&nbsp;</td> 
      <td align="center">&nbsp;</td> 
   </tr>  
<?php 
do{
	if($confUser == $myrows[userName])
		{
		  echo "<tr bgcolor=\"#CCFFCC\"> ";
	    }
	else
		{
		  echo "<tr bgcolor=\"#FFFFFF\"> ";
	    }
	//echo "$myrows[userName],$myrows[privilege],$userInfo[ID]<br>";
	echo "<td align=\"center\">$myrows[userName]</td>";
	echo "<td align=\"center\">$myrows[realName]</td>";
	echo "<td align=\"center\">{$privilegeDefArr[$myrows[privilege]][remark]}</td>";
	echo "<td>{$privilegeRemark[$myrows[privilege]]}</td>";
	
	//for accountManager
	if('accountManager' == $userInfo[ID])
		{
		  $userInfo[privilege] = 4;
	    }

	if ( ($myrows[privilege]<$userInfo[privilege]) || ($myrows[userName] == $userInfo[ID]) ) 
		{
		  echo "<td align=\"center\"><a href=\"./userConf.php?confMode=edit&userName=$myrows[userName]\">$strEdit</td>";
	    }
	else
		{
		  echo "<td>&nbsp;</td>";
	    }
	if ( ($myrows[privilege]<$userInfo[privilege]) && ($myrows[userName] != $userInfo[ID]) ) 
		{
		  echo "<td align=\"center\"><a href=\"./userConf.php?confMode=del&userName=$myrows[userName]\">$strDelete</td>";
	    } 
	else 
		{
		  echo "<td>&nbsp;</td>";
	    }
	echo "</tr>";
  }while($myrows=mysqli_fetch_array($result)); 
 
?> 
  
</table>   
<?php
adjust_content_tail();
?>    
</body> 
</html>  
