Viewing file: mo_rg_registdetails.php (43.15 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once("da_rg_RegistDetails.php");
class Mo_rg_RegistDetails extends Da_rg_RegistDetails {
/** * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่ลงทะเบียนเรียนจริงตามเงื่อนไข * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return query >= 1 rows () : rg_RegistDetails.* * @todo use */ public function qryRd($condition="", $order="", $group="") { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails $c1 $c3 $c2"; $query = $this->db->query($sql); return $query; }
/** * หน้าที่ของฟังก์ชั่น คือ หารายวิชา และเกรดที่นักศึกษาแต่ละคนลงทะเบียนเรียน * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return query >= 1 rows () : rg_RegistDetails.*, rg_Student.*, rg_Prefix.*, rg_GradeTp.*, rg_Grade.* * @todo not use */ /*public function qryGrdOfStdByCoId($condition,$order,$group) { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId LEFT JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId LEFT JOIN $this->rg_dbname.rg_GradeTp ON stdGtpId=gtpId LEFT JOIN $this->rg_dbname.rg_Grade ON gtpId=grdGtpId $c1 $c2 $c3"; $query = $this->db->query($sql); return $query; }*/
/** * หน้าที่ของฟังก์ชั่น คือ * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return query >= 1 rows () : rg_RegistDetails.*, rg_Student.*, rg_Prefix.*, rg_GradeTp.*, rg_Grade.* * @todo use */ public function qrySstOfStd($condition='',$order='',$group='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId LEFT JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId LEFT JOIN $this->rg_dbname.rg_StudentStatus ON stdSstId=sstId $c1 $c2 $c3"; $query = $this->db->query($sql); return $query; }
// use public function qryRdJnCrsOpCrs($condition='',$order='',$group='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1); $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId $c1 $c3 $c2"; $query = $this->db->query($sql); return $query; } //Use public function qryRdJnCrsOpCrsCountRow($condition='',$order='',$group='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1); $sql = "SELECT b.*, COUNT( * ) AS total FROM ( SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId $c1 $c3 $c2 ) AS b GROUP BY coCrsId ORDER BY coSyId,coTmId"; //echo $sql; $query = $this->db->query($sql); return $query; } //Use public function qryRdJnCrsOpCrsCountRowInSomeCon($condition='',$order='',$group='',$in="") { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $cond = ($in == "" ? '' : 'AND coCrsId IN ('.$in.')'); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1); $sql = "SELECT b.coCrsId,b.crsCode,b.crsName,b.crsCreditTotal, COUNT( * ) AS total FROM ( SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId $c1 $cond $c3 $c2 ) AS b GROUP BY coCrsId"; //echo $sql; $query = $this->db->query($sql); return $query; } // @use public function qryRdCoIdJoinCoCrs($condition='',$order='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $sql = "SELECT rdCoId FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId $c1 $c2 GROUP BY rdCoId"; $query = $this->db->query($sql); return $query; }
// @use public function qryRdJoinCoCrsCof($condition='',$order='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $sql = "SELECT rdCoId FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId=coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId $c1 $c2 GROUP BY rdCoId"; $query = $this->db->query($sql); return $query; }
/** * หน้าที่ของฟังก์ชั่น คือ หาคนลงทะเบียนเรียนในรายวิชานี้ * * @access public * @param rdCoId * @return query >= 1 rows () : rg_RegistDetails.* * @todo use */ public function RSEnrollItemByClIdAndStudying($coId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId LEFT JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId WHERE rdCoId = ? AND stdSstIdTmp = 1 ORDER BY stdCode"; $query = $this->db->query($sql,array($coId)); return $query; }
/** * หน้าที่ของฟังก์ชั่น คือ หาคนลงทะเบียนเรียนในรายวิชานี้ * * @access public * @param rdCoId * @return query >= 1 rows () : rg_RegistDetails.* * @todo use */ public function getRegistDetailsByStdIdAcYTmId($stdId, $acY, $tmId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ?"; $query = $this->db->query($sql, array($stdId, $acY, $tmId)); return $query; } /** * หน้าที่ของฟังก์ชั่น คือ รายวิชานี้มีใครลงทะเบียนเรียน และแต่ละคนได้เกรดเท่าไหร่ * * @access public * @param int the course open id * @param int the acadyear * @param int the term * @param int the course section * @return */ public function qryStdRegist($coId, $crsSectionClass, $acY, $tmId) { $sql = "SELECT rg_RegistDetails.*, rg_Student.stdId, rg_Student.stdName, rg_Student.stdSurname, rg_Student.stdPfId, Prefix.prefixId, Prefix.prefixName FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId INNER JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId WHERE rdCoId=? AND rdSection=? AND rdAcY=? AND rdTmId=?"; $query = $this->db->query($sql,array($coId, $crsSectionClass, $acY, $tmId)); return $query; }
public function qryRdByClIdStrAcYTmId($clIdStr, $acY, $tmId) { $sql = "SELECT * FROM ( SELECT ei.*, m.stdCode FROM $this->rg_dbname.rg_RegistDetails ei, $this->rg_dbname.rg_Student m WHERE rdCoId IN ($clIdStr) AND rdAcY = ? AND rdTmId = ? AND rdStdId = stdId AND stdSstId = 1 UNION SELECT ei.*, m.stdCode FROM $this->rg_dbname.rg_RegistDetails ei, $this->rg_dbname.rg_StudentSummary s, $this->rg_dbname.rg_Student m WHERE rdCoId IN ($clIdStr) AND rdAcY = ? AND rdTmId = ? AND rdStdId = ssmStdId AND ssmAcY = ? AND ssmTmId = ? AND ssmSstId = 1 AND rdStdId = stdId ) AS tt ORDER BY stdCode"; $query = $this->db->query($sql,array($acY, $tmId, $acY, $tmId, $acY, $tmId)); return $query; }
public function qryRdJoinSsm($condition,$order,$group) { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_StudentSummary ON rdStdId = ssmStdId AND rdAcY = ssmAcY AND rdTmId = ssmTmId $c1 $c2 $c3"; $query = $this->db->query($sql); return $query; }
public function getSumCr1($condition="") { $where = $this->checkCondition($condition);
$c1= substr($where, 0, -3);
$sql = "SELECT IFNULL(SUM(rdCredit1), 0) AS num FROM $this->rg_dbname.rg_RegistDetails $c1"; $query = $this->db->query($sql); if ($query->num_rows()) { return $query->row()->num; }else{ return 0; } }
public function getSumCr2($condition="") { $where = $this->checkCondition($condition);
$c1= substr($where, 0, -3);
$sql = "SELECT IFNULL(SUM(rdCredit2), 0) as num FROM $this->rg_dbname.rg_RegistDetails $c1"; $query = $this->db->query($sql); if ($query->num_rows()) { return $query->row()->num; }else{ return 0; } }
public function getCreditAttempt($condition="") { $where = $this->checkCondition($condition);
$c1= substr($where, 0, -3);
$sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) as num FROM $this->rg_dbname.rg_RegistDetails $c1"; $query = $this->db->query($sql); if ($query->num_rows()) { return $query->row()->num; }else{ return 0; } }
// use function RSRegistDetailsByStIdAndAcYAndSeAndCoId($stId, $acY, $se, $coId){ $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ? AND coCrsId =? AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stId, $acY, $se, $coId)); return $query; }
// use function qryRdByStIdAndStY( $stId, $stY ) { $sql = "SELECT * FROM $this->rg_dbname.rg_Regist INNER JOIN $this->rg_dbname.rg_RegistDetails ON rgStdId = rdStdId AND rdAcY = rgAcY AND rdTmId = rgTmId AND rdSeq = rgSeq LEFT JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId WHERE rgStdId = ? AND rgSyId = ? ORDER BY rgTmId"; $query = $this->db->query($sql, array($stId, $stY)); return $query; }
/** * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่ส่งเกรดแล้ว * * @access public * @param * @return */ public function qryRdByCurIdAdYSyIdAcYTmId($curId, $adY, $syId, $acY, $tmId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_Student ON rdStdId = stdId INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId WHERE stdCurId = ? AND stdAdY = ? AND stdSyId = ? AND rdAcY = ? AND rdTmId = ? AND rdGrade <> '' AND coSendGradeStatus = 'Y'"; $query = $this->db->query($sql, array($curId, $adY, $syId, $acY, $tmId)); return $query; }
function getSumCrAt($condition="") { $where = $this->checkCondition($condition);
$c1= substr($where, 0, -3);
$sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails $c1"; $query = $this->db->query($sql); return $query->row()->num; }
public function getSumCrAtByStdIdAcYTmId($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ?"; $query = $this->db->query($sql, array($stdId, $acY, $tmId)); return $query->row()->num; }
function getAllFDivisorGPA($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS divisor FROM $this->rg_dbname.rg_Student INNER JOIN $this->rg_dbname.rg_Curriculum ON stdCurId = curId INNER JOIN $this->rg_dbname.rg_RegistDetails ON stdId = rdStdId INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON curGtpId = grdGtpId AND rdGrade = grdGrade WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ? AND coDeclareStatus = 'Y' AND grdCalGrade = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY, $tmId)); return $query->row()->divisor; }
// use public function getAllFDivisorGPAX($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS divisor FROM $this->rg_dbname.rg_Student INNER JOIN $this->rg_dbname.rg_RegistDetails ON stdId = rdStdId INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Curriculum ON stdCurId = curId INNER JOIN $this->rg_dbname.rg_Grade ON curGtpId = grdGtpId AND rdGrade = grdGrade WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND coDeclareStatus = 'Y' AND grdCalGrade = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY.$tmId)); if ($query->num_rows()) { return $query->row()->divisor; } else { return 0; } }
// use public function GetAllFDivisorAYRGPAX($stdId, $acY) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS divisor FROM $this->rg_dbname.rg_Student INNER JOIN $this->rg_dbname.rg_RegistDetails ON stdId = rdStdId INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Curriculum ON stdCurId = curId INNER JOIN $this->rg_dbname.rg_Grade ON curGtpId = grdGtpId AND rdGrade = grdGrade WHERE rdStdId = ? AND rdAcY = ? AND coDeclareStatus = 'Y' AND grdCalGrade = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY)); if ($query->num_rows()) { return $query->row()->divisor; } else { return 0; } }
// use public function getDividendAYRGPAByStIdAndStY($stdId, $acY) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt * grdPoint), 0) AS divisor FROM $this->rg_dbname.rg_Regist INNER JOIN $this->rg_dbname.rg_RegistDetails ON rgStdId = rdStdId AND rgAcY = rdAcY AND rgTmId = rdTmId AND rgSeq = rdSeq INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON rdGrade = grdGrade WHERE rgStdId = ? AND rgSyId = ? AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY));
if ($query->num_rows()) { return $query->row()->divisor; } else { return 0; } }
// use public function getAllFDivisorAYRGPAXByStIdAndStY($stdId, $acY) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS divisor FROM $this->rg_dbname.rg_Regist INNER JOIN $this->rg_dbname.rg_RegistDetails ON rgStdId = rdStdId AND rgAcY = rdAcY AND rgTmId = rdTmId AND rgSeq = rdSeq INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON rdGrade = grdGrade WHERE rgStdId = ? AND rgSyId = ? AND coDeclareStatus = 'Y' AND grdCalGrade = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY));
if ($query->num_rows()) { return $query->row()->divisor; } else { return 0; } }
function getOneFDivisorGPAX($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(tt), 0) AS divisor FROM ( SELECT IFNULL(SUM(rdCreditAttempt), 0) AS tt FROM $this->rg_dbname.rg_RegistDetails, $this->rg_dbname.rg_CourseOpen, $this->rg_dbname.rg_Grade WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND rdCoId = coId AND coDeclareStatus = 'Y' AND rdGrade = grdGrade AND grdPoint <> 0 AND coCrsId NOT IN ( SELECT coCrsId FROM $this->rg_dbname.rg_RegistDetails, rg_CourseOpen WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND rdCoId = coId GROUP BY rdStdId, coCrsId HAVING COUNT(coCrsId) > 1 ) UNION SELECT IFNULL(SUM(rdCreditAttempt), 0) AS tt FROM $this->rg_dbname.rg_RegistDetails, $this->rg_dbname.rg_CourseOpen, $this->rg_dbname.rg_Grade WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND rdCoId = coId AND coDeclareStatus = 'Y' AND rdGrade <> 'F' AND rdGrade = grdGrade AND coCrsId IN ( SELECT coCrsId FROM $this->rg_dbname.rg_RegistDetails, $this->rg_dbname.rg_CourseOpen WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND rdCoId = coId GROUP BY rdStdId, coCrsId HAVING COUNT(coCrsId) > 1 ) ) aa"; $query = $this->db->query($sql, array($stdId, $acY.$tmId, $stdId, $acY.$tmId, $stdId, $acY.$tmId, $stdId, $acY.$tmId)); return $query->row()->divisor; }
public function qryRdSemGradeCr($stdId, $acY, $tmId, $str) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ? AND rdNoCalGPA = 'N' AND rdGrade IN ($str) AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY, $tmId)); return $query->row()->num; }
public function qryRdCumGradeCr($stdId, $acY, $tmId, $str) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND ? >= CONCAT(rdAcY, rdTmId) AND rdNoCalGPA = 'N' AND rdGrade IN ($str)"; $query = $this->db->query($sql, array($stdId, $acY.$tmId)); return $query->row()->num; }
public function qryRdCumGradeCr2($stdId, $acY, $tmId, $str) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId WHERE rdStdId = ? AND ? >= CONCAT(rdAcY, rdTmId) AND rdNoCalGPA = 'N' AND rdGrade IN ($str) AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY.$tmId)); return $query->row()->num; }
public function calCreditSatisfy($stdId, $acY, $tmId) { $ci =& get_instance(); $ci->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $ci->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');
$con_qu_std = array('stdId' => $stdId); $qu_std = $ci->std->qryStdJoinCur($con_qu_std);
$con_rs_grd = array('grdGtpId' => $qu_std->row()->curGtpId);
$i = 0; $strGnfy = ""; $rs_grd = $ci->grd->qryGrd($con_rs_grd); foreach ($rs_grd->result() as $row_grd) { if (($row_grd->grdGrade != 'F') && ($row_grd->grdCalCredit == 'Y')) { if ($i == 0) $strGnfy = "'".$row_grd->grdGrade."'"; else $strGnfy .= ",'".$row_grd->grdGrade."'"; } $i++; }
$sumCreditSatisfy = $this->qryRdSemGradeCr($stdId, $acY, $tmId, $strGnfy);
return $sumCreditSatisfy; }
public function calCumCreditAttempt($stdId, $acY, $tmId) { $ci =& get_instance(); $ci->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $ci->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');
$con_qu_std = array('stdId' => $stdId); $qu_std = $ci->std->qryStdJoinCur($con_qu_std);
$con_rs_grd = array('grdGtpId' => $qu_std->row()->curGtpId); $i = 0; $strGrd = ""; $rs_grd = $ci->grd->qryGrd($con_rs_grd); foreach ($rs_grd->result() as $row_grd) { if ($i == 0) $strGrd = "'".$row_grd->grdGrade."',".$strGrd; else $strGrd = "'".$row_grd->grdGrade."',".$strGrd; $i++; } $strGrd .= "''"; $cumCreditAttmp = $this->qryRdCumGradeCr($stdId, $acY, $tmId, $strGrd);
return $cumCreditAttmp; }
public function calCumCreditSatisfy($stdId, $acY, $tmId) { $ci =& get_instance(); $ci->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $ci->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');
$con_qu_std = array('stdId' => $stdId); $qu_std = $ci->std->qryStdJoinCur($con_qu_std);
$con_rs_grd = array('grdGtpId' => $qu_std->row()->curGtpId);
$i = 0; $strGnfy = ""; $rs_grd = $ci->grd->qryGrd($con_rs_grd); foreach ($rs_grd->result() as $row_grd) { if (($row_grd->grdGrade != 'F') && ($row_grd->grdCalCredit == 'Y')) { if ($i == 0) $strGnfy = "'".$row_grd->grdGrade."'"; else $strGnfy .= ",'".$row_grd->grdGrade."'"; } $i++; }
$cumCreditSatisfy = $this->qryRdCumGradeCr2($stdId, $acY, $tmId, $strGnfy);
return $cumCreditSatisfy; }
public function getDividendGPA($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt * grdPoint), 0) AS dividend FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON rdGrade = grdGrade WHERE rdStdId = ? AND rdAcY = ? AND rdTmId = ? AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY, $tmId)); return $query->row()->dividend; }
//use public function getDividendGPAX($stdId, $acY, $tmId) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt * grdPoint), 0) AS dividend FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON rdGrade = grdGrade WHERE rdStdId = ? AND CONCAT(rdAcY, rdTmId) <= ? AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY.$tmId)); if ($query->num_rows()) { return $query->row()->dividend; } else { return 0; } }
//use public function GetDividendAYRGPA($stdId, $acY) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt * grdPoint), 0) AS dividend FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId INNER JOIN $this->rg_dbname.rg_Grade ON rdGrade = grdGrade WHERE rdStdId = ? AND rdAcY = ? AND coDeclareStatus = 'Y'"; $query = $this->db->query($sql, array($stdId, $acY)); if ($query->num_rows()) { return $query->row()->dividend; } else { return 0; } }
/** * หน้าที่ของฟังก์ชั่น คือ ค้นหาจำนวนคนที่ลงทะเบียนเรียนในรายวิชานี้ตามเกรดเฉลี่ย * * @access public * @param rdCoId * @return query >= 1 rows () : rg_RegistDetails.* * @todo use */ public function countStIdByGrade($coId, $acY, $tmId, $grade) { $sql = "SELECT count(rdStdId) as num FROM $this->rg_dbname.rg_RegistDetails WHERE rdCoId = ? AND rdAcY = ? AND rdTmId = ? AND rdGrade = ?"; $query = $this->db->query($sql,array($coId, $acY, $tmId, $grade)); if ($query->num_rows() > 0) { $row = $query->row(); return $row->num; } else { return 0; } }
/** * หน้าที่ของฟังก์ชั่น คือ หาผลรวมของหน่วยกิต * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return numCredit คือ ค่าผลรวมของหน่วยกิต * @todo use */ public function getSumCreditAttempt($condition="",$order="",$group="") { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group);
$c1 = substr($where, 0, -3); $c2 = substr($order, 0, -1); $c3 = substr($group, 0, -1);
$sql = "SELECT IFNULL(sum(rdCreditAttempt), 0) AS numCredit FROM $this->rg_dbname.rg_CourseOpen INNER JOIN $this->rg_dbname.rg_RegistDetails ON coId = rdCoId INNER JOIN $this->rg_dbname.rg_Student ON rdStdId = stdId $c1 $c3 $c2"; $query = $this->db->query($sql); if($query->num_rows()) { $num = $query->row(); return ($num->numCredit==NULL) ? 0 : $num->numCredit; } else { return 0; } }
/** * หน้าที่ของฟังก์ชั่น คือ หาผลรวมของหน่วยกิต ในกรณีที่เปิดเรียนรวมหลายหลักสูตร * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return numCredit คือ ค่าผลรวมของหน่วยกิต * @todo use /*WHERE coAcY=2551 AND coTmId=1 AND cofCurId=5 AND stdAdY=2551"; */ public function getSumCreditAttemptCurIsNULL($condition="",$order="",$group="") { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group);
$c1 = substr($where, 0, -3); $c2 = substr($order, 0, -1); $c3 = substr($group, 0, -1);
$sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS numCredit FROM $this->rg_dbname.rg_CourseOpen INNER JOIN $this->rg_dbname.rg_RegistDetails ON coId=rdCoId INNER JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId INNER JOIN $this->rg_dbname.rg_CourseOpenFor ON cofCurId=stdCurId $c1 AND coCurId IS NULL $c3 $c2"; $query = $this->db->query($sql); if($query->num_rows()) { $num = $query->row(); return ($num->numCredit==NULL) ? 0 : $num->numCredit; } else { return 0; } }
/** * หน้าที่ของฟังก์ชั่น คือ หาผลรวมของหน่วยกิต ในแต่ละเทอม ตามเงื่อนไข * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return numCredit คือ ค่าผลรวมของหน่วยกิต * @todo use */ public function getSumCreditAttemptEachTerm($condition="",$order="",$group="") { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group);
$c1 = substr($where, 0, -3); $c2 = substr($order, 0, -1); $c3 = substr($group, 0, -1);
$sql = "SELECT IFNULL(sum(rdCreditAttempt), 0) AS numCredit FROM $this->rg_dbname.rg_RegistDetails $c1 $c3 $c2"; $query = $this->db->query($sql); if($query->num_rows()) { $num = $query->row(); return ($num->numCredit==NULL) ? 0 : $num->numCredit; } else { return 0; } } /** * หน้าที่ของฟังก์ชั่น คือ หารายวิชาลงทะเบียนเรียน ตามเงื่อนไข * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return $query >= 1 row: rg_RegistDetails.*, rg_CourseOpen.*, rg_Course.* edit 22/1/2556 */ public function qryRdJoinCoCrs($condition='',$order='',$group='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order); $group = $this->checkGroupBy($group); $c1= substr($where, 0, -3); $c2= substr($order, 0, -1); $c3= substr($group, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId=coId INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId LEFT JOIN $this->rg_dbname.rg_RegistFee ON rdAcY=rfAcY AND rdTmId=rfTmId AND rdStdId=rfStdId LEFT JOIN $this->rg_dbname.rg_StudentSummary ON rdAcY=ssmAcY AND rdTmId=ssmTmId AND rdStdId=ssmStdId $c1 $c3 $c2"; $query = $this->db->query($sql); return $query; }
function qryRdJoinCoCrsRg($condition='',$order='') { $where = $this->checkCondition($condition); $order = $this->checkOrderBy($order);
$c1= substr($where, 0, -3); $c2= substr($order, 0, -1);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId=coId INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId INNER JOIN $this->rg_dbname.rg_Regist ON rdStdId = rgStdId AND rdAcY = rgAcY AND rdTmId = rgTmId AND rdSeq = rgSeq $c1 $c2"; $query = $this->db->query($sql); return $query; }
public function qryRdByAcYTmIdGroupCurIdSyIdCrsId($acY, $tmId) { $sql = "SELECT MIN(rdCoId) AS rdCoId FROM $this->rg_dbname.rg_RegistDetails, $this->rg_dbname.rg_CourseOpen, $this->rg_dbname.rg_Course WHERE rdAcY = ? AND rdTmId = ? AND rdCoId = coId AND coCrsId = crsId GROUP BY coCurId, coSyId, coCrsId ORDER BY coCurId, crsCode, crsName, CAST(coSection AS SIGNED)"; $query = $this->db->query($sql, array($acY, $tmId)); return $query; }
public function qryRdByAcYTmIdGroupCoId($acY, $tmId) { $sql = "SELECT rdCoId FROM $this->rg_dbname.rg_RegistDetails, $this->rg_dbname.rg_CourseOpen, $this->rg_dbname.rg_Course WHERE rdAcY = ? AND rdTmId = ? AND rdCoId = coId AND coCrsId = crsId GROUP BY rdCoId ORDER BY coCurId, crsCode, crsName, CAST(coSection AS SIGNED)"; $query = $this->db->query($sql, array($acY, $tmId)); return $query; }
public function qryRdByClIdStrGradeIsEmpty($clIdStr) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId WHERE rdCoId IN ($clIdStr) AND rdGrade = '' AND stdSstId IN (1)"; $query = $this->db->query($sql); return $query; }
public function qryRdByStdIdClIdStr($stdId, $clIdStr) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdCoId IN ($clIdStr)"; $query = $this->db->query($sql, array($stdId)); return $query; }
public function qryRdByStdIdAcYSendGrIsNUnionGradeInIEPX($stdId, $acY) { $sql = "SELECT ei.* FROM $this->rg_dbname.rg_RegistDetails ei, $this->rg_dbname.rg_CourseOpen WHERE rdStdId = ? AND rdAcY = ? AND rdCoId = coId AND coSendGradeStatus = 'N' UNION SELECT ei.* FROM $this->rg_dbname.rg_RegistDetails ei WHERE rdStdId = ? AND rdAcY = ? AND rdGrade IN ('I', 'E', 'P', 'X', '')"; $query = $this->db->query($sql, array($stdId, $acY, $stdId, $acY)); return $query; }
function getSumCrAtByStdIdCdId1($stdId, $cdId1) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdCdId1 = ? AND rdGrade != 'F'"; $query = $this->db->query($sql, array($stdId, $cdId1)); return $query->row()->num; }
function getSumCrAtByStdIdCdId1CdId2($stdId, $cdId1, $cdId2) { $sql = "SELECT IFNULL(SUM(rdCreditAttempt), 0) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdCdId1 = ? AND rdCdId2 = ? AND rdGrade != 'F'"; $query = $this->db->query($sql, array($stdId, $cdId1, $cdId2)); return $query->row()->num; }
function qryRdByStdIdGrade($stdId, $str) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdGrade IN ($str)"; $query = $this->db->query($sql, array($stdId)); return $query; }
function qryRdByStdIdGradeIsF($stdId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdGrade = 'F'"; $query = $this->db->query($sql, array($stdId)); return $query; }
function qryRdByStdIdAcYTmIdCrsId($stdId, $acY, $tmId, $crsId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId WHERE rdStdId = ? AND CONCAT(?, ?) > CONCAT(rdAcY, rdTmId) AND coCrsId = ? AND rdGrade != 'F'"; $query = $this->db->query($sql, array($stdId, $acY, $tmId, $crsId)); return $query; }
/****************************** Start Pass Student ******************************/ public function getCountGradeByStdIdAcYGradeIsF($stdId, $acY) { $sql = "SELECT COUNT(rdGrade) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdStdId = ? AND rdAcY = ? AND rdNoCalGPA = 'N' AND rdGrade = 'F'"; $query = $this->db->query($sql, array($stdId, $acY)); return $query->row()->num; }
public function qryRdByStdIdAcYCoIdGrInAtoF($stdId, $acY, $coId) { $sql = "SELECT COUNT(ei.rdGrade) AS num FROM $this->rg_dbname.rg_RegistDetails ei WHERE rdStdId = ? AND rdAcY = ? AND rdCoId = ? AND EXISTS ( SELECT grdGrade FROM rg_Grade WHERE grdCalGrade = 'Y' AND grdGrade = ei.rdGrade )"; $query = $this->db->query($sql, array($stdId, $acY, $coId)); return $query->row()->num; }
public function getPassStatusByStdIdAcY($stdId, $acY) { $ci =& get_instance(); $ci->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $ci->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur'); $ci->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
$ci->std->stdId = $stdId; $qu_std = $ci->std->get_by_key(); $row_std = $qu_std->row();
$ci->cur->curId = $qu_std->row()->stdCurId; $qu_cur = $ci->cur->get_by_key();
$qu_ac = $ci->ac->get_by_key(); $row_ac = $qu_ac->row();
if ($row_std->stdSstId==7 || $row_std->stdSstId==9 || intval($acY - $row_std->stdAdY)>$qu_cur->row()->curMaxStudyY) { return 5; } else { if ($row_std->stdTotalPoint < 80) { return 4; } else { if ($row_std->stdGPA >= $row_ac->acAnnualGPAX) { if ($this->getCountGradeByStdIdAcYGradeIsF($stdId, $acY) == 0) { return 1; } else { return 2; } } else if ($row_std->stdGPA>=1.95 && $row_std->stdGPA<$row_ac->acAnnualGPAX) { return 3; } else { return 4; } } } } /****************************** End Pass Student ******************************/
public function getCountStdId($condition='') { $where = $this->checkCondition($condition); $c1= substr($where, 0, -3);
$sql = "SELECT COUNT(rdStdId) AS num FROM $this->rg_dbname.rg_RegistDetails $c1"; $query = $this->db->query($sql); return $query->row()->num; }
/** * หน้าที่ของฟังก์ชั่น คือ หารายวิชา และเกรดที่นักศึกษาลงทะเบียนเรียน * * @access public * @param array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT * @param array order โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการเรียงลำดับ ORDER BY * @param array group โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขการจัดกลุ่ม GROUP BY * @return query >= 1 rows () : rg_RegistDetails.*, rg_Student.*, rg_StudentSummary.* * @todo use WHERE rdCoId=?, rdAcY=?, rdTmId=?, stdSstId=1 WHERE rdCoId=?, rdAcY=?, rdTmId=?, ssmSstId=1 */ function qryRdJoinStdSsm($condition1="",$condition2="") { $where1 = $this->checkCondition($condition1); $where2 = $this->checkCondition($condition2);
$c1 = substr($where1, 0, -3); $c2 = substr($where2, 0, -3);
$sql = "SELECT * FROM (SELECT rg_RegistDetails.*, rg_Student.*, Prefix.* FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId LEFT JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId $c1 UNION SELECT rg_RegistDetails.*, rg_Student.*, Prefix.* FROM $this->rg_dbname.rg_RegistDetails LEFT JOIN $this->rg_dbname.rg_StudentSummary ON rdStdId=ssmStdId LEFT JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId LEFT JOIN $this->ppc_dbname.Prefix ON stdPfId=prefixId $c2) AS tt ORDER BY stdCode"; $query = $this->db->query($sql); return $query; }
function getCountStdIdByGrade($clIdStr, $acY, $tmId, $grade) { $sql = "SELECT COUNT(rdStdId) AS num FROM $this->rg_dbname.rg_RegistDetails WHERE rdCoId IN ($clIdStr) AND rdAcY = ? AND rdTmId = ? AND rdGrade = ?"; $query = $this->db->query($sql, array($acY, $tmId, $grade)); return $query->row()->num; } public function RSClassExamByStIdAndAcYAndExCode($stId, $acY, $exC){ $sql = "select es.esCoId as coId from $this->rg_dbname.rg_RegistDetails rd, $this->rg_dbname.rg_ExamSchedule es where rd.rdStdId='$stId' and rd.rdAcY='$acY' and rd.rdCoId=es.esCoId and es.esExamType='$exC' group by es.esCoId order by es.esDate, es.esPrdFrTime"; $query = $this->db->query($sql); return $query; } public function RSClassExamByTecAndAcYAndExCode($prsId, $acY, $exC){ $sql = "SELECT es.esCoId as coId FROM $this->rg_dbname.rg_RegistDetails rd,$this->rg_dbname.rg_ExamSchedule es WHERE rd.rdCoId=es.esCoId and rdAcY= '$acY' and esPrsId = '$prsId' and es.esExamType='$exC' group by es.esCoId order by es.esDate, es.esPrdFrTime"; $query = $this->db->query($sql); return $query; } public function qryRdGrpRdAcY($stdId) { $sql = "SELECT rdAcY FROM $this->rg_dbname.rg_RegistDetails where rdStdId = '$stdId' GROUP BY rdAcY "; $query = $this->db->query($sql); return $query; }
public function get_optionsGrpRdAcY($stdId,$optional='y') { $query = $this->qryRdGrpRdAcY($stdId); if($optional=='y') $opt[''] = ''; if($query->num_rows()>0){ foreach($query->result() as $row) { $opt[$row->rdAcY] = $row->rdAcY; } }else{ $opt = array(); } return $opt; }
public function qryRdJoinStdOrdStdCode($clIdStr, $acY, $tmId) { $sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_Student ON rdStdId=stdId WHERE rdCoId IN ($clIdStr) AND rdAcY = ? AND rdTmId = ? ORDER BY stdCode"; $query = $this->db->query($sql, array($acY, $tmId)); return $query; }
public function qryRdJoinCoByGrade($condition='') { $where = $this->checkCondition($condition);
$c1= substr($where, 0, -3);
$sql = "SELECT * FROM $this->rg_dbname.rg_RegistDetails INNER JOIN $this->rg_dbname.rg_CourseOpen ON rdCoId = coId $c1 AND rdGrade <> ''"; $query = $this->db->query($sql); return $query; } } ?>
|