Viewing file: alumni1.php (15.17 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('ea_controller.php');
class Alumni extends Ea_controller {
// function __construct() {
// parent::Controller();
// }
function am_input() {
$this->output($this->config->item("ea_folder")."v_searchAlumniForHis");
}
function am_search() {
$this->load->model($this->config->item("ea_folder").'mo_alumnimain','am');
if($this->input->post('studentCode')!="" || $this->input->post('studentName')!="" || $this->input->post('curName')!="" || $this->input->post('admitAcadYear')!="") {
$this->contents['rs_am'] = $this->am->qryAmByLikeNameAndCurAndAdY($this->input->post('studentCode'),$this->input->post('studentName'),$this->input->post('curName'),$this->input->post('admitAcadYear'));
} else if($this->input->post('search'))
$this->contents['err_msg'] = "กรุณาป้อนคำค้นลงในช่องใดช่องหนึ่ง";
$this->output($this->config->item("ea_folder")."v_searchAlumniForHis");
}
function tb_1save() {
//$tab = 1;
//$this->binput($tab);
//redirect($this->config->item("ea_folder")."tab/binput");
}
function tb_2save() {
redirect($this->config->item("ea_folder")."tab/binput");
}
function binput($tab=0) {
$this->output($this->config->item("ea_folder")."v_bMain");
}
function am_detail($tb='',$std='') {
//$tab = $this->input->post('tab')=='' ? ($tb==0 ? 1 : $tb) : $this->input->post('tab');
///$stdId = $this->input->post('stdId')=="" ? $id : $this->input->post('stdId');
if($tb=='') {
$tab = ($this->input->post('tab')=='') ? 1 : $this->input->post('tab');
} else {
$tab = $tb;
}
$data['alumniId'] = $this->input->post('alumniId');
if($tab==1) {
$data['tab'] = $tab;
$ord_rs_na = array('nationName');
$this->load->model($this->config->item('ea_folder').'mo_nation','na');
$data['rs_na'] = $this->na->get_options('','',$ord_rs_na,'y');
$ord_rs_re = array('religionName');
$this->load->model($this->config->item('ea_folder').'mo_religion','re');
$data['rs_re'] = $this->re->get_options('',$ord_rs_re,'','y');
$con_rs_cur = array("curStatus" => "Y");
$ord_rs_cur = array("curName" => "curName");
$this->load->model($this->config->item('ea_folder').'mo_curriculum','cur');
$data['rs_cur'] = $this->cur->get_options($con_rs_cur, $ord_rs_cur,'','y');
$con_qu_am = array('am.alumniId' => $this->input->post('alumniId'));
$this->load->model($this->config->item('ea_folder').'mo_alumnimain','am');
$data['qu_am'] = $this->am->qryAmAndAb($con_qu_am);
echo $this->db->last_query();
$this->contents['v'] = $this->load->view($this->config->item('ea_folder').'v_alumniDetail',$data,TRUE);
} else if($tab==2) {
$data['tab'] = $tab;
$this->load->model($this->config->item('ea_folder').'mo_alumnibio','ab');
$con_qu_ab_home = array('ab.alumniId' => $this->input->post('alumniId'));
$data['qu_ab_home'] = $this->ab->qryAbAndAddHome($con_qu_ab_home );
$con_qu_ab_curr = array('ab.alumniId' => $this->input->post('alumniId'));
$data['qu_ab_curr'] = $this->ab->qryAbAndAddCurrent($con_qu_ab_curr );
$con_qu_ab_off = array('ab.alumniId' => $this->input->post('alumniId'));
$data['qu_ab_off'] = $this->ab->qryAbAndAddOffice($con_qu_ab_off );
$ord_rs_co = array('countryName');
$this->load->model($this->config->item('ea_folder').'mo_country','co');
$data['rs_co'] = $this->co->get_options('','',$ord_rs_co,'y');
$this->contents['v'] = $this->load->view($this->config->item('ea_folder').'v_alumniAddress',$data,TRUE);
} else if($tab==3) {
$data['tab'] = $tab;
$this->load->model($this->config->item('ea_folder').'mo_hiswork','hw');
//$con_qu_hw = array('alumniId' => $this->input->post('studentId'));
//$ord_qu_hw = array('seqId');
//$data['qu_hw'] = $this->hw->qryHw($con_qu_hw,$ord_qu_hw);
//echo $this->db->last_query();
$con_rs_hw = array('alumniId' => $this->input->post('alumniId'));
$ord_rs_hw = array('seqId');
$data['rs_hw'] = $this->hw->qryHw($con_rs_hw,$ord_rs_hw);
$this->contents['v'] = $this->load->view($this->config->item('ea_folder').'v_alumniWork',$data,TRUE);
} else if($tab==4) {
$data['tab'] = $tab;
$this->load->model($this->config->item('ea_folder').'mo_hisaward','ha');
$ord_rs_ta = array('taNameT');
$this->load->model($this->config->item('ea_folder').'mo_typeaward','ta');
$data['rs_ta'] = $this->ta->get_options('',$ord_rs_ta,'','y');
$ord_rs_la = array('laNameT');
$this->load->model($this->config->item('ea_folder').'mo_levelaward','la');
$data['rs_la'] = $this->la->get_options('',$ord_rs_la,'','y');
$con_rs_ha = array('alumniId' => $this->input->post('alumniId'));
$ord_rs_ha = array('seqId');
$data['rs_ha'] = $this->ha->qryHa($con_rs_ha,$ord_rs_ha);
$this->contents['v'] = $this->load->view($this->config->item('ea_folder').'v_alumniAward',$data,TRUE);
} else if($tab==5) {
$data['tab'] = $tab;
$this->load->model($this->config->item('ea_folder').'mo_hiseducation','he');
$ord_rs_ledu = array('leduName');
$this->load->model($this->config->item('ea_folder').'mo_leveledu','ledu');
$data['rs_ledu'] = $this->ledu->get_options('',$ord_rs_ledu,'','y');
$ord_rs_edu = array('eduName');
$this->load->model($this->config->item('ea_folder').'mo_education','edu');
$data['rs_edu'] = $this->edu->get_options('',$ord_rs_edu,'','y');
$ord_rs_medu = array('meduName');
$this->load->model($this->config->item('ea_folder').'mo_majoredu','medu');
$data['rs_medu'] = $this->medu->get_options('',$ord_rs_medu,'','y');
$con_rs_he = array('alumniId' => $this->input->post('alumniId'));
$ord_rs_he = array('seqId');
$data['rs_he'] = $this->he->qryHe($con_rs_he,$ord_rs_he);
$this->contents['v'] = $this->load->view($this->config->item('ea_folder').'v_alumniLearn',$data,TRUE);
}
$this->contents['tab'] = $tab;
$this->output($this->config->item("ea_folder")."v_mainAlumni");
}
function v_alumniDetail() {
$tab = $this->input->post('tab');
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
$this->form_validation->set_rules('programId','หลักสูตร','trim|required|xss_clean');
$this->form_validation->set_rules('prefixId','คำนำหน้าชื่อ','trim|required|xss_clean');
$this->form_validation->set_rules('studentName','ชื่อ','trim|required|xss_clean');
$this->form_validation->set_rules('studentSurname','นามสกุล','trim|required|xss_clean');
$this->form_validation->set_rules('citizenId','เลขที่บัตรประจำตัวประชาชน','trim|required|xss_clean');
if($this->form_validation->run() == true) {
$con_qu_am = array('am.alumniId' => $this->input->post('alumniId'));
$this->load->model($this->config->item("ea_folder").'mo_alumnimain','am');
$data['qu_am'] = $this->am->qryAmAndAb($con_qu_am);
//echo $this->db->last_query();
$this->am->alumniId = $this->input->post('alumniId');
$this->am->prefixId = $this->input->post('prefixId');
$this->am->programId = $this->input->post('programId');
$this->am->studentName = $this->input->post('studentName');
$this->am->studentSurname = $this->input->post('studentSurname');
$this->am->citizenId = $this->input->post('citizenId');
$this->am->update();
if($this->db->trans_status() === false)
$this->db->trans_rollback();
else
$this->db->trans_commit();
$this->v_alumniDetail();
} else {
$this->am_detail($tab);
}
}
function v_alumniAddress() {
$tab = $this->input->post('tab');
echo "processss ผ่าน ++".$tab;
$this->am_detail($tab);
}
function v_alumniWork() {
$tab = $this->input->post('tab');
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
$this->form_validation->set_rules('seqId',' ','trim|xss_clean');
$this->form_validation->set_rules('alumniId',' ','trim|xss_clean');
$this->form_validation->set_rules('companyNameT','ชื่อหน่วยงาน (ภาษาไทย)','trim|required|xss_clean');
$this->form_validation->set_rules('companyNameE','ชื่อหน่วยงาน (ภาษาอังกฤษ)','trim|required|xss_clean');
$this->form_validation->set_rules('companyAddr','ที่อยู่ของหน่วยงาน','trim|required|xss_clean');
$this->form_validation->set_rules('companyPosition','ตำแหน่ง','trim|required|xss_clean');
$this->form_validation->set_rules('companyAdmidPosYear',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'mo_hiswork','hw');
$con_rs_hw = array('alumniId' => $this->input->post('alumniId'),
'companyNameT' => $this->input->post('companyNameT'),
'companyNameE' => $this->input->post('companyNameE'),
'companyAddr' => $this->input->post('companyAddr'),
'companyPosition' => $this->input->post('companyAddr'),
'companyAdmidPosYear'=> $this->input->post('companyAdmidPosYear'));
$rs_hw = $this->hw->qryHw($con_rs_hw,'','');
$seqId = $this->hw->qryHwByMaxSeqId($this->input->post('alumniId'));
if(!$rs_hw->num_rows()) {
$this->hw->seqId = $seqId;
$this->hw->alumniId = $this->input->post('alumniId');
$this->hw->companyNameT = $this->input->post('companyNameT');
$this->hw->companyNameE = $this->input->post('companyNameE');
$this->hw->companyAddr = $this->input->post('companyAddr');
$this->hw->companyPosition = $this->input->post('companyPosition');
$this->hw->companyAdmidPosYear = date('Y-m-d');
if($this->input->post('seqId')=='') {
$this->hw->insert();
} else {
$this->hw->seqId = $this->input->post('seqId');
$this->hw->update();
}
redirect($this->config->item("ea_folder")."alumni/v_alumniAward");
}
} else {
$this->am_detail($tab);
}
}
function alumniWork_delete() {
$this->load->model($this->config->item("ea_folder").'mo_hiswork','hw');
$this->hw->seqId = $this->input->post('seqId');
$this->hw->delete();
redirect($this->config->item("ea_folder")."alumni/v_alumniWork");
}
function v_alumniAward() {
$tab = $this->input->post('tab');
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
$this->form_validation->set_rules('seqId',' ','trim|xss_clean');
$this->form_validation->set_rules('alumniId',' ','trim|xss_clean');
$this->form_validation->set_rules('awardNameT','ชื่อรางวัล (ภาษาไทย)','trim|required|xss_clean');
$this->form_validation->set_rules('awardNameE','ชื่อรางวัล (ภาษาอังกฤษ)','trim|required|xss_clean');
$this->form_validation->set_rules('awardCompany','หน่วยงานที่ให้รางวัล','trim|required|xss_clean');
$this->form_validation->set_rules('taId','ประเภทรางวัล','trim|required|xss_clean');
$this->form_validation->set_rules('laId','ระดับการได้รับรางวัล','trim|required|xss_clean');
$this->form_validation->set_rules('awardYear',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'mo_hisaward','ha');
$con_rs_ha = array('alumniId' => $this->input->post('alumniId'),
'awardNameT' => $this->input->post('awardNameT'),
'awardNameE' => $this->input->post('awardNameE'),
'awardCompany' => $this->input->post('awardCompany'),
'awardtaId' => $this->input->post('awardtaId'),
'awardlaId' => $this->input->post('awardlaId'),
'awardYear' => $this->input->post('awardYear'));
$rs_ha = $this->ha->qryHa($con_rs_ha,'','');
$seqId = $this->ha->qryHaByMaxSeqId($this->input->post('alumniId'));
echo $this->db->last_query();
if(!$rs_ha->num_rows()) {
$this->ha->seqId = $seqId;
$this->ha->alumniId = $this->input->post('alumniId');
$this->ha->awardNameT = $this->input->post('awardNameT');
$this->ha->awardNameE = $this->input->post('awardNameE');
$this->ha->awardCompany = $this->input->post('awardCompany');
$this->ha->awardtaId = $this->input->post('taId');
$this->ha->awardlaId = $this->input->post('laId');
$this->ha->awardYear = $this->input->post('awardYear');
if($this->input->post('seqId')=='') {
$this->ha->insert();
//echo $this->db->last_query();
} else {
$this->ha->seqId = $this->input->post('seqId');
$this->ha->update();
}
}
redirect($this->config->item("ea_folder")."alumni/v_alumniAward");
} else {
$this->am_detail($tab);
}
}
function v_alumniLearn() {
$tab = $this->input->post('tab');
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<font color="red">','</font>');
$this->form_validation->set_rules('seqId',' ','trim|xss_clean');
$this->form_validation->set_rules('alumniId',' ','trim|xss_clean');
$this->form_validation->set_rules('heduName','ชื่อปริญญา','trim|required|xss_clean');
$this->form_validation->set_rules('leduId','ระดับ','trim|required|xss_clean');
$this->form_validation->set_rules('eduId','สถาบัน','trim|required|xss_clean');
$this->form_validation->set_rules('meduId','สาขา','trim|required|xss_clean');
$this->form_validation->set_rules('heduSDate',' ','trim|xss_clean');
$this->form_validation->set_rules('heduGDate',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("ea_folder").'mo_hiseducation','he');
$con_rs_he = array('alumniId' => $this->input->post('alumniId'),
'heduName' => $this->input->post('heduName'),
'heduleduId' => $this->input->post('leduId'),
'hedueduId' => $this->input->post('eduId'),
'hedumeduId' => $this->input->post('meduId'),
'heduSDate' => $this->input->post('heduSDate'),
'heduGDate' => $this->input->post('heduSDate'));
$rs_he = $this->he->qryHe($con_rs_he,'','');
$seqId = $this->he->qryHeByMaxSeqId($this->input->post('alumniId'));
if(!$rs_he->num_rows()) {
$this->he->seqId = $seqId;
$this->he->alumniId = $this->input->post('alumniId');
$this->he->heduName = $this->input->post('heduName');
$this->he->heduleduId = $this->input->post('leduId');
$this->he->hedueduId = $this->input->post('eduId');
$this->he->hedumeduId = $this->input->post('meduId');
$this->he->heduSDate = date('Y-m-d');
$this->he->heduGDate = date('Y-m-d');
if($this->input->post('seqId')=='') {
$this->he->insert();
//echo $this->db->last_query();
} else {
$this->he->seqId = $this->input->post('seqId');
$this->he->update();
}
}
redirect($this->config->item("ea_folder")."alumni/v_alumniLearn");
} else {
$this->am_detail($tab);
}
}
}
?>
|