PHP分页显示的简单例子(三 表现层)

本文介绍了一个简单的员工列表管理系统,该系统采用PHP实现,用于展示员工的基本信息,并提供了分页功能及编辑、删除等操作选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<? session_start();
if ($_SESSION['Company']==''){
 //exit;
}

$path = dirname(__FILE__);
require_once($path.'/../../Module/Factory.php');
try {
 $Factory = new Factory();
 $BLL_Personel = $Factory->FactoryPersonnel();
     $Personnel =new  Personnel();
     $Page=new Page();
     if ($_GET['Page']=='')
{
 $Page->Page=0;
}
else
{
 $Page->Page=$_GET['Page'];
}
$Page->Pager=15;
 $PersonnelList = $BLL_Personel->ScanPersonnel($Personnel,$Page);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="../Goods/goods.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="W500">
 <div class="Title">员工列表</div>
    <div class="ListTitle">
     <div class="Items1" style="width:100px">员工帐户</div>
        <div class="Items1" style="width:80px">员工姓名</div>
        <div class="Items1" style="width:50px">性别</div>
        <div class="Items1" style="width:120px">身份证号</div>
        <div class="Items1" style="width:100px">电话</div>   
        <div class="Items1" style="width:50px">操作</div>    
    </div>
    <?
    if (count($PersonnelList)!=0) {
     foreach ($PersonnelList as $Personnel){
 ?>
    <div title="职位:<?echo $Personnel->Job->Title?><?echo chr(13)?>推荐人:<?if ($Personnel->Recommand->WebID!=''){echo $Personnel->Recommand->TrueName;}else{echo '无推荐人';}?><?echo chr(13)?>联系地址:<?echo $Personnel->Address?><?echo chr(13)?>Email:<?echo $Personnel->Email?><?echo chr(13)?>入职时间:<?echo date('Y年m月d日',$Personnel->JoinTime)?>" class="List" onmouseover="this.className='ListB'" onmouseout="this.className='List'">
     <div class="Items1" style="width:80px">【<?echo $Personnel->WebID?>】</div>
     <div class="Items1" style="width:100px; color:#FF0000"><?echo $Personnel->TrueName?></div>
     <div class="Items1" style="width:50px"><?if ($Personnel->Sex) {echo '女';}else{echo '男';}?></div>
     <div class="Items1" style="width:120px"><?echo $Personnel->Identity?></div>
     <div class="Items1" style="width:100px"><?echo $Personnel->Tel?></div>
        <div class="Items1" style="width:50px"><a href="../Personnel/EditPersonnel.php?WebID=<?echo $Personnel->WebID?>"><img alt="修改" src="../img/Edit.png" border="0" /></a> <a onclick="return Del()" href="../Personnel/DelPersonnel.php?WebID=<?echo $Personnel->WebID?>"><img alt="删除" src="../img/Del.png" border="0" /></a></div>
  </div>
    <?
     }
    }
    ?>
     <div class="Page">
    <?echo $Page->Page+1?>页/<?echo $Page->MaxPage+1?>页
    <?
    if ($Page->Page==0)
    {
     echo '首页';
     
    }
    else
    {
     echo ' <a href="listPersonel.php?Page=0">首页</a>';
    }
    ?>
   
  
    <?if ($Page->Page>0) {?>
     <a href="listPersonel.php?Page=<?echo $Page->Page-1?>">上一页</a> 
    <?
    }
    else {
     echo '上一页';
    }
    ?>
    <?if ($Page->Page<$Page->MaxPage) {?>
    <a href="listPersonel.php?Page=<?echo $Page->Page+1?>">下一页</a> 
    <?
 }
 else {
  echo '下一页';
 }
 ?>
 <?
    if ($Page->Page==$Page->MaxPage)
    {
     
     echo '尾页';
    }
    else
    {
     echo '<a href="listPersonel.php?Page='.$Page->MaxPage.'">尾页</a>';
    }
   
 ?>
   
    共<?echo $Page->Sum?>条记录
    </div>
</div>

</body>
</html>
<script language="javascript">
function Del()
{
 if(!confirm('真的要删除这个员工吗?')) {
  return false;
 }
}
</script>
<?
}
catch (Exception $Err)
{
 echo $Err->getMessage();
}
?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值