Viewing file: clsProgram.php (5.83 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class Program--------------------------
//--PK of Program ::
// 1. programId
class Program extends clsDB{
var $result;
var $programId;
var $programCode;
var $programYear;
var $degreeId;
var $levelId;
var $programName;
var $programNameEng;
var $programAbbr;
var $programAbbrEng;
var $creditTotal;
var $description;
var $descriptionEng;
var $studyYearMax;
var $gradePointMin;
var $createDateTime;
var $createUserId;
var $updateDateTime;
var $updateUserId;
var $semesterPerYear;
var $programStatus;
var $studyYear;
var $programConfId;
function Program(&$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->programId=$this->GetNextCode();
$sql = "insert into Program values(
'$this->programId',
'$this->programCode',
'$this->programYear',
'$this->degreeId',
'$this->levelId',
'$this->programName',
'$this->programNameEng',
'$this->programAbbr',
'$this->programAbbrEng',
'$this->creditTotal',
'$this->description',
'$this->descriptionEng',
'$this->studyYearMax',
'$this->gradePointMin',
'$this->createDateTime',
'$this->createUserId',
'$this->updateDateTime',
'$this->updateUserId',
'$this->semesterPerYear',
'$this->programStatus',
'$this->studyYear',
'$this->programConfId'
)";
}else {
$sql = "update Program set
programCode='$this->programCode',
programYear='$this->programYear',
degreeId='$this->degreeId',
levelId='$this->levelId',
programName='$this->programName',
programNameEng='$this->programNameEng',
programAbbr='$this->programAbbr',
programAbbrEng='$this->programAbbrEng',
creditTotal='$this->creditTotal',
description='$this->description',
descriptionEng='$this->descriptionEng',
studyYearMax='$this->studyYearMax',
gradePointMin='$this->gradePointMin',
createDateTime='$this->createDateTime',
createUserId='$this->createUserId',
updateDateTime='$this->updateDateTime',
updateUserId='$this->updateUserId',
semesterPerYear='$this->semesterPerYear',
programStatus='$this->programStatus',
studyYear='$this->studyYear',
programConfId='$this->programConfId'
where programId='$this->programId'";
}
return $this->Dml($sql);
}
function Delete(){
//--??????????????????????, ??????????????????? 1 ???????
//--???????????????????????????? SearchByKey()-->GetRecord()-->Delete()
return $this->Dml("delete from Program where programId='$this->programId'");
}
function GetNextCode(){
//--????????????????????????????????????????? ???????? auto increment
//--???????????????????????????????????????? ?????????????????????????????
$this->SetQuery("select max(programId) as num from Program");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSProgram(){
//--??????????????????? RS (ResultSet) ??????????????????????????????????????? select ??????? 1 ???????
//--???????????????? GetRecord() ???????? ??????????? ResultSet ????????????
//--???????????????????????????????? ?????????????????? RS
$this->SetQuery("select * from Program order by programId");
}
function GetRecord(){
//--??????????? ResultSet ???????????????????????????????????
//--????? GetRecord() ?????????? ??????????????????????????????????????
if ($this->result = $this->GetResult()) {
$this->programId = $this->result['programId'];
$this->programCode = $this->result['programCode'];
$this->programYear = $this->result['programYear'];
$this->degreeId = $this->result['degreeId'];
$this->levelId = $this->result['levelId'];
$this->programName = $this->result['programName'];
$this->programNameEng = $this->result['programNameEng'];
$this->programAbbr = $this->result['programAbbr'];
$this->programAbbrEng = $this->result['programAbbrEng'];
$this->creditTotal = $this->result['creditTotal'];
$this->description = $this->result['description'];
$this->descriptionEng = $this->result['descriptionEng'];
$this->studyYearMax = $this->result['studyYearMax'];
$this->gradePointMin = $this->result['gradePointMin'];
$this->createDateTime = $this->result['createDateTime'];
$this->createUserId = $this->result['createUserId'];
$this->updateDateTime = $this->result['updateDateTime'];
$this->updateUserId = $this->result['updateUserId'];
$this->semesterPerYear = $this->result['semesterPerYear'];
$this->programStatus = $this->result['programStatus'];
$this->studyYear = $this->result['studyYear'];
$this->programConfId = $this->result['programConfId'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
//--?????????????? PK ??????????????????????? ??????????????????? GetRecord() ????
if ($this->SetQuery("select * from Program where programId= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function RSProgramName($xKey){
//--??????????????????? RS (ResultSet) ??????????????????????????????????????? select ??????? 1 ???????
//--???????????????? GetRecord() ???????? ??????????? ResultSet ????????????
//--???????????????????????????????? ?????????????????? RS
$this->SetQuery("select * from Program where programName LIKE '$xKey%' order by programId");
}
function RSProgramLimit($xKey,$yKey,$zKey){
//--??????????????????? RS (ResultSet) ??????????????????????????????????????? select ??????? 1 ???????
//--???????????????? GetRecord() ???????? ??????????? ResultSet ????????????
//--???????????????????????????????? ?????????????????? RS
$this->SetQuery("select * from Program where programName LIKE '$zKey%' limit $xKey,$yKey");
}
} //--End class Program--
?>
|