Viewing file: clsEsa_ResultRQPj.php (4.64 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class ResultRQPj extends clsDB{
var $result;
var $rsRQPjid;
var $doPjid;
var $sectionRQid;
var $RQid;
var $point;
var $xbar;
var $sd;
var $section;
var $per;
var $num;
function ResultRQPj(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function GetNextCode(){
$this->SetQuery("select max(rsRQPjid) as num from ea_ResultRQPj");
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->resultRQid=$this->GetNextCode();
$sql = "insert into ea_ResultRQPj values(
'$this->rsRQPjid',
'$this->doPjid',
'$this->sectionRQid',
'$this->RQid',
'$this->point'
)";
}else {
$sql = "update ea_ResultRQPj set
doPjid='$this->doPjid',
sectionRQid='$this->sectionRQid',
RQid='$this->RQid',
point='$this->point'
where rsRQPjid='$this->rsRQPjid'";
}
return $this->Dml($sql);
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->rsRQPjid = $this->result['rsRQPjid'];
$this->doPjid = $this->result['doPjid'];
$this->sectionRQid = $this->result['sectionRQid'];
$this->RQid = $this->result['RQid'];
$this->point = $this->result['point'];
$this->xbar = $this->result['xbar'];
$this->sd = $this->result['sd'];
$this->per = $this->result['per'];
$this->num = $this->result['num'];
return 1;
}else {
return 0;
}
}
function RSXbarSD($acadYear, $semester, $assid, $defineid, $pjid, $stdid, $RQid, $sectionRQid){
$cond = '';
$cond.= ($defineid!='%')? " AND df.defineid = $defineid" : '' ;
$cond.= ($pjid!='%')? " AND da.pjId = $pjid" : '' ;
$cond.= ($stdid!='%')? " AND da.stdId = $stdid" : '' ;
$cond.= ($RQid!='%')? " AND rrq.RQid = $RQid" : '' ;
$cond.= ($sectionRQid!='%')? " AND rrq.sectionRQid = $sectionRQid" : '' ;
$sql = "
SELECT (r1.xbar/r2.score)*100 AS per, r1.xbar AS xbar, r1.sd AS sd
FROM
(
SELECT rrq.sectionRQid, avg( point ) AS xbar, STDDEV(point) AS sd
FROM DefineAssessment df
INNER JOIN ea_DoProject da ON df.defineid = da.defineid
INNER JOIN ea_ResultRQPj rrq ON rrq.doPjid = da.doPjid
WHERE df.acadYear = '$acadYear'
AND df.semester = '$semester'
AND df.assid = '$assid'
$cond
GROUP BY rrq.RQid, rrq.sectionRQid
)r1,(
SELECT MAX(score) AS score
FROM HeaderQuestion hq
INNER JOIN DetailScore ds ON ds.Hsid = hq.Hsid
WHERE hq.assid = '$assid'
)r2
";
if ($this->SetQuery($sql)){
return 1;
}else {
return 0;
}
}
function CountPoint($acadYear, $semester, $assid,$xRQid,$defineid,$pjid,$stdid,$xscore){
$cond = '';
$cond.= ($defineid!='%')? " AND df.defineid = $defineid" : '' ;
$cond.= ($pjid!='%')? " AND da.pjId = $pjid" : '' ;
$cond.= ($stdid!='%')? " AND da.stdId = $stdid" : '' ;
$this->SetQuery("select count(point) as num
FROM DefineAssessment df
INNER JOIN ea_DoProject da ON df.defineid = da.defineid
INNER JOIN ea_ResultRQPj rrq ON rrq.doPjid = da.doPjid
WHERE df.acadYear = '$acadYear'
AND df.semester = '$semester'
AND df.assid = '$assid'
AND rrq.RQid = '$xRQid'
AND point = '$xscore'
$cond ");
$result = $this->GetResult();
return $result['num'];
}
function SearchPointByDoidSectionRQid($xdoid,$xsectionRQid){
if ($this->SetQuery("select point
from ea_ResultRQPj
where doPjid = '$xdoid'
and sectionRQid = '$xsectionRQid'
order by RQid")){
return 1;
}else {
return 0;
}
}
}
?>
|