Viewing file: clsEsa_ResultTQPj.php (2.61 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class ResultTQPj extends clsDB{
var $result;
var $rsTQPjid;
var $doPjid;
var $sectionTQid;
var $TQid;
var $comment;
function ResultTQPj(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function GetNextCode(){
$this->SetQuery("select max(rsTQPjid) as num from ea_ResultTQPj");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function Save(){
//--ข้อมูลในอ๊อบเจ๊กเป็นข้อมูลใหม่หรือข้อมูลเดิม --1:ข้อมูลใหม่ 2:ข้อมูลเดิม
if ($this->status==1){
//uncomment a line below if your table use ID as running number
$this->resultTQid=$this->GetNextCode();
$sql = "insert into ea_ResultTQPj values(
'$this->rsTQPjid',
'$this->doPjid',
'$this->sectionTQid',
'$this->TQid',
'$this->comment'
)";
}else {
$sql = "update ea_ResultTQPj set
doPjid='$this->doPjid',
sectionTQid='$this->sectionTQid',
TQid='$this->TQid',
comment='$this->comment'
where rsTQPjid='$this->rsTQPjid'";
}
return $this->Dml($sql);
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->rsTQPjid = $this->result['rsTQPjid'];
$this->doPjid = $this->result['doPjid'];
$this->sectionRQid = $this->result['sectionRQid'];
$this->TQid = $this->result['TQid'];
$this->comment = $this->result['comment'];
return 1;
}else {
return 0;
}
}
function RSComment($acadYear, $semester, $assid, $defineid, $pjid, $stdid='%'){
$cond = '';
$cond.= ($defineid!='%')? " AND df.defineid = $defineid" : '' ;
$cond.= ($pjid!='%')? " AND da.pjId = $pjid" : '' ;
$cond.= ($stdid!='%')? " AND da.stdId = $stdid" : '' ;
// $cond.= "AND comment NOT IN ('-','--','_',' ')";
$sql = "
SELECT distinct comment
FROM DefineAssessment df
INNER JOIN ea_DoProject da ON df.defineid = da.defineid
INNER JOIN ea_ResultTQPj rtq ON rtq.doPjid = da.doPjid
WHERE df.acadYear = '$acadYear'
AND df.semester = '$semester'
AND df.assid = '$assid'
$cond
";
if ($this->SetQuery($sql)){
return 1;
}else {
return 0;
}
}
}
?>
|