mattsmith Posted February 14, 2017 Report Share Posted February 14, 2017 Is there any way of restricting aircraft, so when a pilot bids on a flight then no one else can book a flight with that aircraft? Quote Link to comment Share on other sites More sharing options...
web541 Posted February 14, 2017 Report Share Posted February 14, 2017 Are you using a separate module or just the default schedules? Quote Link to comment Share on other sites More sharing options...
mattsmith Posted February 15, 2017 Author Report Share Posted February 15, 2017 The default one. Quote Link to comment Share on other sites More sharing options...
web541 Posted February 15, 2017 Report Share Posted February 15, 2017 (edited) Add this to your OperationsData.class.php public static function getBidByAircraft($aircraftid) { $aircraftid = DB::escape($aircraftid); $sql = 'SELECT s.*, b.bidid, a.name as aircraft, a.id as aircraftid, a.registration FROM ' . TABLE_PREFIX . 'schedules s, ' . TABLE_PREFIX . 'bids b, ' . TABLE_PREFIX . 'aircraft a WHERE b.routeid = s.id AND s.aircraft='.$aircraftid; return DB::get_row($sql); } And Add/Replace this in your schedule_results.php file <?php # If aircraft is disabled $aircraft = OperationsData::getAircraftInfo($schedule->aircraftid); # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($aircraft->enabled != 1) { echo 'Unable to Bid! Aircraft is disabled!'; } elseif($acbidded) { echo 'Unable to Bid! Aircraft already bidded!'; } elseif(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) { echo '<a id="'.$schedule->id.'" class="addbid" href="'.SITE_URL.'/action.php/schedules/addbid/?id='.$schedule->id.'">Add to Bid</a>'; } else { if(Auth::LoggedIn()) { echo '<a id="'.$schedule->id.'" class="addbid" href="'.SITE_URL.'/index.php/schedules/addbid/?id='.$schedule->id.'">Add to Bid</a>'; } } ?> Edited February 15, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
mattsmith Posted February 15, 2017 Author Report Share Posted February 15, 2017 Thanks Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted February 17, 2017 Moderators Report Share Posted February 17, 2017 On 15/2/2017 at 5:47 PM, web541 said: Add this to your OperationsData.class.php public static function getBidByAircraft($aircraftid) { $aircraftid = DB::escape($aircraftid); $sql = 'SELECT s.*, b.bidid, a.name as aircraft, a.id as aircraftid, a.registration FROM ' . TABLE_PREFIX . 'schedules s, ' . TABLE_PREFIX . 'bids b, ' . TABLE_PREFIX . 'aircraft a WHERE b.routeid = s.id AND s.aircraft='.$aircraftid; return DB::get_row($sql); } And Add/Replace this in your schedule_results.php file <?php # If aircraft is disabled $aircraft = OperationsData::getAircraftInfo($schedule->aircraftid); # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($aircraft->enabled != 1) { echo 'Unable to Bid! Aircraft is disabled!'; } elseif($acbidded) { echo 'Unable to Bid! Aircraft already bidded!'; } elseif(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) { echo '<a id="'.$schedule->id.'" class="addbid" href="'.SITE_URL.'/action.php/schedules/addbid/?id='.$schedule->id.'">Add to Bid</a>'; } else { if(Auth::LoggedIn()) { echo '<a id="'.$schedule->id.'" class="addbid" href="'.SITE_URL.'/index.php/schedules/addbid/?id='.$schedule->id.'">Add to Bid</a>'; } } ?> And how can I do it by the "Fltbook"? (I guess is your own module) Quote Link to comment Share on other sites More sharing options...
web541 Posted February 17, 2017 Report Share Posted February 17, 2017 2 hours ago, joooseb said: And how can I do it by the "Fltbook"? (I guess is your own module) Try this (should be able to just replace $schedule with $route <?php # If aircraft is disabled $aircraft = OperationsData::getAircraftInfo($schedule->aircraftid); # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($aircraft->enabled != 1) { echo '<div class="btn btn-danger btn-sm sharp disabled">Booked (Aircraft Disabled)</div>'; # Aircraft Disabled } elseif($acbidded) { echo '<div class="btn btn-danger btn-sm sharp disabled">Booked (Aircraft Bidded)</div>'; # Aircraft Bidded } elseif(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) { echo '<a data-toggle="modal" href="'.SITE_URL.'/action.php/Fltbook/confirm?id='.$route->id.'&airline='.$route->code.'&aicao='.$route->aircrafticao.'" data-target="#confirm" class="btn btn-success btn-md">Book</a>'; # Schedule's already been bidded } else { if(Auth::LoggedIn()) { echo '<a data-toggle="modal" href="'.SITE_URL.'/action.php/Fltbook/confirm?id='.$route->id.'&airline='.$route->code.'&aicao='.$route->aircrafticao.'" data-target="#confirm" class="btn btn-success btn-md">Book</a>'; # Default } } ?> Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted February 17, 2017 Moderators Report Share Posted February 17, 2017 58 minutes ago, web541 said: Try this (should be able to just replace $schedule with $route Hide contents <?php # If aircraft is disabled $aircraft = OperationsData::getAircraftInfo($schedule->aircraftid); # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($aircraft->enabled != 1) { echo '<div class="btn btn-danger btn-sm sharp disabled">Booked (Aircraft Disabled)</div>'; # Aircraft Disabled } elseif($acbidded) { echo '<div class="btn btn-danger btn-sm sharp disabled">Booked (Aircraft Bidded)</div>'; # Aircraft Bidded } elseif(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) { echo '<a data-toggle="modal" href="'.SITE_URL.'/action.php/Fltbook/confirm?id='.$route->id.'&airline='.$route->code.'&aicao='.$route->aircrafticao.'" data-target="#confirm" class="btn btn-success btn-md">Book</a>'; # Schedule's already been bidded } else { if(Auth::LoggedIn()) { echo '<a data-toggle="modal" href="'.SITE_URL.'/action.php/Fltbook/confirm?id='.$route->id.'&airline='.$route->code.'&aicao='.$route->aircrafticao.'" data-target="#confirm" class="btn btn-success btn-md">Book</a>'; # Default } } ?> Thanks, but i think the code must be on confirmbid.tpl Here's my code: (confirmbid.tpl) <style> .sharp { border-radius: 0; margin-left: 3px; margin-right: 3px; } </style> <div class="container-fluid"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Confirmar Reserva<!-- <?php echo $routeid; ?> | <?php echo $airline; ?> | <?php echo $aicao; ?> --></h4> </div> <div class="modal-body"> <h3>Seleccionar Aeronave</h3> <form action="<?php echo url('/schedules/addbid');?>" method="post"> <select class="form-control" name="aircraftid" id="aircraftid"> <option value="" selected disabled>Selecciona Tu Avi贸n</option> <?php $allaircraft = FltbookData::getAllAircraftFltbook($airline, $aicao); foreach($allaircraft as $aircraft) { $icaoairline = "{$aircraft->icao}{$airline}"; if($aircraft->registration == $icaoairline) { echo ''; } else { $sel = ($_POST['aircraft'] == $aircraft->name || $bid->registration == $aircraft->registration)?'selected':''; echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->registration.' - '.$aircraft->icao.' - '.$aircraft->name.' ('.(AircraftMarketData::getaccond($aircraft->id)).'%)</option>'; } } ?> </select> <hr /> <input type="hidden" name="routeid" value="<?php echo $routeid; ?>" /> <input type="submit" name="submit" class="btn btn-success" value="Reservar" /> <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button> </form> </div> <!-- <a class="btn btn-success" href="<?php echo url('/schedules/addbid/'.$routeid.'?id='.$aircraft->id);?>">Book</a> --> </div> Where can I add the code above? Quote Link to comment Share on other sites More sharing options...
web541 Posted February 17, 2017 Report Share Posted February 17, 2017 Add the code from my above post in schedule_results and then add this in the confirmbid <?php $allaircraft = FltbookData::getAllAircraftFltbook($airline, $aicao); foreach($allaircraft as $aircraft) { $bidded = OperationsData::getBidByAircraft($aircraft->id); if($aircraft->enabled != 1) { continue; } if($bidded) { continue; } $icaoairline = "{$aircraft->icao}{$airline}"; if($aircraft->registration == $icaoairline) { echo ''; } else { $sel = ($_POST['aircraft'] == $aircraft->name || $bid->registration == $aircraft->registration)?'selected':''; echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->registration.' - '.$aircraft->icao.' - '.$aircraft->name.' ('.(AircraftMarketData::getaccond($aircraft->id)).'%)</option>'; } } ?> Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted February 18, 2017 Moderators Report Share Posted February 18, 2017 On 17/2/2017 at 3:47 AM, web541 said: Add the code from my above post in schedule_results and then add this in the confirmbid <?php $allaircraft = FltbookData::getAllAircraftFltbook($airline, $aicao); foreach($allaircraft as $aircraft) { $bidded = OperationsData::getBidByAircraft($aircraft->id); if($aircraft->enabled != 1) { continue; } if($bidded) { continue; } $icaoairline = "{$aircraft->icao}{$airline}"; if($aircraft->registration == $icaoairline) { echo ''; } else { $sel = ($_POST['aircraft'] == $aircraft->name || $bid->registration == $aircraft->registration)?'selected':''; echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->registration.' - '.$aircraft->icao.' - '.$aircraft->name.' ('.(AircraftMarketData::getaccond($aircraft->id)).'%)</option>'; } } ?> Works but with some aircraft... Look at the attached pics! Thanks for your time :D! Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted February 20, 2017 Moderators Report Share Posted February 20, 2017 Is possible to get a "Booked" or "Free" State in Fleet page?? Quote Link to comment Share on other sites More sharing options...
web541 Posted February 20, 2017 Report Share Posted February 20, 2017 Add this <?php # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($acbidded) { echo 'Aircraft Free!'; } else { echo 'Aircraft Booked!'; } ?> Change $schedule->aircraftid on the first line to the variable of your fleet page. Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted February 21, 2017 Moderators Report Share Posted February 21, 2017 10 hours ago, web541 said: Add this <?php # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($schedule->aircraftid); if($acbidded) { echo 'Aircraft Free!'; } else { echo 'Aircraft Booked!'; } ?> Change $schedule->aircraftid on the first line to the variable of your fleet page. Nice but i Think i don't have any variables for schedule jajaja look at my fleet page snippet code: <?php require 'lib/skins/crewcenter/app_top.php' ?> <section class="content-header"> <h1>Flota</h1> </section> <section class="content"> <section class="content"> <div class="row"> <div class="col-lg-16"> <div class="box box-primary"> <div class="box-body table-responsive"> <table id="tabledlist" class="tablesorter table table-hover"> <thead> <tr> <center> <th>Aerolínea</th> <th>Tipo</th> <th>Matrícula</th> <th>Ubicación</th> <th>Disponibilidad</th> <th>Estado</th> <th>Detalles</th> </tr> </thead> <tbody> <center> <?php if($aircrafts != null){ foreach($aircrafts as $aircrafts){ ?> <tr> <td><?php $allairlines = OperationsData::GetAllAirlines(true); foreach($allairlines as $airline) if($airline->code == $aircrafts->airline) { echo '<option value="'.$airline->code.'">'.$airline->name.'</option>'; } ?></td> <td><?php echo $aircrafts->fullname; ?></td> <td><?php echo $aircrafts->registration; ?></td> <?php $params = (array('a.registration'=>$aircrafts->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td style="font-weight: bolder;"><?php echo $current_location.''.$current_location2; ?></td> <td><?php If($aircrafts->enabled == 1){echo 'Disponible';} elseif($aircrafts->enabled == 0) {echo '<p style="color:red">En Mantenimiento';} ?></td> <td><?php echo AircraftMarketData::getaccond($aircrafts->id);?>%</td> <td><a class="btn btn-primary btn-block" href="<?php echo url('fleet/view/' . $aircrafts->id); ?>">Ver</a></td> </tr> <?php } }?> </tbody> </table> </div> </div> </div> </div> </section> <?php require 'lib/skins/crewcenter/app_bottom.php' ?> Quote Link to comment Share on other sites More sharing options...
web541 Posted February 21, 2017 Report Share Posted February 21, 2017 Quote <?php require 'lib/skins/crewcenter/app_top.php' ?> <section class="content-header"> <h1>Flota</h1> </section> <section class="content"> <section class="content"> <div class="row"> <div class="col-lg-16"> <div class="box box-primary"> <div class="box-body table-responsive"> <table id="tabledlist" class="tablesorter table table-hover"> <thead> <tr> <center> <th>Aerolínea</th> <th>Tipo</th> <th>Matrícula</th> <th>Ubicación</th> <th>Disponibilidad</th> <th>Estado</th> <th>Detalles</th> </center> </tr> </thead> <tbody> <center> <?php if($aircrafts != null) { foreach($aircrafts as $aircrafts) { ?> <tr> <td> <?php $allairlines = OperationsData::GetAllAirlines(true); foreach($allairlines as $airline) { if($airline->code == $aircrafts->airline) { echo '<option value="'.$airline->code.'">'.$airline->name.'</option>'; } ?> </td> <td><?php echo $aircrafts->fullname; ?></td> <td><?php echo $aircrafts->registration; ?></td> <?php $params = (array('a.registration'=>$aircrafts->registration, 'p.accepted'=>PIREP_ACCEPTED)); $pirep = PIREPData::findPIREPS($params); $current_location2 = $pirep[0]->arrname; ?> <td style="font-weight: bolder;"><?php echo $current_location.''.$current_location2; ?></td> <td><?php If($aircrafts->enabled == 1){ echo 'Disponible';} elseif($aircrafts->enabled == 0) {echo '<p style="color:red">En Mantenimiento';} ?></td> <td><?php echo AircraftMarketData::getaccond($aircrafts->id);?>%</td> <td><a class="btn btn-primary btn-block" href="<?php echo url('fleet/view/' . $aircrafts->id); ?>">Ver</a></td> </tr> <?php } }?> </tbody> </table> </div> </div> </div> </div> </section> <?php require 'lib/skins/crewcenter/app_bottom.php' ?> Try this <?php # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($aircrafts->id); if($acbidded) { echo 'Aircraft Free!'; } else { echo 'Aircraft Booked!'; } ?> If that doesn't work, a link to your site and/or an image of the fleet page would help. Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 3, 2017 Moderators Report Share Posted March 3, 2017 On 21/2/2017 at 5:18 PM, web541 said: Try this <?php # Aircraft has already been bidded by another pilot $acbidded = OperationsData::getBidByAircraft($aircrafts->id); if($acbidded) { echo 'Aircraft Free!'; } else { echo 'Aircraft Booked!'; } ?> If that doesn't work, a link to your site and/or an image of the fleet page would help. Hi can you helo me? I'm using your fltbook system and A payware module (Tour system of Crazy creatives common). On booking process it works fine but when I try bid with tour center the following error appear: Warning: Missing argument 3 for SchedulesData::addBid(), called in /home1/mcfilmsp/public_html/crewcenter/core/modules/TourCenter/TourCenter.php on line 188 and defined in /home1/mcfilmsp/public_html/crewcenter/core/common/SchedulesData.class.php on line 834 In Tourcenter.php missed the $aircraftid variable Quote Link to comment Share on other sites More sharing options...
web541 Posted March 4, 2017 Report Share Posted March 4, 2017 To do this, you've got a few options Add a few variable checks into the SchedulesData.class.php addbid function to check whether the $aircraftid variable exists for the tour center, this should allow both modules to work side-by-side. Move the SchedulesData.class.php addbid function into the Fltbook module, change a few links around and hope it works. Then get the original SchedulesData.class.php and replace your current one with it. This should also work as it is just the default which the TourCenter is trying to deal with. Merge my module and the TourCenter module to get both bookings to work side-by-side (I will not do this as I don't own it, and the dev. of the TourCenter probably won't either, so your on your own with this one). Test out my fltbook v2 module which should have everything concealed inside the module so that the default SchedulesData.class.php can be put back in and the TourCenter should work properly without interfering with fltbook. Your choice. And what phpVMS version are you on? .tpl or .php. Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 4, 2017 Moderators Report Share Posted March 4, 2017 (edited) 14 hours ago, web541 said: To do this, you've got a few options Add a few variable checks into the SchedulesData.class.php addbid function to check whether the $aircraftid variable exists for the tour center, this should allow both modules to work side-by-side. Move the SchedulesData.class.php addbid function into the Fltbook module, change a few links around and hope it works. Then get the original SchedulesData.class.php and replace your current one with it. This should also work as it is just the default which the TourCenter is trying to deal with. Merge my module and the TourCenter module to get both bookings to work side-by-side (I will not do this as I don't own it, and the dev. of the TourCenter probably won't either, so your on your own with this one). Test out my fltbook v2 module which should have everything concealed inside the module so that the default SchedulesData.class.php can be put back in and the TourCenter should work properly without interfering with fltbook. Your choice. And what phpVMS version are you on? .tpl or .php. I'm using .tpl version. Where can I find your fltbook v2?? Edited March 4, 2017 by joooseb Quote Link to comment Share on other sites More sharing options...
web541 Posted March 4, 2017 Report Share Posted March 4, 2017 (edited) 7 hours ago, joooseb said: I'm using .tpl version. Where can I find your fltbook v2?? Github Edited March 5, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 4, 2017 Moderators Report Share Posted March 4, 2017 (edited) 46 minutes ago, web541 said: Github Nice, works perfectly with .tpl version Congratulations =), great job !! Now I will try to solve the "Tour Center" Error Edited March 4, 2017 by joooseb Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 4, 2017 Moderators Report Share Posted March 4, 2017 3 hours ago, joooseb said: I'm using .tpl version. Where can I find your fltbook v2?? It's works :D! thanks you so much!! Quote Link to comment Share on other sites More sharing options...
web541 Posted March 5, 2017 Report Share Posted March 5, 2017 (edited) 3 hours ago, joooseb said: It's works :D! thanks you so much!! Did you solve your TourCenter issue? Edited March 5, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 5, 2017 Moderators Report Share Posted March 5, 2017 1 hour ago, web541 said: Did you solve your TourCenter issue? Yeah! works like a charm =) but in "Flight academy" show No route passed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.