<!--#INCLUDE FILE="setup.asp" -->
<!--#include file="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%
locat="班级列表"
Call top(1,1)
%>
<br><br>
<table cellpadding=4 cellspacing=1 border=0 width=100% Class=TableBorder>
<tr Class=LightTableBody> 
	<td colspan=5 valign=top width=350 align=center>&nbsp;<img src="images/classlist.gif"></td>
	<td colspan=3 align=center>注册班级数：<%=ClassNum%></td>
</tr>
<tr>
<th align=center><a href="?OrderBy=classname" title="按班级名排序">班级名</a>
<%if Request("OrderBy")="classname" Then Response.Write "&nbsp;<img src=images/sort.gif>"
response.write "</th><th align=center>班级主页</th><th align=center colspan=2>管理员</th>"&_
"<th align=center><a href=""?OrderBy=studcount"" title=""按班级成员数排序"">班级成员</a>"
if Request("OrderBy")="studcount" Then Response.Write "&nbsp;<img src=images/sort.gif>"
response.write "</th><th align=center><a href=""?OrderBy=enyear"" title=""按班级入学年份排序"">入学年份</a>"
if Request("OrderBy")="enyear" Then Response.Write "&nbsp;<img src=images/sort.gif>"
response.write "</th><th align=center><a href=""?OrderBy=regdate"" title=""按注册日期排序"">注册日期</a>"
if Request("OrderBy")="regdate" or Request("OrderBy")="" Then Response.Write "&nbsp;<img src=images/sort.gif>"
response.write "</th><th align=center><a href=""?OrderBy=visitcount"" title=""按班级成员访问次数排序"">访问次数</a>"
if Request("OrderBy")="visitcount" Then Response.Write "&nbsp;<img src=images/sort.gif>"
response.write "</th></tr>"


Dim totalPages,currentPage
Dim rs,sql
Dim PageSize

if Request("OrderBy")="classname" or Request("OrderBy")="studcount" or Request("OrderBy")="visitcount" or Request("OrderBy")="enyear" or Request("OrderBy")="regdate" Then
	order=Request("OrderBy")
Else
	order="regdate"
End if

sql="Select classid,classname,homepage,studcount,regdate,visitcount,enyear,admin1,admin2 from class "&_
	"order by "&order&" desc"

Set rs=server.createobject("adodb.recordset")
	rs.open sql,Conn,1,1
	if rs.eof and rs.bof Then
%>
<tr Class=DarkTableBody> 
	<td colspan=8>&nbsp;&nbsp;还没有注册任何班级。</td>
</tr></table><BR>
<%
Else

pagesize=20
rs.pagesize=pagesize
totalpages=rs.pagecount

currentPage=Request("page")
if currentpage="" Then currentpage=1
if not isNumeric(currentpage) Then
	currentpage=1
ElseIf Cint(currentpage)>totalpages Then
	currentpage=totalpages
End if
currentpage=Cint(currentpage)
rs.absolutepage=currentpage

for i=1 to pagesize

response.write "<tr Class=LightTableBody><td>&nbsp;"
if membername<>"" Then
	Response.Write "<a target=_blank href=""BrowseClass.asp?ClassID="&rs(0)&""" title=""浏览『"&rs(1)&"』的班级信息"">"&htmlencode(rs(1))&"</a>"
Else
	Response.Write htmlencode(rs(1))
End if
response.write "</td><td align=center>"
if rs(2)<>"" and rs(2)<>"http://" Then
	response.write "<a href="""&rs(2)&""" target=_blank  title=""访问"&rs(1)&"的主页"">"&_
	"<img border=0 src=images/homepage.gif>主页</a>"
Else
	response.write "-" 
End if
response.write "</td><td>"
if rs(7)<>"" Then
	response.write "&nbsp;<a href=""Profile.asp?Name="&rs(7)&"""  target=_blank title=""查看班级管理员"&rs(7)&"的个人信息"">"&htmlencode(rs(7))&"</a>"
End if
response.write "</td><td>"
if rs(8)<>"" Then
	response.write "&nbsp;<a href=""Profile.asp?Name="&rs(8)&""" target=_blank title=""查看副班级管理员"&rs(8)&"的个人信息"">"&htmlencode(rs(8))&"</a>"
End if
response.write "</td><td align=center>"&rs(3)&"</td><td align=center>"&rs(6)&"</td>"&_
	"<td align=center>"&rs(4)&"</td><td align=center>"&rs(5)&"</td></tr>"

rs.movenext

if currentpage=totalpages then
	if rs.eof then exit for
end if 

next

%>
</table>
<table width=100% align="center">
<tr><td align=left valign=center>
<%if currentpage<>1 Then
	Response.Write "　<a href=""?page="&currentpage-1&"&OrderBy="&order&"""><img src=images/left.gif border=0 hspace=2>上一页</a>"
End if
		
if currentpage<>totalpages Then
	Response.Write "　<a href=""?page="&currentpage+1&"&OrderBy="&order&"""><img src=images/right.gif border=0 hspace=2>下一页</a>"
End if
response.write "</td><td align=right valign=center>"&_
	"页次:"&currentpage&"/"&totalpages&"&nbsp;&nbsp;&nbsp;去第"&_
	"<input type=hidden value="""&order&""" name=orderby>"%>
&nbsp;<input type=text name=targetPage size=2 style="height:16px;width:20px;">&nbsp;页</td><td width=15 align=right style="cursor:hand" onclick="document.location.href='ClassList.asp?OrderBy='+orderby.value+'&page='+targetPage.value;"><img src=images/btngo.gif width=13 height=15></td></tr></table><BR>
<%

End if
rs.close
Set rs=Nothing

Call footer%>
