-
Posts
48 -
Joined
-
Last visited
Content Type
Profiles
Forums
phpVMS Resources
Downloads
Posts posted by Nuclear
-
-
The lesson here, don't edit in cpanel
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.
-
Oops. It should be:
$bids=SchedulesData::getBids(Auth::PilotID());
That's what I get for posting when I first wake up
- 1
-
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.'; }?>
- 1
-
In local.config in the 'core' directory:
define('DBASE_USER', 'xxx'); define('DBASE_PASS', 'xxx'); define('DBASE_NAME', 'xxx');
-
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.
-
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'.
-
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 .
-
$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;
-
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; ... }?>
- 1
-
Well, I tried that and it echoed persons after the number which in my case stayed the same. I wonder if I should have deleted my cache and all that good stuff in the maint center to get the number to reflect accurately.
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.
-
-
Thanks great addon. But look here. This is a Problem
http://sflogistik.dhl-aircargo.de/index.php/timetable
And whre can i change the Name of the Table to our Airline Name?
Thanks
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.
-
-
Nabeel, is of course right, but I do have a question:
Don't use raw SQL, use the API for these queries: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...)
-
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).
- 1
- Copy the Timetable folder to /core/modules
-
I'm running into the same problem. What do I need to do in order to not show the duplicates. I have removed some of the original code and still get errors. This is the code I have now with yours that works but shows the duplicates.
<?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
}
?>
<?php
$query='SELECT * FROM phpvms_pilots ORDER BY joindate DESC LIMIT 5';
$pilots=DB::get_results($query);
foreach($pilots as $pilot)
{
echo '<a href='.SITE_URL.'/index.php/profile/view/'.$pilot->pilotid.'>';
echo PilotData::getPilotCode($pilot->code,$pilot->pilotid).' '.$pilot-
>firstname.' '.$pilot->lastname.'</a><br><br>';
}?>
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.
-
Your welcome, Jimmy. Glad you got it working.
-
I don't think you're going to have much luck with this unless you can use the javascript variables already given in the comments (which wouldn't really allow you to do what you want).
The way the ACARS map is done is unfortunately really... odd.
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.
-
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).
-
You're welcome
-
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
-
If you're looking for something to display a table of your aircraft, try this: http://forum.phpvms.net/topic/1522-fleet-table/
-
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.
-
Hey Michael,
Just to clear up, I don't think you need the 's in in the VA code.
It should be done like that..
<?php echo StatsData::TotalPaxCarried(MER); ?>
and it will return the data in order of an VA.
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.
Email problem
in Support Forum
Posted
Try: