?? mng_stu_list.php
字號(hào):
<?php session_start(); if(!$_SESSION['teacher']) {echo '<SCRIPT LANGUAGE="JavaScript">location.replace(\'mng.php\');</script>';exit;}?>
<html>
<head>
<title>學(xué)生管理-分班瀏覽學(xué)生信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="et.css" rel="stylesheet" type="text/css">
<style type="text/css">
body,td,th {font-size: 14px;}
</style>
<script language="javascript" src="ItAssisJS/java.js"></script>
</head>
<body>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" background="images/top_bg.jpg"><div align="left"> 位于:<a href="mng_stu_list.php" class="red"><strong>已注冊(cè)學(xué)生</strong></a> <a href="mng_stu_mng_unregister.php">待注冊(cè)學(xué)生</a> <a href="mng_stu_add_unregister.php">添加名單</a></div></td>
<td width="100" background="images/top_bg.jpg"><div align="left">[<a href="#explain">說明</a>]</div></td>
</tr>
</table>
<?php
include "config.inc.php";
include "ItAssisFC/FLib.php";
include "conn.inc.php";
$db=Connect_db($CFG_DB_ADDRESS,$CFG_DB_PORT,$CFG_DB_NAME,$CFG_DB_OWNER,$CFG_DB_PWD);
$result_msg="";
//搜索學(xué)生
if(isset($_GET['action']) && $_GET['action']=="search"){
$sid=trim($_GET['sid']);
$sex=trim($_GET['sex']);
$sql ="select team,sid,pic,seat,identity from stu";
$condition[0]="";
if($sid!="姓名")
array_push($condition,"sid like \"%$sid%\"");
if($sex!="")
array_push($condition,"sex=\"$sex\"");
array_shift($condition);
$condition=implode(" and ", array_values($condition));
if($condition)
$sql.=" where $condition";
$sql.=" order by grade,class,sid";
$result2 = mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
$num=mysql_num_rows($result2);
$result_msg="<strong><span class=red>$num</span></strong>個(gè)結(jié)果";
}//搜索學(xué)生結(jié)束
?>
<form name="form1" method="GET" >
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0" background="images/top_bg.jpg">
<tr>
<td height="20">
<input name="sid" type="text" value="<?php if(isset($_GET['sid'])) echo $_GET['sid'];else echo "姓名"; ?>" size="8">
<select name="sex" >
<option selected value="">性別</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
<select name="menu" onChange="MM_jumpMenu('self',this,0)">
<option value=NULL>↓分班列出名單↓</option>
<?php
//顯示班級(jí)列表
$sql ="select grade,class,count(*) as total from stu ";
$sql.="group by grade,class";
$result = mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
while($array=mysql_fetch_array($result)){
$grade=$array['grade'];
$class=$array['class'];
$base_url="mng_stu_list.php?action=list&grade_class=$grade,$class";
echo "<option value=\"$base_url\">$grade($class)班[{$array['total']}人]</option>";}?>
</select>
<input name="search" type="image" src="images/search.gif" width="25" height="17" border="0">
<input name="action" type="hidden" value="search">
<?php echo $result_msg ?> </td>
</tr>
</table>
</form>
<table width="740" align="center">
<tr>
<td><table border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
<tr>
<?php
//顯示搜索學(xué)生結(jié)果
if(isset($num) && $num>0){
$i=1;
while($array=mysql_fetch_array($result2)){
$base_url="mng_stu_edit.php?sid=".$array['sid'];
$stu_msg=preg_replace("/$sid/","<span class=red>$sid</span>",$array['sid']);
$stu_msg="<a href=javascript:popUpWindow('$base_url',150,80,500,340) title=查看、修改學(xué)生資料>$stu_msg</a>";
if(!$array['pic']) $array['pic']="none.jpg";
$image_url="$CFG_STU_PHOTO_DIR/".$array['pic'];
if(bcmod($i++,13)!=0){
if($array['identity']==2)
$stu_msg.="<br>座[".$array['seat']."]";
else if($array['identity']==1)
$stu_msg.="<br>座[".$array['seat']."]<span class=blue>組</span>";
else if($array['identity']==0)
$stu_msg.="<br>座[".$array['seat']."]<span class=red>課</span>"; ?>
<td width="60"><table border="1" align="center" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFD6AC">
<tr>
<td><div align="center"><img src="<?php echo $image_url;?>" width=50 height=60 border=0 align="middle"></div></td>
</tr>
<tr>
<td><p align="center"><?php echo $stu_msg ?> </p></td>
</tr>
</table></td>
<?php
}else
echo "</tr><tr>";
}//end while?>
</tr>
</table>
<?php
}//end if//顯示搜索學(xué)生結(jié)果結(jié)束
//顯示學(xué)生分組列表
if(isset($_GET['action']) && $_GET['action']=="list" && isset($_GET['grade_class'])){
list($grade,$class)=split(",",$_GET['grade_class']);
$sql ="select team,sid,pic,seat,identity from stu";
$sql.=" where grade=$grade AND class=$class";
$sql.=" ORDER BY team,seat";
$result = mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
echo "<table><div align=center>$grade($class)班學(xué)生分組列表</div></table>";?>
<table border="0" cellpadding="0" cellspacing="1">
<tr>
<?php
$i=0;
$array=mysql_fetch_array($result);
do{
$bgc=$i%2==0?"#3399FF":"#33CCFF";
if($array['team']!=$i) {$i++;continue;}
?>
<td width="20" bgcolor="<?php echo $bgc ?>"><div align="center">
<p>第<br>
<?php echo $i ?><br>
組</p>
</div></td>
<?php
while($array['team']==$i && $array){
$base_url="mng_stu_edit.php?sid=".$array['sid'];
if(!$array['pic']) $array['pic']="none.jpg";
if(!isset($_SESSION['image']) || $_SESSION['image']=="on")
$img_msg="<img src=$CFG_STU_PHOTO_DIR/{$array['pic']} width=50 height=60 border=0 align=middle></a>";
else
$img_msg='';;
$name_msg="<a href=javascript:popUpWindow('$base_url',150,80,500,340) title=\"點(diǎn)擊編輯學(xué)生檔案\" >".$array['sid']."</a>";
if($array['identity']==2)
$name_msg.="<br>座[".$array['seat']."]";
else if($array['identity']==1)
$name_msg.="<br>座[".$array['seat']."]<span class=組長(zhǎng)>組</span>";
else if($array['identity']==0)
$name_msg.="<br>座[".$array['seat']."]<span class=課代表>課</span>";
?>
<td width="60"><table border="1" align="center" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFD6AC">
<tr>
<td><div align="center"><?php echo $img_msg;?></div></td>
</tr>
<tr>
<td><div align="center"><?php echo $name_msg;?></div></td>
</tr>
</table></td>
<?php
$array=mysql_fetch_array($result);
}//內(nèi)部while結(jié)束
$i++;
?>
</tr>
<?php
}while($array and $i<=$CFG_USER_MAX_CLASS);//外部while結(jié)束
}//顯示學(xué)生分組列表結(jié)束
?>
</table></td>
</tr>
</table>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#F7F3F7"><p> <a name="說明"></a>說明:</p>
<ul>
<li class="explain_hight">支持姓名模糊搜索。例如輸入“張”,將顯示所有姓“張”的同學(xué)。</li>
<li class="explain_hight">默認(rèn)搜索全體學(xué)生,不過這樣比較無聊。</li>
<li class="explain_hight">學(xué)生列表顯示后,單擊學(xué)生姓名可以查看、修改學(xué)生資料,或者刪除。</li>
</ul></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -