Viewing file: clsrg_CopyTimeTable.php (33.6 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class rg_CopyTimeTable--------------------------
include_once "clsbase_rg_CopyTimeTable.php";
class rg_CopyTimeTable extends base_rg_CopyTimeTable{
function RSrg_CopyTimeTableByAcYAndSe($acY, $se){
$this->SetQuery("select t.* from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttcCoId");
}
function RSrg_CopyTimeTableByAcYAndSeAndTtIdIsNotNull($acY, $se){
$this->SetQuery("select t.* from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttcCoId
and ttcTtId is not null");
}
function RSrg_CopyTimeTableByAcYAndSeAndConfirmIsY($acY, $se){
$this->SetQuery("select t.* from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttcCoId
and ttcConfirm='Y'");
}
function RSrg_CopyTimeTableByAcYAndSeAndSstIdGroupClId($acY, $se, $sstId){
$this->SetQuery("select ttcCoId from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttcCoId
and ttcStId='$sstId' group by ttcCoId");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeGroupOfId($acY, $stY, $se){
$this->SetQuery("select ttcPrsId from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se."
and c.coId=t.ttcCoId group by ttcPrsId");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdGroupOfId($acY, $stY, $se, $coId){
$this->SetQuery("select ttcPrsId from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se." and coCrsId='$coId'
and c.coId=t.ttcCoId group by ttcPrsId");
}
function RSrg_CopyTimeTableByClIdAndLtId($clId, $ltId){
$this->SetQuery("select * from rg_TimeTableCopy where ttcCoId='$clId' and ttcLtId='$ltId'");
}
function RSrg_CopyTimeTableByClIdAndSstId($clId, $sstId){
$this->SetQuery("select * from rg_TimeTableCopy where ttcCoId='$clId' and ttcStId='$sstId'");
}
function RSrg_CopyTimeTableByClIdAndSstIdGroupClId($clId, $sstId){
$this->SetQuery("select ttcCoId from rg_TimeTableCopy where ttcCoId='$clId' and ttcStId='$sstId' group by ttcCoId");
}
function RSrg_CopyTimeTableByAcYAndSeAndLtId($acY, $se, $ltId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coTmId='$se' and c.coId=t.ttcCoId
and ttcLtId='$ltId'");
}
function GetCountOVLByAcYAndRmIdAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdAndFrPrAndToPr($acY, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr){
$this->SetQuery("select sum(numOvl) as num from (
select count(*) as numOvl from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId='$rmId' and ttcEtpMepId is null and ttcEtpSepId is null
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ($frPr between ttcPrdFrTime and ttcPrdToTime or ttcPrdFrTime between $frPr and $toPr)
union
select count(*) as numOvl from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId is null and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ($frPr between ttcPrdFrTime and ttcPrdToTime or ttcPrdFrTime between $frPr and $toPr)
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_CopyTimeTableByAcYAndRmIdAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdAndFrPrAndToPr($acY, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId='$rmId' and ttcEtpMepId is null and ttcEtpSepId is null
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ($frPr between ttcPrdFrTime and ttcPrdToTime or ttcPrdFrTime between $frPr and $toPr)
union
select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId is null and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ($frPr between ttcPrdFrTime and ttcPrdToTime or ttcPrdFrTime between $frPr and $toPr)");
}
function SearchByAll($clId, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr, $ofId, $sstId){
$this->SetQuery("select * from rg_TimeTableCopy
where ttcCoId='$clId' and ttcRmId='$rmId' and ttcEtpMepId is null and ttcEtpSepId is null
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ttcPrdFrTime='$frPr' and ttcPrdToTime='$toPr'
and ttcPrsId='$ofId' and ttcStId='$sstId'
union
select * from rg_TimeTableCopy
where ttcCoId='$clId' and ttcRmId is null and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ttcPrdFrTime='$frPr' and ttcPrdToTime='$toPr'
and ttcPrsId='$ofId' and ttcStId='$sstId'");
}
function SearchByAllAndNotId($clId, $rmId, $epMepId, $epSepId, $acYWeekNo, $dyId, $frPr, $toPr, $ofId, $sstId, $id){
$this->SetQuery("select * from rg_TimeTableCopy
where ttcCoId='$clId' and ttcRmId='$rmId' and ttcEtpMepId is null and ttcEtpSepId is null
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ttcPrdFrTime='$frPr' and ttcPrdToTime='$toPr'
and ttcPrsId='$ofId' and ttcStId='$sstId' and ttcId<>'$id'
union
select * from rg_TimeTableCopy
where ttcCoId='$clId' and ttcRmId is null and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
and ttcPrdFrTime='$frPr' and ttcPrdToTime='$toPr'
and ttcPrsId='$ofId' and ttcStId='$sstId' and ttcId<>'$id'");
}
function GetCountIdByAcYAndPgIdStrAndStYAndAcYWeekNoAndDyId($acY, $pgIdStr, $stY, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCurId".$pgIdStr." and coSyId='$stY' and c.coId=t.ttcCoId
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndRmIdAndAcYWeekNoAndDyId($acY, $rmId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId='$rmId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyId($acY, $epMepId, $epSepId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndOfIdAndAcYWeekNoAndDyId($acY, $ofId, $acYWeekNo, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcPrsId='$ofId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndCoIdAndDyId($acY, $coId, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCrsId='$coId' and c.coId=t.ttcCoId
and ttcDyId='$dyId'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetCountIdByAcYAndCoIdAndClIdAndDyId($acY, $coId, $clId, $dyId){
$this->SetQuery("select count(*) as num from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCrsId='$coId' and coId='$clId' and c.coId=t.ttcCoId
and ttcDyId='$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.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coCurId".$pgIdStr." and coSyId='$stY' and c.coId=t.ttcCoId
) as t2 on t1.ttcWdAcYWeekNo=t2.ttcWdAcYWeekNo and t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and coCurId".$pgIdStr." and coSyId='$stY'
and t1.ttcWdAcYWeekNo='$acYWeekNo' and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) 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.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
) as t2 on t1.ttcRmId=t2.ttcRmId
and t1.ttcWdAcYWeekNo=t2.ttcWdAcYWeekNo and t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and t1.ttcRmId='$rmId'
and t1.ttcWdAcYWeekNo='$acYWeekNo' and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) 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.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
) as t2 on t1.ttcEtpMepId=t2.ttcEtpMepId and t1.ttcEtpSepId=t2.ttcEtpSepId
and t1.ttcWdAcYWeekNo=t2.ttcWdAcYWeekNo and t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and t1.ttcEtpMepId='$epMepId' and t1.ttcEtpSepId='$epSepId'
and t1.ttcWdAcYWeekNo='$acYWeekNo' and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) 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.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
) as t2 on t1.ttcPrsId=t2.ttcPrsId
and t1.ttcWdAcYWeekNo=t2.ttcWdAcYWeekNo and t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and t1.ttcPrsId='$ofId'
and t1.ttcWdAcYWeekNo='$acYWeekNo' and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function GetMaxOVLByAcYAndCoIdAndDyId($acY, $coId, $dyId){
$this->SetQuery("select max(numOvl) as num
from (select t1.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and coCrsId='$coId' and c.coId=t.ttcCoId
) as t2 on t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and coCrsId='$coId'
and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) 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.ttcId, count(*) as numOvl
from rg_CourseOpen c
inner join rg_TimeTableCopy t1 on c.coId=t1.ttcCoId
inner join (select t.*
from rg_CourseOpen c, rg_TimeTableCopy t
where coCrsId='$coId' and coId='$clId' and c.coId=t.ttcCoId
) as t2 on t1.ttcDyId=t2.ttcDyId
where coAcY='$acY'
and coCrsId='$coId' and coId='$clId'
and t1.ttcDyId='$dyId'
and t1.ttcPrdFrTime between t2.ttcPrdFrTime and t2.ttcPrdToTime
group by t1.ttcId
) as tt");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_CopyTimeTableByAcYAndPgIdStrAndStYAndAcYWeekNoAndDyIdOrderId($acY, $pgIdStr, $stY, $acYWeekNo, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCurId".$pgIdStr." and coSyId='$stY' and c.coId=t.ttcCoId
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByAcYAndRmIdAndAcYWeekNoAndDyIdOrderId($acY, $rmId, $acYWeekNo, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcRmId='$rmId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByAcYAndEpMepIdAndEpSepIdAndAcYWeekNoAndDyIdOrderId($acY, $epMepId, $epSepId, $acYWeekNo, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcEtpMepId='$epMepId' and ttcEtpSepId='$epSepId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByAcYAndOfIdAndAcYWeekNoAndDyIdOrderId($acY, $ofId, $acYWeekNo, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY' and c.coId=t.ttcCoId
and ttcPrsId='$ofId'
and ttcWdAcYWeekNo='$acYWeekNo' and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByAcYAndCoIdAndDyIdOrderId($acY, $coId, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCrsId='$coId' and c.coId=t.ttcCoId
and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByAcYAndCoIdAndClIdAndDyIdOrderId($acY, $coId, $clId, $dyId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'
and coCrsId='$coId' and coId='$clId' and c.coId=t.ttcCoId
and ttcDyId='$dyId'
order by ttcId");
}
function RSrg_CopyTimeTableByClIdOrderAcYWeekNoDyIdFrPr($clId){
$this->SetQuery("select * from rg_TimeTableCopy where ttcCoId='$clId' order by ttcWdAcYWeekNo, ttcDyId, ttcPrdFrTime");
}
function GetTimeBySec($sec) {
$this->SetQuery("select sec_to_time($sec) as num");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSrg_CopyTimeTableByAcYAndStYAndSe($acY, $stY, $se){
$this->SetQuery("select t.* from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se."
and c.coId=t.ttcCoId");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndSstId($acY, $stY, $se, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se."
and c.coId=t.ttcCoId and ttcStId='$sstId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNull($acY, $stY, $se, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se'
and c.coId=t.ttcCoId and ttcStId='$sstId'
and ttcLtId is null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNotNull($acY, $stY, $se, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se'
and c.coId=t.ttcCoId and ttcStId='$sstId'
and ttcLtId is not null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndOfId($acY, $stY, $se, $ofId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se."
and c.coId=t.ttcCoId and ttcPrsId='$ofId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstId($acY, $stY, $se, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se."
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, $se, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se'
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'
and ttcLtId is null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, $se, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se'
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'
and ttcLtId is not null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoId($acY, $stY, $se, $coId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se." and coCrsId='$coId'
and c.coId=t.ttcCoId");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstId($acY, $stY, $se, $coId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se." and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcStId='$sstId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNull($acY, $stY, $se, $coId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se' and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcStId='$sstId'
and ttcLtId is null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNotNull($acY, $stY, $se, $coId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se' and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcStId='$sstId'
and ttcLtId is not null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfId($acY, $stY, $se, $coId, $ofId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se." and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcPrsId='$ofId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acY, $stY, $se, $coId, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY.$se." and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, $se, $coId, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se' and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'
and ttcLtId is null");
}
function RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, $se, $coId, $ofId, $sstId){
$this->SetQuery("select * from rg_CourseOpen c, rg_TimeTableCopy t
where coAcY='$acY'".$stY." and coTmId='$se' and coCrsId='$coId'
and c.coId=t.ttcCoId and ttcPrsId='$ofId' and ttcStId='$sstId'
and ttcLtId is not null");
}
function GetHrByAcYAndStYAndSe($acY, $stY, $se){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSe($acY, $stY, $se);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndSstId($acY, $stY, $se, $sstId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstId($acY, $stY, $se, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndOfId($acY, $stY, $se, $ofId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfId($acY, $stY, $se, $ofId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndOfIdAndSstId($acY, $stY, $se, $ofId, $sstId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstId($acY, $stY, $se, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndCoId($acY, $stY, $se, $coId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoId($acY, $stY, $se, $coId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndCoIdAndSstId($acY, $stY, $se, $coId, $sstId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstId($acY, $stY, $se, $coId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndCoIdAndOfId($acY, $stY, $se, $coId, $ofId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfId($acY, $stY, $se, $coId, $ofId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetHrByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acY, $stY, $se, $coId, $ofId, $sstId){
include_once "clsPeriod.php";
$oPr = new Period();
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acY, $stY, $se, $coId, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
return $this->GetTimeBySec($sec);
}
function GetUnitByAcYAndStYAndSeAndSstId($acY, $stY, $se, $sstId) {
include_once "clsrg_HrPerUnit.php";
include_once "clsPeriod.php";
$oHu = new rg_HrPerUnit();
$oPr = new Period();
$unit = 0;
if(!$se || $se==1) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 1, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNull($acY, $stY, 1, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNotNull($acY, $stY, 1, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 1, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==2) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 2, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNull($acY, $stY, 2, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNotNull($acY, $stY, 2, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 2, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==3) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 3, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNull($acY, $stY, 3, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndSstIdAndLtIdIsNotNull($acY, $stY, 3, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 3, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
return $unit;
}
function GetUnitByAcYAndStYAndSeAndOfIdAndSstId($acY, $stY, $se, $ofId, $sstId) {
include_once "clsrg_HrPerUnit.php";
include_once "clsPeriod.php";
$oHu = new rg_HrPerUnit();
$oPr = new Period();
$unit = 0;
if(!$se || $se==1) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 1, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 1, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 1, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 1, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==2) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 2, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 2, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 2, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 2, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==3) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 3, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 3, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 3, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 3, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
return $unit;
}
function GetUnitByAcYAndStYAndSeAndCoIdAndSstId($acY, $stY, $se, $coId, $sstId) {
include_once "clsrg_HrPerUnit.php";
include_once "clsPeriod.php";
$oHu = new rg_HrPerUnit();
$oPr = new Period();
$unit = 0;
if(!$se || $se==1) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 1, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNull($acY, $stY, 1, $coId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNotNull($acY, $stY, 1, $coId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 1, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==2) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 2, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNull($acY, $stY, 2, $coId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNotNull($acY, $stY, 2, $coId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 2, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==3) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 3, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNull($acY, $stY, 3, $coId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndSstIdAndLtIdIsNotNull($acY, $stY, 3, $coId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 3, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
return $unit;
}
function GetUnitByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acY, $stY, $se, $coId, $ofId, $sstId) {
include_once "clsrg_HrPerUnit.php";
include_once "clsPeriod.php";
$oHu = new rg_HrPerUnit();
$oPr = new Period();
$unit = 0;
if(!$se || $se==1) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 1, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 1, $coId, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 1, $coId, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 1, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==2) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 2, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 2, $coId, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 2, $coId, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 2, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
if(!$se || $se==3) {
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($acY, 3, $sstId);
if($oHu->GetRecord()) {
$sec = 0;
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNull($acY, $stY, 3, $coId, $ofId, $sstId);
while($this->GetRecord()) {
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
}
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
$this->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdAndOfIdAndSstIdAndLtIdIsNotNull($acY, $stY, 3, $coId, $ofId, $sstId);
while($this->GetRecord()) {
$sec = 0;
for($i=$this->ctFrPr; $i<=$this->ctToPr; $i++)
$sec += $oPr->GetSecByPr($i);
$oHu->SearchByKey($acY, 3, $this->ctLtId);
$oHu->GetRecord();
$unit += (($sec / 3600) * $oHu->huUnit) / $oHu->huHr;
}
}
return $unit;
}
} //--End class rg_CopyTimeTable--
?>
|