<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
Dim AskD,inHtml
Set AskD = Server.CreateObject("KwAsk.FunAsk")
opendb
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	AskD.GetUserRole()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
	AskD.GetTemplate("T-Honours.html")
    inHtml=RexHtml(AskD.tempbody)
    inHtml=RexHtml_IF(inHtml)
    Response.Write(inHtml)
	set AskD.myConn =Nothing
closedb	
Set AskD = Nothing

Function Honours()
  dim rs,str,i,gradetype,rs1,gradename,score,face,id
  set rs=conn.execute("select * from "&predb&"user where isstrong=1 order by strongtime desc")
  do while not rs.eof
  id=rs("id")
  gradetype=rs("gradetype")
  score=rs("score")
  face=rs("face")
  if face&""="" then face="Face/info.gif"
  
		if gradetype=0 then
		set rs1=conn.execute("select gradename from ("&predb&"UserGrade a inner join "&predb&"UserGradeType b on b.id=a.GradeTypeId) inner join "&predb&"Score c on c.grade=a.grade where b.isDefault=1 and tscore>="&score&"")
		else
		set rs1=conn.execute("select gradename from ("&predb&"UserGrade a inner join "&predb&"UserGradeType b on b.id=a.GradeTypeId) inner join "&predb&"Score c on c.grade=a.grade where b.id="&gradetype&" and tscore>="&score&"")
		end if
			gradename=rs1("gradename")
		set rs1=nothing
		
  i=i+1
  str=str&"<div class=""hon-l"">"&vbcrlf
  str=str&"<div class=""hono0""><img src=""UploadFile/"&Face&""" width=""48"" height=""63"" alt=""""></div>"&vbcrlf
  str=str&"<div class=""hono1"">"&vbcrlf
  str=str&"<p><b>荣誉知识人"&i&"</b></p>"&vbcrlf
  str=str&"<p>UID：<a href=""user/userinfo.asp?id="&id&""" target=""_blank"">"&rs("userid")&"</a></p>"&vbcrlf
  str=str&"<p>头衔："&gradename&"</p>"&vbcrlf
  str=str&"<p>积分："&rs("score")&"</p>"&vbcrlf
  str=str&"</div>"&vbcrlf
  
  str=str&"<div class=""hono2"">"&vbcrlf
  str=str&"精彩回答"&vbcrlf
  str=str&"</div>"&vbcrlf
  
  str=str&"<div class=""hono3"">"&vbcrlf
       set rs1=conn.execute("select top 3 a.askid,title from "&predb&"ans a inner join "&predb&"ask b on a.askid=b.askid where a.AnsUser="&id&" and isCN=1")
	   do while not rs1.eof
	   
			IF setting(34)=0 Then
  str=str&"<p><a href=""ask.asp?id="&rs1("askid")&""" target=""_blank"">"&AskD.Leftstr(rs1("title"),54)&"</a></p>"&vbcrlf
			Else
  str=str&"<p><a href=""ask-"&rs1("askid")&".html"" target=""_blank"">"&AskD.Leftstr(rs1("title"),54)&"</a></p>"&vbcrlf
			End IF
	   
	   rs1.movenext
	   loop
	   set rs1=nothing
	   
  str=str&"</div>"&vbcrlf
  str=str&"</div>"&vbcrlf
  rs.movenext
  loop
  set rs=nothing
  Honours=str
End Function
%>