Viewing file: general.php (20.56 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('application/controllers/login.php');
class General extends Login {
private $acY;
private $tmId;
function __construct() {
parent::__construct();
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$qu_tmc = $this->tmc->qryTmcBetweenDate(getNowDate());
if ($qu_tmc->num_rows()) {
$row_tmc = $qu_tmc->row();
$this->acY = $row_tmc->tmcAcY;
$this->tmId = $row_tmc->tmcTmId;
}
$qu_cfg = $this->cfg->qryCfg();
if ($qu_cfg->num_rows()) {
$row_cfg = $qu_cfg->row();
$data['table_color_even'] = $row_cfg->cfgBgClTrAndTd;
$data['tr_color_even'] = $row_cfg->cfgBgClSwapTr;
$data['font_color_table'] = $row_cfg->cfgFnClHeadTb;
$data['font_color_err'] = $row_cfg->cfgFnClErrSpec;
$this->body = $this->load->view($this->config->item("rg_folder").'v_header_js', $data, true);
}
}
function curs () {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
$this->load->model($this->config->item("rg_folder").'mo_rg_programcourses','pcr');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$curId = $this->input->post('curId');
$typeLang = $this->input->post('typeLang');
$data['qu_cfg'] = $this->cfg->qryCfg();
$data['curId'] = $curId;
$data['typeLang'] = $typeLang;
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$data['rs_cur'] = $this->cur->get_options($con_rs_cur, $ord_rs_cur);
$con_qu_cur = array('curId' => $curId);
$data['qu_cur'] = $this->cur->qryCurJoinLv($con_qu_cur);
$i = 0;
$arr = array();
// หาหมวดวิชา
$rs_cs = $this->cs->qryCsByCurIdGroupCdId1($curId);
foreach ($rs_cs->result() as $row_cs1) {
$this->cd->cdId = $row_cs1->csCdId1;
$qu_cd = $this->cd->get_by_key();
if ($qu_cd->num_rows()) {
$arr[$i]['cdType'] = 'H';
$arr[$i]['seq'] = $row_cs1->csSeq;
$arr[$i]['qu_cd'] = $qu_cd;
$arr[$i]['credit'] = $row_cs1->csCreditTotal;
}
// หากลุ่มวิชา
$rs_cs = $this->cs->qryCsByCurIdCdId1CdId2GT1($curId, $row_cs1->csCdId1);
if ($rs_cs->num_rows()) {
$i++;
foreach ($rs_cs->result() as $row_cs2) {
$this->cd->cdId = $row_cs2->csCdId2;
$qu_cd = $this->cd->get_by_key();
if ($qu_cd->num_rows()) {
$arr[$i]['cdType'] = 'C';
$arr[$i]['seq'] = $row_cs2->csSeq;
$arr[$i]['qu_cd'] = $qu_cd;
$arr[$i]['credit'] = $row_cs2->csCreditTotal;
// หารายวิชา กรณีมีกลุ่มวิชา
$con_rs_pcr = array('pcrCsCurId' => $curId,
'pcrCsCdId1' => $row_cs1->csCdId1,
'pcrCsCdId2' => $row_cs2->csCdId2,
'pcrStatus' => 'Y'
);
$arr[$i]['rs_pcr'] = $this->pcr->qryPcrJoinCrs($con_rs_pcr);
$i++;
}
}
} else {
// หารายวิชา กรณีไม่มีกลุ่มวิชา
$con_rs_pcr = array('pcrCsCurId' => $curId,
'pcrCsCdId1' => $row_cs1->csCdId1,
'pcrCsCdId2' => 1,
'pcrStatus' => 'Y'
);
$arr[$i]['rs_pcr'] = $this->pcr->qryPcrJoinCrs($con_rs_pcr);
$i++;
}
}
$data['rs'] = $arr;
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_curriculums', $data, true);
$this->show();
}
function showDetailStudyPlan () {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
$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_curriculumstructure','cs');
$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->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$curId = $this->input->post('curId');
$typeLang = $this->input->post('typeLang');
$data['qu_cfg'] = $this->cfg->qryCfg();
$data['curId'] = $curId;
$data['typeLang'] = $typeLang;
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$data['rs_cur'] = $this->cur->get_options($con_rs_cur, $ord_rs_cur);
$this->cur->curId = $curId;
$data['qu_cur'] = $this->cur->get_by_key();
$arr = array();
// หาชั้นปี
$con_rs_sp = array('spCurId' => $curId);
$rs_sp = $this->sp->qrySpGroupSyId($con_rs_sp);
foreach ($rs_sp->result() as $row_sp1) {
$this->sy->syId = $row_sp1->spSyId;
$arr[$row_sp1->spSyId]['qu_sy'] = $this->sy->get_by_key();
// หาภาคการศึกษา
$con_rs_sp = array('spCurId' => $curId,
'spSyId' => $row_sp1->spSyId
);
$rs_sp = $this->sp->qrySpGroupTmId($con_rs_sp);
foreach ($rs_sp->result() as $row_sp2) {
$this->tm->tmId = $row_sp2->spTmId;
$arr[$row_sp1->spSyId][$row_sp2->spTmId]['qu_tm'] = $this->tm->get_by_key();
// หาหมวดวิชา
$rs_cs = $this->cs->qryCsByCurIdGroupCdId1($curId);
foreach ($rs_cs->result() as $row_cs) {
// หารายวิชา
$con_rs_sp = array('spCurId' => $curId,
'spSyId' => $row_sp1->spSyId,
'spTmId' => $row_sp2->spTmId,
'spCdId1' => $row_cs->csCdId1
);
$rs_sp = $this->sp->qrySpJoinCrs($con_rs_sp);
if ($rs_sp->num_rows()) {
$this->cd->cdId = $row_cs->csCdId1;
$arr[$row_sp1->spSyId][$row_sp2->spTmId][$row_cs->csCdId1]['qu_cd'] = $this->cd->get_by_key();
$arr[$row_sp1->spSyId][$row_sp2->spTmId][$row_cs->csCdId1]['rs_sp'] = $rs_sp;
}
}
}
}
$data['rs'] = $arr;
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showDetailStudyPlan', $data, true);
$this->show();
}
function rptRis132() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_studyplan','sp');
$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_curriculumstructure','cs');
$this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
$curId = $this->input->post('curId');
$typeLang = $this->input->post('typeLang');
$data['curId'] = $curId;
$data['typeLang'] = $typeLang;
$this->cur->curId = $curId;
$qu_cur = $this->cur->get_by_key();
if ($qu_cur->num_rows()) {
$data['qu_cur'] = $qu_cur;
}
$arr = array();
// หาชั้นปี
$con_rs_sp = array('spCurId' => $curId);
$rs_sp = $this->sp->qrySpGroupSyId($con_rs_sp);
foreach ($rs_sp->result() as $row_sp1) {
$this->sy->syId = $row_sp1->spSyId;
$arr[$row_sp1->spSyId]['qu_sy'] = $this->sy->get_by_key();
// หาภาคการศึกษา
$con_rs_sp = array('spCurId' => $curId,
'spSyId' => $row_sp1->spSyId
);
$rs_sp = $this->sp->qrySpGroupTmId($con_rs_sp);
foreach ($rs_sp->result() as $row_sp2) {
$this->tm->tmId = $row_sp2->spTmId;
$arr[$row_sp1->spSyId][$row_sp2->spTmId]['qu_tm'] = $this->tm->get_by_key();
// หาหมวดวิชา
$rs_cs = $this->cs->qryCsByCurIdGroupCdId1($curId);
foreach ($rs_cs->result() as $row_cs) {
// หารายวิชา
$con_rs_sp = array('spCurId' => $curId,
'spSyId' => $row_sp1->spSyId,
'spTmId' => $row_sp2->spTmId,
'spCdId1' => $row_cs->csCdId1
);
$rs_sp = $this->sp->qrySpJoinCrs($con_rs_sp);
if ($rs_sp->num_rows()) {
$this->cd->cdId = $row_cs->csCdId1;
$arr[$row_sp1->spSyId][$row_sp2->spTmId][$row_cs->csCdId1]['qu_cd'] = $this->cd->get_by_key();
$arr[$row_sp1->spSyId][$row_sp2->spTmId][$row_cs->csCdId1]['rs_sp'] = $rs_sp;
}
}
}
}
$data['rs'] = $arr;
$this->load->view($this->config->item("rg_folder").'v_rptRis132', $data);
}
function crs() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
$this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$curId = $this->input->post('curId');
$acY = $this->input->post('acY');
$tmId = $this->input->post('tmId');
$syId = $this->input->post('syId');
$crsCode = $this->input->post('crsCode');
$crsName = $this->input->post('crsName');
$crsNameE = $this->input->post('crsNameE');
$btnSearch = $this->input->post('btnSearch');
$data['curId'] = $curId;
$data['crsCode'] = $crsCode;
$data['crsName'] = $crsName;
$data['crsNameE'] = $crsNameE;
$data['btnSearch'] = $btnSearch;
$data['qu_cfg'] = $this->cfg->qryCfg();
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$data['rs_cur'] = $this->cur->get_options($con_rs_cur, $ord_rs_cur);
$data['rs_tmc'] = $this->tmc->get_optionsGroupAcY();
$ord_rs_tm = array('tmCode' => 'ASC');
$data['rs_tm'] = $this->tm->get_options('', $ord_rs_tm);
$ord_rs_sy = array('syCode' => 'ASC');
$data['rs_sy'] = $this->sy->get_options('', $ord_rs_sy);
$con_rs_co = array('crsCode' => '%'.$crsCode.'%',
'crsName' => '%'.$crsName.'%',
'crsNameE' => '%'.$crsNameE.'%'
);
if ($curId) {
$con_rs_co['coCurId'] = $curId;
}
if ($acY) {
$con_rs_co['coAcY'] = $acY;
}
if ($syId) {
$con_rs_co['coSyId'] = $syId;
}
if ($tmId) {
$con_rs_co['coTmId'] = $tmId;
}
$data['rs_co'] = $this->co->qryCoJoinCrs($con_rs_co);
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_course', $data, true);
$this->show();
}
function showSd () {
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$acY = $this->input->post('acY');
$tmId = $this->input->post('tmId');
$data['acY'] = ($acY) ? $acY : $this->acY;
$data['tmId'] = ($tmId) ? $tmId : $this->tmId;
$data['qu_cfg'] = $this->cfg->qryCfg();
$data['rs_tmc'] = $this->tmc->get_optionsGroupAcY();
$ord_rs_tm = array('tmCode' => 'ASC');
$data['rs_tm'] = $this->tm->get_options('', $ord_rs_tm);
$this->sd->sdAcY = $acY;
$this->sd->sdTmId = $tmId;
$qu_sd = $this->sd->get_by_key();
if ($qu_sd->num_rows()) {
$data['qu_sd'] = $qu_sd;
}
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showSchedule', $data, true);
$this->show();
}
function showGD () {
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$stdGraduateY = $this->input->post('stdGraduateY');
$data['stdGraduateY'] = ($stdGraduateY) ? $stdGraduateY : $this->acY;
$data['rs_std'] = $this->std->get_optionsGroupGraduateY();
$ord_rs_tm = array('tmCode' => 'ASC');
$rs_tm = $this->tm->qryTm('', $ord_rs_tm);
$data['rs_tm'] = $rs_tm;
$arr = array();
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$rs_cur = $this->cur->qryCur($con_rs_cur, $ord_rs_cur);
foreach ($rs_cur->result() as $row_cur) {
$arr[$row_cur->curId]['curName'] = $row_cur->curName;
foreach ($rs_tm->result() as $row_tm) {
$this->tmc->tmcAcY = $stdGraduateY;
$this->tmc->tmcTmId = $row_tm->tmId;
$qu_tmc = $this->tmc->get_by_key();
if ($qu_tmc->num_rows()) {
$row_tmc = $qu_tmc->row();
$rs_std = $this->std->qryStdByCurIdGdDateGdY($row_cur->curId, $row_tmc->tmcFrDate, $row_tmc->tmcToDate, $stdGraduateY);
$arr[$row_cur->curId][$row_tm->tmId]['sumStd'] = $rs_std->num_rows() ? $rs_std->num_rows() : '-';
} else {
$arr[$row_cur->curId][$row_tm->tmId]['sumStd'] = '-';
}
}
}
$data['rs'] = $arr;
$data['qu_cfg'] = $this->cfg->qryCfg();
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showGD', $data, true);
$this->show();
}
function showGDSt () {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$curId = $this->input->post('curId');
$stdGraduateY = $this->input->post('stdGraduateY');
$tmId = $this->input->post('tmId');
$data['stdGraduateY'] = $stdGraduateY;
$this->cur->curId = $curId;
$data['qu_cur'] = $this->cur->get_by_key();
$this->tm->tmId = $tmId;
$data['qu_tm'] = $this->tm->get_by_key();
$this->tmc->tmcAcY = $stdGraduateY;
$this->tmc->tmcTmId = $tmId;
$qu_tmc = $this->tmc->get_by_key();
$row_tmc = $qu_tmc->row();
$qu_ac = $this->ac->qryAc();
$row_ac = $qu_ac->row();
$i = 0;
$arr = array();
$rs_std = $this->std->qryStdByCurIdGdDateGdY($curId, $row_tmc->tmcFrDate, $row_tmc->tmcToDate, $stdGraduateY);
foreach ($rs_std->result() as $row_std) {
$con_qu_std = array('stdId' => $row_std->stdId);
$arr[$i]['qu_std'] = $this->std->qryStdJoinPfCurSySstElv($con_qu_std);
$str = "acHonor".$row_std->stdHonor;
eval("\$str;");
$arr[$i]['honor'] = ($row_std->stdHonor) ? $row_ac->$str : '';
$i++;
}
$data['rs'] = $arr;
$data['qu_cfg'] = $this->cfg->qryCfg();
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showGDSt', $data, true);
$this->show();
}
function showFaq () {
$this->load->model($this->config->item("rg_folder").'mo_rg_faq','faq');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$ord_rs_faq = array('faqId' => 'ASC');
$data['rs_faq'] = $this->faq->qryFaq('', $ord_rs_faq);
$data['qu_cfg'] = $this->cfg->qryCfg();
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showFaq', $data, true);
$this->show();
}
function arranged_schedule($mode){
if($mode=="teacher"){
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$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->load->model($this->config->item("rg_folder").'mo_rg_weekdate','wd');
$group_AcY = array('coAcY'=>'coAcY');
$rs_co= $this->co->get_options('',array('coAcY'=>'DESC'),$group_AcY,'n');
$group_AcY = array('wdAcY'=>'wdAcY');
$rs_wd = $this->wd->get_options('',array('wdAcY'=>'DESC'),$group_AcY);
$year = array_intersect($rs_co,$rs_wd);
$data['tmc'] = $year;
$data['tm'] = $this->tm->get_options('',array('tmName'=>''),'','N');
$data['mode'] = $mode;
// หาวันทั้งหมด วัน
$this->load->model($this->config->item("rg_folder").'mo_rg_day','dy');
$condition = '';
$group = '';
$option = '';
$order = array('dyId'=>'');
$data['dy'] = $this->dy->qryDy($condition,$order,$group,$option);
// หาคาบเรียน เวลาเริ่มต้นเรียน
$this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
$condition = '';
$group = '';
$option = '';
$order = array('prdId'=>'');
$data['prdFr'] = $this->prd->get_options_frTime($condition,$order,$group,$option);
$this->load->model($this->config->item("ppc_folder").'mo_spc_place','spc');
$data['rm'] = $this->spc->get_optionsRm("N");
$this->body .= $this->load->view($this->config->item("rg_folder").'v_ttArrangedSchedule', $data, true);
$this->show();
}
}
function showClassStudy(){
$this->body .= $this->load->view($this->config->item("rg_folder").'v_beforeShowClassStudy', '', true);
$this->show();
}
function beforeShowClassStudy(){
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
$this->form_validation->set_rules('stdCode',' ','trim|xss_clean');
$this->form_validation->set_rules('stdName',' ','trim|xss_clean');
$this->form_validation->set_rules('stdSurname',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
if($this->input->post('stdCode') !="" || $this->input->post('stdName') !="" || $this->input->post('stdSurname') !=""){
$con_std = array('stdCode'=>'%'.$this->input->post('stdCode').'%','stdName'=>'%'.$this->input->post('stdName').'%','stdSurname'=>'%'.$this->input->post('stdSurname').'%');
$ord_std = array('stdCode'=>'');
$data['rs_std'] = $this->std->qryStdJoinPf($con_std,$ord_std);
}else{
$data['str_fault'] = $this->config->item('str_fault');
}
$this->body .= $this->load->view($this->config->item("rg_folder").'v_beforeShowClassStudy', $data, true);
$this->show();
}else{
$this->showClassStudy();
}
}
function showTimeTableSt(){
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
$this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
if($this->input->post('stdId')){
$stdId = $this->input->post('stdId');
}else{
$login = $this->session->userdata('UsPsCode');
$con_std_login = array('stdCode' => $login);
$std_login = $this->std->qryStd($con_std_login);
if($std_login->num_rows()) {
$stdId = $std_login->row()->stdId;
}
}
if(!Empty($stdId)){
$group_AcY = array('tmcAcY'=>'tmcAcY');
$rs_tmc= $this->tmc->get_options('',array('tmcAcY'=>'DESC'),$group_AcY);
$data['AcY'] = $rs_tmc;
$con_std = array('stdId'=>$stdId);
$qu_std = $this->std->qryStdDetails($con_std);
$data['qu_std'] = $qu_std;
if($qu_std->num_rows()>0){
$row_std = (isset($qu_std) && $qu_std!=NULL) ? $qu_std->row() : NULL;
$this->sy->syId = $row_std->stdSyId;
$data['qu_sy'] = $this->sy->get_by_key();
$con_rd = array('rdStdId'=>$row_std->stdSyId);
$rs_rd = $this->rd->qryRdJnCrsOpCrs($con_rd);
}
$this->body .= $this->load->view($this->config->item("rg_folder").'v_showTimeTableSt', $data, true);
$this->show();
}else{
$this->beforeShowClassStudy();
}
}
function showNw() {
$this->load->model($this->config->item("rg_folder").'mo_rg_news','nw');
$this->load->model($this->config->item("rg_folder").'mo_rg_newsfileupload','nwu');
$this->load->model($this->config->item("ums_folder").'m_umsystem','sys');
$this->load->model($this->config->item("rg_folder").'mo_rg_config','cfg');
$data['qu_cfg'] = $this->cfg->qryCfg();
$i = 0;
$rs_nw = array();
$nw = $this->nw->qryNwBetweenDateOrderDateDesc(getNowDate());
if($nw->num_rows()) {
foreach($nw->result() as $row_nw) {
$con_file = array('nwuNwId' =>$row_nw->nwId);
$rs_nw[$i]['nw'] = $row_nw;
$rs_nw[$i]['file'] = $this->nwu->qryNwu($con_file);
$i++;
}
}
$data['rs_nw'] = $rs_nw;
$this->body .= $this->load->view($this->config->item("rg_folder").'v_g_showNw', $data, true);
$this->show();
}
}
?>
|