Landingstats beta (DEPRECATED)

I have created a module to extract and display the touchdown rate for landings for pilots submitting a pirep via fsacars and looking for some active airlines to test it and give feedback.

To install;

1 - Download attached folder and unzip

2 - Place the Landingstats module folder in core/modules/

3 - Place the LandingstatsData.class.php file in core/common/

4 - Place the lstats.tpl file in core/templates or your skin folder

5 - Use phpmyadmin (or similar) to run the landing_stats.sql file in your airline database. It will add two fields to the pireps table, stat_calculated and landing_stat

6 - In admin/templates find and open pireps_list.tpl

Find Line 51:

Flight Time: <?php echo $report->flighttime; ?><br />

Add a new blank line after line 51 and insert:

Landing Rate: <?php echo $report->landing_stat; ?> ft/min<br />

Save file

**You will have to have at least one pirep filed (of any type) after installing the module for the module to go back and calculate the landing stat for all the old pireps. From then on it will calculate the landing rate for each pirep filed and insert it into the database.

You will be able to see the landing rate (for pireps filed using fsacars) in the admin panel when reviewing new pireps for approval.

If you want a chart showing the best landing rates on your site you can use the other function built into Landingstats to call a table ->

<?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?>

It will output ->

The ‘8’ in the call for the table tells it how many rows you want returned. It is set to return the best rate first and then decending through the rest so if you only call for one row, you will get only the best landing rate currently filed.

*The lstats.tpl file is very basic and will need to be skinned into your template

*tested with beta778 in it’s current form with no issues

Please let me know of any issues in your installation that you have with the module.

Hi Simpilot,

Have followed the above instructions step-by step and have had no problems at all. Thanks for the addon, have been waiting for something like this for many months. Nice job.

Thanks again,

James

Instead of Arrival field in the stats, perhaps aircraft type would be better.  Have a 92 ft/min landing in a Cessna is one thing, but a 92 ft/min landing in a 747 is another.

Chuck

CYXU

Good point above, also, it would be good to have the firstname and lastname of the pilot instead of the member number. I tried to change this, but my knowledge of PHP is very slim.

James

To get more information back from the stats you can ->

In LandingStatsData.Class.php in core/common, find line 8

$query = "SELECT pirepid, pilotid, code, arricao, landing_stat

and change it to

$query = "SELECT *

This will return all the pirep fields in the db back to the template in the $lstats variable.

Then in the template after your for each command you can display whichever information you would like.

For example,

<center>
<table>
<tr>
<td>Pilot</td>
<td>Arrival Field</td>
<td>Aircraft</td>
<td>Touchdown Rate</td>
</tr>
<?php
foreach ($lstats as $row)
{
	echo '<tr><td><b>';
	$pilot = PilotData::GetPilotData($row->pilotid);
	echo $pilot->firstname.' '.$pilot->lastname;
	echo '</b></td>';
	echo '<td><b>';
	echo $row->arricao;
	echo '</b></td><td>';
	echo '<b>';
	$aircraft2 = OperationsData::GetAircraftInfo($row->aircraft);
	echo $aircraft2->name;
	echo '</b></td><td>';
	echo '<b>';
	echo $row->landing_stat;
	echo ' ft/min';
	echo '</b></td></tr>';
}
?>
</table>
</center>

would display something like this ->

You can just replace the field after -> with the db field in the pireps table for the information you want to display.

I will change it for the next version.

Hi Simpilot,

Thanks for the reply. I have a question though - where do i get the other variables to type in? I’ve tried $data->firstname to get the pilot’s firstname, but it doesn’t work.

Thanks,

EDIT: Infact sorry, disregard
i remembered the print_r function, and have found what i’m after.

Thanks alot!

The pilots first name is not in the pireps table, only the pilot id out of the db - ie pilot id “1”. You have to use the PilotsData class to retrieve the specific pilots information.

Something like this->

$pilot = PilotData::GetPilotData($row->pilotid);
echo $pilot->firstname.' '.$pilot->lastname;

Thanks for your reply - but it’s getting out of my knowledge range. I’m just getting syntax errors. Superb addon, though.

Thanks for your reply - but it’s getting out of my knowledge range. I’m just getting syntax errors. Superb addon, though.

try this for your lstats.tpl

<center>
<table>
<tr>
<td>Pilot</td>
<td>Arrival Field</td>
<td>Aircraft</td>
<td>Touchdown Rate</td>
</tr>
<?php
foreach ($lstats as $row)
{
	echo '<tr><td><b>';
	$pilot = PilotData::GetPilotData($row->pilotid);
	echo $pilot->firstname.' '.$pilot->lastname;
	echo '</b></td>';
	echo '<td><b>';
	echo $row->arricao;
	echo '</b></td><td>';
	echo '<b>';
	$aircraft2 = OperationsData::GetAircraftInfo($row->aircraft);
	echo $aircraft2->name;
	echo '</b></td><td>';
	echo '<b>';
	echo $row->landing_stat;
	echo ' ft/min';
	echo '</b></td></tr>';
}
?>
</table>
</center>

Awesome stuff. It’s now sitting nicely on our homepage.

Many thanks.

hello was very good wanted to thank you for this project that will improve our lives going forward.

now I take a look if I can get just the last 30 days of the current month only for the top 10

thanks for your help.

ass: Marcelo R. Queiroz

Brazil

Figured I would give this a try Using Beta version 779 I get the following

Warning: Invalid argument supplied for foreach() in /home/paranorm/public_html/phpVMS/lib/skins/crystal2/lstats.tpl on line 9

Pilot ID Arrival Field Touchdown Rate

And in the admin, I added that line of code as well and it shows up great. But it says the rate of touchdown is 0 even after filing a pirep after install and recalculating everything as a last ditch effort.

It is a bare bones kit as supplied. I have not done any mods to it at all.

Do you have any PIreps filed via fsacars? If there are none, then there are no logs for the mod to look for and create a landing rate figure to put in the database which then will return an error as you are seeing as the variable is empty coming back from the database.

works for me, thanks a lot !

Hi Guys,

I am new to all this and not really php minded, I am trying to get this to work on a fresh install updated to the lastest Beta version available in the downloads section.

I have followed the instructions but I get the following error;

Warning: call_user_method_array() [function.call-user-method-array]: Unable to call index() in /home/james200/public_html/ava/phpvms/core/classes/MainController.class.php on line 274

Would any of you know what I am doing wrong ?

I have one pirep installed.

Any help would be appreciated and thanks in advance.

Adam

yeah I did file a pirep via ACARS after I put it on site. I’ll do another today just in case and  recalculate. I’m sure it will work. Thanks for the quick reply.

When displaying on the main page I get the following error.

Warning: Invalid argument supplied for foreach() in /home/flyakaco/public_html/lib/skins/_SKIN/lstats.tpl on line 9

Pilot ID Arrival Field Touchdown Rate

Para obter mais informaçÔes de volta a partir das estatĂ­sticas que vocĂȘ pode ->

Em LandingStatsData.Class.php no core / comum, encontrar a linha 8

$ query = "SELECT cĂłdigo pirepid, pilotid, arricao, landing_stat

e alterĂĄ-lo para

$ query = "SELECT *

Isso irĂĄ retornar todos os campos PIREP no PO de volta para o modelo na variĂĄvel $ lstats.

EntĂŁo, no modelo apĂłs o seu para cada comando vocĂȘ pode exibir qualquer informação que vocĂȘ gostaria.

Por exemplo,

<?php foreach ($ lstats R $ row) ( echo ''; echo ''; ) ?>
Piloto Chegada Campo Aircraft Touchdown Rate
'; piloto $ = PilotData:: GetPilotData ($ row-> pilotid); echo $ piloto-> FirstName. piloto ". $-> sobrenome; echo ' '; echo $ row-> arricao; echo ' '; echo ''; $ aircraft2 = OperationsData:: GetAircraftInfo ($ row-> aeronaves); echo $ aircraft2-> nome; echo ' '; echo ''; echo $ row-landing_stat>; m echo '/ min; echo '

iria mostrar algo parecido com isto ->

VocĂȘ pode simplesmente substituir o campo depois -> com o campo na tabela db PIREPs para a informação que vocĂȘ deseja exibir.

Vou mudĂĄ-lo para a prĂłxima versĂŁo.

up a tutorial on how to make change you have to rename like this here ($ query = "SELECT * ) and make a flight to enable it

When displaying on the main page I get the following error.

Warning: Invalid argument supplied for foreach() in /home/flyakaco/public_html/lib/skins/_SKIN/lstats.tpl on line 9

Pilot ID Arrival Field Touchdown Rate

Have you filed a pirep since you installed the module? If not, the module has never had the chance to populate the new db fileds and will return the error you are seeing. Try filing a pirep, it does not matter if it is manual or acars, and then trying it. You can delete the priep after you file it.

We have 1582 pireps fled.