<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/char.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	useflag=3

	action=Trim(Request.QueryString("action"))
	id=ReplaceBadChar(int(Trim(Request.QueryString("id"))))
	if action="open" then		
		conn.Execute "update train set zhuangtai=1 where id="&id&""
		response.write"<script language=JavaScript>alert('您的操作已完成，现在为您返回');"    
		response.write"this.location.href='admin_train.asp';</script>"
		
		response.end
	end if
	if action="close" then		
		conn.Execute "update train set zhuangtai=0 where id="&id&""
		response.write"<script language=JavaScript>alert('您的操作已完成，现在为您返回');"    
		response.write"this.location.href='admin_train.asp';</script>"
		response.end
	end if
	
	if action="del" then
	
		call DeleteFolder("../html/train/"&id&"")
		
		conn.Execute "delete from train where id="&id&""
		response.write"<script language=JavaScript>alert('您的操作已完成，现在为您返回');"    
		response.write"this.location.href='admin_train.asp';</script>"
		response.end
	end if
%>
<!--#include file="flag.asp"-->
<HTML>
<HEAD>
<TITLE>培训管理</TITLE>
<META http-equiv=Content-Type content="text/html; chaRSet=gb2312">
<LINK href="Include/Admin_Style.css" type=text/css rel=stylesheet>
<script language="javascript">
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
</script>
<SCRIPT language=JavaScript>
var GroupID='0';        //企业ID
var KeyWord='';         //搜索关键字
var SearchParam='KeyWord=&SearchType='; //搜索参数集合
</SCRIPT>
<SCRIPT language=JavaScript src="Include/Common.js"></SCRIPT>
<SCRIPT language=JavaScript src="Include/ContextMenu1.js"></SCRIPT>
<SCRIPT language=JavaScript src="Include/SelectElement.js"></SCRIPT>
<SCRIPT language=javascript>
var DocElementArrInitialFlag=false;
var DocElementArr = new Array();
var DocContextMenuArr=new Array();
var SelectedFile='',SelectedFolder='';
function document.onreadystatechange()
{   if (DocElementArrInitialFlag) return;
	InitialDocElementArr('GroupID','AdminID');
	InitialDocContextMenuArr();
	DocElementArrInitialFlag=true;
}
function SetAdminPassWord()
{
	GetSelectStatus('GroupID','AdminID');
	if (SelectedFile!='')
	if (SelectedFile.indexOf(',')==-1) 
		{ 
			OpenWindow('Admin_Frame.asp?type=train&id='+SelectedFile,480,420,window);
			SelectedFile='';
		}
	else alert('一次只能给一个个人用户修改资料!'); 
	else
		 alert('请选择要修改资料的用户!')
}
function EditAdmin(AdminID)
{
OpenWindow('Admin_Frame.asp?type=train&id='+AdminID,480,420,window);
Reload();
}
function Reload()
{
	location.href='Admin_train.asp';
}
</SCRIPT>
<META content="MSHTML 6.00.2900.3020" name=GENERATOR>
</HEAD>
<BODY onselectstart="return false;" onkeydown=GetKeyDown(); onclick=SelectElement(); leftMargin=0 topMargin=0 >
<TABLE class=sortbutton cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<FORM name="form1" method="get">
<input name="action" type="hidden" value="search">
<TR>
 <TD width="18%"><INPUT name=Button1 type=button class="sortbutton" title=培训会员修改资料 onclick=SetAdminPassWord(); value=培训会员修改资料></TD>
 <TD width="82%" valign="middle">搜索关键字：
		    <Input maxLength=30 name="Keyword" value="关键字" onMouseOver="if(this.value=='关键字'){this.value=''}" title="关键字">&nbsp;<input name="type" type="radio" value="uname" checked>用户名&nbsp;<input name="type" type="radio" value="iname">院校名称&nbsp;
      <Input class='button' type=submit value=" 查 询 "></TD>
  </TR>
  </FORM>
</TBODY>
</TABLE>
<TABLE height=25 cellSpacing=1 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR align=middle>
          <TD class=sort width=99 height=23>用户名</TD>
          <TD class=sort width=151>机构名称</TD>
          <TD class=sort width=105>联系电话</TD>
          <TD class=sort width=185>机构地址</TD>
          <TD class=sort width=64>审核状态</TD>
          <TD class=sort width=149>最后登陆时间</TD>
          <TD class=sort width=66>发送信息</TD>
		  <TD width=174 align="center" class=sort>操作</TD>
        </TR>
<%
	searchtype=""
	
	if Trim(Request.QueryString("action"))="search" then
		
		type1=ReplaceBadChar(Trim(Request.QueryString("type")))
		Keyword=ReplaceBadChar(Trim(Request.QueryString("Keyword")))
		if Keyword<>"" and Keyword<>"关键字" then
			if type1="uname" then
				searchtype="where tname like '%"&Keyword&"%'"
			else
				searchtype="where train_name like '%"&Keyword&"%'"
			end if
		end if
		
	end if

	dim i,intPage,page,pre,last,filepath'定义变量
	set rs_user = server.CreateObject("adodb.recordset")'创建对象
	sql="select * from train "&searchtype&" order by id desc"'定义SQL语句
	rs_user.PageSize = 16 '这里设定每页显示的记录数
	rs_user.CursorLocation = 3
	rs_user.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
	pre = true
	last = true
	page = trim(Request.QueryString("page"))'变量是跳转页面时的值

	if len(page) = 0 then
		intpage = 1
		pre = false
	else
		if cint(page) =< 1 then
			intpage = 1
			pre = false
		else
			if cint(page) >= rs_user.PageCount then
				intpage = rs_user.PageCount
				last = false
			else
				intpage = cint(page)
			end if
		end if
	end if
	if not rs_user.eof then
		rs_user.AbsolutePage = intpage
	end if
	if rs_user.eof then
		response.Write "<TR><td colspan=7><div align=center><font size=3 color=red><b>没有培训机构用户，请查询后再重试</b></font></div></td></tr>"
		response.End
	else
	for i=1 to rs_user.PageSize
	if rs_user.EOF or rs_user.BOF then exit for
%>
        <TR>
          <TD height=25>&nbsp;<SPAN ondblclick=EditAdmin(this.AdminID); AdminID="<%=rs_user("id")%>"><IMG height=16 src="images/Log.gif" width=16 align=absMiddle><SPAN style="CURSOR: default"><%=rs_user("tname")%> </SPAN><SPAN></SPAN></SPAN></TD>
          <TD align=middle><%=left(rs_user("train_name"),8)%>...</TD>
          <TD align=middle><%=rs_user("phone")%></TD>
          <TD align=middle><%=left(rs_user("address"),10)%>...</TD>
          <TD align=middle><% if rs_user("zhuangtai")=1 then Response.Write("<a href='?action=close&id="&rs_user("id")&"'><font color='red'>已审核</font></a>") else Response.Write("<a href='?action=open&id="&rs_user("id")&"'>未审核</a>")%></TD>
          <TD align=middle><% if rs_user("lasttime")&"a"="a" then%>未登陆<% Else %><%=year(rs_user("lasttime"))%>-<%=month(rs_user("lasttime"))%>-<%=day(rs_user("lasttime"))%><% End If %></TD>
          <TD align=middle><a href="JavaScript:openScript('send_message.asp?tid=<%=rs_user("id")%>&ttype=4',450,330)"><font color="red">发送信息</font></a></TD>
 	      <TD align=center><a href="add_kc.asp?uname=<%=rs_user("tname")%>&action=add">添加课程</a> || <a href="JavaScript:openScript('add_train_money.asp?tid=<%=rs_user("id")%>',650,150)"><font color="red">充值</font></a> || <a href="?action=del&id=<%=rs_user("id")%>">删除</a></TD>
        </TR>
<%
	rs_user.movenext
	next
	End If
%>
<table width="99%" border="0" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs_user.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs_user.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="?page=1&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>">首页</a>|
<%if pre then%>
<a href="?page=<%=intpage -1%>&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>">上页</a>| <%end if%>
<%if last then%>
<a href="?page=<%=intpage +1%>&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>">下页</a> |<%end if%>
<a href="?page=<%=rs_user.PageCount%>&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>">尾页</a>|转到第
<select name="sel_page" onchange=javascript:location.href=this.options[this.selectedIndex].value>
<%
	for i = 1 to rs_user.PageCount
	if i = intpage then
%>
<option value="?page=<%=i%>&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>" selected><%=i%></option>
<%else%> 
<option value="?page=<%=i%>&action=<%= Trim(Request.QueryString("action")) %>&Keyword=<%= Trim(Request.QueryString("Keyword")) %>&type=<%= Trim(Request.QueryString("type")) %>"><%=i%></option>
<%
	end if
	next
	rs_user.close
	set rs_user=nothing
	conn.close
	set conn=nothing
%>
</select>页</font></td>
</tr>
</table>
</TABLE>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
