Viewing file:      mo_rg_examschedule.php (2.46 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 include_once("da_rg_ExamSchedule.php");
 class Mo_rg_examschedule extends Da_rg_ExamSchedule {
     
     /**
      * หน้าที่ของฟังก์ชั่น คือ หาข้อมูลตารางสอบ
      *
      * @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_ExamSchedule.*
      */
     public function qryEs($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_ExamSchedule
                     $c1
                     $c3
                     $c2";
         $query = $this->db->query($sql);
         return $query;
     }
 
     function getCountCoId($condition="") {
         $where = $this->checkCondition($condition);
 
         $c1 = substr($where, 0, -3);
 
         $sql = "SELECT COUNT(esCoId) AS num 
                     FROM $this->rg_dbname.rg_ExamSchedule 
                     $c1";
         $query = $this->db->query($sql);
         return $query->row()->num;
     }
 
     function getCountByExTypeDateRmIdTime($exType, $dt, $rmId, $frTime, $toTime) {
         $sql = "SELECT COUNT(*) AS num 
                     FROM $this->rg_dbname.rg_ExamSchedule 
                     WHERE esExamType = ? 
                     AND esDate = ? 
                     AND esRmId = ? 
                     AND (esPrdToTime >= ? AND esPrdFrTime <= ?)";
         $query = $this->db->query($sql, array($exType, $dt, $rmId, $frTime, $toTime));
         return $query->row()->num;
     }
 
     function getCountByDateTimePrsId($dt, $frTime, $toTime, $prsId) {
         $sql = "SELECT COUNT(*) AS num 
                     FROM $this->rg_dbname.rg_ExamSchedule 
                     WHERE esDate = ? 
                     AND (esPrdToTime >= ? AND esPrdFrTime <= ?) 
                     AND esPrsId = ?";
         $query = $this->db->query($sql, array($dt, $frTime, $toTime, $prsId));
         return $query->row()->num;
     }
 }
 ?>
  |