Serrador Posted July 2, 2010 Report Posted July 2, 2010 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? Quote
Jeff Posted July 2, 2010 Report Posted July 2, 2010 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 Quote
CrashGordon Posted July 2, 2010 Report Posted July 2, 2010 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. Quote
Serrador Posted July 2, 2010 Author Report Posted July 2, 2010 After I added this code in the End of File Php gave this error below Quote
Serrador Posted July 2, 2010 Author Report Posted July 2, 2010 I got solved by adding this command on my header.tpl template and appeared on the status Very Thanks Quote
Jeff Posted July 3, 2010 Report Posted July 3, 2010 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. Quote
CrashGordon Posted July 3, 2010 Report Posted July 3, 2010 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 Quote
Jeff Posted July 3, 2010 Report Posted July 3, 2010 what is the code you are using to pull the total fuel burned, because mine never shows the decimal? Quote
CrashGordon Posted July 3, 2010 Report Posted July 3, 2010 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. Quote
Jeff Posted July 3, 2010 Report Posted July 3, 2010 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. Quote
Administrators simpilot Posted July 3, 2010 Administrators Report Posted July 3, 2010 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. Quote
CrashGordon Posted July 3, 2010 Report Posted July 3, 2010 Thanks for solving the decimal situation. I reached the same conclusion about the number of pax. Quote
Jason Posted July 7, 2010 Report Posted July 7, 2010 How do you do Cargo, instead of Passangers carried? Quote
Administrators simpilot Posted July 8, 2010 Administrators Report Posted July 8, 2010 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 Quote
Guest lorathon Posted July 8, 2010 Report Posted July 8, 2010 Sim is correct. Although I would write a new stats class for this so it would not be overwritten in an upgrade. This is what I did. I have a class specifically built for modified standard classes that is full of stuff just like this. Quote
Jason Posted July 9, 2010 Report Posted July 9, 2010 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 Quote
Jason Posted July 10, 2010 Report Posted July 10, 2010 anyone know why this error is here? i would really like this on my site Quote
Jeff Posted July 10, 2010 Report Posted July 10, 2010 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. Quote
Administrators Nabeel Posted July 10, 2010 Administrators Report Posted July 10, 2010 Moving to code snippets. anyone know why this error is here? i would really like this on my site What is that line? Quote
Jason Posted July 10, 2010 Report Posted July 10, 2010 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 Quote
Jason Posted July 10, 2010 Report Posted July 10, 2010 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 Quote
Jeff Posted July 10, 2010 Report Posted July 10, 2010 David, I got it fixed for you. Check your PM Quote
Jason Posted July 10, 2010 Report Posted July 10, 2010 David, I got it fixed for you. Check your PM do you have the error fixed??? Quote
Guest lfreitas1 Posted November 6, 2010 Report Posted November 6, 2010 I solved the problem of Cargo Stats copy this code between the TotalPaxCarried and PilotCount the code is: /** * Return the total number of Cargo Carried * * * */ 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; } Like this: /* These contributed by simpilot from phpVMS forums */ /** * Get the total number of pilots */ public static function PilotCount($airline_code='') { $key = 'pilot_count'; if($airline_code != '') { $key .= '_'.$airline_code; } $total = CodonCache::read($key); if($total === false) { $params = array( 'table' => TABLE_PREFIX.'pilots', 'fields' => 'COUNT(*) as `total`', ); 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; } /** * Return the total number of Cargo Carried * * * */ 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; } /** * Return the total number of passengers carried * * @return mixed This is the return value description * */ public static function TotalPaxCarried($airline_code = '') { $key = 'total_pax_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' => 'P' ), ); 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; } if you want to have my full file statsdata.class.php, in this Attachments Portuguese: Eu Resolvi o problema do Cargo Stats copie esse codigo entre o TotalPaxCarried e PilotCount o codigo é: /** * Return the total number of Cargo Carried * * * */ 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; } ficara assim: /* These contributed by simpilot from phpVMS forums */ /** * Get the total number of pilots */ public static function PilotCount($airline_code='') { $key = 'pilot_count'; if($airline_code != '') { $key .= '_'.$airline_code; } $total = CodonCache::read($key); if($total === false) { $params = array( 'table' => TABLE_PREFIX.'pilots', 'fields' => 'COUNT(*) as `total`', ); 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; } /** * Return the total number of Cargo Carried * * * */ 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; } /** * Return the total number of passengers carried * * @return mixed This is the return value description * */ public static function TotalPaxCarried($airline_code = '') { $key = 'total_pax_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' => 'P' ), ); 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; } Se você quiserem o meu arquivo completo statsdata.class.php esta no Attachments StatsData.class.php Quote
TAV1702 Posted November 26, 2010 Report Posted November 26, 2010 I have added all the necessary code to my site and cargo will not update for me at all. I will have a look at the stats file that was attached here and see if mine differs or not. Quote
TAV1702 Posted November 26, 2010 Report Posted November 26, 2010 Still no go. I have changed the name of my other stats dataclass php file and uploaded the new one deleted all cache and all and still cargo will not show. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.