Jump to content

bass

Members
  • Posts

    240
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by bass

  1. Tell me how to show on main page table (such as admin) Top 10 Routes Routes?
  2. This can only be done with tables? I have a list of trips not made in the form table, and <div> and on the page it is very much help to make the page out of 20 blocks. thank you.
  3. Help me with the code. I'm trying to do so on the page of the Airport (HUB module), displays a list of planes that are currently at this airport. I'm trying to take some code from the module (RealScheduleLite), but the page out only the aircraft which have not yet done a single flight. Below the code of the page (hub master) hubview.tpl <div class="container">[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<br>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<div class="row">[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<div class="col-md-3"> <div class="panel panel-default"> <div class="panel-heading">AIRPORT DETALIS </div> <table class="table table-hover"> <tbody> <tr> <td><img src="<?php echo SITE_URL;?>/lib/skins/red/images/airports/<?php echo $hubs->icao;?>.jpg" alt="<?php echo $hubs->icao;?>" width="100%" height="100"/></td></tr> <tr><td><div><strong>ICAO</strong></div> <?php echo $hubs->icao;?></td></tr> <tr><td><div><strong>Airport name</strong></div> <?php echo $hubs->name;?> </td></tr> <tr><td><div><strong>Number of Pilots:</strong></div> <span><?php echo HubStats::CountPilots($hubs->icao);?></font></span><br></td></tr> <tr><td><div><strong>Total Flight </strong></div> <?php echo vFleetTrackData::countFlights($aircraft->id);?><br></td></tr> <tr><td><div><strong>Location (Lat) </strong></div> <?php echo $hubs->lat;?><br></td></tr><tr><td><div><strong>Location (Lon) </strong></div> <?php echo round(vFleetTrackData::countHours($aircraft->id));?><br></td></tr> <tr><td><div><strong>Annual passenger traffic</strong></div> 30 500 000 people<br></td></tr> <tr><td><div><strong>Number of Flights Flown:</strong></div><?php echo HubStats::CountFlights($hubs->icao);?> <br></td></tr> <tr><td><div><strong>Number of Routes Flown From <?php echo $hubs->icao;?>:</strong></div><?php echo HubStats::CountRoutes($hubs->icao);?><br></td></tr> <tr><td><div><strong>Total Miles Flown:</strong></div><?php echo HubStats::TotalMiles($hubs->icao);?>nm <br></td></tr> <tr><td><div><strong>Total Hours Flown:</strong></div><?php echo round(HubStats::TotalHours($hubs->icao));?><br></td></tr> <tr><td><div><strong>Total Fuel Used:</strong></div><?php echo round(HubStats::TotalFuelUsed($hubs->icao));?>lbs <br></td></tr> <tr><td><div><strong>Hub for airlines (ICAO) </strong></div>SVR, RWZ, SBI, MOV, RLU <br></td></tr> <tr><td><div><strong>Maximum takeoff weight (MTOW)</strong></div><br></td></tr> <tr><td><div><strong>Type</strong></div> International civil<br></td></tr><tr><td><div class="small"><strong>IATA</strong></div> DME<br></td></tr> <tr><td><div><strong>Country</strong></div>Russian Federation<br></td></tr> </tbody></table>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] </div> </div>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<div>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<div class="col-md-3"> <div class="panel panel-default"> <div class="panel-heading">AIRPORT Ranweys </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th>Runway</th> <th>Runway length</th> <th>Runway width</th> </tr> <tr> <td>14C</td> <td>8531 ft</td> <td>148 ft</td> </tr> <tr> <td>32C</td> <td>8531 ft</td> <td>148 ft</td> </tr> <tr> <td>14L</td> <td>12448 ft</td> <td>174 ft</td> </tr> <tr> <td>32R</td> <td>12448 ft</td> <td>174 ft</td> </tr> <tr> <td>14R</td> <td>11483 ft</td> <td>230 ft</td> </tr> <tr> <td>32L</td> <td>11483 ft</td> <td>230 ft</td> </tr> </table>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] </div> </div> <div class="col-md-3"> <div class="panel panel-default"> <div class="panel-heading">AIRPORT FREQUENCIES </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th>Type</th> <th>Name</th> <th>Frequency</th> </tr> <tr> <td>APP</td> <td>APP</td> <td>120.6 MHZ</td> </tr> <tr> <td>ATIS</td> <td>ATIS</td> <td>128.3 MHZ</td> </tr> <tr> <td>GND</td> <td>TAXIING</td> <td>119 MHZ</td> </tr> <tr> <td>MISC</td> <td>TRANSIT</td> <td>129.15 MHZ</td> </tr> <tr> <td>PMSV</td> <td>VOLMET</td> <td>127.875 MHZ</td> </tr> <tr> <td>RDR</td> <td>KRUG</td> <td>127.7 MHZ</td> </tr> <tr> <td>RMP</td> <td>APRON</td> <td>130.6 MHZ</td> </tr> <tr> <td>TWR</td> <td>TWR</td> <td>118.6 MHZ</td> </tr> </table>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] </div> </div> <div class="col-md-3"> <div class="panel panel-default"> <div class="panel-heading">AIRPORT NAVIGATION AIDS </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th>Type</th> <th>Name</th> <th>Frequency</th> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>437 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>659 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>659 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>437 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>887 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>320 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>320 KHZ</td> </tr> <tr> <td>NDB</td> <td>Domodedovo</td> <td>887 KHZ</td> </tr> </table>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] </div> </div> [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<div class="col-md-9"> <div class="panel panel-default"> <!-- Default panel contents --> <div class="panel-heading"><?php echo $hubs->icao;?> map</div> <!--<img src="http://www.gcmap.com/map?P=<?php echo $hubs->icao;?>,+&MS=bm&MR=30&MX=700x360&PM=b:disc4:blue%2b%22%25i%25+%28N%2210:yellow&PC=%23ffffff&MP=rect" width="100%" />--> <script type="text/javascript">[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] function initialize() { var mapDiv = document.getElementById('airport'); var map = new google.maps.Map(mapDiv, { center: new google.maps.LatLng(<?php echo $hubs->lat;?> , <?php echo $hubs->lng;?> ), zoom: 14, mapTypeId: google.maps.MapTypeId.SATELLITE }); } [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] google.maps.event.addDomListener(window, 'load', initialize); </script> <div id="airport" style="width: 100%; height: 250px"></div></div> </br> <div class="panel panel-default"> <!-- Default panel contents --> <div class="panel-heading"> <?php echo '<td>'.$airport->name.'</td>'; echo '<td>'.$airport->country.'</td><td>'; $aircrafts = OperationsData::getAllAircraft('true'); $count = 0; if(!$aircrafts) { echo 'The Airline Has No Aircraft'; } else { foreach ($aircrafts as $aircraft) { $location = RealScheduleLiteData::get_aircraft_location($aircraft->id); $airfield = $location->arricao; if(!$location) { $location = RealScheduleLiteData::get_aircraft_start($aircraft->id); $airfield = $location->depicao; } else { $airfield = $location->arricao; } if ($airfield == $airport->icao) { if ($count == 0) { echo '| '; } echo ''.$aircraft->registration.' | '; $count++; } } if ($count == 0) { echo '<font color="#6D7B8D"><i>No Aircraft Available</i></font>'; } echo '</td>'; } ?> </div></div> </br> <div class="panel panel-default"> <!-- Default panel contents --> <div class="panel-heading">FLIGHTS FOR AIRCRAFT WITH TAIL NUMBER</div> <div> <div> <?php $hubs_details = HubStats::Pilots($hubs->icao); if($hubs_details == ''){ echo 'Sorry, no Pilots allocated to this hub yet. <br />';} else { [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]?> <script type="text/javascript"> $(document).ready(function() { $('#plist').dataTable( { "sPaginationType": "bootstrap" } ); } ); </script> <table width="100%" id="plist" class="table table-striped"> <thead> <tr id="tablehead"> <th>Country</th> <th>Pilot ID</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<th>Name</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<th>Rank</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<th>Flights</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<th>Hours</th> <th>Group</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] <th>Vatsim ID/IVAO ID</th> <th>Active</th>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]</tr> </thead> <tbody> <?php foreach($hubs_details as $pilot) { if($pilot->retired =='1') { continue; } if($pilot->totalhours =='0'){ continue; } if(!$pilot){echo "Sorry, no pilot allocated to this hub yet.";} ?>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<tr> <td> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> </td> <td width="1%" nowrap><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid;?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid);?></a>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]</td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<td> [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] <?php echo $pilot->firstname.' '.$pilot->lastname;?>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]</td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<td><img src="<?php echo $pilot->rankimage;?>" alt="<?php echo $pilot->rank;?>" /></td> [/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<td><?php echo $pilot->totalflights; ?></td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td> <td><?php echo $pilot->group;?></td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] <td><?php[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]$fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID');[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]if($fieldvalue != '')[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]{[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] echo '<a href="http://www.vataware.com/pilot.cfm?cid='.$fieldvalue.'" target="_blank"><img src="'.SITE_URL.'/lib/skins/mva/images/vatsim.gif" alt="Vatsim ID" border="0" /></a>';[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]}[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]?> <?php $feildvalue = PilotData::GetFieldValue($pilot->pilotid, 'IVAO ID');[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]if($feildvalue != '') { echo '<img src="http://status.ivao.aero/R/'.$feildvalue.'.png">'; } ?> </td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] <td> <?php if($pilot->retired == 0) echo '<span class="label label-success">Active</span>'; elseif($pilot->retired == 1) echo '<span class="label label-warning">Inactive</span>'; elseif($pilot->retired == 2) echo '<span class="label label-error">Banned</span>'; elseif($pilot->retired == 3) echo '<span class="label label-warning">On Leave</span>'; ?> <!--<?php if($pilot->retired == '1') {echo '<img src="'.SITE_URL.'/lib/skins/mva/images/no.png" alt="Retired" /> - Retired';} else {echo '<img src="'.SITE_URL.'/lib/skins/mva/images/yes.png" alt="Active" /> - Active';} ?>--> <?php[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]}[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]?></td>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]</tr> </tbody> </table> <?php[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]}?> </div> </div> </div> </div> </div> </div>
  4. Help put a map with the route of flight on the page with the briefing.
  5. Everything!!!) I finally made a Board for airport website) If someone is interested in my work, send me a PM.
  6. Here I made an example code, maybe there is some other way? (Is too large code....) <?php $string = "$pirep->log"; if($string!=str_replace("-1deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-2deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-3deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-4deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-5deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-6deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-7deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-8deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-9deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-10deg","",$string)) echo "<font color='red'>Strike the front of the chassis!</font> </br>"; elseif($string!=str_replace("-11deg","",$string)) echo "<font color='red'>Hard touch the front!</font> </br>"; elseif($string!=str_replace("-12deg","",$string)) echo "<font color='red'>Hard touch the front!</font> </br>"; elseif($string!=str_replace("-13deg","",$string)) echo "<font color='red'>Hard touch the front!</font> </br>"; elseif($string!=str_replace("-14deg","",$string)) echo "<font color='red'>Hard touch the front!</font> </br>"; elseif($string!=str_replace("-15deg","",$string)) echo "<font color='red'>Hard touch the front!</font> </br>"; elseif($string!=str_replace("-16deg","",$string)) echo "<font color='red'>Broken front landing gear!!!</font> </br>"; elseif($string!=str_replace("-17deg","",$string)) echo "<font color='red'>Broken front landing gear!!!</font> </br>"; elseif($string!=str_replace("-18deg","",$string)) echo "<font color='red'>Broken front landing gear!!!</font> </br>"; elseif($string!=str_replace("-19deg","",$string)) echo "<font color='red'>Broken front landing gear!!!</font> </br>"; elseif($string!=str_replace("-20deg","",$string)) echo "<font color='red'>Broken front landing gear!!!</font> </br>"; ?>
  7. [16:34] - Flaps to position 3 at 2067ft and 156kts [16:34] - Flaps to position 4 at 2041ft and 153kts [16:37] - Landed at -306fpm. With 2266kgs of fuel onboard and a pitch angle of 2deg. [16:37] - Wind Heading 90 | Wind Speed 12kts | Temperature 33 deg ........
  8. Prompt how to report (pirep_viewreport.tpl) on the flight of the log page to display a pitch angle of (...) deg.?
  9. Works well! on the old version of phpvms.
  10. Create TPL file and copy the code from the folder TEMPLITE. In the module file, change the php to tpl. <?php class WTHR extends CodonModule { public function index() { $this->show('weather/weather.tpl'); } public function metar() { $icao = DB::escape($_POST['icao']); $url = 'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString='.$icao.'&hoursBeforeNow=1'; $xml = simplexml_load_file($url); $metar = $xml->data->METAR->raw_text; $altimeter = $xml->data->METAR->altim_in_hg; $dewpoint = $xml->data->METAR->dewpoint_c; $flightrules = $xml->data->METAR->flight_category; $station = $xml->data->METAR->station_id; $temperature = $xml->data->METAR->temp_c; $time = $xml->data->METAR->observation_time; $visibility = $xml->data->METAR->visibility_statute_mi; $winddir = $xml->data->METAR->wind_dir_degrees; $windspd = $xml->data->METAR->wind_speed_kt; $lat = $xml->data->METAR->latitude; $lng = $xml->data->METAR->longitude; $sky1 = $xml->data->METAR->sky_condition[1]->sky_cover; //$sky2 = $xml->data->METAR->sky_condition[1]; $elevation = $xml->data->METAR->elevation_m; $sql="SELECT * FROM phpvms_airports WHERE icao = '$station'"; $airport = DB::get_row($sql); $this->set('metar', $metar); $this->set('altimeter', $altimeter); $this->set('dewpoint', $dewpoint); $this->set('flightrules', $flightrules); $this->set('airport', $airport); $this->set('temperature', $temperature); $this->set('time', $time); $this->set('visibility', $visibility); $this->set('winddir', $winddir); $this->set('windspd', $windspd); $this->set('lat', $lat); $this->set('lng', $lng); $this->set('elevation', $elevation); $this->set('sky1', $sky1); //$this->set('sky2', $sky2); $this->set('station', $station); $this->render('weather/weather.tpl'); } } ?>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]
  11. Thank you! Good module, easy to adapt the website.
  12. http://www.parkho.ir/index.php/vatsimstats This is your module somewhere to download? Want to make a widget for the site.
  13. Hello! Decided to make online display of departures-arrivals for the site. As it turns out modest. I suggest in this topic to create a good Board (so she could stretch across the length of the site) This HTML CSS my Board. Will be very modestly((( http://simer.clan.su/taba.html The source (html css code) Board <style>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4] table.taba{ margin: 50px 0; text-align: left; border-collapse: separate; border: 1px solid #ddd; border-spacing: 3px; border-radius: 5px; background-image: url('https://vatrus.info/img/timetable_33/background.png'); font-size: 19.5px; width: auto; } td,th{ border: 1px solid #ddd; padding: 5px; border-radius: 3px; } th{ background-image: url('http://www.airport.md/img/images/fbr_header.jpg'); } caption{ font-style: italic; text-align: right; color: #547901; } .text { color: #9DA610; letter-spacing: 6.2px; } .text2 {color: #CCCCCC} .text3 {color: #66CC00} .text4 {color: #993333} </style>[/size][/font][/color] [color=#333333][font=Arial, Helvetica, sans-serif][size=4]<table class="taba" background="https://vatrus.info/img/timetable_33/background.png"> <caption> 19:40 16.09.2016 </caption> <tr> <th colspan="4" background="http://www.airport.md/img/images/fbr_header.jpg"><div align="right"><span class="text2"> <object type="application/x-shockwave-flash" data="http://www.airport.md/img/media/online_table_clocks_updated.swf" width="206" height="41" id="fbr_city_clocks" style="visibility: visible;"> <param name="wmode" value="transparent"> <param name="flashvars" value="time_shift_0=2&time_shift_1=1&time_shift_2=2&time_shift_3=4&time_shift_4=3&timestamp=1468163531000&wmode=transparent"> </object> </span></div></th> </tr> <tr> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">SVR9026</span></td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">UUDD - URKK</span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">A320 (RA0091)</span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text3">Прибыл</span></td> </tr> <tr> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">SVR9481</span></td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">USSS - URFF</span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">A321 (RA1031)</span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text3">В пути </span></td> </tr> <tr> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">SVR921</span></td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">URKK - UUDD </span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text">A320 (RA0051)</span> </td> <td height="15" background="https://vatrus.info/img/timetable_33/empty.png"><span class="text4">Отменен </span></td> </tr> </table>
  14. WORKING!!! Thank you very much for your help!
  15. And where you can see the version?))) Screen footer Admin panels
  16. This is a link to a file that I changed on your tip, pomezhete see where the error? https://cloud.mail.ru/public/GJDs/RYiRZtoKe
  17. Error Fatal error: Call to undefined method Operations::checkPermission() in/home/u173934115/public_html/admin/modules/Operations/Operations.php on line 979
  18. admin/core/modules/Schedules I have generally no such folder in this directory
  19. Can you suggest how this code to register right? This is my Schedules.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Schedules extends CodonModule { public function index() { $this->view(); } public function view() { if(isset($this->post->action) && $this->post->action == 'findflight') { $this->FindFlight(); return; } $this->showSchedules(); } public function detail($routeid='') { $this->details($routeid); } public function details($routeid = '') { //$routeid = $this->get->id; if(!is_numeric($routeid)) { preg_match('/^([A-Za-z]{3})(\d*)/', $routeid, $matches); $code = $matches[1]; $flightnum = $matches[2]; $params = array('s.code'=>$code, 's.flightnum'=>$flightnum); } else { $params = array('s.id' => $routeid); } $schedule = SchedulesData::getScheduleDetailed($routeid); $this->set('schedule', $schedule); $this->render('schedule_details.tpl'); $this->render('route_map.tpl'); } public function brief($routeid = '') { if($routeid == '') { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } $schedule = SchedulesData::getScheduleDetailed($routeid); $this->set('schedule', $schedule); $this->render('schedule_briefing.tpl'); } public function boardingpass($routeid) { if($routeid == '') { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } $schedule = SchedulesData::getScheduleDetailed($routeid); $this->set('schedule', $schedule); $this->render('schedule_boarding_pass.tpl'); } public function bids() { if(!Auth::LoggedIn()) return; $this->set('bids', SchedulesData::GetBids(Auth::$userinfo->pilotid)); $this->render('schedule_bids.tpl'); } public function addbid() { if(!Auth::LoggedIn()) return; $routeid = $this->get->id; if($routeid == '') { echo 'No route passed'; return; } // See if this is a valid route $route = SchedulesData::findSchedules(array('s.id' => $routeid)); if(!is_array($route) && !isset($route[0])) { echo 'Invalid Route'; return; } CodonEvent::Dispatch('bid_preadd', 'Schedules', $routeid); /* Block any other bids if they've already made a bid */ if(Config::Get('DISABLE_BIDS_ON_BID') == true) { $bids = SchedulesData::getBids(Auth::$userinfo->pilotid); # They've got somethin goin on if(count($bids) > 0) { echo 'Bid exists!'; return; } } $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid); CodonEvent::Dispatch('bid_added', 'Schedules', $routeid); if($ret == true) { echo 'Bid added'; } else { echo 'Already in bids!'; } } public function removebid() { if(!Auth::LoggedIn()) return; SchedulesData::RemoveBid($this->post->id); } public function showSchedules() { $depapts = OperationsData::GetAllAirports(); $equip = OperationsData::GetAllAircraftSearchList(true); $this->set('depairports', $depapts); $this->set('equipment', $equip); $this->render('schedule_searchform.tpl'); # Show the routes. Remote this to not show them. $this->set('allroutes', SchedulesData::GetSchedules()); $this->render('schedule_list.tpl'); } public function findFlight() { if($this->post->depicao != '') { $params = array('s.depicao' => $this->post->depicao); } if($this->post->arricao != '') { $params = array('s.arricao' => $this->post->arricao); } if($this->post->equipment != '') { $params = array('a.name' => $this->post->equipment); } if($this->post->distance != '') { if($this->post->type == 'greater') $value = '> '; else $value = '< '; $value .= $this->post->distance; $params = array('s.distance' => $value); } $params['s.enabled'] = 1; $this->set('allroutes', SchedulesData::findSchedules($params)); $this->render('schedule_results.tpl'); } public function statsdaysdata($routeid) { $routeinfo = SchedulesData::findSchedules(array('s.id'=>$routeid)); $routeinfo = $routeinfo[0]; // Last 30 days stats $data = PIREPData::getIntervalDataByDays( array( 'p.code' => $routeinfo->code, 'p.flightnum' => $routeinfo->flightnum, ), 30); $this->create_line_graph('Schedule Flown Counts', $data); } protected function create_line_graph($title, $data) { if(!$data) { $data = array(); } $titles = array(); $bar_titles = array(); foreach($data as $val) { $titles[] = $val->ym; $values[] = floatval($val->total); } OFCharts::add_data_set($titles, $values); echo OFCharts::create_line_graph($title); } }
  20. No, the file I edited. It lies in the modules?
  21. SchedulesData.class <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class SchedulesData extends CodonData { /** * A generic find function for schedules. As parameters, do: * * $params = array( 's.depicao' => 'value', * 's.arricao' => array ('multiple', 'values'), * ); * * Syntax is ('s.columnname' => 'value'), where value can be * an array is multiple values, or with a SQL wildcard (%) * if that's what is desired. * * Columns from the schedules table should be prefixed by 's.', * the aircraft table as 'a.' * * You can also pass offsets ($start and $count) in order to * facilitate pagination * * @tutorial http://docs.phpvms.net/media/development/searching_and_retriving_schedules */ public static function findSchedules($params, $count = '', $start = '') { $sql = 'SELECT s.*, a.id as aircraftid, a.name as aircraft, a.registration, a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM '.TABLE_PREFIX.'schedules AS s LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft '; /* Build the select "WHERE" based on the columns passed, this is a generic function */ $sql .= DB::build_where($params); // Order matters if(Config::Get('SCHEDULES_ORDER_BY') != '') { $sql .= ' ORDER BY '.Config::Get('SCHEDULES_ORDER_BY'); } if(strlen($count) != 0) { $sql .= ' LIMIT '.$count; } if(strlen($start) != 0) { $sql .= ' OFFSET '. $start; } $ret = DB::get_results($sql); return $ret; } /** * Get the total number of schedules based on criterea * * @param array $params key => value list * @return int Returns the total number * */ public static function countSchedules($params) { $sql = 'SELECT COUNT(s.id) as total FROM '.TABLE_PREFIX.'schedules AS s LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft '; $sql .= DB::build_where($params); $res = DB::get_row($sql); return $res->total; } /** * Return information about a schedule (pass the ID) */ public static function getSchedule($id) { return self::getScheduleDetailed($id); } /** * Return a flight given the airline code and flight number * * @deprecated * * @param string $code Airline code * @param mixed $flightnum Flight number * @return array Returns a full flight * */ public static function getScheduleByFlight($code, $flightnum) { $params = array( 's.code' => strtoupper($code), 's.flightnum' => strtoupper($flightnum), ); $schedule = self::findSchedules($params); return $schedule[0]; } /** * Find a flight on the flightnumber and departure airport * * @param string $flightnum Flight numbers * @param string $depicao Departure airport * @return array Returns one flight * */ public static function findFlight($flightnum, $depicao='') { $params = array('s.flightnum' => strtoupper($flightnum)); if($depicao != '') { $params['s.depicao'] = $depicao; } $schedule = self::findSchedules($params); return $schedule[0]; } /** * Extract the code and flight number portions from the flight number * Ensures that the code and number are properly split */ public static function getProperFlightNum($flightnum) { if($flightnum == '') return false; $ret = array(); $flightnum = strtoupper($flightnum); $airlines = OperationsData::getAllAirlines(false); foreach($airlines as $a) { $a->code = strtoupper($a->code); if(strpos($flightnum, $a->code) === false) { continue; } $ret['code'] = $a->code; $ret['flightnum'] = str_ireplace($a->code, '', $flightnum); return $ret; } # Invalid flight number $ret['code'] = ''; $ret['flightnum'] = $flightnum; return $ret; } /** * Increment the flown count for a schedule * * @param string $code Airline code * @param int $flightnum Flight number * @return bool * */ public static function IncrementFlownCount($code, $flightnum) { $schedid = intval($schedid); $code = strtoupper($code); $flightnum = strtoupper($flightnum); $sql = 'UPDATE '.TABLE_PREFIX."schedules SET timesflown=timesflown+1 WHERE code='{$code}' AND flightnum='{$flightnum}'"; $res = DB::query($sql); if(DB::errno() != 0) return false; return true; } /** * Get detailed information about a schedule * * @param int $id ID of the schedule * @return array Schedule details * */ public static function getScheduleDetailed($id) { $schedules = self::findSchedules(array('s.id' => $id)); if(!$schedules) return false; $schedule = $schedules[0]; unset($schedules); /*$schedule->route_details = unserialize($schedule->route_details); if(!empty($schedule->route) && !$schedule->route_details) { $schedule->route_details = SchedulesData::getRouteDetails($schedule->id, $schedule->route); }*/ if($schedule->route != '') { $schedule->route_details = NavData::parseRoute($schedule); } return $schedule; } /** * Return all the airports by depature, which have a schedule, for * a certain airline. If the airline * @return object_array */ public static function getDepartureAirports($airlinecode='', $onlyenabled=false) { $airlinecode = DB::escape($airlinecode); if($onlyenabled) $enabled = 'AND s.enabled=1'; else $enabled = ''; $sql = 'SELECT DISTINCT s.depicao AS icao, a.name FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'airports a WHERE s.depicao = a.icao '.$enabled; if($airlinecode != '') $sql .= " AND s.code='{$airlinecode}' "; $sql .= ' ORDER BY depicao ASC'; return DB::get_results($sql); } /** * Get all of the airports which have a schedule, from * a certain airport, using the airline code. Code * is optional, otherwise it returns all of the airports. * * @return database object */ public static function getArrivalAiports($depicao, $airlinecode='', $onlyenabled=true) { $depicao = strtoupper($depicao); $airlinecode = strtoupper($airlinecode); $depicao = DB::escape($depicao); if($onlyenabled) $enabled = 'AND s.enabled=1'; else $enabled = ''; $sql = 'SELECT DISTINCT s.arricao AS icao, a.name FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'airports a WHERE s.arricao = a.icao '.$enabled; if($airlinecode != '') $sql .= " AND s.code='{$airlinecode}' "; $sql .= ' ORDER BY depicao ASC'; return DB::get_results($sql); } /** * Get all the schedules, $limit is the number to return */ public static function getSchedules($onlyenabled=true, $limit='', $start='') { $params = array(); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); } /** * This gets all of the schedules which are disabled */ /*public static function getInactiveSchedules($count='', $start='') { $params = array('s.enabled'=>0); return self::findSchedules($params, $count, $start); }*/ /** * Calculate the distance between two coordinates * Using a revised equation found on http://www.movable-type.co.uk/scripts/latlong.html * * Also converts to proper type based on UNIT setting * */ public static function distanceBetweenPoints($lat1, $lng1, $lat2, $lng2) { /* Use a radius depending on the final units we want to be in New formula, from http://jan.ucc.nau.edu/~cvm/latlon_formula.html */ if(strtolower(Config::Get('UNITS')) === 'mi') # miles $radius = 3963.192; elseif(strtolower(Config::Get('UNITS')) === 'km') # Convert to km $radius = 6378.14; else $radius = 3443.92; /* $distance = ($radius * 3.1415926 * sqrt(($lat2-$lat1) * ($lat2-$lat1) +cos($lat2/57.29578) * cos($lat1/57.29578) * ($lng2-$lng1) * ($lng2-$lng1))/180); return $distance; */ $lat1 = deg2rad(floatval($lat1)); $lat2 = deg2rad(floatval($lat2)); $lng1 = deg2rad(floatval($lng1)); $lng2 = deg2rad(floatval($lng2)); $a = sin(($lat2 - $lat1)/2.0); $b = sin(($lng2 - $lng1)/2.0); $h = ($a*$a) + cos($lat1) * cos($lat2) * ($b*$; $theta = 2 * asin(sqrt($h)); # distance in radians $distance = $theta * $radius; return $distance; /* Convert all decimal degrees to radians */ $dlat = $lat2 - $lat1; $dlng = $lng2 - $lng1; $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); $distance = $r * $c; return $distance; /*$distance = acos(cos($lat1)*cos($lng1)*cos($lat2)*cos($lng2) + cos($lat1)*sin($lng1)*cos($lat2)*sin($lng2) + sin($lat1)*sin($lat2)) * $r; return floatval(round($distance, 2));*/ } /** * Update a distance * * @deprecated */ /*public static function UpdateDistance($scheduleid, $distance) { $sql = 'UPDATE '.TABLE_PREFIX."schedules SET distance='{$distance}' WHERE id={$scheduleid}"; $res = DB::query($sql); if(DB::errno() != 0) return false; return true; }*/ /** * Add a schedule * * Pass in the following: $data = array( 'code'=>'', 'flightnum'='' 'depicao'=>'', 'arricao'=>'', 'alternativ'=>'', 'route'=>'', 'aircraft'=>'', 'distance'=>'', 'deptime'=>'', 'arrtime'=>'', 'flighttime'=>'', 'notes'=>'', 'enabled'=>'', 'price'=>'' 'flighttype'=>''); */ public static function addSchedule($data) { if(!is_array($data)) return false; # Commented out to allow flights to/from the same airport #if($data['depicao'] == $data['arricao']) # return false; $data['code'] = strtoupper($data['code']); $data['flightnum'] = strtoupper($data['flightnum']); $data['deptime'] = strtoupper($data['deptime']); $data['arrtime'] = strtoupper($data['arrtime']); $data['depicao'] = strtoupper($data['depicao']); $data['arricao'] = strtoupper($data['arricao']); $data['alternativ'] = strtoupper($data['alternativ']); if($data['enabled'] == true) $data['enabled'] = 1; else $data['enabled'] = 0; # If they didn't specify $data['flighttype'] = strtoupper($data['flighttype']); if($data['flighttype'] == '') $data['flighttype'] = 'P'; $data['flightlevel'] = str_replace(',', '', $data['flightlevel']); if(isset($fields['route'])) { $fields['route'] = str_replace('SID', '', $fields['route']); $fields['route'] = str_replace('STAR', '', $fields['route']); $fields['route'] = trim($fields['route']); $fields['route_details'] = ''; } foreach($data as $key=>$value) { $data[$key] = DB::escape($value); } $data['flighttime'] = str_replace(':', '.', $data['flighttime']); $sql = "INSERT INTO " . TABLE_PREFIX ."schedules (`code`, `flightnum`, `depicao`, `arricao`, `alternativ`, `route`, `route_details`, `aircraft`, `flightlevel`, `distance`, `deptime`, `arrtime`, `flighttime`, `daysofweek`, `price`, `flighttype`, `notes`, `enabled`) VALUES ('{$data['code']}', '{$data['flightnum']}', '{$data['depicao']}', '{$data['arricao']}', '{$data['alternativ']}', '{$data['route']}', '{$data['route_details']}', '{$data['aircraft']}', '{$data['flightlevel']}', '{$data['distance']}', '{$data['deptime']}', '{$data['arrtime']}', '{$data['flighttime']}', '{$data['daysofweek']}', '{$data['price']}', '{$data['flighttype']}', '{$data['notes']}', {$data['enabled']})"; $res = DB::query($sql); if(!empty($data['route'])) { self::getRouteDetails(DB::$insert_id, $data['route']); } if(DB::errno() != 0) return false; return true; } /** * Edit a schedule * Pass in the columns - deprecated */ public static function editSchedule($data) { if(!is_array($data)) return false; $id = $data['id']; unset($data['id']); self::editScheduleFields($id, $data); } /** * Parse a schedule's route, and store it in the route_details * column for later on. It will store a serialized array of the * route's details. * * @param int $schedule_id ID of the schedule to parse * @param string $route Optional route to parse, otherwise it will look it up * @return array Returns the route's details * */ public static function getRouteDetails($schedule_id, $route = '') { $schedule = self::findSchedules(array('s.id' => $schedule_id), 1); $schedule = $schedule[0]; if(empty($schedule->route)) { return; } $route_details = NavData::parseRoute($schedule); $store_details = DB::escape(serialize($route_details)); $val = self::editScheduleFields($schedule_id, array('route_details' => $store_details)); return $route_details; } /** * Update any fields in a schedule, other update functions come down to this * * @param int $scheduleid ID of the schedule to update * @param array $fields Array, column name as key, with values to update * @return bool * */ public static function updateScheduleFields($scheduleid, $fields) { return self::editScheduleFields($scheduleid, $fields); } /** * Update any fields in a schedule, other update functions come down to this * * @param int $scheduleid ID of the schedule to update * @param array $fields Array, column name as key, with values to update * @return bool * */ public static function editScheduleFields($scheduleid, $fields) { if(!is_array($fields)) { return false; } if(isset($fields['depicao']) && isset($fields['arricao'])) { if($fields['depicao'] == $fields['arricao']) { return false; } } /* Ensure data is ok and formatted properly */ if(isset($fields['code'])) { $fields['code'] = strtoupper($fields['code']); } if(isset($fields['flightnum'])) { $fields['flightnum'] = strtoupper($fields['flightnum']); } if(isset($fields['depicao'])) { $fields['depicao'] = strtoupper($fields['depicao']); } if(isset($fields['arricao'])) { $fields['arricao'] = strtoupper($fields['arricao']); } if(isset($fields['deptime'])) { $fields['deptime'] = strtoupper($fields['deptime']); } if(isset($fields['arrtime'])) { $fields['arrtime'] = strtoupper($fields['arrtime']); } if(isset($fields['enabled'])) { if($fields['enabled'] == true) $fields['enabled'] = 1; else $fields['enabled'] = 0; } # If they didn't specify a flight type, just default to pax if(isset($fields['flighttype'])) { $fields['flighttype'] = strtoupper($fields['flighttype']); if($fields['flighttype'] == '') { $fields['flighttype'] = 'P'; } } if(isset($fields['flightlevel'])) { $fields['flightlevel'] = str_replace(',', '', $fields['flightlevel']); } if(isset($fields['flighttime'])) { $fields['flighttime'] = str_replace(':', '.', $fields['flighttime']); } if(isset($fields['route'])) { $fields['route'] = str_replace('SID', '', $fields['route']); $fields['route'] = str_replace('STAR', '', $fields['route']); $fields['route'] = trim($fields['route']); } foreach($fields as $key=>$value) { $fields[$key] = DB::escape($value); } $sql = "UPDATE `".TABLE_PREFIX."schedules` SET "; $sql .= DB::build_update($fields); $sql .= ' WHERE `id`='.$scheduleid; $res = DB::query($sql); if(DB::errno() != 0) { return false; } return true; } /** * Delete a schedule */ public static function deleteSchedule($scheduleid) { $scheduleid = DB::escape($scheduleid); $sql = 'DELETE FROM ' .TABLE_PREFIX.'schedules WHERE id='.$scheduleid; $res = DB::query($sql); if(DB::errno() != 0) return false; return true; } public static function deleteAllSchedules() { $sql = 'DELETE FROM ' .TABLE_PREFIX.'schedules'; $res = DB::query($sql); if(DB::errno() != 0) return false; return true; } public static function deleteAllScheduleDetails() { $sql = 'UPDATE '.TABLE_PREFIX."schedules SET `route_details` = ''"; $res = DB::query($sql); if(DB::errno() != 0) return false; return true; } public static function getAllBids() { $sql = 'SELECT p.*, s.*, b.bidid as bidid, b.dateadded, a.name as aircraft, a.registration FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'aircraft a, '.TABLE_PREFIX.'pilots p WHERE b.routeid = s.id AND s.aircraft=a.id AND p.pilotid = b.pilotid ORDER BY b.bidid DESC'; return DB::get_results($sql); } /** * Get the latest bids */ public static function getLatestBids($limit=5) { $sql = 'SELECT p.*, s.*, b.bidid as bidid, a.name as aircraft, a.registration FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'aircraft a, '.TABLE_PREFIX.'pilots p WHERE b.routeid = s.id AND s.aircraft=a.id AND p.pilotid = b.pilotid ORDER BY b.bidid DESC LIMIT '.$limit; return DB::get_results($sql); } public function getLatestBid($pilotid) { $pilotid = DB::escape($pilotid); $sql = 'SELECT s.*, b.bidid, a.id as aircraftid, a.name as aircraft, a.registration, a.maxpax, a.maxcargo FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'aircraft a WHERE b.routeid = s.id AND s.aircraft=a.id AND b.pilotid='.$pilotid.' ORDER BY b.bidid ASC LIMIT 1'; return DB::get_row($sql); } /** * Get a specific bid with route information * * @param unknown_type $bidid * @return unknown */ public static function getBid($bidid) { $bidid = DB::escape($bidid); $sql = 'SELECT s.*, b.bidid, b.pilotid, b.routeid, a.name as aircraft, a.registration FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'aircraft a WHERE b.routeid = s.id AND s.aircraft=a.id AND b.bidid='.$bidid; return DB::get_row($sql); } /** * Get all of the bids for a pilot * * @param unknown_type $pilotid * @return unknown */ public static function getBids($pilotid) { $pilotid = DB::escape($pilotid); $sql = 'SELECT s.*, b.bidid, a.name as aircraft, a.registration FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'aircraft a WHERE b.routeid = s.id AND s.aircraft=a.id AND b.pilotid='.$pilotid; return DB::get_results($sql); } /** * Get find a bid for the pilot based on ID, * the airline code for the flight, and the flight number */ public static function getBidWithRoute($pilotid, $code, $flightnum) { if($pilotid == '') return; $sql = 'SELECT b.bidid FROM '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'schedules s WHERE b.pilotid='.$pilotid.' AND b.routeid=s.id AND s.code=\''.$code.'\' AND s.flightnum=\''.$flightnum.'\''; return DB::get_row($sql); } public static function setBidOnSchedule($scheduleid, $bidid) { $scheduleid = intval($scheduleid); $bidid = intval($bidid); $sql = 'UPDATE '.TABLE_PREFIX.'schedules SET `bidid`='.$bidid.' WHERE `id`='.$scheduleid; DB::query($sql); if(DB::errno() != 0) return false; return true; } /** * Add a bid */ public static function addBid($pilotid, $routeid) { $pilotid = DB::escape($pilotid); $routeid = DB::escape($routeid); if(DB::get_row('SELECT bidid FROM '.TABLE_PREFIX.'bids WHERE pilotid='.$pilotid.' AND routeid='.$routeid)) { return false; } $pilotid = DB::escape($pilotid); $routeid = DB::escape($routeid); $sql = 'INSERT INTO '.TABLE_PREFIX.'bids (pilotid, routeid, dateadded) VALUES ('.$pilotid.', '.$routeid.', NOW())'; DB::query($sql); self::setBidOnSchedule($routeid, DB::$insert_id); if(DB::errno() != 0) return false; return true; } public static function deleteExpiredBids() { $cache_time = Config::Get('BID_EXPIRE_TIME'); if($cache_time == '') { return; } $sql = 'DELETE FROM '.TABLE_PREFIX."bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; DB::query($sql); } /** * Remove a bid, by passing it's bid id */ public static function deleteBid($bidid) { self::removeBid($bidid); } /** * Remove a bid, by passing it's bid id */ public static function removeBid($bidid) { $bidid = intval($bidid); $bid_info = self::getBid($bidid); $sql = 'DELETE FROM '.TABLE_PREFIX.'bids WHERE `bidid`='.$bidid; DB::query($sql); self::SetBidOnSchedule($bid_info->routeid, 0); if(DB::errno() != 0) return false; return true; } /** * @deprecated * */ public static function getScheduleFlownCounts($code, $flightnum, $days=7) { $max = 0; $code = strtoupper($code); $flightnum = strtoupper($flightnum); $start = strtotime("- $days days"); $end = time(); $data = array(); # Turn on caching: DB::enableCache(); do { $count = PIREPData::getReportCountForRoute($code, $flightnum, $start); $date = date('m-d', $start); $data[$date] = $count; $start += SECONDS_PER_DAY; } while ($start <= $end); DB::disableCache(); return $data; } /** * Show the graph of the past week's reports. Outputs the * image unless $ret == true * * @deprecated */ public static function showReportCounts() { // Recent PIREP #'s $max = 0; $data = array(); $time_start = strtotime('-7 days'); $time_end = time(); // This is for the past 7 days do { $count = PIREPData::getReportCount($time_start); $data[] = $count; if($count > $max) $max = $count; $time_start += SECONDS_PER_DAY; } while ($time_start < $time_end); return $data; } /* Below here, these are all deprecated. In your code, you should use the query structure, defined within the functions /** * @deprecated */ /*public static function getSchedulesWithCode($code, $onlyenabled=true, $limit='', $start='') { $params = array('s.code' => strtoupper($code)); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ /** * @deprecated */ /*public static function getSchedulesWithFlightNum($flightnum, $onlyenabled=true, $limit='', $start='') { $params = array('s.flightnum' => $flightnum); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ /** * Return all of the routes give the departure airport * * @deprecated */ /*public static function getSchedulesWithDeparture($depicao, $onlyenabled = true, $limit = '', $start='') { self::getRoutesWithDeparture($depicao, $onlyenabled, $limit); }*/ /** * @deprecated */ /*public static function getRoutesWithDeparture($depicao, $onlyenabled=true, $limit='', $start='') { $params = array('s.depicao' => strtoupper($depicao)); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ /** * @deprecated */ /*public static function getRoutesWithArrival($arricao, $onlyenabled=true, $start='', $limit='') { return self::getSchedulesWithArrival($arricao, $onlyenabled, $limit); }*/ /** * @deprecated */ /*public static function getSchedulesWithArrival($arricao, $onlyenabled=true, $start='', $limit='') { $params = array('s.arricao' => strtoupper($arricao)); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ /** * @deprecated */ /*public static function getSchedulesByDistance($distance, $type, $onlyenabled=true, $start='', $limit='') { if($type == '') $type = '>'; $params = array('s.distance' => trim($type).' '.$distance); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ /** * Search schedules by the equipment type * * @deprecated */ /*public static function getSchedulesByEquip($ac, $onlyenabled = true, $start='', $limit='') { $params = array('a.name' => $ac); if($onlyenabled) $params['s.enabled'] = '1'; return self::findSchedules($params, $limit, $start); }*/ }
  22. Help make sure to record the alternate airport in the database. I added a column to the table SCHEDULES, then added a line in "ops_scheduleform" I made changes to SchedulesData.klass file, but with the addition of the flight, an alternative airport is not recorded in the database (((, can you help?
  23. Hey, someone has already installed this script? What I do not understand. Installed in the Settings file I ordered the necessary code for an example (AFL) see that a lot, but I it did not appear on the network drivers of the AFL, why?
×
×
  • Create New...