예제 #1
0
 function CI_score_services()
 {
     try {
         // simponi constructor
         parent::__construct();
     } catch (Exception $error) {
         // var_dump($error);die;
     }
 }
예제 #2
0
 public function rute_edit($registrasi_id = "", $kode_frekuensi = "", $mode = "")
 {
     // set rules
     $this->_set_page_rule('R');
     // load javascript
     $this->smarty->load_javascript("resource/js/jquery/jquery-ui-1.9.2.custom.min.js");
     $this->smarty->load_javascript("resource/js/jquery/jquery.ui.timepicker.js");
     $this->smarty->load_javascript("resource/js/select2-3.4.5/select2.min.js");
     // load style ui
     $this->smarty->load_style("jquery.ui/redmond/jquery-ui-1.8.13.custom.css");
     $this->smarty->load_style("jquery.ui/redmond/jquery.ui.timepicker.css");
     $this->smarty->load_style("select2/select2.css");
     // get detail data
     $params = array($registrasi_id, $this->com_user['airlines_id'], $this->group_id);
     $result = $this->m_izin->get_pending_registrasi_by_id($params);
     if (empty($result)) {
         redirect('member/pending_izin');
     }
     $izin_request_date = str_replace("-", "", $result['izin_request_letter_date']);
     $this->smarty->assign("detail", $result);
     list($orig, $dest) = explode("-", $result['izin_rute_start']);
     $params = array($orig);
     $rs_airport1 = $this->m_airport->get_airport_by_code($params);
     $this->smarty->assign("airport1", $rs_airport1);
     // tambah pengecekan apabila ada airport yang belum terdaftar pada database
     if ($rs_airport1['airport_iata_cd'] == '') {
         $rs_airport1['airport_iata_cd'] = $orig;
     }
     $params = array($dest);
     $rs_airport2 = $this->m_airport->get_airport_by_code($params);
     $this->smarty->assign("airport2", $rs_airport2);
     /*
      * LAMA
      */
     // detail lama
     $result_lama = $this->m_izin->get_izin_rute_by_kode_frekuensi_active(array($kode_frekuensi, $this->com_user['airlines_id']));
     if (empty($result_lama)) {
         redirect('izin_pending_domestik/frekuensi/list_rute/' . $registrasi_id);
     }
     $this->smarty->assign("izin_start_date", $result_lama['izin_start_date']);
     $this->smarty->assign("izin_expired_date", $result_lama['izin_expired_date']);
     // rute lama
     $rs_id_lama = $this->m_izin->get_list_data_rute_by_kode_frekuensi(array($kode_frekuensi, $this->com_user['airlines_id']));
     foreach ($rs_id_lama as $k1 => $v1) {
         $last_key = $v1['izin_id'];
         $group_izin = 0;
         foreach ($rs_id_lama as $k2 => $v2) {
             if ($last_key == $v2['izin_id']) {
                 $group_izin++;
             }
         }
         $rs_id_lama[$k1]['rowspan'] = $group_izin;
     }
     $this->smarty->assign("rs_id_lama", $rs_id_lama);
     /*
      * PERUBAHAN
      */
     // detail rute by frekuensi yang akan diubah
     $result = $this->m_izin->get_izin_rute_by_kode_frekuensi(array($kode_frekuensi, $this->com_user['airlines_id'], 'perubahan', $registrasi_id));
     if (empty($result)) {
         $result = $result_lama;
     } else {
         foreach ($rs_id as $k1 => $v1) {
             $last_key = $v1['izin_id'];
             $group_izin = 0;
             foreach ($rs_id as $k2 => $v2) {
                 if ($last_key == $v2['izin_id']) {
                     $group_izin++;
                 }
             }
             $rs_id[$k1]['rowspan'] = $group_izin;
         }
     }
     // SCORE Service
     $this->smarty->assign("mode", $mode);
     if ($mode != "form" && ($rs_airport1['is_used_score'] == 1 || $rs_airport2['is_used_score'] == 1)) {
         $received = true;
         try {
             $client = new SCORE_Service();
             //request
             $params = new getConfirmedSlot($this->com_user['airlines_iata_cd'], $orig, $dest, "", $izin_request_date, "*");
             $score = $client->getConfirmedFullSlot($params, @intval($rs_airport1['airport_utc']), @intval($rs_airport2['airport_utc']), array("frekuensi" => $frek));
             // $score_tmp = $score;
             // unset($score);
             // foreach ($score_tmp as $k => $v) {
             //     $params = array($v['rute_all'], $v['flight_no'], $v['aircraft_type'], $v['dos']);
             //     $rs = $this->m_izin->get_list_rute_by_rute_flightno_aircraft_dos($params, "NOT FIND_IN_SET(a.izin_id,'".$result_lama['izin_id'].",".$result['izin_id']."')");
             //     if (empty($rs)){
             //         // nor old DOS
             //         foreach ($rs_id_lama as $k1 => $v1) {
             //             if ($v['rute_all']==$v1['rute_all'] && $v['flight_no']==$v1['flight_no'] && $v['aircraft_type']==$v1['aircraft_type'] && $v['dos']!=$v1['dos']){
             //                 if ($v['etd'] == "") $v['etd']=$v1['etd'];
             //                 if ($v['eta'] == "") $v['eta']=$v1['eta'];
             //                 $score[] = $v;
             //                 break;
             //             }
             //         }
             //     }
             // }
         } catch (Exception $error) {
             if (ENVIRONMENT == "testing") {
                 var_dump($error);
                 die;
             }
             unset($score);
             $received = false;
         }
         $this->smarty->assign("template_content", "izin_pending_domestik/frekuensi/edit_score.html");
         $this->smarty->assign("score", $score);
     } else {
         if ($rs_airport1['is_used_score'] == 0 && $rs_airport2['is_used_score'] == 0) {
             $this->smarty->assign("template_content", "izin_pending_domestik/frekuensi/edit.html");
             // dos
             $dos = array();
             for ($i = 1; $i <= 7; $i++) {
                 $dos[$i] = substr($result['dos'], $i - 1, 1);
             }
             $result['dos'] = $dos;
             // assign
             $this->smarty->assign("dos", $result['dos']);
             if ($result['pairing'] == 'VV') {
                 $no = 11;
                 if ($rs_id[0]['rute_all'] != $result['izin_rute_start']) {
                     // switch
                     $tmp = $rs_id[0];
                     $rs_id[0] = $rs_id[1];
                     $rs_id[1] = $tmp;
                 }
             } else {
                 $no = '';
             }
             foreach ($rs_id as $data) {
                 $result['rute_all' . $no] = $data['rute_all'];
                 $result['flight_no' . $no] = $data['flight_no'];
                 $result['etd' . $no] = $data['etd'];
                 $result['eta' . $no] = $data['eta'];
                 if ($lama == 1) {
                     $result['slot_number' . $no] = '';
                     $result['slot_date' . $no] = '';
                 } else {
                     $result['slot_number' . $no] = $data['slot_number'];
                     $result['slot_date' . $no] = $data['slot_date'];
                 }
                 list($orig, $dest) = explode("-", $data['rute_all']);
                 if ($rs_airport1['airport_iata_cd'] == $orig) {
                     $result['ao_is_used_score' . $no] = $rs_airport1['is_used_score'];
                     $result['ad_is_used_score' . $no] = $rs_airport2['is_used_score'];
                 }
                 if ($rs_airport2['airport_iata_cd'] == $dest) {
                     $result['ao_is_used_score' . $no] = $rs_airport2['is_used_score'];
                     $result['ad_is_used_score' . $no] = $rs_airport1['is_used_score'];
                 }
                 if ($result['pairing'] == 'VV') {
                     $no++;
                 }
             }
         } else {
             $this->smarty->assign("template_content", "izin_pending_domestik/frekuensi/edit_multi.html");
             foreach ($rs_id as $k1 => $v1) {
                 list($orig, $dest) = explode("-", $v1['rute_all']);
                 if ($rs_airport1['airport_iata_cd'] == $orig) {
                     $rs_id[$k1]['ao_used_score'] = $rs_airport1['is_used_score'];
                     $rs_id[$k1]['ad_used_score'] = $rs_airport2['is_used_score'];
                 } else {
                     $rs_id[$k1]['ao_used_score'] = $rs_airport2['is_used_score'];
                     $rs_id[$k1]['ad_used_score'] = $rs_airport1['is_used_score'];
                 }
                 // doop
                 $doop = array();
                 for ($i = 1; $i <= 7; $i++) {
                     $doop[$i] = substr($v1['doop'], $i - 1, 1);
                 }
                 $rs_id[$k1]['doop'] = $doop;
             }
         }
     }
     $this->smarty->assign("result", $result);
     $this->smarty->assign("rute", $rs_id);
     // notification
     $this->tnotification->display_notification();
     $this->tnotification->display_last_field();
     // untuk hak akses
     $data = $this->tnotification->get_field_data();
     if (isset($data['dos[]']['postdata'])) {
         if (!empty($data['dos[]']['postdata'])) {
             // dos
             $this->smarty->assign("dos", $data['dos[]']['postdata']);
         }
     }
     // output
     parent::display();
 }
예제 #3
0
 public function aunb_rute_fa($data_id = "", $mode = "")
 {
     // set page rules
     $this->_set_page_rule("C");
     $block_st = $this->m_block->get_block_st_by_airlines_id(array($this->com_user['airlines_id']));
     if ($block_st) {
         $this->tnotification->sent_notification("error", "Anda tidak dapat melakukan proses pada halaman registrasi karena Airlines anda dalam status blokir");
         // default redirect
         redirect("member/pending");
     }
     // get detail data
     $params = array($data_id, $this->com_user['airlines_id']);
     $result = $this->m_pending->get_data_by_id($params);
     if (empty($result)) {
         redirect('member/pending');
     }
     // get pesan revisi
     $message = $this->m_pending->get_revision($params);
     $this->smarty->assign("message", $message);
     // get detail data airport registration
     list($orig, $dest) = explode("-", $result['rute_all']);
     $params = array(trim($orig));
     $rs_airport1 = $this->m_airport->get_airport_by_code($params);
     $params = array(trim($dest));
     $rs_airport2 = $this->m_airport->get_airport_by_code($params);
     // setup filter by Service Code: Charter Flight (C), Extra Flight (G) >> if no row >> manual entry slot
     $rules_sc = array("C", "G");
     $is_filter_by_rule_sc = in_array($result['services_cd'], $rules_sc);
     // SCORE Service
     $this->smarty->assign("mode", $mode);
     if ($is_filter_by_rule_sc && $mode != "form" && ($rs_airport1['is_used_score'] == 1 || $rs_airport2['is_used_score'] == 1)) {
         $received = true;
         try {
             $client = new SCORE_Service();
             //request
             if ($result['data_flight'] == "domestik") {
                 $date_start = str_replace("-", "", $result['date_start']);
                 $date_end = str_replace("-", "", $result['date_end']);
             } else {
                 $date_start = str_replace("-", "", $result['date_start']);
                 $date_end = str_replace("-", "", $result['date_start_upto']);
             }
             if ($date_end == "") {
                 $date_end = $date_start;
             }
             if ($date_start == "") {
                 $date_start = $date_end;
             }
             $params = new getConfirmedSlot($this->com_user['airlines_iata_cd'], $orig, $dest, $date_start, $date_end, "*");
             $score = $client->getConfirmedFullSlot($params, @intval($rs_airport1['airport_utc']), @intval($rs_airport2['airport_utc']));
         } catch (Exception $error) {
             if (ENVIRONMENT == "testing") {
                 var_dump($error);
                 die;
             }
             unset($score);
             $received = false;
         }
         if (!is_array($score)) {
             $this->smarty->assign("template_content", "member/pending/form/registration_scheduled/form_next_def.html");
         } else {
             $this->smarty->assign("template_content", "member/pending/form/registration_scheduled/form_next.html");
             $this->smarty->assign("score", $score);
         }
     } else {
         $this->smarty->assign("template_content", "member/pending/form/registration_scheduled/form_next_def.html");
     }
     // load javascript
     $this->smarty->load_javascript("resource/js/jquery/jquery-ui-1.9.2.custom.min.js");
     $this->smarty->load_javascript("resource/js/jquery/jquery.ui.timepicker.js");
     $this->smarty->load_javascript("resource/js/select2-3.4.5/select2.min.js");
     // load style ui
     $this->smarty->load_style("jquery.ui/redmond/jquery.ui.timepicker.css");
     $this->smarty->load_style("jquery.ui/redmond/jquery-ui-1.8.13.custom.css");
     $this->smarty->load_style("select2/select2.css");
     // assign
     $result['eta'] = substr($result['eta'], 0, 5);
     $result['eta_utc'] = substr($result['eta_utc'], 0, 5);
     $result['etd'] = substr($result['etd'], 0, 5);
     $result['etd_utc'] = substr($result['etd_utc'], 0, 5);
     $result['eta_2'] = substr($result['eta_2'], 0, 5);
     $result['eta_2_utc'] = substr($result['eta_2_utc'], 0, 5);
     $result['etd_2'] = substr($result['etd_2'], 0, 5);
     $result['etd_2_utc'] = substr($result['etd_2_utc'], 0, 5);
     $result['is_used_score'] = $rs_airport1['is_used_score'] && $is_filter_by_rule_sc && is_array($score);
     $result['is_used_score_2'] = $rs_airport2['is_used_score'] && $is_filter_by_rule_sc && is_array($score);
     $this->smarty->assign("result", $result);
     $this->smarty->assign("orig", $orig);
     $this->smarty->assign("dest", $dest);
     // var_dump($result);die;
     // get remark field
     $this->smarty->assign("remark_field", $this->m_registration->get_remark_field(array($result['data_type'], $result['data_flight'], $result['services_cd'])));
     // var_dump($result);die;
     // notification
     $this->tnotification->display_notification();
     $this->tnotification->display_last_field();
     // output
     parent::display();
 }