Viewing file: clsrg_TimeTable.php (19.65 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class rg_TimeTable--------------------------
include_once "clsbase_rg_TimeTable.php";
class rg_TimeTable extends base_rg_TimeTable{
function RSrg_TimeTableByAcYAndAcYWeekNoAndDyIdAndFrPrAndToPr($acY, $acYWeekNo, $dyId, $frPr, $toPr){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttToPr>=$frPr and ttFrPr<=$toPr");
}
function GetCountOVLByAcYAndRmIdAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdAndFrPrAndToPr($acY, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr){
$this->SetQuery("select sum(numOvl) as num from (
select count(*) as numOvl from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId='$rmId' and ttEpMepId is null and ttEpSepId is null
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ($frPr between ttFrPr and ttToPr or ttFrPr between $frPr and $toPr)
union
select count(*) as numOvl from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId is null and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ($frPr between ttFrPr and ttToPr or ttFrPr between $frPr and $toPr)
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_TimeTableByAcYAndRmIdAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdAndFrPrAndToPr($acY, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId='$rmId' and ttEpMepId is null and ttEpSepId is null
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ($frPr between ttFrPr and ttToPr or ttFrPr between $frPr and $toPr)
union
select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId is null and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ($frPr between ttFrPr and ttToPr or ttFrPr between $frPr and $toPr)");
}
function RSrg_TimeTableByAll($clId, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr, $sstId, $title){
$this->SetQuery("select * from rg_TimeTable
where ttClId='$clId' and ttRmId='$rmId' and ttEpMepId is null and ttEpSepId is null
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttSstId='$sstId' and ttTitle='$title'
union
select * from rg_TimeTable
where ttClId='$clId' and ttRmId is null and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttSstId='$sstId' and ttTitle='$title'");
}
function SearchByAll($clId, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr, $ofId, $sstId){
$this->SetQuery("select * from rg_TimeTable
where ttClId='$clId' and ttRmId='$rmId' and ttEpMepId is null and ttEpSepId is null
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttOfId='$ofId' and ttSstId='$sstId'
union
select * from rg_TimeTable
where ttClId='$clId' and ttRmId is null and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttOfId='$ofId' and ttSstId='$sstId'");
}
function SearchByAllAndNotId($clId, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr, $ofId, $sstId, $id){
$this->SetQuery("select * from rg_TimeTable
where ttClId='$clId' and ttRmId='$rmId' and ttEpMepId is null and ttEpSepId is null
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttOfId='$ofId' and ttSstId='$sstId' and ttId<>'$id'
union
select * from rg_TimeTable
where ttClId='$clId' and ttRmId is null and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
and ttFrPr='$frPr' and ttToPr='$toPr'
and ttOfId='$ofId' and ttSstId='$sstId' and ttId<>'$id'");
}
function GetCountIdByAcYAndPgIdStrAndStYAndAcYWeekNoAndDyId($acY, $pgIdStr, $stY, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY'
and programId".$pgIdStr." and studentYear='$stY' and c.classId=t.ttClId
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndRmIdAndAcYWeekNoAndDyId($acY, $rmId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId='$rmId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyId($acY, $epMepId, $epSepId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndOfIdAndAcYWeekNoAndDyId($acY, $ofId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttOfId='$ofId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndCoIdAndDyId($acY, $coId, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY'
and courseId='$coId' and c.classId=t.ttClId
and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndCoIdAndClIdAndDyId($acY, $coId, $clId, $dyId){
$this->SetQuery("select count(*) as num from Class c, rg_TimeTable t
where acadYear='$acY'
and courseId='$coId' and classId='$clId' and c.classId=t.ttClId
and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByStIdAndAcYAndAcYWeekNoAndDyId($stId, $acY, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from EnrollItem e, rg_TimeTable t
where studentId='$stId' and acadYear='$acY' and e.classId=t.ttClId
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndPgIdStrAndStYAndAcYWeekNoAndDyId($acY, $pgIdStr, $stY, $acYWeekNo, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where acadYear='$acY' and programId".$pgIdStr." and studentYear='$stY' and c.classId=t.ttClId
) as t2 on t1.ttWdAcYWeekNo=t2.ttWdAcYWeekNo and t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and programId".$pgIdStr." and studentYear='$stY'
and t1.ttWdAcYWeekNo='$acYWeekNo' and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndRmIdAndAcYWeekNoAndDyId($acY, $rmId, $acYWeekNo, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
) as t2 on t1.ttRmId=t2.ttRmId
and t1.ttWdAcYWeekNo=t2.ttWdAcYWeekNo and t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and t1.ttRmId='$rmId'
and t1.ttWdAcYWeekNo='$acYWeekNo' and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyId($acY, $epMepId, $epSepId, $acYWeekNo, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
) as t2 on t1.ttEpMepId=t2.ttEpMepId and t1.ttEpSepId=t2.ttEpSepId
and t1.ttWdAcYWeekNo=t2.ttWdAcYWeekNo and t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and t1.ttEpMepId='$epMepId' and t1.ttEpSepId='$epSepId'
and t1.ttWdAcYWeekNo='$acYWeekNo' and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndOfIdAndAcYWeekNoAndDyId($acY, $ofId, $acYWeekNo, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
) as t2 on t1.ttOfId=t2.ttOfId
and t1.ttWdAcYWeekNo=t2.ttWdAcYWeekNo and t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and t1.ttOfId='$ofId'
and t1.ttWdAcYWeekNo='$acYWeekNo' and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndCoIdAndDyId($acY, $coId, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where acadYear='$acY' and courseId='$coId' and c.classId=t.ttClId
) as t2 on t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and courseId='$coId'
and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndCoIdAndClIdAndDyId($acY, $coId, $clId, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from Class c
inner join rg_TimeTable t1 on c.classId=t1.ttClId
inner join (select t.*
from Class c, rg_TimeTable t
where courseId='$coId' and classId='$clId' and c.classId=t.ttClId
) as t2 on t1.ttDyId=t2.ttDyId
where acadYear='$acY'
and courseId='$coId' and classId='$clId'
and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByStIdAndAcYAndAcYWeekNoAndDyId($stId, $acY, $acYWeekNo, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttId, count(*) as numOvl
from EnrollItem e
inner join rg_TimeTable t1 on e.classId=t1.ttClId
inner join (select t.*
from EnrollItem e, rg_TimeTable t
where studentId='$stId' and acadYear='$acY' and e.classId=t.ttClId
) as t2 on t1.ttWdAcYWeekNo=t2.ttWdAcYWeekNo and t1.ttDyId=t2.ttDyId
where studentId='$stId' and acadYear='$acY'
and t1.ttWdAcYWeekNo='$acYWeekNo' and t1.ttDyId='$dyId'
and t1.ttFrPr between t2.ttFrPr and t2.ttToPr
group by t1.ttId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_TimeTableByAcYAndPgIdStrAndStYAndAcYWeekNoAndDyIdOrderId($acY, $pgIdStr, $stY, $acYWeekNo, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY'
and programId".$pgIdStr." and studentYear='$stY' and c.classId=t.ttClId
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndRmIdAndAcYWeekNoAndDyIdOrderId($acY, $rmId, $acYWeekNo, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttRmId='$rmId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdOrderId($acY, $epMepId, $epSepId, $acYWeekNo, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttEpMepId='$epMepId' and ttEpSepId='$epSepId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndOfIdAndAcYWeekNoAndDyIdOrderId($acY, $ofId, $acYWeekNo, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY' and c.classId=t.ttClId
and ttOfId='$ofId'
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndCoIdAndDyIdOrderId($acY, $coId, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY'
and courseId='$coId' and c.classId=t.ttClId
and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndCoIdAndClIdAndDyIdOrderId($acY, $coId, $clId, $dyId){
$this->SetQuery("select * from Class c, rg_TimeTable t
where acadYear='$acY'
and courseId='$coId' and classId='$clId' and c.classId=t.ttClId
and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByStIdAndAcYAndAcYWeekNoAndDyIdOrderId($stId, $acY, $acYWeekNo, $dyId){
$this->SetQuery("select * from EnrollItem e, rg_TimeTable t
where studentId='$stId' and acadYear='$acY' and e.classId=t.ttClId
and ttWdAcYWeekNo='$acYWeekNo' and ttDyId='$dyId'
order by ttId");
}
function RSrg_TimeTableByAcYAndSeAndCrsCodeAndCrsNameGroupClIdOrderPgId($acY, $se, $crsCode, $crsName){
$this->SetQuery("select ttClId from Class cl, Course co, rg_TimeTable t
where acadYear='$acY' and semester='$se' and cl.courseId=co.courseId
and courseCode like '%$crsCode%' and courseName like '%$crsName%' and cl.classId=t.ttClId
group by ttClId order by programId");
}
function RSrg_TimeTableByAcYAndSeAndOfIdGroupClIdOrderPgId($acY, $se, $ofId){
$this->SetQuery("select ttClId from Class c, rg_TimeTable t
where acadYear='$acY' and semester='$se' and c.classId=t.ttClId and ttOfId='$ofId'
group by ttClId order by programId");
}
function RSrg_TimeTableByClIdGroupOfId($clId){
$this->SetQuery("select ttOfId from rg_TimeTable where ttClId='$clId' group by ttOfId");
}
function RSrg_TimeTableByClIdStrGroupOfId($clIdStr){
$this->SetQuery("select ttOfId from rg_TimeTable where ttClId in ($clIdStr) group by ttOfId");
}
function GetSumHrByClId($clId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from rg_TimeTable
where ttClId='$clId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByClIdAndSstId($clId, $sstId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from rg_TimeTable
where ttClId='$clId' and ttSstId='$sstId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByOfIdAndClId($ofId, $clId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from rg_TimeTable
where ttOfId='$ofId' and ttClId='$clId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByOfIdAndClIdAndSstId($ofId, $clId, $sstId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from rg_TimeTable
where ttOfId='$ofId' and ttClId='$clId' and ttSstId='$sstId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByAcYAndSeAndCrsCodeAndCrsName($acY, $se, $crsCode, $crsName){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from Class cl, Course co, rg_TimeTable t
where acadYear='$acY' and semester='$se' and cl.courseId=co.courseId
and courseCode like '%$crsCode%' and courseName like '%$crsName%' and cl.classId=t.ttClId");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByAcYAndSeAndCrsCodeAndCrsNameAndSstId($acY, $se, $crsCode, $crsName, $sstId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from Class cl, Course co, rg_TimeTable t
where acadYear='$acY' and semester='$se' and cl.courseId=co.courseId
and courseCode like '%$crsCode%' and courseName like '%$crsName%' and cl.classId=t.ttClId
and ttSstId='$sstId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByAcYAndSeAndOfId($acY, $se, $ofId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from Class c, rg_TimeTable t
where acadYear='$acY' and semester='$se' and c.classId=t.ttClId
and ttOfId='$ofId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetSumHrByAcYAndSeAndOfIdAndSstId($acY, $se, $ofId, $sstId){
$this->SetQuery("select sum(ttToPr - ttFrPr + 1) as num from Class c, rg_TimeTable t
where acadYear='$acY' and semester='$se' and c.classId=t.ttClId
and ttOfId='$ofId' and ttSstId='$sstId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_TimeTableByAcY($acY){
$this->SetQuery("select * from Class c, rg_TimeTable t where acadYear='$acY' and c.classId=t.ttClId");
}
function RSrg_TimeTableByClIdOrderAcYWeekNoDyIdFrPr($clId){
$this->SetQuery("select * from rg_TimeTable
where ttClId='$clId'
order by ttWdAcYWeekNo, ttDyId, ttFrPr");
}
function RSrg_TimeTableByClIdGroupAllOrderAcYWeekNoDyIdFrPr($clId){
$this->SetQuery("select ttRmId, ttEpMepId, ttEpSepId, ttWdAcYWeekNo, ttDyId, ttFrPr, ttToPr, ttSstId, ttTitle,
count(ttOfId) as ttOfId from rg_TimeTable
where ttClId='$clId'
group by ttRmId, ttEpMepId, ttEpSepId, ttWdAcYWeekNo, ttDyId, ttFrPr, ttToPr, ttSstId, ttTitle
order by ttWdAcYWeekNo, ttDyId, ttFrPr");
}
function RSrg_TimeTableByAcYAndCoIdGroupAllOrderAcYWeekNoDyIdFrPr($acY, $coId){
$this->SetQuery("select ttClId, ttRmId, ttEpMepId, ttEpSepId, ttWdAcYWeekNo, ttDyId, ttFrPr, ttToPr, ttSstId, ttTitle,
count(ttOfId) as ttOfId from Class c, rg_TimeTable t
where acadYear='$acY' and courseId='$coId' and c.classId=t.ttClId
group by ttClId, ttRmId, ttEpMepId, ttEpSepId, ttWdAcYWeekNo, ttDyId, ttFrPr, ttToPr, ttSstId, ttTitle
order by ttWdAcYWeekNo, ttDyId, ttFrPr, cast(section as signed)");
}
function RSGetLastInsertId(){
$this->SetQuery("select last_insert_id() as num");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
// ***** Start TEACHINGWORKLOAD *****
function RSrg_TimeTableByAcYAndSe($acY, $se){
$this->SetQuery("select t.* from rg_CourseOpen c, rg_TimeTable t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttCoId");
}
// ***** End TEACHINGWORKLOAD *****
} //--End class rg_TimeTable--
?>
|