Viewing file: curriculum.php (5.11 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include("rg_controller.php");
class Curriculum extends Rg_controller {
// ##### start cur
function cur_show() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$ord_rs_cur = array('curName' => '');
$rs= $this->cur->qryCur('',$ord_rs_cur);
$this->contents['rs_cur'] = $rs;
if ( file_exists(dirname(__FILE__).'/curpbri.php') ) {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumpublic','cpub');
$cp = array();
$cpub_rs = $this->cpub->qryCpub();
if ($cpub_rs->num_rows()>0) {
foreach($cpub_rs->result() as $cpub_row){
$cp[$cpub_row->cpubCurId] = $cpub_row->cpubPublic;
}
}
$this->contents['cp'] = $cp;
}
$this->output($this->config->item("rg_folder")."v_showCurriculum");
}
function cur_detail() {
if ($this->input->server('REQUEST_METHOD') === 'POST') {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_edudegree','edg');
$id = $this->input->post('id');
$this->cur->curId = $id;
$rs = $this->cur->get_by_key();
$this->contents['qu_cur'] = $rs;
if ($rs->num_rows() > 0) {
$row = $rs->row();
$this->edg->edgId = $row->curEdgId;
$this->contents['qu_edg'] = $this->edg->get_by_key();
$this->load->model($this->config->item("ppc_folder").'mo_level','lv');
$this->lv->levelId = $row->curElvId;
$this->contents['qu_lv'] = $this->lv->get_by_key();
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumconfig','cc');
$this->cc->ccId = $row->curCcId;
$this->contents['qu_cc'] = $this->cc->get_by_key();
}
$this->output_detail($this->config->item("rg_folder")."v_detailCurriculum");
}
}
function cur_input() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_edudegree','edg');
$this->load->model($this->config->item("ppc_folder").'mo_level','lv');
$this->load->model($this->config->item("rg_folder").'mo_rg_gradetp','gtp');
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumconfig','cc');
$curId = $this->input->post('curId');
$this->cur->curId = $curId;
$qu_cur = $this->cur->get_by_key();
$this->contents['qu_cur'] = $qu_cur;
if ($qu_cur->num_rows()) {
$row_cur = $qu_cur->row();
$this->edg->edgId = $row_cur->curEdgId;
$this->contents['qu_edg'] = $this->edg->get_by_key();
$this->lv->levelId = $row_cur->curElvId;
$this->contents['qu_lv'] = $this->lv->get_by_key();
$this->gtp->gtpId = $row_cur->curGtpId;
$this->contents['qu_gtp'] = $this->gtp->get_by_key();
$this->cc->ccId = $row_cur->curCcId;
$this->contents['qu_cc'] = $this->cc->get_by_key();
}
$this->contents['rs_edg'] = $this->edg->qryEdg();
$this->contents['rs_lv'] = $this->lv->qryLev();
$this->contents['rs_gt'] = $this->gtp->qryGtp();
$con_rs_cur = array('ccStatus' => 'Y');
$ord_rs_cur = array('ccId' => 'ASC');
$this->contents['rs_cc'] = $this->cc->qryCc($con_rs_cur, $ord_rs_cur);
if ( file_exists(dirname(__FILE__).'/curpbri.php') ) {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumpublic','cpub');
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
if($this->input->post('curId')!=""){
$this->cpub->cpubCurId = $curId;
$qu_cp = $this->cpub->get_by_key();
$cpub = ($qu_cp->num_rows()>0)? $qu_cp->row()->cpubPublic:"";
$this->contents['cpub'] = $cpub;
$this->cs->csCurId = $curId;
$cs1 = $this->cs->qryCsLv1();
$lv1_credit = 0;
foreach( $cs1->result() as $lv1 ){
$lv1_credit+=$lv1->csCreditTotal;
}
$this->contents['lv1_credit'] = $lv1_credit;
}
$this->contents['action'] = 'curpbri/cur_insert_update';
$this->contents['pbri'] = 1;
} else {
$this->contents['action'] = 'curriculum/cur_update';
$this->contents['pbri'] = 0;
}
$this->output($this->config->item("rg_folder")."v_addCurriculum");
}
function cur_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curStatus',' ','trim|xss_clean');
if ($this->form_validation->run() == true) {
$this->db->trans_begin();
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->cur->curId = $this->input->post('curId');
$this->cur->get_by_key(TRUE);
$this->cur->curStatus = $this->input->post('curStatus') ? $this->input->post('curStatus') : 'Y';
$this->cur->curUpdateUsLogin = $this->session->userdata("UsLogin");
$this->cur->curUpdateDate = date('Y-m-d H:i:s');
$this->cur->update();
if ($this->cur->db->trans_status() === false) {
$this->cur->db->trans_rollback();
} else {
$this->cur->db->trans_commit();
}
redirect($this->config->item("rg_folder")."curriculum/cur_show");
} else {
$this->cur_input();
}
}
// ##### end cur
}
?>
|