Viewing file: 2552-05-19-1.0.01-clsClassAssessTmp.php (11.33 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class ClassAssessTmp--------------------------
//--PK of ClassAssessTmp ::
// 1. classId
class ClassAssessTmp extends clsDB{
var $result;
var $classId;
var $programId;
var $acadYear;
var $semester;
var $studentYear;
var $courseId;
var $sectionClass;
var $section;
var $totalSeat;
var $enrollSeat;
var $classTime;
var $officerId;
function ClassAssessTmp(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
//--ข้อมูลในอ๊อบเจ๊กเป็นข้อมูลใหม่หรือข้อมูลเดิม --1:ข้อมูลใหม่ 2:ข้อมูลเดิม
if ($this->status==1){
//uncomment a line below if your table use ID as running number
//$this->classId=$this->GetNextCode();
$sql = "insert into ClassAssessTmp values(
'$this->classId',
'$this->programId',
'$this->acadYear',
'$this->semester',
'$this->studentYear',
'$this->courseId',
'$this->sectionClass',
'$this->section',
'$this->totalSeat',
'$this->enrollSeat',
'$this->classTime',
'$this->officerId'
)";
}else {
$sql = "update ClassAssessTmp set
programId='$this->programId',
acadYear='$this->acadYear',
semester='$this->semester',
studentYear='$this->studentYear',
courseId='$this->courseId',
sectionClass='$this->sectionClass',
section='$this->section',
totalSeat='$this->totalSeat',
enrollSeat='$this->enrollSeat',
classTime='$this->classTime',
officerId='$this->officerId'
where classId='$this->classId'";
}
return $this->Dml($sql);
}
function Delete(){
//--ลบข้อมูลเดิมในอ๊อบเจ๊ก, เป็นการลบข้อมูลทีละ 1 เรคอร์ด
//--ต้องเรียกเมธอดตามลำดับดังนี้ SearchByKey()-->GetRecord()-->Delete()
return $this->Dml("delete from ClassAssessTmp where 1");
}
function GetNextCode(){
//--หาค่าสูงสุดของฟิลด์ที่ใช้เป็นคีย์ของตาราง ในลักษณะ auto increment
//--ต้องเป็นฟิลด์ชนิดตัวเลขจำนวนเต็มเท่านั้น และไม่ได้กำหนดรหัสเองทางจอภาพ
$this->SetQuery("select max(classId) as num from ClassAssessTmp");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSClassAssess(){
//--เมธอดที่ขึ้นต้นด้วย RS (ResultSet) มีความหมายว่าจะได้รับข้อมูลกลับมาจากการ select มากกว่า 1 เรคอร์ด
//--จะต้องเรียกเมธอด GetRecord() ด้วยเสมอ นำข้อมูลจาก ResultSet เข้าอ๊อบเจ๊ก
//--โดยสามารถเพิ่มเมธอดได้ตามต้องการ แต่ต้องขึ้นต้นด้วย RS
$this->SetQuery("select * from ClassAssessTmp order by classId");
}
function GetRecord(){
//--นำข้อมูลจาก ResultSet มากำหนดให้กับแอตทริบิวต์ของอ๊อบเจ็ก
//--เรียก GetRecord() หนึ่งครั้ง จะเลื่อนตัวชี้เรคอร์ดไปอีกหนึ่งเรคอร์ด
if ($this->result = $this->GetResult()) {
$this->classId = $this->result['classId'];
$this->programId = $this->result['programId'];
$this->acadYear = $this->result['acadYear'];
$this->semester = $this->result['semester'];
$this->studentYear = $this->result['studentYear'];
$this->courseId = $this->result['courseId'];
$this->sectionClass = $this->result['sectionClass'];
$this->section = $this->result['section'];
$this->totalSeat = $this->result['totalSeat'];
$this->enrollSeat = $this->result['enrollSeat'];
$this->classTime = $this->result['classTime'];
$this->officerId = $this->result['officerId'];
return 1;
}else {
return 0;
}
}
function GetRecordJoin(){
//--นำข้อมูลจาก ResultSet มากำหนดให้กับแอตทริบิวต์ของอ๊อบเจ็ก
//--เรียก GetRecord() หนึ่งครั้ง จะเลื่อนตัวชี้เรคอร์ดไปอีกหนึ่งเรคอร์ด
if ($this->result = $this->GetResult()) {
$this->classId = $this->result['classId'];
$this->programId = $this->result['programId'];
$this->acadYear = $this->result['acadYear'];
$this->semester = $this->result['semester'];
$this->studentYear = $this->result['studentYear'];
$this->courseId = $this->result['courseId'];
$this->sectionClass = $this->result['sectionClass'];
$this->section = $this->result['section'];
$this->totalSeat = $this->result['totalSeat'];
$this->enrollSeat = $this->result['enrollSeat'];
$this->classTime = $this->result['classTime'];
$this->officerId = $this->result['officerId'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
//--ค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select * from ClassAssessTmp where classId= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function DeleteAll(){
return $this->Dml("delete from ClassAssessTmp where 1");
}
function DeleteClassAssessByAcadSem($xacadYear,$xsemester){
return $this->Dml("delete from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester'");
}
function SearchClassIdByAcadSem($xacadYear,$xsemester){
if ($this->SetQuery("select classId from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester' order by classId")){
return 1;
}else {
return 0;
}
}
function SearchByAcadSem($xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester' order by classId")){
return 1;
}else {
return 0;
}
}
function SearchByCourseIdAcadSem($xcourseId,$xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp where courseId = '$xcourseId' and acadYear = '$xacadYear' and semester = '$xsemester' order by programId, studentYear, section, classId")){
return 1;
}else {
return 0;
}
}
function JoinSearchByCourseIdAcadSemGroupOfficerId($xcourseId,$xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp A, ClassInStructorAssessTmp B WHERE A.courseId = '$xcourseId' and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and A.classId = B.classId group by B.officerId")){
return 1;
}else {
return 0;
}
}
function JoinSearchByCourseIdAcadSemOfficerIdGroupClassId($xcourseId,$xacadYear,$xsemester,$xofficerId){
if ($this->SetQuery("select * from ClassAssessTmp A, ClassInStructorAssessTmp B WHERE A.courseId = '$xcourseId' and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and B.officerId = '$xofficerId' and A.classId = B.classId group by A.classId order by programId,studentYear,section")){
return 1;
}else {
return 0;
}
}
function JoinSearchByCourseIdAcadSemGroupClassId($xcourseId,$xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp A, ClassInStructorAssessTmp B WHERE A.courseId = '$xcourseId' and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and A.classId = B.classId group by A.classId order by programId,studentYear,section")){
return 1;
}else {
return 0;
}
}
function JoinSearchByCourseIdAcadSemSectionGroupClassIdProgramId($xcourseId,$xacadYear,$xsemester,$xsection){
if ($this->SetQuery("select * from ClassAssessTmp A, ClassInStructorAssessTmp B WHERE A.courseId = '$xcourseId' and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and A.classId = B.classId and A.section = '$xsection' group by A.classId, A.programId order by programId,studentYear,section")){
return 1;
}else {
return 0;
}
}
function SearchClassIdCourseIdByAcadSemOfficer($xacadYear,$xsemester,$xofficerId){
if ($this->SetQuery("select * From ClassAssessTmp A, ClassInStructorAssessTmp B where A.classId = B.classId and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and B.officerId = '$xofficerId' order by A.programId, A.courseId,A.studentYear,A.section")){
return 1;
}else {
return 0;
}
}
function SearchClassIdCourseIdByAcadSemOfficerGroupClassId($xacadYear,$xsemester,$xofficerId){
if ($this->SetQuery("select * From ClassAssessTmp A, ClassInStructorAssessTmp B where A.classId = B.classId and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and B.officerId = '$xofficerId' group by A.classId order by A.programId, A.courseId,A.studentYear,A.section ")){
return 1;
}else {
return 0;
}
}
// 8/11/2549
function SearchJoinByAcadSemOfficerSectionGroupClassId($xacadYear,$xsemester,$xofficerId,$xsection){
if ($this->SetQuery("select * From ClassAssessTmp A, ClassInStructorAssessTmp B where A.classId = B.classId and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and B.officerId = '$xofficerId' and A.section = '$xsection' group by A.classId order by A.programId, A.courseId,A.studentYear,A.section ")){
return 1;
}else {
return 0;
}
}
// 12/11/2549
function SearchJoinByAcadSemSectionGroupClassId($xacadYear,$xsemester,$xsection){
if ($this->SetQuery("select * From ClassAssessTmp A, ClassInStructorAssessTmp B where A.classId = B.classId and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and A.section = '$xsection' group by A.classId order by A.programId, A.courseId,A.studentYear,A.section ")){
return 1;
}else {
return 0;
}
}
function SearchCourseIdTeachByAcadSemOfficer($xacadYear,$xsemester,$xofficerId){
if ($this->SetQuery("select courseId From ClassAssessTmp A, ClassInStructorAssessTmp B where A.classId = B.classId and A.acadYear = '$xacadYear' and A.semester = '$xsemester' and B.officerId = '$xofficerId' order by A.courseId,A.section")){
return 1;
}else {
return 0;
}
}
function SearchByAcadSemGroupAndOrderByCourseId($xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester' group by courseId order by courseId")){
return 1;
}else {
return 0;
}
}
function SearchLimitJointClassCourseByAcadSemGroupAndOrderByCourseId($xacadYear,$xsemester,$xstart,$xpageSize){
if ($this->SetQuery("select * From ClassAssessTmp A, CourseAssess B where acadYear = '$xacadYear' and semester = '$xsemester' and A.courseId = B.courseId group by A.courseId order by courseCode limit $xstart, $xpageSize")){
return 1;
}else {
return 0;
}
}
function CountClassIdAtAcadSem($xacadYear,$xsemester){
$this->SetQuery("select count(*) as num from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester'");
$result = $this->GetResult();
return $result['num'];
}
function SearchLimitPageByAcadSem($xacadYear,$xsemester,$xstart, $xpageSize){
$this->SetQuery("select * from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester' order by programId, studentYear, section limit $xstart, $xpageSize");
}
function SearchJoinClassCISByCourseIdGroupOfficerId($xcourseId){
$this->SetQuery("select * from ClassAssessTmp A, ClassInStructorAssessTmp B WHERE A.classId = B.classId and A.courseId = '$xcourseId' group by B.officerId");
}
// closeDate
function RSClassAssessByAcYAndSeAndOfIdGroupCoId($acY, $se, $ofId){
$this->SetQuery("select cl.courseId from ClassAssessTmp cl, ClassInStructorAssessTmp ci
where cl.acadYear='$acY' and cl.semester='$se' and cl.classId=ci.classId
and ci.officerId='$ofId' group by cl.courseId");
}
// หารายวิชาที่รับผิดชอบส่งเกรด
function SearchClassIdByAcadSemOfficerGroupClassId($xacadYear,$xsemester,$xofficerId){
if ($this->SetQuery("select * From ClassAssessTmp
where acadYear = '$xacadYear'
and semester = '$xsemester'
and officerId = '$xofficerId'
order by studentYear , courseId,section")){
return 1;
}else {
return 0;
}
}
function SearchByAcadSemOrderByCourseIdSection($xacadYear,$xsemester){
if ($this->SetQuery("select * from ClassAssessTmp where acadYear = '$xacadYear' and semester = '$xsemester' order by courseId ,section")){
return 1;
}else {
return 0;
}
}
} //--End class ClassAssessTmp--
?>
|