Jump to content

Recommended Posts

  • Administrators
Posted

landingstats_logo.png

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.

chartadmin.gif

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 ->

chart.gif

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.

Posted

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

Posted

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

  • Administrators
Posted

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 ->

Capture-4.jpg

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.

Posted

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!

  • Administrators
Posted

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;

  • Administrators
Posted
  Quote

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>

Posted

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

Posted

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.

  • Administrators
Posted

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.

Posted

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

Posted

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

Posted
  Quote

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,

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

iria mostrar algo parecido com isto ->

Capture-4.jpg

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

  • Administrators
Posted
  Quote

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.

  • Administrators
Posted
  Quote

no, total before. I had 3 in pending when I installed th module. I accepted one and nothing changed.

you have to file one for it to start - the listener is looking for "New PIREP Filed" just file a pirep manually and then delete it from pending. That should populate the db, it ma y take a few seconds to go through that many pireps the first time but should not be an issue

  • Administrators
Posted
  Quote

That didn't work. I will wait for a new pirep with a landing rate. Maybe because manually pireps don't have the landing rates.

the module knows the difference between a manual and acars pirep... Check your db in the stat_calculated colom and tell me what is in it, and make sure both the stat_calculated and landing_rate coloum are there

Posted

Don't have Landing Rate, here is what I have

pirepid pilotid code flightnum depicao arricao aircraft flighttime distance submitdate accepted log load fuelused fuelunitcost fuelprice price flighttype pilotpay expenses expenselist source stat_calculated landing_stat

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...