Jump to content

Nuclear

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Nuclear

  1. Nuclear

    Email problem

    Try: <?php echo $pilot->pilotid ?>
  2. I think that's probably good advice. I've had problems in the past with the editor in cPanel losing or otherwise maiming text. The best practice is to download the file to your local computer, edit it (preferable with something like Notepad++), and re-upload to the server.
  3. Oops. It should be: $bids=SchedulesData::getBids(Auth::PilotID()); That's what I get for posting when I first wake up
  4. Something like this should work (note: untested): <?php $bids=getBids(Auth::PilotID()); if($bids) { foreach($bids as $bid) { echo $bid->code.$bid->flightnum.' - '.$bid->depicao.' - '.$bid->arricao.'<br />'; } } else { echo 'You have not bid on any flights.'; }?>
  5. In local.config in the 'core' directory: define('DBASE_USER', 'xxx'); define('DBASE_PASS', 'xxx'); define('DBASE_NAME', 'xxx');
  6. The SQL is in the getAllAirlines() function in OperationsData.class: if($all_airlines === false) { $sql = 'SELECT * FROM ' . TABLE_PREFIX ."airlines $where} ORDER BY `code` ASC"; $all_airlines= DB::get_results($sql); CodonCache::write($key, $all_airlines, 'long'); } You could change the ORDER BY clause, but I don't know if that might break something somewhere else.
  7. In any language I've ever used, manipulating dates, times, datetimes...always is a big pain I'm no expert in PHP, but unless DATE_FORMAT is some PHP constant (which it could be, for all I know) then you need to actually enter the format that you want as a string. The PHP reference for the date function is here. An example: <li><strong>Date Joined: </strong><?php echo date('F j', strtotime($pilotinfo->joindate));?></li> will display the date as 'Month Day' like 'April 19'.
  8. Just as an additional note: I would suggest not using Notepad or Wordpad to edit PHP files. Over the years, I've found that they can do some strange things, like adding extra formatting characters which are not readily visible. I suggest using something specifically made for editing source code. I personally use Notepad++. Not only does it not jack up the formatting, it includes such things as syntax highlighting and auto-indent, which makes editing and writing code much easier .
  9. $queryP="SELECT SUM(`load`) as totalpax FROM `phpvms_pireps` WHERE `flighttype`='P'"; $resultP=DB::get_results($queryP); $queryH="SELECT SUM(`load`) as totalpax FROM `phpvms_pireps` WHERE `flighttype`='H'"; $resultH=DB::get_results($queryH); $total=$resultH[0]->totalpax + $resultP[0]->totalpax; echo $total I don't remember what you were doing with this, but if you're not using the results for anything but just to get the totals, you can eliminate one of the queries: $query="SELECT SUM(`load`) as totalpax FROM `phpvms_pireps` WHERE `flighttype`='P' OR `flighttype`='H'"; $result=DB::get_results($query); $total=$result[0]->totalpax;
  10. Yes, you could use a series of if statements: <?php echo 'Flight Type: '; if($route->flighttype=='P') echo 'Passenger<br />'; elseif($route-flighttype=='C') echo 'Cargo<br />'; ...?> You can also use a switch statement: <?php echo 'Flight Type: '; switch($route->flighttype) { case 'C': echo 'Cargo<br />'; break; case 'P': echo 'Passenger<br />'; break; ... }?>
  11. Can you post the exact code you're using? The cache shouldn't make a difference; the code I posted is a direct SQL query, which is not cached, unlike the API calls, which do utilize caching. My way is not necessarily better, in fact it's worse in several ways, but it is one way to get the results.
  12. Nuclear

    Timetable

    Dresdenair and twincessna, sorry about that. I apparently uploaded the wrong version of timetable.tpl in the original zip file. I've updated the download in the original post. The only changes are to timetable.tpl. Let me know if this works now, thanks.
  13. Nuclear

    Timetable

    Yes, putting it on your front page is problematic, since it tends to be fairly long. I suggest you create a link, this will render it in it's own page.
  14. Nuclear

    Timetable

    Yes, Tom. Looking at Simpilot's add-on, it's very similar. I wrote this completely unaware of his contribution at the time, if that's what you're implying.
  15. Nabeel, is of course right, but I do have a question: I understand the API exists to deal with most everything. but what's the problem with using raw SQL? Beside the fact that it's raw SQL? I do get it, but I find it much easier to use raw SQL (assuming that there isn't an API call for it...)
  16. Nuclear

    Timetable

    Here's something I created for my VA and I thought it might be useful for others. It displays your flight schedule as a timetable. Installation: Copy the Timetable folder to /core/modules Copy timetable.tpl to your skins folder Create a link: <a href="<?php echo url('/timetable'); ?>">Timetable</a> Note that much of the table style is hard-coded, so if you don't like the way it looks, you're SOL (just kidding, you just need to edit the timetable.tpl to your liking). timetable 1.1.zip
  17. You should remove this part: <?php foreach($pilots as $pilot) { if($pilot->confirmed != 1) continue; ?> <p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p> <?php } ?> If you only want to show pilots who have been confirmed, change this: $query='SELECT * FROM phpvms_pilots ORDER BY joindate DESC LIMIT 5'; To this: $query='SELECT * FROM phpvms_pilots WHERE confirmed=1 ORDER BY joindate DESC LIMIT 5'; I should have also noted - if you don't want to show the newest 5 pilots, you can change 'LIMIT 5' to however many pilots you want to display.
  18. Your welcome, Jimmy. Glad you got it working.
  19. Yeah, I agree. I don't know if it's "odd", but it certainly isn't as straightforward as the other templates. The only way would be to edit the JS to expose the new variable.
  20. No problem. If I have time this weekend, I'll look at it, but I don't have much experience with JS (which the acars map uses).
  21. I didn't realize you were trying to alter the acarsmap.tpl. This is a lot more complicated. I'd have to look at it and I'm not sure whether I'd be able to figure it out
  22. If you're looking for something to display a table of your aircraft, try this: http://forum.phpvms.net/topic/1522-fleet-table/
  23. Well, there is a way to do it using SQL: $query="SELECT SUM(`load`) as totalpax FROM `phpvms_pireps` WHERE `flighttype`='P'"; $result=DB::get_results($query); echo $result[0]->totalpax; This sums up the load for passenger flights only. This assumes that you have your cargo routes set as cargo flights.
  24. I just tested it again and it works either with or without the quotes. I also tested StatsData::TotalPaxCarried() without passing any arguments and it still returned the same value (2945), so I'm not sure what's wrong with the OP.
×
×
  • Create New...