<!-- #include file="conn.asp" -->
<!-- #include file="inc.asp" -->
<html>
<head>
<title>武汉家教网（学员信息列表）-我要找家教工作！</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css" type="text/css">
<script language="JavaScript">
<!--
function  check() {
if(document.searchid.action[0].checked==false && document.searchid.action[1].checked==false)
		{
			alert("请选择您执行的操作!");
			document.searchid.action[0].focus();
			return false;
		}
 else
	document.searchid.submit();
}// -->
</script>
</head>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0><div align="center">
<!-- #include file="head.asp" -->
    <table width="778" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="FBFCED">
      <tr>
        <td height="30" valign="bottom">&nbsp;&nbsp;&nbsp;<strong>当前位置</strong>：【<a href="http://www.whjjw.com" title="www.whjjw.com"><font color=red><b>武汉家教网</b></font></a>】 → <a href="index.asp">首页</a> → 教员库</td>
      </tr>
      <tr>
        <td align="center" valign="bottom"><img src="IMAGES/line.gif" width="730" height="2"></td>
      </tr>
    </table>
    <TABLE WIDTH=778 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="FBFCED">
              <TR>
                <TD align="center">                  <table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="center">

<table width="90%"border="1" cellpadding="5" cellspacing="0" bgcolor="#FFFFDD" borderColorLight=#000066 borderColorDark=#ffffff>
                      <form name="form1" method="post" action="">
                        <tr align="center">
                          <td bgcolor="#FEF49C">教员搜索</td>
                          <td><input name="key" type="text" value="<%=request("key")%>" size="40"></td>
                          <td><select name="types">
                              <option value="">不限</option>
                              <option value="1">在校学生</option>
                              <option value="2">在职教师</option>
                              <option value="3">专长人士</option>
                          </select></td>
                          <td><input name="Submit" type="submit" class="input2" value="提交"></td>
                          <td bgcolor="#FFF79C"><a href="">教员库</a></td>
                          <td bgcolor="#FFF79C"><a href="?types=2">教师库</a></td>
                        </tr>
                      </form>
                    </table>
<br>
<span class="font12">注：请先<strong>勾选要执行操作的记录</strong>，然后<strong>选择要执行的操作</strong>，<strong>提交操作</strong>即可。</span></td>
                  </tr>
                </table>
<table width="90%"border="1" cellpadding="3" cellspacing="0" bgcolor="#FDFEF5" borderColorLight=#000066 borderColorDark=#ffffff>
<form name="searchid" method="post" action="">
<tr align="center" bgcolor="#FFCC33">
                      <td width="7%">编号</td>
                      <td width="15%">教员类型</td>
                      <td width="9%">姓名</td>
                      <td width="6%">性别</td>
                      <td width="25%">学校</td>
                      <td width="22%">发布日期</td>
                      <td width="6%">查看</td>
					  <td width="6%">修改</td>
					  <td width="4%"><script language=javascript>  
function  selectAll(checkBoxName){  
           var  elms  =  document.getElementsByName(checkBoxName);  
           if  (elms.length<1)  return;  
           var  allChecked  =  true;  
           for  (var  i=0;i<elms.length;i++)  
                       if  (elms[i].type=="checkbox")  
                                   allChecked  &=  elms[i].checked;  
           for  (var  i=0;i<elms.length;i++)  
                       if  (elms[i].type=="checkbox"){  
                                               elms[i].checked  =  !allChecked;  
                                               if  (elms[i].onClick)  elms[i].onClick();  
                       }  
}   
function  mm(o)  
{  
     var  a  =  document.getElementsByName("selAnnounce");  
     for  (var  i=0;  i<a.length;  i++){  
         a[i].checked  =  o.checked;  
     }  
       
}  
</script>
<input name="checkbox"  type=checkbox  onClick="mm(this)"  value="Check  All"></td>
          </tr>
                  <%
page=request.querystring("page")
key=request("key")
DIM totalPut
DIM CurrentPage
DIM TotalPages
DIM i,j
const MaxPerPage=20

if not isempty(request("selAnnounce")) then
idlist=request.Form("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
select case request.form("action")
case "up_tch"
call up_tch(id)
case "del_tch"
call del_tch(id)
end select
next
else
select case request.form("action")
case "up_tch"
call up_tch(clng(idlist))
case "del_tch"
call del_tch(clng(idlist))
end select
end if
end if

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
dim rs
dim sql
types=request("types")
set rs=server.createobject("adodb.recordset")
sql = "select * from teacher where iname<>'-' and pas=yes and agent="&session("Agent_ID")&""
if types<>"" then
sql = sql & " and types=" & types
end if
if key<>"" then
sql = sql & " and teach & school & content & id & iname & tel like '%" & key & "%'"
end if
sql = sql & " order by top_used desc,idate desc"
rs.open sql,conn,1,1 
if rs.eof and rs.bof then 
response.write "<p align='center'>对不起，没有您要查询的[ <font style='font-weight:bold;color:red'>"&key&"</font> ]的信息</p>" 
else 
totalPut=rs.recordcount 
if currentpage<1 then 
currentpage=1 
end if 
if (currentpage-1)*MaxPerPage>totalput then 
if (totalPut mod MaxPerPage)=0 then 
currentpage= totalPut \ MaxPerPage 
else 
currentpage= totalPut \ MaxPerPage + 1 
end if 
end if 
if currentPage=1 then 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else 
if (currentPage-1)*MaxPerPage<totalPut then 
rs.move (currentPage-1)*MaxPerPage 
dim bookmark 
bookmark=rs.bookmark 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else 
currentPage=1 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
end if 
end if 
rs.close 
end if 
set rs=nothing
sub showContent (totalput,MaxPerPage)
do while not rs.eof
if rs("types")=1 then
if rs("edu")="-" then edu="" else edu=rs("edu") end if
msg=edu & "在校学生"
elseif rs("types")=2 then
msg=left(rs("spec"),2) & rs("shenfen") & "教师"
else
msg=rs("spec")
end if
%>
                    <tr align="center" onmouseover="this.style.backgroundColor='#eff7ff'" onmouseout="this.style.backgroundColor='#FDFEF5'">
                      <td><%=makeid("tch","out",rs("id"))%></td>
                      <td><%=Replace(left(msg,6),key,"<span style='font-weight:bold;color:red'>"&key&"</span>")%></td>
                      <td <%if rs("color_time")>now() then response.write "style='font-weight:bold;color:#"&rs("color_value")&"'" end if %>><%if rs("types")=2 then Response.Write(""&left(html(rs("iname")),1)&"老师") else Response.Write(""&left(html(rs("iname")),3)&"") end if%></td>
                      <td><%=rs("sex")%></td>
                      <td><%if rs("types")=2 then Response.Write(""&Replace(left(html(rs("tschool")),12),key,"<font style='font-weight:bold;color:red'>"&key&"</font>")&"") else Response.Write(""&Replace(left(rs("school"),12),key,"<font style='font-weight:bold;color:red'>"&key&"</font>")&"") end if%></td>
                      <td><%=rs("idate")%></td>
                      <td>
					  <a href="tch_info.asp?id=<%=makeid("tch","out",rs("id"))%>">查看</a>
					  </td><td>
					  <a href="agent_tch_mod.asp?id=<%=makeid("tch","out",rs("id"))%>">修改</a>
					  </td>
					  <td>
					  <input id=sel_<%=makeid("tch","out",rs("id"))%> type='checkbox' name='selAnnounce' value='<%=cstr(makeid("tch","out",rs("id")))%>'>
					  </td>
                    </tr>
                    
                  <% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
					                      <tr bgcolor="#FFCC33" align="center">
					  <td>操作</td>
                      <td colspan="8" align="right" class="font_blue_b">
					  		<input type="radio" name="action" value="up_tch">
							更新&nbsp;&nbsp;&nbsp;
							<input type="radio" name="action" value="del_tch">
							删除&nbsp;&nbsp;
						<input name="button" type="button" onClick="check()" value='提交操作' style="height:22">
						&nbsp;&nbsp;</td>
            </tr>

</form>
</table>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then 
n= totalnumber \ maxperpage 
else 
n= totalnumber \ maxperpage+1 
end if 
if CurrentPage<2 then 
response.write "<table border=0 width=80% cellspacing=0 cellpadding=0>" 
response.write "<tr height=50>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>" 
response.write "<td align=right>"
response.write "【最前页】【上一页】" 
else 
response.write "<table border=0 width=90% cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&types="&types&"&key="&key&">最前页</a>】" 
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&types="&types&"&key="&key&">上一页</a>】" 
end if 
if n-currentpage<1 then 
response.write "【下一页】【最后页】" 
else 
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&types="&types&"&key="&key&">" 
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&types="&types&"&key="&key&">最后页</a>】" 
end if 
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
%></TD>
              </TR>
  </TABLE>
<!-- #include file="foot.asp" -->
</div>
</body>
</html>
<%'Conn.Execute("Update teacher Set top_used=0 where top_time<now and top_used>0")
sub del_tch(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
'sql="delete from [teacher] where id="&makeid("tch","in",id)
sql="update teacher set pas=no where id="&makeid("tch","in",id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub 

sub up_tch(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="update teacher set idate=now() where id="&makeid("tch","in",id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "更 新 失 败 !<br>"
end if
End sub
 %>