⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mng_class_arrange_class.php

📁 在实际教学应用中
💻 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">&nbsp;&nbsp;位于:<strong class="red">课堂管理</strong>&nbsp;&nbsp;<a href="mng_class_list_class_history.php">教学进度</a></div></td>
    <td width="100" background="images/top_bg.jpg"><div align="left">[<a href="#&#35828;&#26126;">说明</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 "&nbsp;&nbsp;&nbsp;<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">排课:&nbsp;</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\">&nbsp;&nbsp;〖章〗&para;$title</option>";
			else if($type==2) echo"<option value=\"$cid,$type\">&nbsp;&nbsp;&nbsp;&nbsp;〖节〗&para;&para;$title</option>";
			else if($type==3) echo"<option value=\"$cid,$type\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;【课程】&para;&para;&para;$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>&nbsp;说明<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>&nbsp;</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -