Jump to content

Fleet Table


AFVA | Mitchell

Recommended Posts

You upload the images to your server then you go to Airline Operations --> Add and Edit Fleet .

From there you click on the aircraft you want to add a picture to and the add the full URL to the "Link to Aircraft Image" field. The module will then display the image.

Hope this helps!

Thanks so much... :)

Link to comment
Share on other sites

  • 4 weeks later...
  • Moderators

Hello,

times someone could write an exact installation instruction for the fleet-site. I get it not to run.

Thanks and many greetings

Thomas

Hi its on page 1 at the top, install is easy just follow the steps, then if you want to change things have a look at the rest of the posts :)

Link to comment
Share on other sites

  • Administrators

Would it be possible to display a table only for a certain aircraft? I would like to separate the different aircraft in different tables.

-- http://flyvva.org/dev/index.php/fleet

Here is a mock-up of what I am trying to do... each blue dive is where a table for that aircraft will be.

Thanks,

Chad C.

It might be easier just to do something like that by hand, instead of programatically. It would be alot of code to have it all done automagically.

Link to comment
Share on other sites

  • 2 weeks later...

You can rename the folder Fleet to FleetInfo and rename Fleet.php to FleetInfo.php

OR you can do some coding.

Open your default fleet folder, open fleet.php.

Add this code:

/**
Copyright Mitchell Williamson 2010
Fleet Table 2.0
*/		
public function info()
	{
	$fleet = self::FleetInfo();
	Template::Set('fleet', $fleet);
	Template::Show('fleet_table.tpl');

	}
	/**
	* Return all possible information about the fleet
	* Code by Mitchell W
	* Enhanced by Stu (stuartpb) 		
	* Fleet Table 2.0							
	*/
	public static function FleetInfo()
	{
   $sql = 'SELECT a.*, a.name AS aircraft,
     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     GROUP BY a.registration';

		return DB::get_results($sql);
		DB::debug();
		return $ret;

	}

Add it below public function index or whatever stuff u have in there.

Rename 'info' to whatever u want then go to yourwebsite.com/index.php/fleet/info

Also dont forgot to add fleet_table.tpl to core/templates

Link to comment
Share on other sites

Hi,

since the "Table-View" for my fleet did not look as I expected, I wrote another template.

Maybe someone can get use of it.

fleet_table.jpg

If someone asks for aid, sorry guys. I'm also just an average programmer ;-)

I will help as much as I can.

Overwrite existing file in /core/templates

Regards and Happy landings.

fleet_table.zip

  • Like 2
Link to comment
Share on other sites

  • 5 weeks later...

a conclusion in the two tables, first table of Boeing 737 and the second table all Airbus

how can I create this?

First Table is (list of all Boeing aircraft's)

Boeing B737-300

EI-CHH, total flight time 00:12:50. 

Located at the airport Cologne Bonn (EDDK).

Second Table is (list of all Airbus aircraft's)

Airbus A319-100

VP-BBG, total flight time 01:20:15. 

Located at the airport Munich (EDDM).

please help!!

I've created this code but, this code show all  aircraft's in list, but i needet 2 tabeles! :mellow:

<?php foreach ($fleet as $aircraft) 
{
?>
 <?php $airbus = explode("EI", $aircraft->registration); echo $airbus[0];?>,  total flight time <?php echo $aircraft->totaltime; ?>.<br>  Located at the airport<?php
$params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED));

$pirep = PIREPData::findPIREPS($params);
$current_location = $pirep[0]->arricao;
$current_location2 = $pirep[0]->arrname;
        {
            echo ''.$current_location2.' ('.$current_location.')';
        }
?>.<br><br>
<?php } ?>

Link to comment
Share on other sites

Can someone please post the code to show which member was the last one to fly the aircraft so it will show up in the table as well? Thanx

This was exactly what I was about to ask!

Would be a great addition to a great module!!

Reasin being ...

I duplicated then renamed the original fleet table and edited the out put only to display;

Type

Rego

Location - Location

Now all I need is the last pilot who flew it.

Then I can promote the Module as "Last Known Whereabouts" giving pilots the incentive to take that aircraft and fly it to where they want to go.

Any assistance in coding would be mostly appreciative.

Thanks in advance

Adam

AUZ

Link to comment
Share on other sites

  • 2 weeks later...

I've noticed the table lists the planes in order by their registration.

Example:

MD87 MD-87 N214AM 0 0 130 10000 0

MD88 MD-88 N401NV 0 0 150 15000 0

MD88 MD-88 N402NV 0 0 150 15000 0

MD88 MD-88 N403NV 0 0 150 15000 0

MD88 MD-88 N404NV 0 0 150 15000 0

MD83 MD-83 N405NV 0 0 150 15000 0

MD82 MD-82 N406NV 0 0 150 15000 0

MD82 MD-82 N407NV 0 0 150 15000 0

MD82 MD-82 N408NV 0 0 150 15000 0

How do we set it so that it lists in order by aircraft type ?

MD82 MD-82 N406NV 0 0 150 15000 0

MD82 MD-82 N407NV 0 0 150 15000 0

MD82 MD-82 N408NV 0 0 150 15000 0

MD83 MD-83 N405NV 0 0 150 15000 0

MD87 MD-87 N214AM 0 0 130 10000 0

MD88 MD-88 N401NV 0 0 150 15000 0

MD88 MD-88 N402NV 0 0 150 15000 0

MD88 MD-88 N403NV 0 0 150 15000 0

MD88 MD-88 N404NV 0 0 150 15000 0

Link to comment
Share on other sites

I've noticed the table lists the planes in order by their registration.

Example:

MD87 MD-87 N214AM 0 0 130 10000 0

MD88 MD-88 N401NV 0 0 150 15000 0

MD88 MD-88 N402NV 0 0 150 15000 0

MD88 MD-88 N403NV 0 0 150 15000 0

MD88 MD-88 N404NV 0 0 150 15000 0

MD83 MD-83 N405NV 0 0 150 15000 0

MD82 MD-82 N406NV 0 0 150 15000 0

MD82 MD-82 N407NV 0 0 150 15000 0

MD82 MD-82 N408NV 0 0 150 15000 0

How do we set it so that it lists in order by aircraft type ?

MD82 MD-82 N406NV 0 0 150 15000 0

MD82 MD-82 N407NV 0 0 150 15000 0

MD82 MD-82 N408NV 0 0 150 15000 0

MD83 MD-83 N405NV 0 0 150 15000 0

MD87 MD-87 N214AM 0 0 130 10000 0

MD88 MD-88 N401NV 0 0 150 15000 0

MD88 MD-88 N402NV 0 0 150 15000 0

MD88 MD-88 N403NV 0 0 150 15000 0

MD88 MD-88 N404NV 0 0 150 15000 0

Open up Fleet.php and instead of the default FleetInfo() change it to this code:

		/**
	* Return all possible information about the fleet
	* Code by Mitchell W
	* Enhanced by Stu (stuartpb) 		
	* Fleet Table 2.0 Order by Aicraft Type Edit							
	*/
	public static function FleetInfo()
	{
   $sql = 'SELECT a.*, a.name AS aircraft,
     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     GROUP BY a.name';

		return DB::get_results($sql);
		DB::debug();
		return $ret;

	}

This was exactly what I was about to ask!

Would be a great addition to a great module!!

Reasin being ...

I duplicated then renamed the original fleet table and edited the out put only to display;

Type

Rego

Location - Location

Now all I need is the last pilot who flew it.

Then I can promote the Module as "Last Known Whereabouts" giving pilots the incentive to take that aircraft and fly it to where they want to go.

Any assistance in coding would be mostly appreciative.

Thanks in advance

Adam

AUZ

I have tried to get the last pilot who flew it but I can't seem to get it to work, as soon as I get it working I'll post the code here

a conclusion in the two tables, first table of Boeing 737 and the second table all Airbus

how can I create this?




First Table is (list of all Boeing aircraft's)

Boeing B737-300

EI-CHH, total flight time 00:12:50. 

Located at the airport Cologne Bonn (EDDK).




Second Table is (list of all Airbus aircraft's)

Airbus A319-100

VP-BBG, total flight time 01:20:15. 

Located at the airport Munich (EDDM).


please help!!


I've created this code but, this code show all  aircraft's in list, but i needet 2 tabeles! 




<?php foreach ($fleet as $aircraft) 
{
?>
<?php $airbus = explode("EI", $aircraft->registration); echo $airbus[0];?>,  total flight time <?php echo $aircraft->totaltime; ?>.<br>  Located at the airport<?php
$params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED));

$pirep = PIREPData::findPIREPS($params);
$current_location = $pirep[0]->arricao;
$current_location2 = $pirep[0]->arrname;
       {
           echo ''.$current_location2.' ('.$current_location.')';
       }
?>.<br><br>
<?php } ?>

Copy the table and move it below the first table and change the airbus stuff to boeing or whatever.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 1 month later...

And another question: The script shows all aircraft, also those who are marked as disabled. What do I need to change to see only active aircraft in the list?

I think only the SQL query need to be adopted

		public static function FleetInfo()
	{
   $sql = 'SELECT a.*, a.name AS aircraft,
     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     GROUP BY a.registration';

		return DB::get_results($sql);
		DB::debug();
		return $ret;

	}

to include only enabled aircraft, but I didn't managed to get it working.

Maybe some sql expert could help.

thanks,

Markus

Link to comment
Share on other sites

Hi,

with this one, I get an error on line 4 from the tpl file:

$sql = 'SELECT a.*, a.name AS aircraft,
     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     WHERE a.enabled = 1
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     GROUP BY a.registration';

           return DB::get_results($sql);
           DB::debug();
           return $ret;

Line 4 of the tpl is:

foreach ($fleet as $aircraft) 

any idea?

Link to comment
Share on other sites

Hi,

here is the whole fleet.php

<?php



class Fleet extends CodonModule 
{

       public function index()
       {
       $fleet = self::FleetInfo();
       Template::Set('fleet', $fleet);
       Template::Show('fleet_table.tpl');

       }
       /**
       * Return all possible information about the fleet
       * Code by Mitchell W
       * Enhanced by Stu (stuartpb)         
       * Fleet Table 2.0                            
       */
       public static function FleetInfo()
       {
   $sql = 'SELECT a.*, a.name AS aircraft,
     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     WHERE a.enabled = 1
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     GROUP BY a.registration';

           return DB::get_results($sql);
           DB::debug();
           return $ret;

       }

}

?>

and the tpl:

<h1><?php echo SITE_NAME?> Fleet</h1>
<table align="center"><tr><td>
<?php 
foreach ($fleet as $aircraft) 
{
?>
<div style="float: left;" align="right">
ICAO :<br>
Type :<br>
Full Name:<br>
Registration :<br>
Range :<br>
Empty Weight :<br>
Cruise Alt :<br>
Max Pax :<br>
Max Cargo :<br>
Total hours :<br>
Total Routes flown :<br>
current Airport :<br>
current Country :<br>
<br>
Download :
</div>
<div style="float: left;">
<?php echo $aircraft->icao; ?><br>
<?php echo $aircraft->name; ?><br>
<?php echo $aircraft->fullname; ?><br>
<?php echo $aircraft->registration; ?><br>
<?php echo $aircraft->range; ?><br>
<?php echo $aircraft->weight; ?><br>
<?php echo $aircraft->cruise; ?><br>
<?php echo $aircraft->maxpax; ?><br>
<?php echo $aircraft->maxcargo; ?><br>
<?php echo $aircraft->totaltime; ?><br>
<?php echo $aircraft->routesflown; ?><br>

<?php $params = (array('a.registration'=>$aircraft->registration, 'p.accepted'=>PIREP_ACCEPTED));
$pirep = PIREPData::findPIREPS($params);
$current_location = $pirep[0]->arricao;
$current_location2 = $pirep[0]->arrname;
echo $current_location.'-'.$current_location2;
?>
<?php $airport = OperationsData::getAirportInfo($pirep[0]->arricao); ?><br>
<?php echo $airport->country; ?><br>
<br>
<a href="<?php echo $aircraft->downloadlink; ?>">Download!</a>
</div>
<div style="float: right;">
<img src="<?php echo $aircraft->imagelink; ?>" height="97"
width="160"></div>
<br style="clear:both;">
<br>
<hr>
<br>
<?
}
?>
</td></tr></table>


the error says:

Warning: Invalid argument supplied for foreach() in /var/www/web97/html/phpvms/core/templates/fleet_table.tpl on line 4 

Thanks for help!

best regards,

Markus

Link to comment
Share on other sites

  • 2 weeks later...
  • Administrators

The error is in the sql command for the database, replace it with:

$sql = 'SELECT a.*, a.name AS aircraft,

     COUNT(p.pirepid) AS routesflown,
     SUM(p.distance) AS distance,
     SEC_TO_TIME(SUM(p.flighttime*60*60)) AS totaltime,
     AVG(p.distance) AS averagedistance,
     AVG(p.flighttime) as averagetime
     FROM   '.TABLE_PREFIX.'aircraft a
     LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id)
     WHERE enabled = 1
     GROUP BY a.name';

That will only show enabled aircraft. Also, I am not sure how the current location in the template is relavent unless you only have one unit of each model in your fleet. The module combines all the like aircrtaft in one group, then displays a current location, but that would be just for the last ac in the list. Just pondering...

the module runs slow on my local machine, but I have a lot of data in the database. Might benefit in speed to combine some of the data calls from the template into the model.

Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...