Pax Status

Portuguese:

Ola, Tem Como Eu Colocar No Status da Minha Empresa Aerea Virtual, o numero de passageiros transportados?

English:

Hello, How I Put It On the Status of My Virtual Airline, the number of passengers carried?

You have to pull it from StatsData.class.php

<p><strong>Passengers Carried: </strong><?php echo StatsData::TotalPaxCarried(); ?></p>

You can do alot with these codes, he is what I have showing:

<p><strong>Total Pilots: <?php echo StatsData::PilotCount(); ?></strong></p>
       <p><strong>Total Flights Flown: </strong><?php echo StatsData::TotalFlights(); ?></p>
       <p><strong>Total Aircraft: </strong><?php echo StatsData::TotalAircraftInFleet(); ?></p>
       <p><strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours(); ?></p>
       <p><strong>Passengers Carried: </strong><?php echo StatsData::TotalPaxCarried(); ?></p>
       <p><strong>Fuel Burned (lbs.): </strong><?php echo StatsData::TotalFuelBurned(); ?></p>
       <p><strong>Miles Flown: </strong><?php echo StatsData::TotalMilesFlown(); ?></p>
       <p><strong>Total Flights Today: </strong><?php echo StatsData::totalflightstoday(); ?></p>
1 Like

That’s what I do as well. The only thing missing is the amount of cargo carried, but there does not seem to be any easy way to work that in.

After I added this code in the End of File Php gave this error below

I got solved by adding this command on my header.tpl template and appeared on the status

Very Thanks

That’s what I do as well. The only thing missing is the amount of cargo carried, but there does not seem to be any easy way to work that in.

I have been doing some searching about this, and still can’t seem to find out how people are showing that on their site. It just boggles my mind that I know it is being saved lust like Passengers, but where is it being saved so we can pull it out is the question.

I found something interesting. It took 198 flights to carry over 2 million passengers:rolleyes: I have a nagging suspicion that it is returning the total units, meaning pax and lbs. of cargo. I also haven’t found a way to get rid of the decimal amount in fuel burned.

Airline Statistics

Total Pilots: 28

Total Flights Flown: 198

Total Aircraft: 104

Total Hours Flown: 498.37

Passengers Carried: 2297149

Fuel Burned (lbs.): 3157507.1060009

Miles Flown: 213119

Total Flights Today: 0

Total Schedules: 2335

what is the code you are using to pull the total fuel burned, because mine never shows the decimal?

The same basic code as you posted above. In fact I just duplicated what you posted, this evening and get the same results. I originally had the HTML tied to CSS, rather than using the <STRONG> tags, but I didn’t think that was the problem. Since I’m now using the same code you are, I guess I was right. I’m bewildered as to where the stuff to the right of the decimal came from.

I think I’ve figured out the large number of pax. I suspect it can be traced to cargo a/c accidentally being assigned to pax routes, but I’ll have to scour the pireps to find out.

Yeah, that is definitely weird. If you click my signature, you can see that it doesn’t have a decimal on it, so I just don’t know. I am strictly using FSPassengers only, not using any ACARS at all, so not sure if that could be the reason.

To round the number and remove the decimal use ->

<p><strong>Fuel Burned (lbs.): </strong><?php echo round(StatsData::TotalFuelBurned(), 0); ?></p>

As far as pax count it is pulling the load figure from each PIREP that has a flighttype of “P” ->

$params = array(
			'table' => TABLE_PREFIX.'pireps',
			'fields' => 'SUM(`load`) as `total`',
			'where' => array(
				'accepted' => PIREP_ACCEPTED,
				'flighttype' => 'P'
			),

I would check to see if your cargo flights are being recorded with the correct identifier in the flighttype column of the pireps table.

Thanks for solving the decimal situation. I reached the same conclusion about the number of pax.

How do you do Cargo, instead of Passangers carried?

How do you do Cargo, instead of Passangers carried?

Add something like this to your statsdata class ->

public static function TotalCargoCarried($airline_code = '')
{
	$key = 'total_cargo_carried';
	if($airline_code != '')
	{
		$key .= '_'.$airline_code;
	}

	$total = CodonCache::read($key);

	if($total === false)
	{
		$params = array(
			'table' => TABLE_PREFIX.'pireps',
			'fields' => 'SUM(`load`) as `total`',
			'where' => array(
				'accepted' => PIREP_ACCEPTED,
				'flighttype' => 'C'
			),
		);

		if(!empty($airline_code))
		{
			$params['where']['code'] = $airline_code;
			$params['group'] = 'code';
		}

		$sql = DB::build_select($params);
		$results = DB::get_results($sql);
		if(!$results)
		{
			$total = 0;
		}
		else
		{
			$total = $results[0]->total;
		}

		CodonCache::write($key, $total, '15minute');
	}

	return $total;
}

And use ->

<?php echo StatsData::TotalCargoCarried(); ?>

to display it

Add something like this to your statsdata class ->

public static function TotalCargoCarried($airline_code = ‘’)
{
$key = ‘total_cargo_carried’;
if($airline_code != ‘’)
{
$key .= ‘_’.$airline_code;
}

$total = CodonCache::read($key);

if($total === false)
{
$params = array(
‘table’ => TABLE_PREFIX.‘pireps’,
‘fields’ => ‘SUM(load) as total’,
‘where’ => array(
‘accepted’ => PIREP_ACCEPTED,
‘flighttype’ => ‘C’
),
);

if(!empty($airline_code))
{
$params[‘where’][‘code’] = $airline_code;
$params[‘group’] = ‘code’;
}

$sql = DB::build_select($params);
$results = DB::get_results($sql);
if(!$results)
{
$total = 0;
}
else
{
$total = $results[0]->total;
}

CodonCache::write($key, $total, ‘15minute’);
}

return $total;
}

And use ->

<?php echo StatsData::TotalCargoCarried(); ?>

to display it

Thanks for your help, but i got this error when i added this to my site:

Parse error: syntax error, unexpected T_PUBLIC in /home/skygovac/public_html/core/common/StatsData.class.php on line 838

anyone know why this error is here? i would really like this on my site

David, if you placed that code at the very end of StatsData.class.php AFTER HERE:

/**
 * Return the total number of schedules in the system
 *
 * @return int $airline_code Total number
 *
 */
public static function TotalSchedules($airline_code='')
{
	$key = 'total_schedules';
	if($airline_code != '')
	{
		$key .= '_'.$airline_code;
	}

	$total = CodonCache::read($key);

	if($total === false)
	{
		$params = array(
			'table' => TABLE_PREFIX.'schedules',
			'fields' => 'COUNT(`id`) as `total`',
		);

		if(!empty($airline_code))
		{
			$params['where'] = array('code' => $airline_code);
			$params['group'] = 'code';
		}

		$sql = DB::build_select($params);
		$results = DB::get_results($sql);

		if(!$results)
		{
			$total = 0;
		}
		else
		{
			$total = $results[0]->total;
		}

		CodonCache::write($key, $total, '15minute');
	}

	return $total;
}
} <<<THIS IS THE ONE YOU MOVE

you need to remove the extra } from that code to the very end of the code you just pasted. That’s probably why that error is coming up.

Moving to code snippets.

anyone know why this error is here? i would really like this on my site

What is that line?

Moving to code snippets.

What is that line?

Parse error: syntax error, unexpected T_PUBLIC in /home/skygovac/public_html/core/common/StatsData.class.php on line 838

Im going to try what Jeff said to do, and see if that works

I still got the error:

Parse error: syntax error, unexpected T_PUBLIC in /home/skygovac/public_html/core/common/StatsData.class.php on line 838