Viewing file: basedata.php (41.64 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('import.php');
class Basedata extends Import {
// function __construct() {
// parent::Controller();
// }
// ###### start typeaward
function typeaward_input() {
$this->load->model($this->config->item("ea_folder").'m_typeaward','ta');
// ###### update
$typeAwardId = $this->input->post('typeAwardId');
$this->ta->typeAwardId = $typeAwardId;
$this->contents['qu_ta'] = $this->ta->get_by_key();
// ###### end update
$ord_rs_ta = array('typeAwardNameT' => "");
$this->contents['rs_ta'] = $this->ta->qryTa('',$ord_rs_ta);
$this->output($this->config->item("ea_folder")."v_addTypeAward");
}
function typeaward_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('typeAwardNameT',' ','trim|required|xss_clean');
$this->form_validation->set_rules('typeAwardNameE',' ','trim|required|xss_clean');
$this->form_validation->set_rules('typeAwardId',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_typeaward','ta');
$typeAwardNameT = $this->input->post('typeAwardNameT');
$typeAwardNameE = $this->input->post('typeAwardNameE');
$typeAwardId = $this->input->post('typeAwardId');
$this->ta->typeAwardId = $typeAwardId;
$qu_ta = $this->ta->get_by_key();
$this->db->trans_begin();
if($qu_ta->num_rows()==0) {
$con_rs_ta = array('typeAwardNameE' => $typeAwardNameE,
'typeAwardNameT' => $typeAwardNameT);
$rs_ta = $this->ta->qryTa($con_rs_ta);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_ta->num_rows()==0) {
$this->ta->typeAwardId = "";
$this->ta->typeAwardNameE = $typeAwardNameE;
$this->ta->typeAwardNameT = $typeAwardNameT;
$this->ta->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_ta = $this->ta->qryTaNotId($typeAwardNameE, $typeAwardNameT, $typeAwardId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_ta->num_rows()==0) {
$this->ta->get_by_key(TRUE);
$this->ta->typeAwardNameE = $typeAwardNameE;
$this->ta->typeAwardNameT = $typeAwardNameT;
$this->ta->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/typeaward_input");
} else {
$this->typeaward_input();
}
}
function typeaward_delete() {
$this->load->model($this->config->item("ea_folder").'m_typeaward','ta');
$this->db->trans_begin();
$typeAwardId = $this->input->post('typeAwardId');
$this->ta->typeAwardId = $typeAwardId;
$this->ta->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/typeaward_input");
}
function typeaward_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_typeaward','ta');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_ta = array('typeAwardNameT' => "");
$this->contents['rs_ta'] = $this->ta->qryTa('',$ord_rs_ta);
$this->output_detail($this->config->item("ea_folder")."v_addTypeAward_ex");
}
// ###### end typeaward
// ###### start levelaward
function levelaward_input() {
$this->load->model($this->config->item("ea_folder").'m_levelaward','la');
// ##### update
$levelAwardId = $this->input->post('levelAwardId');
$this->la->levelAwardId = $levelAwardId;
$this->contents['qu_la'] = $this->la->get_by_key();
// ##### end update
$ord_rs_la = array('levelAwardNameT' => '');
$this->contents['rs_la'] = $this->la->qryLevAw('',$ord_rs_la);
$this->output($this->config->item("ea_folder")."v_addLevelAward");
}
function levelaward_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('levelAwardNameT',' ','trim|required|xss_clean');
$this->form_validation->set_rules('levelAwardNameE',' ','trim|required|xss_clean');
$this->form_validation->set_rules('levelAwardId',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_levelaward','la');
$levelAwardNameT = $this->input->post('levelAwardNameT');
$levelAwardNameE = $this->input->post('levelAwardNameE');
$levelAwardId = $this->input->post('levelAwardId');
$this->la->levelAwardId = $levelAwardId;
$qu_la = $this->la->get_by_key();
$this->db->trans_begin();
if($qu_la->num_rows()==0) {
$con_rs_la = array('levelAwardNameT' => $levelAwardNameT,
'levelAwardNameE' => $levelAwardNameE);
$rs_la = $this->la->qryLevAw($con_rs_la);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_la->num_rows()==0) {
$this->la->levelAwardId = "";
$this->la->levelAwardNameE = $levelAwardNameE;
$this->la->levelAwardNameT = $levelAwardNameT;
$this->la->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_la = $this->la->qryLevAwNotId($levelAwardNameE, $levelAwardNameT, $levelAwardId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_la->num_rows()==0) {
$this->la->get_by_key(TRUE);
$this->la->levelAwardNameE = $levelAwardNameE;
$this->la->levelAwardNameT = $levelAwardNameT;
$this->la->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/levelaward_input");
} else {
$this->levelaward_input();
}
}
function levelaward_delete() {
$this->load->model($this->config->item("ea_folder").'m_levelaward','la');
$this->db->trans_begin();
$levelAwardId = $this->input->post('levelAwardId');
$this->la->levelAwardId = $levelAwardId;
$this->la->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/levelaward_input");
}
function levelaward_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_levelaward','la');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_la = array('levelAwardNameT' => '');
$this->contents['rs_la'] = $this->la->qryLevAw('',$ord_rs_la);
$this->output_detail($this->config->item("ea_folder")."v_addLevelAward_ex");
}
// ###### end levelaward
// ###### start education
function education_input($string="", $flg=0) {
$this->load->model($this->config->item("ea_folder").'m_education','edu');
$str = ($string!="") ? $string : $this->input->post('str');
/* ##### แบ่งตัวอักษร ##### */
$this->contents['edu'] = $this->edu->qryDistinctEduName();
/* ##### end แบ่งตัวอักษร ##### */
if($str!="") {
$con_rs_edu = array('educationName' => $str.'%');
$ord_rs_edu = array('educationName' => '');
$this->contents['rs_edu'] = $this->edu->qryEdu($con_rs_edu,$ord_rs_edu);
$this->contents['str'] = $str;
}
// ###### start update
$educationId = $this->input->post('educationId');
$this->edu->educationId = $educationId;
$this->contents['qu_edu'] = $this->edu->get_by_key();
$this->contents['flg'] = $flg;
// ###### end update
$this->output($this->config->item("ea_folder")."v_addEducation");
}
function education_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('educationName',' ','trim|required|xss_clean');
$this->form_validation->set_rules('educationId',' ','trim|xss_clean');
$this->form_validation->set_rules('str',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_education','edu');
$educationName = $this->input->post('educationName');
$educationId = $this->input->post('educationId');
$str = $this->input->post('str');
$this->edu->educationId = $educationId;
$qu_edu = $this->edu->get_by_key();
$this->db->trans_begin();
if($qu_edu->num_rows()==0) {
$con_rs_edu = array('educationName' => $educationName);
$rs_edu = $this->edu->qryEdu($con_rs_edu);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_edu->num_rows()==0) {
$this->edu->educationId = "";
$this->edu->educationName = $educationName;
$this->edu->pbriId = "";
$this->edu->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_edu = $this->edu->qryEduNotId($educationName, $educationId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_edu->num_rows()==0) {
$this->edu->get_by_key(TRUE);
$this->edu->educationName = $educationName;
$this->edu->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
$qu_edu = $this->edu->qryEduNameByString($educationName);
$str = $qu_edu->row()->educationName;
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
} else {
$this->db->trans_commit();
}
$this->load->vars(array('flgSave' => $flgSave));
$this->education_input($str, 1);
} else {
$this->education_input();
}
}
function education_delete() {
$this->load->model($this->config->item("ea_folder").'m_education','edu');
$str = $this->input->post('str');
$this->db->trans_begin();
$educationId = $this->input->post('educationId');
$this->edu->educationId = $educationId;
$this->edu->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$flgSave = $this->config->item('ea_flgDel_21');
} else {
$this->db->trans_commit();
$flgSave = $this->config->item('ea_flgDel_30');
}
$this->load->vars(array('flgSave' => $flgSave));
$this->education_input($str, 1);
}
function education_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_education','edu');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_edu = array('educationName' => '');
$this->contents['rs_edu'] = $this->edu->qryEdu('',$ord_rs_edu);
$this->output_detail($this->config->item("ea_folder")."v_addEducation_ex");
}
// ###### end education
// ###### start majoredu
function majoredu_input($string="", $flg=0) {
$this->load->model($this->config->item("ea_folder").'m_majoredu','maj');
$str = ($string!="") ? $string : $this->input->post('str');
$this->contents['maj'] = $this->maj->qryDistinctMajName();
// ###### start update
$majoreduId = $this->input->post('majoreduId');
$this->maj->majoreduId = $majoreduId;
$this->contents['qu_maj'] = $this->maj->get_by_key();
$this->contents['flg'] = $flg;
// ###### end update
if($str!="") {
$con_rs_maj = array('majoreduName' => $str."%");
$ord_rs_maj = array('majoreduName' => '');
$this->contents['rs_maj'] = $this->maj->qryMaj($con_rs_maj,$ord_rs_maj);
}
$this->contents['str'] = $str;
$this->output($this->config->item("ea_folder")."v_addMajorEdu");
}
function majoredu_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('majoreduName',' ','trim|required|xss_clean');
$this->form_validation->set_rules('majoreduId',' ','trim|xss_clean');
$this->form_validation->set_rules('str',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_majoredu','maj');
$majoreduName = $this->input->post('majoreduName');
$majoreduId = $this->input->post('majoreduId');
$str = $this->input->post('str');
$this->maj->majoreduId = $majoreduId;
$qu_maj = $this->maj->get_by_key();
$this->db->trans_begin();
if($qu_maj->num_rows()==0) {
$con_rs_maj = array('majoreduName' => $majoreduName);
$rs_maj = $this->maj->qryMaj($con_rs_maj);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_maj->num_rows()==0) {
$this->maj->majoreduId = "";
$this->maj->majoreduName = $majoreduName;
$this->maj->pbriId = "";
$this->maj->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_maj = $this->maj->qryMajNotId($majoreduName, $majoreduId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_maj->num_rows()==0) {
$this->maj->get_by_key(TRUE);
$this->maj->majoreduName = $majoreduName;
$this->maj->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
$qu_maj = $this->maj->qryMajNameByString($majoreduName);
$str = $qu_maj->row()->majoreduName;
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
} else {
$this->db->trans_commit();
}
$this->load->vars(array('flgSave' => $flgSave));
$this->majoredu_input($str, 1);
} else {
$this->majoredu_input();
}
}
function majoredu_delete() {
$this->load->model($this->config->item("ea_folder").'m_majoredu','maj');
$str = $this->input->post('str');
$this->db->trans_begin();
$majoreduId = $this->input->post('majoreduId');
$this->maj->majoreduId = $majoreduId;
$this->maj->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$flgSave = $this->config->item('ea_flgDel_21');
} else {
$this->db->trans_commit();
$flgSave = $this->config->item('ea_flgDel_30');
}
$this->load->vars(array('flgSave' => $flgSave));
$this->majoredu_input($str, 1);
}
function majoredu_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_majoredu','maj');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_maj = array('majoreduName' => '');
$this->contents['rs_maj'] = $this->maj->qryMaj('', $ord_rs_maj);
$this->output_detail($this->config->item("ea_folder")."v_addMajorEdu_ex");
}
// ###### end majoredu
// ###### start programalumni
function programalumni_input() {
$this->load->model($this->config->item("ea_folder").'m_programalumni','pa');
$ord_rs_pa = array('programalumniName' => '');
$this->contents['rs_pa'] = $this->pa->qryPa('',$ord_rs_pa);
// ##### start update
$programalumniId = $this->input->post('programalumniId');
$this->pa->programalumniId = $programalumniId;
$this->contents['qu_pa'] = $this->pa->get_by_key();
// ##### end update
$this->output($this->config->item("ea_folder")."v_addProgramAlumni");
}
function programalumni_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('programalumniName',' ','trim|required|xss_clean');
$this->form_validation->set_rules('programalumniId',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_programalumni','pa');
$programalumniName = $this->input->post('programalumniName');
$programalumniId = $this->input->post('programalumniId');
$this->pa->programalumniId = $programalumniId;
$qu_pa = $this->pa->get_by_key();
$this->db->trans_begin();
if($qu_pa->num_rows()==0) {
$con_rs_pa = array('programalumniName' => $programalumniName);
$rs_pa = $this->pa->qryPa($con_rs_pa);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_pa->num_rows()==0) {
$this->pa->programalumniId = "";
$this->pa->programalumniName = $programalumniName;
$this->pa->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_pa = $this->pa->qryPaNotId($programalumniName, $programalumniId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_pa->num_rows()==0) {
$this->pa->get_by_key(TRUE);
$this->pa->programalumniName = $programalumniName;
$this->pa->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/programalumni_input");
} else {
$this->programalumni_input();
}
}
function programalumni_delete() {
$this->load->model($this->config->item("ea_folder").'m_programalumni','pa');
$this->db->trans_begin();
$programalumniId = $this->input->post('programalumniId');
$this->pa->programalumniId = $programalumniId;
$this->pa->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/programalumni_input");
}
function programalumni_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_programalumni','pa');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_pa = array('programalumniName' => '');
$this->contents['rs_pa'] = $this->pa->qryPa('',$ord_rs_pa);
$this->output_detail($this->config->item("ea_folder")."v_addProgramAlumni_ex");
}
// ###### end programalumni
// ###### start ea_curriculumdetails
function ea_curriculumdetails_input() {
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumdetails','curd');
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumconfig','cc');
$this->load->model($this->config->item("ea_folder").'m_ea_edudegree','edg');
$this->load->model($this->config->item("ppc_folder").'mo_level','lev');
$this->contents['rs_cc'] = $this->cc->get_optionsCc();
$this->contents['cc'] = $this->cc->get_countAll();
$ord_rs_edg = array('edgName' => '');
$this->contents['rs_edg'] = $this->edg->get_optionsEdg('',$ord_rs_edg);
$this->contents['edg'] = $this->edg->get_countAll();
$ord_rs_lev = array('levelName' => '');
$this->contents['rs_lev'] = $this->lev->get_options('',$ord_rs_lev);
// ###### start update
$curId = $this->input->post('curId');
$this->curd->curId = $curId;
$this->contents['qu_curd'] = $this->curd->get_by_key();
// ###### end update
$ord_rs_curd = array('curName' => '');
$this->contents['rs_curd'] = $this->curd->qryCurdJoinLev('',$ord_rs_curd);
/********** ต้องไปดึงข้อมูลที่สำคัญๆ จากระบบทะเบียนมาก่อน ************/
// copy rg_Generation
$copyGen = $this->copy_Gen();
$res_copyGen = ($copyGen=='1') ? "คัดลอกข้อมูลรุ่นสำเร็จ" : "คัดลอกข้อมูลรุ่นไม่สำเร็จ";
// copy rg_Curriculum+rg_EduLevel
$copyCur = $this->copy_Cur();
$res_copyCur = ($copyCur=='1') ? "คัดลอกข้อมูลหลักสูตรสำเร็จ" : "คัดลอกข้อมูลหลักสูตรสำเร็จไม่สำเร็จ";
// copy rg_CurriculumConfig
$copyCurriculumConfig = $this->copy_CurriculumConfig();
$res_copyCurriculumConfig = ($copyCurriculumConfig=='1') ? "คัดลอกข้อมูลประเภทบัณฑิตสำเร็จ" : "คัดลอกข้อมูลประเภทบัณฑิตสำเร็จไม่สำเร็จ";
// copy rg_EduDegree
$copyEdg = $this->copy_Edg();
$res_copyEdg = ($copyEdg=="1") ? "คัดลอกข้อมูลวุฒิการศึกษาสำเร็จ" : "คัดลอกข้อมูลวุฒิการศึกษาไม่สำเร็จ";
//echo $res_copyGen.'/'.$res_copyCur.'/'.$res_copyCurriculumConfig.'/'.$res_copyEdg;
/**********************/
$this->output($this->config->item("ea_folder")."v_addCurriculumDetails");
}
function copy_ea_curriculumconfig() {
$process = $this->copy_CurriculumConfig();
if($process==1) {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_40'));
} else {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_50'));
}
redirect($this->config->item("ea_folder")."basedata/ea_curriculumdetails_input");
}
function copy_ea_edudegree() {
$process = $this->copy_Edg();
if($process==1) {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_40'));
} else {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_50'));
}
redirect($this->config->item("ea_folder")."basedata/ea_curriculumdetails_input");
}
function ea_curriculumdetails_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curName',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curCcId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curEdgId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curElvId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curId',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumdetails','curd');
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumconfig','cc');
$this->load->model($this->config->item("ea_folder").'m_ea_edudegree','edg');
$this->load->model($this->config->item("ppc_folder").'mo_level','lev');
$curName = $this->input->post('curName');
$curCcId = $this->input->post('curCcId');
$curEdgId = $this->input->post('curEdgId');
$curElvId = $this->input->post('curElvId');
$curId = $this->input->post('curId');
$this->curd->curId = $curId;
$qu_curd = $this->curd->get_by_key();
// หารายละเอียดเกี่ยวกับหลักสูตร
$this->cc->ccId = $curCcId;
$this->cc->get_by_key(TRUE);
$this->edg->edgId = $curEdgId;
$this->edg->get_by_key(TRUE);
$this->lev->levelId = $curElvId;
$this->lev->get_by_key(TRUE);
// จบ หารายละเอียดเกี่ยวกับหลักสูตร
$this->db->trans_begin();
if($qu_curd->num_rows()==0) {
$con_rs_curd = array('curName' => $curName,
'curCcId' => $curCcId,
'curEdgId' => $curEdgId,
'curElvId' => $curElvId);
$rs_curd = $this->curd->qryCurd($con_rs_curd);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_curd->num_rows()==0) {
$this->curd->curId = $this->curd->qryMaxIdByCurAddTypeIsA();
$this->curd->curImproveY = "";
$this->curd->curName = $curName;
$this->curd->curNameE = "";
$this->curd->curAbbr = "";
$this->curd->curAbbrE = "";
$this->curd->curStatus = "N"; // เพิ่มเองให้สถานะการใช้หลักสูตรเป็น N
$this->curd->curCcId = $curCcId;
$this->curd->ccCode = $this->cc->ccCode;
$this->curd->ccName = $this->cc->ccName;
$this->curd->curEdgId = $curEdgId;
$this->curd->edgName = $this->edg->edgName;
$this->curd->edgNameE = $this->edg->edgNameE;
$this->curd->edgAbbr = $this->edg->edgAbbr;
$this->curd->edgAbbrE = $this->edg->edgAbbrE;
$this->curd->curElvId = $this->lev->levelId;
$this->curd->levelName = $this->lev->levelName;
$this->curd->levelNameEng = $this->lev->levelNameEng;
$this->curd->levelAbbr = $this->lev->levelAbbr;
$this->curd->levelAbbrEng = $this->lev->levelAbbrEng;
$this->curd->curAddType = "A";
$this->curd->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_curd = $this->curd->qryCurdNotId($curName, $curCcId, $curEdgId, $curElvId, $curId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_curd->num_rows()==0) {
$this->curd->get_by_key(TRUE);
$this->curd->curName = $curName;
$this->curd->curCcId = $curCcId;
$this->curd->ccCode = $this->cc->ccCode;
$this->curd->ccName = $this->cc->ccName;
$this->curd->curEdgId = $curEdgId;
$this->curd->edgName = $this->edg->edgName;
$this->curd->edgNameE = $this->edg->edgNameE;
$this->curd->edgAbbr = $this->edg->edgAbbr;
$this->curd->edgAbbrE = $this->edg->edgAbbrE;
$this->curd->curElvId = $this->lev->levelId;
$this->curd->levelName = $this->lev->levelName;
$this->curd->levelNameEng = $this->lev->levelNameEng;
$this->curd->levelAbbr = $this->lev->levelAbbr;
$this->curd->levelAbbrEng = $this->lev->levelAbbrEng;
$this->curd->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/ea_curriculumdetails_input");
} else {
$this->ea_curriculumdetails_input();
}
}
function ea_curriculumdetails_delete() {
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumdetails','curd');
$this->db->trans_begin();
$curId = $this->input->post('curId');
$this->curd->curId = $curId;
$this->curd->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/ea_curriculumdetails_input");
}
function ea_curriculumdetails_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumdetails','curd');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_curd = array('curName' => '');
$this->contents['rs_curd'] = $this->curd->qryCurdJoinLev('',$ord_rs_curd);
$this->output_detail($this->config->item("ea_folder")."v_addCurriculumDetails_ex");
}
// ###### end ea_curriculumdetails
// ###### start level : ระดับการศึกษา
function level_input() {
$this->load->model($this->config->item("ppc_folder").'mo_level','lev');
$ord_rs_lev = array('levelName' => "");
$this->contents['rs_lev'] = $this->lev->qryLev('',$ord_rs_lev);
$this->output($this->config->item("ea_folder")."v_addLevel");
}
function level_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ppc_folder").'mo_level','lev');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_lev = array('levelName' => "");
$this->contents['rs_lev'] = $this->lev->qryLev('',$ord_rs_lev);
$this->output_detail($this->config->item("ea_folder")."v_addLevel_ex");
}
// ###### end level : ระดับการศึกษา
// ###### start mapprogram
function mapprogram_input() {
$this->load->model($this->config->item("ea_folder").'m_ea_curriculumdetails','curd');
$this->load->model($this->config->item("ea_folder").'m_programalumni','pa');
$this->load->model($this->config->item("ea_folder").'m_mapprogram','map');
$this->contents['acY'] = $this->session->userdata('acY');
$con_map = array('mpGraduateY' => $this->contents['acY']);
$map = $this->map->qryMap($con_map);
if($map->num_rows()) {
$this->contents['chkColor'] = $this->config->item('ea_green_color');
} else {
$this->contents['chkColor'] = "";
}
$this->contents['cur'] = $this->curd->get_countAll();
$this->contents['rs_cur'] = $this->curd->get_optionsCurId();
$this->contents['rs_pa'] = $this->pa->get_options();
// ##### start update
$mapId = $this->input->post('mapId');
if($mapId!="") {
$con_qu_map = array('mapId' => $mapId);
$this->contents['qu_map'] = $this->map->qryMapJoinCurdPa($con_qu_map);
}
// ##### end update
$ord_rs_map = array('mpGraduateY' => "DESC");
$this->contents['rs_map'] = $this->map->qryMapJoinCurdPa('',$ord_rs_map);
$this->output($this->config->item("ea_folder")."v_addMapProgram");
}
function copy_ea_curriculumdetails() {
$process = $this->copy_Cur();
if($process==1) {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_40'));
} else {
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_50'));
}
redirect($this->config->item("ea_folder")."basedata/mapprogram_input");
}
function copy_mapprogram() {
$this->load->model($this->config->item("ea_folder").'m_mapprogram','map');
$acY = $this->input->post('acY');
$con_map = array('mpGraduateY' => $acY);
$map = $this->map->qryMap($con_map);
// คัดลอกได้เฉพาะที่ยังไม่มีข้อมูลในปีนั้นๆ
if($map->num_rows()==0) {
$rs_map = $this->map->qryMapToCopy();
if($rs_map->num_rows()) {
$this->db->trans_begin();
foreach($rs_map->result() as $row_map) {
$this->map->mapId = "";
$this->map->mpGraduateY = $acY;
$this->map->programId_reg = $row_map->programId_reg;
$this->map->programId_alumni = $row_map->programId_alumni;
$this->map->insert();
}
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_50'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgCopy_40'));
}
}
}
redirect($this->config->item("ea_folder")."basedata/mapprogram_input");
}
function mapprogram_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('mpGraduateY',' ','trim|required|is_natural_no_zero|callback_checkAdY|xss_clean');
$this->form_validation->set_rules('programId_reg',' ','trim|required|xss_clean');
$this->form_validation->set_rules('programId_alumni',' ','trim|required|xss_clean');
$this->form_validation->set_rules('mapId',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_mapprogram','map');
$this->load->model($this->config->item("ea_folder").'m_alumnimain','am');
$mpGraduateY = $this->input->post('mpGraduateY');
$programId_reg = $this->input->post('programId_reg');
$programId_alumni = $this->input->post('programId_alumni');
$mapId = $this->input->post('mapId');
$this->map->mapId = $mapId;
$qu_map = $this->map->get_by_key();
$this->db->trans_begin();
if($qu_map->num_rows()==0) {
$con_rs_map = array('mpGraduateY' => $mpGraduateY,
'programId_reg' => $programId_reg);
$rs_map = $this->map->qryMap($con_rs_map);
// insert เฉพาะข้อมูลไม่ซ้ำ
// update หลักสูตร ตามระบบทะเบียนศิษย์เก่าให้ นศ.
if($rs_map->num_rows()==0) {
$this->map->mapId = "";
$this->map->mpGraduateY = $mpGraduateY;
$this->map->programId_reg = $programId_reg;
$this->map->programId_alumni = $programId_alumni;
$this->map->insert();
$flgSave = $this->config->item('ea_flgSave_10');
// เอารหัสหลักสูตรทะเบียนศิษย์เก่ามาอัพเดท
$this->am->updateAmProgramAlumniByProgramId($programId_alumni, $programId_reg, $mpGraduateY);
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_map = $this->map->qryMapNotId($programId_reg, $mpGraduateY, $mapId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_map->num_rows()==0) {
$this->map->get_by_key(TRUE);
$this->map->mpGraduateY = $mpGraduateY;
$this->map->programId_reg = $programId_reg;
$this->map->programId_alumni = $programId_alumni;
$this->map->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/mapprogram_input");
} else {
$this->mapprogram_input();
}
}
function mapprogram_delete() {
$this->load->model($this->config->item("ea_folder").'m_mapprogram','map');
$this->db->trans_begin();
$mapId = $this->input->post('mapId');
$this->map->mapId = $mapId;
$this->map->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/mapprogram_input");
}
function mapprogram_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_mapprogram','map');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$ord_rs_map = array('mpGraduateY' => "DESC");
$this->contents['rs_map'] = $this->map->qryMapJoinCurdPa('',$ord_rs_map);
$this->output_detail($this->config->item("ea_folder")."v_addMapProgram_ex");
}
// ###### end mapprogram
// ###### start basesalary
function basesalary_input() {
$this->load->model($this->config->item("ea_folder").'m_ea_basesalary','bs');
$this->load->model($this->config->item("ea_folder").'m_ea_edudegree','edg');
$this->load->model($this->config->item("ppc_folder").'mo_level','lev');
$ord_rs_edg = array('edgName' => '');
$this->contents['rs_edg'] = $this->edg->get_optionsEdg('',$ord_rs_edg);
$ord_rs_lev = array('levelName' => '');
$this->contents['rs_lev'] = $this->lev->get_options('',$ord_rs_lev);
// ##### start update
$bsId = $this->input->post('bsId');
if($bsId!="") {
$con_qu_bs = array('bsId' => $bsId);
$this->contents['qu_bs'] = $this->bs->qryBsJoinEdgLev($con_qu_bs);
}
// ##### end update
$this->contents['rs_bs'] = $this->bs->qryBsJoinEdgLev();
$this->output($this->config->item("ea_folder")."v_addBaseSalary");
}
function basesalary_insert_update() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('bsEdgId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('bsLevelId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('bsAmount',' ','trim|required|is_natural_no_zero|xss_clean');
$this->form_validation->set_rules('bsStartUse',' ','trim|required|xss_clean');
$this->form_validation->set_rules('fDate',' ','trim|required|xss_clean');
$this->form_validation->set_rules('bsId',' ','trim|xss_clean');
if($this->input->post('fDate')=='F') {
$this->form_validation->set_rules('bsFinishUse',' ','trim|callback_checkFrDate[bsStartUse]|xss_clean');
}
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'m_ea_basesalary','bs');
$bsEdgId = $this->input->post('bsEdgId');
$bsLevelId = $this->input->post('bsLevelId');
$bsAmount = $this->input->post('bsAmount');
$bsStartUse = $this->input->post('bsStartUse');
$bsFinishUse = $this->input->post('bsFinishUse');
$bsId = $this->input->post('bsId');
$fDate = $this->input->post('fDate');
$this->bs->bsId = $bsId;
$qu_bs = $this->bs->get_by_key();
$this->db->trans_begin();
if($qu_bs->num_rows()==0) {
$con_rs_bs = array('bsEdgId' => $bsEdgId,
'bsLevelId' => $bsLevelId);
$rs_bs = $this->bs->qryBs($con_rs_bs);
// insert เฉพาะข้อมูลไม่ซ้ำ
if($rs_bs->num_rows()==0) {
$this->bs->bsId = "";
$this->bs->bsEdgId = $bsEdgId;
$this->bs->bsLevelId = $bsLevelId;
$this->bs->bsStartUse = splitDateForm2($bsStartUse,'-');
if($fDate=="F") {
$this->bs->bsFinishUse = splitDateForm2($bsFinishUse,'-');
} else {
$this->bs->bsFinishUse = "0000-00-00";
}
$this->bs->bsAmount = $bsAmount;
$this->bs->insert();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
} else {
$rs_bs = $this->bs->qryBsNotId($bsEdgId, $bsLevelId, $bsId);
// update เฉพาะข้อมูลไม่ซ้ำ
if($rs_bs->num_rows()==0) {
$this->bs->get_by_key(TRUE);
$this->bs->bsStartUse = $bsStartUse;
if($fDate=="F") {
$this->bs->bsFinishUse = splitDateForm2($bsFinishUse,'-');
} else {
$this->bs->bsFinishUse = "0000-00-00";
}
$this->bs->bsAmount = $bsAmount;
$this->bs->update();
$flgSave = $this->config->item('ea_flgSave_10');
} else {
$flg_db_status = 0;
$flgSave = $this->config->item('ea_flgSave_21');
}
}
if($this->db->trans_status() === false || isset($flg_db_status)) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $flgSave);
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $flgSave);
}
redirect($this->config->item("ea_folder")."basedata/basesalary_input");
} else {
$this->basesalary_input();
}
}
function basesalary_delete() {
$this->load->model($this->config->item("ea_folder").'m_ea_basesalary','bs');
$this->db->trans_begin();
$bsId = $this->input->post('bsId');
$this->bs->bsId = $bsId;
$this->bs->delete();
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_21'));
} else {
$this->db->trans_commit();
$this->session->set_flashdata('flgSave', $this->config->item('ea_flgDel_30'));
}
redirect($this->config->item("ea_folder")."basedata/basesalary_input");
}
function basesalary_ex() {
$this->load->model($this->config->item("ppc_folder").'mo_config','cfg');
$this->load->model($this->config->item("ea_folder").'m_ea_basesalary','bs');
$this->contents['qu_cfg'] = $this->cfg->qryCfg();
$this->contents['rs_bs'] = $this->bs->qryBsJoinEdgLev();
$this->output_detail($this->config->item("ea_folder")."v_addBaseSalary_ex");
}
// ###### end basesalary
}
?>
|