Viewing file: lessonPlan.php (7.06 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if( !session_is_registered("valid_user") && !session_is_registered("Priority") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../includes/Function.php" );
require_once( "../includes/FunctionDB.php" );
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "teach_lessonplans ";
$myTablePK = "lessId";
$myOrderBy = "lessId";
//=== projectstdplan_tb //
$query = " SELECT * FROM $myTable ";
$result = $dbObj->execQuery($query);
$rs01 = $dbObj->fetchArray($result);
$num = $dbObj->_numrows;
/** Paging */
$page = $_GET['page'];
if( $page == "" ) { $page = 1; }
/** จำนวนข้อมูล ต่อ 1 หน้า */
$perpage = $_REQUEST['perpage'];
if( $perpage == "" ) { $perpage = 50; }
/** Botton Name Action */
$action = $_REQUEST['action'];
$id = $_REQUEST['id'];
if( isset($action) && !empty($action) ) {
switch($action) {
case "Update" :
$num = count($id);
for( $i=0; $i<$num; $i++ ) {
$query6 = " SELECT * FROM tech_lesson_plans WHERE lessId ='$id[$i]' ";
$result6= mysql_query($query6);
InsertLessonPlan ( $id[$i], $ttpId , $programId ) ;
}
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว');</script>";
echo "<script>window.opener.document.all.myForm; window.opener.location.reload(); window.close();</script>";
exit();
break;
} # switch
} # if
/** Parameters */
$params = "programId=$programId";
} # else
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/utilities.js"></script>
<title>วิธีการสอน</title>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="590" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="590" align="center" valign="top" style="padding:10px 0px 5px 10px">
<?php
/** Config Paging */
if( $perpage == "" ) { $limit = $_Config_limit; }
else { $limit = $perpage; }
$scroll = $_Config_scroll;
/** ตั้งค่า Default สำหรับการทำ Order By */
if( $OrderBy == "" ) { $OrderBy = $myTablePK ; }
if( !isset($_GET['ASCDESC']) ) { $ASCDESC = "ASC"; }
if( $_GET['ASCDESC'] == "DESC" ) { $ASCDESC = "ASC"; }
elseif( $_GET['ASCDESC'] == "ASC" ) { $ASCDESC = "DESC"; }
/** Query เพื่อหา Numrows ก่อน */
$query = " SELECT * FROM $myTable ";
$result = $dbObj->execQuery($query);
$numrows = $dbObj->_numrows;
/** Paging */
$display = ( !isset ($_GET['page']) ) ? 1 : $_GET['page'];
$start = ( ($display * $limit) - $limit );
/** Paging */
if( isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable ORDER BY $OrderBy $ASCDESC ";
}
elseif( !isset($_GET['OrderBy']) ) {
$query = " SELECT * FROM $myTable ORDER BY $myTablePK ASC ";
}
$query .= " LIMIT $start, $limit ";
$result = $dbObj->execQuery($query);
?>
<fieldset><table width="578" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="<?=$PHP_SELF;?>?page=<?=$page;?>&<?=$params;?>">
<tr>
<td width="578" height="5"></td>
</tr>
<tr>
<td height="111" align="center" valign="top">
<?php if( $numrows > 0 ) { ?>
<table width="580" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="414" height="25" align="left" style="padding-bottom:5px;">จำนวน: <span class="TEXT-CLIMSON10"><strong><?=$numrows;?></strong></span> รายการ</td>
<td width="165" align="right" style="padding-bottom:5px;"><span style="padding-bottom:5px">
<?php if( $numrows > 0 ) { ?>
<input type="submit" name="action" id="action" value="Update" class="TEXT-CLIMSON10 CURSOR-HAND WIDTH60" onclick="return confirmUpdate(this.form);" />
<?php } #if ?>
</span> </td>
</tr>
</table>
<table width="572" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="background-color:#EEEEEE; border:0px solid gray" size="12">
<tr>
<td height="20" colspan="11" align="center" class="BORDER-TOP-LEFT-RIGHT PADDING-LEFT-3">คุณลักษณะของแผนการสอน </td>
</tr>
<?php
$no = 1+($display-1)*$limit;
while($rss = mysql_fetch_array($result)){ ;
$bgColor = ( $bgColor == "#FFFFFF" ) ? "#F9FBFB" : "#FFFFFF";
?>
<tr bgcolor="<?=$bgColor;?>" onmouseover="this.style.backgroundColor='#FFFFE0'" onmouseout="this.style.backgroundColor=''">
<td width="35" align="center" valign="top" class="PADDING-RIGHT-5 BORDER-TOP-LEFT-RIGHT"><?=$no ;?></td>
<td width="486" align="left" valign="top" class="PADDING-LEFT-5 BORDER-TOP-RIGHT"><?=htmlspecialchars_decode( nl2br( $rss['lessName'] ) );?></a> </td>
<td width="45" colspan="9" align="center" valign="top" class="BORDER-TOP-RIGHT PADDING-LEFT-3"><input name="ttpId" type="hidden" id="ttpId" value="<?=$ttpId ;?>" /><input type="checkbox" name="id[]" value="<?=$rss['lessId'];?>" onclick="highlightRow(this);" title="ลบข้อมูล(<?php echo $rss['lessId']; ?>)" /><input name="programId" type="hidden" id="programId" value="<?=$programId;?>" /></td>
</tr>
<?php
$no++;
} # while
?>
</table>
<?php } #if ?></td>
</tr>
<tr>
<td> </td>
</tr>
</form>
</table>
</fieldset></td>
</tr>
</table>
</body>
</html>
<?php
/** Free Resource */
//$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|