Viewing file:      alumni.php (20.27 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')); //echo $this->db->last_query();die;         } 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=0, $id=0) {
          $tab = $this->input->post('tab')=='' ? ($tb==0 ? 1 : $tb) : $this->input->post('tab');         $alumniId = $this->input->post('alumniId')=="" ? $id : $this->input->post('alumniId');         //$studentId = $this->input->post('studentId')=="" ? $id : $this->input->post('studentId');
          $data['tab'] = $tab;         $data['alumniId'] = $alumniId;         //$data['studentId'] = $studentId;
          if($tab==1) {             $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) {                          $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');
              $con_qu_ab = array('ab.alumniId' => $this->input->post('alumniId'));             $this->load->model($this->config->item('ea_folder').'mo_alumnibio','ab');             $data['qu_ab'] = $this->ab->qryAb($con_qu_ab);                 //echo $this->db->last_query();
              $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;
              $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');             $this->load->model($this->config->item('ea_folder').'mo_hiseducation','he');             $data['rs_he'] = $this->he->qryHeAndLeEduMedu($con_rs_he,'',$ord_rs_he);             //echo $this->db->last_query();
              $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", $this->session->flashdata('msg'));         //$this->output($this->config->item("rg_folder")."v_editStudentMBInfo", $this->session->flashdata('msg'));     }
      function learn_delete() {         $this->load->model($this->config->item('ea_folder').'mo_hiseducation','he');
          $this->he->seqId = $this->input->post('seqId');         $this->he->delete();         $this->session->set_flashdata('msg', 3);         redirect($this->config->item("ea_folder")."basedata/la_input");     }     function v_alumniDetail() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('alumniId',' ','trim|required|xss_clean');         $this->form_validation->set_rules('studentId',' ','trim|required|xss_clean');         $this->form_validation->set_rules('tab',' ','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');         $this->form_validation->set_rules('programId','หลักสูตร','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_alumnimain','am');             $this->load->model($this->config->item("ea_folder").'mo_alumnibio','ab');
              $flgmsg = 0;             $this->db->trans_begin();             $alumniId = $this->input->post('alumniId');             $studentId = $this->input->post('studentId');             $tab = $this->input->post('tab');             $prefixId = $this->input->post('prefixId');             $studentName = $this->input->post('studentName');             $studentSurname = $this->input->post('studentSurname');             $citizenId = $this->input->post('citizenId');             $programId = $this->input->post('programId');             $studentEmail = $this->input->post('studentEmail');             $bloodGroup = $this->input->post('bloodGroup');             $nationId = $this->input->post('nationId');             $religionId = $this->input->post('religionId');
              $this->am->alumniId = $alumniId;             $this->am->studentId = $studentId;             $this->am->get_by_key(TRUE);             $this->am->prefixId = $prefixId;             $this->am->studentName = $studentName;             $this->am->studentSurname = $studentSurname;             $this->am->citizenId = $citizenId;             $this->am->programId = $programId;             $this->am->studentEmail = $studentEmail;             $this->am->updateDateTime = date('Y-m-d H:i:s');             $this->am->updateUserId = $this->session->userdata('UsLogin');             $this->am->update();
              $this->ab->alumniId = $alumniId;             $this->ab->studentId = $studentId;             $this->ab->get_by_key(TRUE);             $this->ab->bloodGroup = $bloodGroup;             $this->ab->nationId = $nationId;             $this->ab->religionId = $religionId;             $this->ab->update();             //echo $this->db->last_query();             $flgmsg = 10;
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 0);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', $flgmsg);             }
              //redirect($this->config->item("ea_folder")."alumni/am_detail/$tab/$alumniId");         //} else {             //redirect($this->config->item("ea_folder")."alumni/am_detail/$tab/$alumniId");             $this->am_detail();         }     }
      function v_alumniAddress() {         //$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('alumniId',' ','trim|required|xss_clean');         $this->form_validation->set_rules('studentId',' ','trim|required|xss_clean');         $this->form_validation->set_rules('tab',' ','trim|required|xss_clean');         $this->form_validation->set_rules('homeAddress','','trim|required|xss_clean');         $this->form_validation->set_rules('districtId','','trim|required|xss_clean');         $this->form_validation->set_rules('amphurId','','trim|required|xss_clean');         $this->form_validation->set_rules('provinceId','','trim|required|xss_clean');         $this->form_validation->set_rules('homeZipcode','','trim|required|xss_clean');         $this->form_validation->set_rules('homePhoneNo','','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_alumnibio','ab');
              $alumniId = $this->input->post('alumniId');             $studentId = $this->input->post('studentId');             $tab = $this->input->post('tab');             $homeAddress = $this->input->post('homeAddress');             $districtId = $this->input->post('districtId');             $amphurId = $this->input->post('amphurId');             $provinceId = $this->input->post('provinceId');             $homeZipcode = $this->input->post('homeZipcode');             $homePhoneNo = $this->input->post('homePhoneNo');
              $officeAddress = $this->input->post('officeAddress');             $offDistrictId = $this->input->post('offDistrictId');             $offAmphurId = $this->input->post('offAmphurId');             $offProvinceId = $this->input->post('offProvinceId');             $officeZipcode = $this->input->post('officeZipcode');             $officePhoneNo = $this->input->post('officePhoneNo');
              $currentAddress = $this->input->post('currentAddress');             $curDistrictId = $this->input->post('curDistrictId');             $curAmphurId = $this->input->post('curAmphurId');             $curProvinceId = $this->input->post('curProvinceId');             $currentZipcode = $this->input->post('currentZipcode');             $currentPhoneNo = $this->input->post('currentPhoneNo');
              $countryAddress  = $this->input->post('countryAddress');             $countryId = $this->input->post('countryId');
              $this->ab->alumniId = $alumniId;             $this->ab->studentId = $studentId;             $this->ab->get_by_key(TRUE);             $this->ab->homeAddress = $homeAddress;             $this->ab->homeDistrictId = $districtId;             $this->ab->homeAmphurId = $amphurId ;             $this->ab->homeProvinceId = $provinceId;             $this->ab->homeZipcode = $homeZipcode;             $this->ab->homePhoneNo = $homePhoneNo;
              $this->ab->officeAddress = $officeAddress;             $this->ab->officeDistrictId = $offDistrictId;             $this->ab->officeAmphurId = $offAmphurId;             $this->ab->officeProvinceId = $offProvinceId;             $this->ab->officeZipcode = $officeZipcode;             $this->ab->officePhoneNo = $officePhoneNo;
              $this->ab->currentAddress = $currentAddress;             $this->ab->currentDistrictId = $curDistrictId ;             $this->ab->currentAmphurId = $curAmphurId;              $this->ab->currentProvinceId = $curProvinceId;             $this->ab->currentZipcode = $currentZipcode;             $this->ab->currentPhoneNo = $currentPhoneNo;
              $this->ab->countryAddress = $countryAddress;             $this->ab->countryId = $countryId;             $this->ab->update();             //echo $this->db->last_query();                          $this->am_detail();         }     }
      function v_alumniWork() {
          $tab = $this->input->post('tab');         $alumniId = $this->input->post('alumniId');
          $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()) {                 //$tab = $this->input->post('tab');                 $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();                     //echo $this->db->last_query();                 }                 //redirect($this->config->item("ea_folder")."alumni/am_detail/$tab/$alumniId");             }                      //} else {             $this->am_detail();         }
      }
      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();
                      //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();         }     }     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();         }     }
 
  } ?>
  |