?? mng_class_arrange_class.php
字號:
<?php session_start(); if(!$_SESSION['teacher']) {echo '<SCRIPT LANGUAGE="JavaScript">location.replace(\'mng.php\');</script>';exit;}?>
<html>
<head>
<title>EasyTeacher信息技術課堂教學助手(ItAssis)-課堂管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="et.css" rel="stylesheet" type="text/css">
<style type="text/css">
body,td,th {font-size: 14px;}
</style>
</head>
<body>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" background="images/top_bg.jpg"><div align="left"> 位于:<strong class="red">課堂管理</strong> <a href="mng_class_list_class_history.php">教學進度</a></div></td>
<td width="100" background="images/top_bg.jpg"><div align="left">[<a href="#说明">說明</a>]</div></td>
</tr>
</table>
<p>
<?php
function List_arranged_class($db){//函數 列出今日排課表
$sql="SELECT * FROM lesson WHERE end=\"N\" ORDER BY grade,class";
$result=mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
if(mysql_num_rows($result))
echo "<hr align=center noshade class=red width=740><p align=center>今日上課班級:(點擊班級進行實時課堂管理)</p><p align=center>";
$i=1;
while ($array =mysql_fetch_array($result)){
$g=$array['grade'];$c=$array['class'];
$lid=$array['lid'];
echo " <a href=mng_class_mng_class.php?lid=$lid title=實時課堂管理 target=_blank>$g($c)班</a>
[<a href=".$_SERVER['PHP_SELF']."?action=end&lid=$lid&grade=$g&class=$c>結束</a>]";
if(bcmod($i++,5)==0)
echo "<p align=center>";
}
if(mysql_num_rows($result))
echo "<hr align=center noshade class=red width=740>";
}
function End_class($db,$lid){//函數 結束課程
if($lid==-1){//檢查課程是否是當日課程,不是則結束課程。
$now_time=date("Ymd");
$sql="update lesson set end=\"Y\" where time<$now_time";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
}else{
$sql="update lesson set end=\"Y\" where lid=$lid";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
}
}
function Creat_online_class($db,$online_class){//函數 創建班級在線課堂表
list($g,$c)=split(",",$online_class);
$online_class=$g."_".$c;
$sql="drop table IF EXISTS $online_class";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
$sql="CREATE TABLE IF NOT EXISTS $online_class(";
$sql.="login ENUM('Y','N') DEFAULT 'N',";
$sql.="upload ENUM('Y','N') DEFAULT 'N',";
$sql.="PRIMARY KEY (sid))";
$sql.=" select sid from stu where grade=$g and class=$c";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
}
include "conn.inc.php";
include "ItAssisFC/FLib.php";
include "config.inc.php";
$db=Connect_db($CFG_DB_ADDRESS,$CFG_DB_PORT,$CFG_DB_NAME,$CFG_DB_OWNER,$CFG_DB_PWD);
End_class($db,-1);//結束以往課程 -1代表以往課程
// 排課*********************************************************
if(isset($_POST['action']) && $_POST['action']=="creat"){
list($cid,$type)=split(",",$_POST['cid_type']);
if($type!=3) Return_error_and_exit("必須選擇<strong>課程</strong>類型。");
list($g,$c)=split(",",$_POST['g_c']);
$now_time=date("Ymd");
$sql="select * from lesson";
$sql.=" where grade=$g and class=$c and time=$now_time and end=\"N\"";
$result=mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
$same_class=false;
if(mysql_num_rows($result)>0){//班級當天已排課處理
$array=mysql_fetch_array($result);
if($array['cid']==$cid)
$same_class=true;
else{//刪除原課程
$sql="delete from lesson where lid=".$array['lid'];
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
echo "<span class=red>提醒</span>:“$g($c)”班原來課程已廢除。";
}
}
if($same_class)
echo "<span class=red>警告:</span>“$g($c)”班雷同排課。";
else{
//排課表中插入排課記錄
$sql="insert into lesson(cid,grade,class) values($cid,$g,$c)";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
echo "<span class=red>報告</span>:“$g($c)班”排課成功。";
Creat_online_class($db,$_POST['g_c']);
}
}
//結束課堂************************************************
if(isset($_GET['action']) && $_GET['action'] =="end"){
End_class($db,$_GET['lid']);
$online_class=$_GET['grade']."_".$_GET['class'];
$sql="drop table IF EXISTS $online_class";
mysql_query($sql,$db) or die("<b>$sql</b><br>" . mysql_error());
$replace_page=$_SERVER['PHP_SELF'];
Replace_with_page("$replace_page");
}
List_arranged_class($db);
?>
</p>
<?php
$rsc_array=Read_course_List2($db);
if(!$rsc_array){
echo "沒有任何教學資源,請返回到[<a href=\"mng_course_list.php\"><strong>課程資源</strong></a>]中添加教材。";
exit;
}?>
<form name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<hr align="center" width="740" noshade color="#DEE3EF">
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="59"><div align="right">排課: </div></td>
<td width="77">選擇班級:</td>
<td width="85"><select name="g_c">
<?php
for($i=$CFG_USER_START_GRADE;$i<=$CFG_USER_END_GRADE;$i++)
for($j=1;$j<=$CFG_USER_MAX_CLASS;$j++)
echo "<option value=$i,$j>$i($j)班</option>";
?>
</select></td>
<td width="71">選擇課程:</td>
<td width="448"><select name="cid_type">
<?php
while($array=array_shift($rsc_array)){
$cid=$array['cid'];
$type=$array['type'];
$title=$array['title'];
if($type==0) echo"<option value=\"$cid,$type\">〖教材〗$title</option>";
else if($type==1) echo"<option value=\"$cid,$type\"> 〖章〗¶$title</option>";
else if($type==2) echo"<option value=\"$cid,$type\"> 〖節〗¶¶$title</option>";
else if($type==3) echo"<option value=\"$cid,$type\"> 【課程】¶¶¶$title</option>";
}?>
</select>
<input name="action" type="hidden" value="creat">
<input type="submit" name="submit" value="確定"></td>
</tr>
</table>
<hr align="center" width="740" noshade color="#DEE3EF">
</form>
</p>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="740" bgcolor="#F7F3F7"><p> 說明<a name="說明"></a>:</p>
<ul>
<li><span class="explain_hight">排課目的: </span>
<ul>
<li class="explain_hight">提供學生登陸系統時需要的課堂信息。</li>
<li class="explain_hight">統計課堂內學生出勤和交作業情況。</li>
<li class="explain_hight">給學生作課堂評價。</li>
</ul>
</li>
<li class="explain_hight">只有課程才能被選中,其他的選擇是無效的。</li>
<li class="explain_hight">一個班一天只能排一次課。可以直接變更課程內容,而無需結束課程。</li>
<li class="explain_hight">應當提前排課,建議一次性排好一天課,你隨時都可以結束這些班級。</li>
<li class="explain_hight">系統具有次日自動結束昨日課程功能。</li>
</ul></td>
</tr>
</table>
<p> </p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -