/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // The Below snippet of code in front end for busLayout session->userdata('logged_in') != TRUE) { redirect(base_url().'login'); } else if($this->input->post("btnSubmit")) {} else { $bustype = ""; $rowarray = array(); $array_zindez0_tr1 = array(); $array_zindez0_tr2 = array(); $array_zindez0_tr3 = array(); $array_zindez0_tr4 = array(); $array_zindez0_tr5 = array(); $array_zindez1_tr1 = array(); $array_zindez1_tr2 = array(); $array_zindez1_tr3 = array(); $array_zindez1_tr4 = array(); $array_zindez1_tr5 = array(); $array_row_values0 = array(); $array_col_values0 = array(); $array_row_values1 = array(); $array_col_values1 = array(); $zindex0 = false; $zindex1 = false; $user=$this->session->userdata('user_type'); if(trim($user) == 'Distributor' or trim($user) == 'MasterDealer' or trim($user) == 'Agent') { $dataarray = json_decode(base64_decode($this->input->post("hidrows"))); $hidfrom = base64_decode($this->input->post("hidfrom")); $hidto = base64_decode($this->input->post("hidto")); $hiddate = base64_decode($this->input->post("hiddate")); //echo "From : ".$hidfrom; //echo "
"; //echo "to : ".$hidto; //echo "
"; //echo "date : ".$hiddate; //echo "
"; // print_r($dataarray); //print_r($dataarray->boardingPoints); //echo "
"; //exit; if(isset($dataarray->inventoryType) and isset($dataarray->routeScheduleId)) { $url = 'http://test.etravelsmart.com/etsAPI/api/getBusLayout?sourceCity='.$hidfrom.'&destinationCity='.$hidto.'&doj='.$hiddate.'&inventoryType='.(string)$dataarray->inventoryType.'&routeScheduleId='.(string)$dataarray->routeScheduleId; $LoginID= "qewweqewqw"; $Password="dasdas2112"; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $LoginID.":".$Password); // username and password - declared at the top of the doc curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_POST, 0); $response = curl_exec($ch); $tablestr = ''; $tr1 = ''; $tr2 = ''; $tr3 = ''; $tr4 = ''; $tr5 = ''; curl_close($ch); $seatarray = json_decode($response); //print_r($seatarray );exit; $zindex0str = ''; $zindex1str = ''; // echo '



'; foreach($seatarray->seats as $sr) { //print_r($sr); $width = (string)$sr->width; $ladiesSeat = (string)$sr->ladiesSeat; $fare = (string)$sr->fare; $zIndex = (string)$sr->zIndex; $serviceTaxAmount = (string)$sr->serviceTaxAmount; $commission = (string)$sr->commission; $operatorServiceChargeAbsolute = (string)$sr->operatorServiceChargeAbsolute; $operatorServiceChargePercent = (string)$sr->operatorServiceChargePercent; $totalFareWithTaxes = (string)$sr->totalFareWithTaxes; $bookedBy = (string)$sr->bookedBy; $ac = (string)$sr->ac; $sleeper = (string)$sr->sleeper; $serviceTaxPer = (string)$sr->serviceTaxPer; $available = (string)$sr->available; $column = (string)$sr->column; $row = (string)$sr->row; $length = (string)$sr->length; $id = (string)$sr->id; //echo "Width :".$width." zIndex : ".$zIndex." Column : ".$column." Row : ".$row; if($zIndex == "0") { array_push($array_row_values0, $row); array_push($array_col_values0, $column); $zindex0 = true; $rowarray[0][$row][$column] = $sr; } if($zIndex == "1") { array_push($array_row_values1, $row); array_push($array_col_values1, $column); $zindex1 = true; $rowarray[1][$row][$column] = $sr; } //echo "
"; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // lower part seat layout drawing table start here //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //row column settings $tablestr0 = ''; if($zindex0 == true) { $tablestr0 .= ''; for($r0 = 0;$r0 <= max($array_row_values0);$r0++) { $tablestr0.=''; if($r0 == 0) { $tablestr0.= ''; $tablestr0.= ''; } else { $tablestr0.= ''; } for($c0 = 0;$c0 <= max($array_col_values0);$c0++) { $class3 = ''; if(isset($rowarray[0][$r0][$c0])) { //$tablestr0.= $rowarray[0][$r0][$c0]->row.' '.$rowarray[0][$r0][$c0]->column; if((string)$rowarray[0][$r0][$c0]->length == 1) { if((string)$rowarray[0][$r0][$c0]->available == 1) { $class3.='seat-sprite seat-avail'; } else { $class3.='seat-sprite male-seat-booked'; } } if((string)$rowarray[0][$r0][$c0]->length == 2) { if((string)$rowarray[0][$r0][$c0]->available == 1) { $class3.='hori-sleep-sprite hori-sleep-avail'; } else { $class3.='hori-sleep-sprite hori-sleep-booked'; } } $tablestr0.=''; } else { $tablestr0.=''; } } $tablestr0.=''; } $tablestr0.='
'; $tablestr0 .= '
'; $tablestr0.='
'; $tablestr0.='
'; } ///*******************************************************************************************************************************// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Upper part seat layout drawing table start here //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $tablestr1 = ''; if($zindex1 == true) { $tablestr1 .= ''; for($r1 = 0;$r1 <= max($array_row_values1);$r1++) { $tablestr1.=''; if($r1 == 0) { $tablestr1.= ''; $tablestr1.= ''; } else { $tablestr1.= ''; } for($c1 = 0;$c1 <= max($array_col_values1);$c1++) { $class3 = ''; if(isset($rowarray[1][$r1][$c1])) { //$tablestr0.= $rowarray[0][$r0][$c0]->row.' '.$rowarray[0][$r0][$c0]->column; if((string)$rowarray[1][$r1][$c1]->length == 1) { if((string)$rowarray[1][$r1][$c1]->available == 1) { $class3.='seat-sprite seat-avail'; } else { $class3.='seat-sprite male-seat-booked'; } } if((string)$rowarray[1][$r1][$c1]->length == 2) { if((string)$rowarray[1][$r1][$c1]->available == 1) { $class3.='hori-sleep-sprite hori-sleep-avail'; } else { $class3.='hori-sleep-sprite hori-sleep-booked'; } } $tablestr1.=''; } else { $tablestr1.=''; } } $tablestr1.=''; } $tablestr1.='
'; $tablestr1 .= '
'; $tablestr1.='
'; $tablestr1.='
'; } ///*******************************************************************************************************************************// echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$tablestr1.'
'.$tablestr0.'
'; echo '
'; echo $this->getCustomerForm($dataarray->boardingPoints,(string)$dataarray->routeScheduleId); echo '
'; exit; } } else {redirect(base_url().'login');} } } private function getCustomerForm($boardingpoints,$routeid) { $str = '
Seat No Fare
Select Boarding Point: '; $str .=''; $str.= '
'; return $str; } }?>