<% if session("admid")="" or Session("pwd")="" then response.redirect "default.asp"%>
<!--#include file="conn.asp"-->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Course Setting </title>
<link rel="stylesheet" href="style/t.css" type="text/css">
<style type="text/css">
<!--
.STYLE1 {font-size: 16px}
.STYLE2 {color: #FF0000}
.STYLE3 {
	font-family: Tahoma;
	color: #000000;
}
.STYLE5 {color: #FF0000; font-weight: bold; }
-->
</style>
</head>
</html>
<html>
<head>
</head>
<body bgcolor="#D6D3CE">


<%
'response.Write request("act")
'response.End()
 if request("act")="save" then
 
 tbu=TRIM(Request.form("ChkBusinessStudies"))
 tch=TRIM(Request.form("ChkChemistry"))
 tec=TRIM(Request.form("ChkEconomics"))
 ten=TRIM(Request.form("ChkEnglish"))
 tma=TRIM(Request.form("ChkMaths"))
 tfu=TRIM(Request.form("ChkFurtherMaths"))
 tph=TRIM(Request.form("ChkPhysics"))

 
 bu=split(tbu,",")
 ch=split(tch,",")
 ec=split(tec,",")
 en=split(ten,",")
 ma=split(tma,",")
 fu=split(tfu,",")
 ph=split(tph,",")
 

     set rs2=server.createobject("ADODB.Recordset") 
     sql2="select * from student"
     rs2.open sql2,conntmp,3,3
	
	 do while not rs2.eof
	    flagbu=false
	  	For  i=LBound(bu)  To Ubound(bu)
			if  cint(bu(i))=rs2("id") then flagbu= true
		next
		if flagbu= true then	rs2("BusinessStudies")=true  else rs2("BusinessStudies")=false 
		 
		flagch= false
		For  i=LBound(ch)  To Ubound(ch)
			if  cint(ch(i))=rs2("id") then flagch= true
		next
		if flagch= true then	rs2("Chemistry")=true  else rs2("Chemistry")=false  
		
		flagec= false
		For  i=LBound(ec)  To Ubound(ec)
			if  cint(ec(i))=rs2("id") then flagec= true
		next
		if flagec= true then	rs2("Economics")=true  else rs2("Economics")=false  
		
		flagen= false
		For  i=LBound(en)  To Ubound(en)
			if  cint(en(i))=rs2("id") then flagen= true
		next
		if flagen= true then	rs2("English")=true  else rs2("English")=false  
		
		flagma= false
		For  i=LBound(ma)  To Ubound(ma)
			if  cint(ma(i))=rs2("id") then flagma= true
		next
		if flagma= true then	rs2("Maths")=true  else rs2("Maths")=false  
		
		flagfu= false
		For  i=LBound(fu)  To Ubound(fu)
			if  cint(fu(i))=rs2("id") then flagfu= true
		next
		if flagfu= true then	rs2("FurtherMaths")=true  else rs2("FurtherMaths")=false  
	
	    flagph= false
	    For  i=LBound(ph)  To Ubound(ph)
			if  cint(ph(i))=rs2("id") then flagph= true
		next
		if flagph= true then	rs2("Physics")=true  else rs2("Physics")=false 
		'if  a=5   then rs2("English")=true else rs2("English")=false
		'if  a=5  then rs2("Maths")=true else rs2("Maths")=false
		'if a=5  then rs2("FurtherMaths")=true else rs2("FurtherMaths")=false
		'if a=5  then rs2("BusinessStudies")=true else rs2("Physics")=false
	 
     'response.Write rs2("id")&"X<br>"
	 on error resume next
	 rs2.movenext
	 loop
	 
	 rs2.update
	 rs2.close
	 set rs2=nothing
	 response.Redirect "coursesetting.asp?act=test"
else
%>




<p align="center" class=header STYLE1	>Course Setting </p>
<div align="center">
  <center>
  <form method="POST" action="coursesetting.asp" name="form1">
  <table border="1" bordercolorlight="#848284" cellspacing="0" cellpadding="4" bordercolordark="#FFFFFF">
    <tr>
      <td colspan="10">
        <p align="center"><span class="STYLE2"><span class="STYLE3">This interface only allows the use of<span class="STYLE5"><font size="3"> TAO</font></span></span></span></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF" class="altbg1">Class</td>
      <td align="center" bgcolor="#FFFFFF" class="altbg2">Chinese Name</td>   
      <td align="center" bgcolor="#FFFFFF" >English Name</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">Business<br>
        Studies</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">Chemistry</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">Economics</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">English</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">Maths</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">FurtherMaths</td>
      <td width="60" align="center" bgcolor="#FFFFFF" class="altbg2">Physics</td>
    </tr>
	 <%
     set rs=server.createobject("ADODB.Recordset") 
     sql="select * from student"
     rs.open sql,conntmp,1,1
	 
     do while not rs.eof%>
     	<tr>
		<td width="40" align=center class=altbg2><%=rs("class")%></td>
		<td width="60" align=center class=altbg2><%=rs("name_cn")%></td>
		<td width="60" align=center class=altbg2><%=rs("name_en")%></td>
		<td width="60" align=center <% if rs("BusinessStudies")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkBusinessStudies" type="checkbox" value="<%=rs("id")%>" <% if rs("BusinessStudies")=true then response.Write "checked" end if %>></td>
		<td width="60" align=center <% if rs("Chemistry")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkChemistry" type="checkbox" value="<%=rs("id")%>" <% if rs("Chemistry")=true then response.Write "checked" end if %>></td>
		<td width="60" align=center <% if rs("Economics")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%> ><INPUT  name="ChkEconomics" type="checkbox" value="<%=rs("id")%>" <% if rs("Economics")=true then response.Write "checked" end if %>></td>
		<td width="60" align=center <% if rs("English")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkEnglish" type="checkbox" value="<%=rs("id")%>" <% if rs("English")=true then response.Write "checked" end if %>> </td>
		<td width="60" align=center <% if rs("Maths")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkMaths" type="checkbox" value="<%=rs("id")%>" <% if rs("Maths")=true then response.Write "checked" end if %>> </td>
		<td width="60" align=center <% if rs("FurtherMaths")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkFurtherMaths" type="checkbox" value="<%=rs("id")%>" <% if rs("FurtherMaths")=true then response.Write "checked" end if %>></td>
		<td width="60" align=center <% if rs("Physics")=true then response.Write "bgcolor=#CCCCCC" else  response.Write "bgcolor=#ffffff"%>><INPUT  name="ChkPhysics" type="checkbox" value="<%=rs("id")%>" <% if rs("Physics")=true then response.Write "checked" end if %>></td>
		</tr>
     <%rs.movenext
     loop
	 rs.close
	 set rs=nothing	 
     %>
	
  <tr>
    <td colspan="10" align="center" height="25">
	<input type="hidden" value="save" name="act">
	<input type="submit" value="Submit" name="B1"></td>
  </tr>
  </table>
  
  </form>
  </center>
</div>
<br>

 <%end if%>


<p align="center" class=header	>&nbsp; </p>
</body>

</html>

