Jump to content

Recommended Posts

Posted

Hey Jeff hey Simpilot ! any help please ?

Can't you just use the standard code and then change one code at a time until you get the look you want? I'm trying to figure out exactly what you want.

Posted

@Jeff

Im using FsCaptain and its similar to FsPassengers as a code and I cant use standard code, the stats work perfectly I just want to see top five only and if possible have the ranking displayed to the left as in the screenshot.

Thats all ! is that possible ?

Thanks Jeff

  • Administrators
Posted

@Jeff

Im using FsCaptain and its similar to FsPassengers as a code and I cant use standard code, the stats work perfectly I just want to see top five only and if possible have the ranking displayed to the left as in the screenshot.

Thats all ! is that possible ?

Thanks Jeff

Look back through the posts, I posted what you have to change to make it work for your custom table but you keep bringing the native code that Jeff posts back which will not work in your situation.

Posted

Look back through the posts, I posted what you have to change to make it work for your custom table but you keep bringing the native code that Jeff posts back which will not work in your situation.

Yeah, that's where I keep getting confused. The best thing for you to do is start reading from the beginning of this thread and see if you can find what you are looking for.

Posted

@ SIMPILOT

Hi Simpilot !

Sorry if I disturb you but I would like to learn how the stats work once and for all :)

my TouchdownStatsData.class.php :

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TouchdownStatsData extends CodonData  {

   public function get_all_stats() { 
      $query = "SELECT * FROM flights
                   WHERE TouchDownVertSpeedFt < '-100' 
                   ORDER BY TouchDownVertSpeedFt DESC";

       return DB::get_results($query);
   }

    public function get_stats($howmany) {
      $query = "SELECT * FROM flights
                   WHERE TouchDownVertSpeedFt < '-100'
                   ORDER BY TouchDownVertSpeedFt DESC";

       return DB::get_results($query);
   }

}

The TouchdownStats.php :

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TouchdownStats extends CodonModule {

   public function index() {
       $this->set('stats', TouchdownStatsData::get_all_stats());
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

   public function top_landings($howmany)  {
       $this->set('stats', TouchdownStatsData::get_stats($howmany));
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }
}

and touchdownstats_index.tpl:

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/
?>
<table width="100%" border="1" bordercolor="#FFFFFF" class="tablesorter" id="tabledlist">
<tr align="center" valign="middle" bgcolor="#0079B2">

       <td>Pilot</td>
       <td>Aircraft</td>
       <td>Arrival Field</td>
       <td>Landing Rate</td>
       <td>Date Posted</td>
   </tr>
<?php 
   foreach($stats as $stat) 
   { 
       echo '<tr>'; 
       echo '<td>'.$stat->PilotName.'</td>'; 
       echo '<td>'.$stat->AircraftName.'</td>'; 
       echo '<td>'.$stat->ArrivalIcaoName.'</td>'; 
       echo '<td>'.$stat->TouchDownVertSpeedFt.'</td>'; 
       echo '<td>'.$stat->datestamp.'</td>'; 
               echo '</tr>'; 
   } 
?> 
</table>

I used this link to see the top ten but I still see all flights :(http://www.cargoitaliavirtual.com/index.php/TouchdownStats/top_landings/10

I tried to make a monthly stats and followed this :

public function get_all_stats($month) { 
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` 
                   WHERE landingrate < '0'
                   AND MONTH(submitdate) = '$month'
                   ORDER BY landingrate DESC"; 

       return DB::get_results($query); 
   }

But could not reach my objective...

Would you please have the patience and teach me how to make a table similar to the screenshot I posted where I can have top FIVE of the month ?

Please its important !

Thanks again and really sorry if that disturbs you

statstable.jpg

Posted

sshot120.png

<?php
$conexao = mysql_connect('localhost', 'LOG', 'PSS');
mysql_select_db('BD', $conexao);
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Controle de Estoque - Empresas Figueiredo</title>
<style media="all">
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.titulo_row {
background: #575757;
color: #FFFFFF;
}
.style2 {color: #FFFFFF}
.style3 {color: #000000; }
</style>
</head>
<center>
<body>
<h2><span style="color: rgb(0, 0, 255);">Os 10 melhores pousos do mes</span></h2>

<?php
$busca_produtos="SELECT p.code, p.pilotid, firstname, lastname, a.fullname, r.pilotid, landingrate, depicao, arricao
FROM phpvms_pilots p left join phpvms_pireps r on p.pilotid = r.pilotid right join phpvms_aircraft a on a.id = r.aircraft
WHERE year(r.submitdate) = year(now()) and month(r.submitdate) = month(now()) and landingrate < '0'
ORDER BY landingrate desc
LIMIT 0,10";

$exec_produtos = mysql_query($busca_produtos); // Executo a busca
$nume_produtos = mysql_num_rows($exec_produtos); // Verifico o n�mero de linhas retornadas

$cor = "#D5D5D5"; // Defino a segunda cor
?>
<table width="630" border="0" cellspacing="0" cellpadding="2">
<tr class="titulo_row">
<td width="">Piloto</td>
<td width="">Nome</td>
<td width="43">Saida</td>
<td width="43">Destino</td>
<td width="">Equipamento</td>
<td width="">Totidal Rate</td>
</tr>
<?php

// Verifico se alguma linha foi retornada
if($nume_produtos > 0) {

// Monto o loop de informa��es com a matriz associativa $pinfo
while($pinfo = mysql_fetch_assoc($exec_produtos)) {

// Crio o IF que me retornar� a cor da vez
if($cor == "#D5D5D5") {

$cor = "#FFFFFF"; // Aqui � a primeira cor
}
else {

$cor = "#D5D5D5";
}


?>
<tr bgcolor="<?php echo $cor; ?>">
<td width=""><?php echo $pinfo['code']. "0". $pinfo['pilotid']; ?></td>
<td width=""><?php echo $pinfo['firstname']. "  ". $pinfo['lastname']; ?></td>
<td width="8"><?php echo $pinfo['depicao']; ?></td>
<td width="8"><?php echo $pinfo['arricao']; ?></td>
<td width=""><?php echo $pinfo['fullname']; ?></td>
<td width=""><?php echo $pinfo['landingrate']; ?></td>
</tr>

<?php
}
}
?>

</table>





<h2><span style="color: rgb(0, 0, 255);">Utimos voos</span></h2>

<?php
$busca_produtos1="SELECT *
FROM phpvms_pilots p left join phpvms_pireps r on p.pilotid = r.pilotid right join phpvms_aircraft a on a.id = r.aircraft
ORDER BY pirepid desc
LIMIT 0,10";
$exec_produtos1 = mysql_query($busca_produtos1); // Executo a busca
$nume_produtos1 = mysql_num_rows($exec_produtos1); // Verifico o n�mero de linhas retornadas

$cor1 = "#D5D5D5"; // Defino a segunda cor
?>
<table width="630" border="0" cellspacing="0" cellpadding="2">
<tr class="titulo_row">
<td width="70">Voo N°</td>
<td width="43">Saida</td>
<td width="43">Destino</td>
<td width="">Piloto</td>
<td width="">Aircraft</td>
<td width="">Touch Down Rate</td>
<td width="">Flight Time</td>
<td width="">fuel</td>
</tr>

<?php

// Verifico se alguma linha foi retornada
if($nume_produtos1 > 0) {

// Monto o loop de informa��es com a matriz associativa $pinfo
while($pinfo1 = mysql_fetch_assoc($exec_produtos1)) {

// Crio o IF que me retornar� a cor da vez
if($cor1 == "#D5D5D5") {

$cor1 = "#FFFFFF"; // Aqui � a primeira cor
}
else {

$cor1 = "#D5D5D5";
}


?>


<td>
<tr bgcolor="<?php echo $cor1; ?>">
<td width="70"><a href="http://grupobrazilair.com/index.php/pireps/view/<?php echo $pinfo1['pirepid'];?>" target="_top"><?php echo $pinfo1['code']. "  ". $pinfo1['flightnum']; ?></a></td>
<td width="8"><?php echo $pinfo1['depicao']; ?></td>
<td width="8"><?php echo $pinfo1['arricao']; ?></td>
<td width=""><a href="http://grupobrazilair.com/index.php/profile/view/<?php echo $pinfo1['pilotid'];?>" target="_top"><?php echo $pinfo1['firstname']. "  ". $pinfo1['lastname']; ?></a></td>
<td width=""><?php echo $pinfo1['fullname']; ?></td>
<td width=""><?php echo $pinfo1['landingrate']; ?></td>
<td width=""><?php echo $pinfo1['flighttime']; ?></td>
<td width=""><?php echo $pinfo1['fuelused']; ?></td>
</tr>

<?php
}
}
?>

</table>

<h2><span style="color: rgb(0, 0, 255);">Utimas Reservas</span></h2>
<center>
<?php
$busca_bids="SELECT  p.*, s.*, 
					b.bidid as bidid, a.name as aircraft, a.registration, b.dateadded as dateadded
			FROM  phpvms_schedules s, 
				  phpvms_bids b,
				  phpvms_aircraft a,
				  phpvms_pilots p
			WHERE b.routeid = s.id AND s.aircraft=a.id AND p.pilotid = b.pilotid
			ORDER BY b.bidid DESC
			LIMIT 0,05";
$exec_bids = mysql_query($busca_bids); // Executo a busca
$nume_bids = mysql_num_rows($exec_bids); // Verifico o n�mero de linhas retornadas

$cor = "#D5D5D5"; // Defino a segunda cor
?>
<table width="630" border="0" cellspacing="0" cellpadding="2">
<tr class="titulo_row">
<td width="">Voo N°</td>
<td width="43">Saida</td>
<td width="43">Destino</td>
<td width="">Aircraft</td>
<td width="">Piloto</td>
<td width="">Data</td>
</tr>

<?php

// Verifico se alguma linha foi retornada
if($nume_bids > 0) {

// Monto o loop de informa��es com a matriz associativa $pinfo
while($bidsin = mysql_fetch_assoc($exec_bids)) {

// Crio o IF que me retornar� a cor da vez
if($cor1 == "#D5D5D5") {

$cor1 = "#FFFFFF"; // Aqui � a primeira cor
}
else {

$cor1 = "#D5D5D5";
}


?>

<td>
<tr bgcolor="<?php echo $cor1; ?>">
<td width=""><?php echo $bidsin['code'].  $bidsin['flightnum'] ?> </td>
<td width="8"><?php echo $bidsin['depicao']; ?></td>
<td width="8"><?php echo $bidsin['arricao']; ?></td>
<td width=""><?php echo $bidsin['aircraft']. "  " . $bidsin['registration']; ?></a></td>
<td width=""><?php echo $bidsin['firstname']. "  ". $bidsin['lastname']; ?></td>
<td width=""><?php echo $bidsin['dateadded']; ?></td>
</tr>

<?php
}
}
?>

</table>          

</body>
</html>
</center>

Posted

@SIMPILOT

Hey matey ! I managed to create something here and I think I'm really close to the objective!

http://www.cargoitaliavirtual.com/index.php/TouchdownStats

I still need to learn how to insert the PilotName and TouchDownVertSpeedFt from the database !!!

take a look at my touchdownstats_index.tpl

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/
?>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="TableFullyBorderedLightGray" class="tablesorter" id="tabledlist">
 <tbody>
    <tr align="center" bgcolor="#B3C7EF" class="TableFullyBorderedLightGrayCell">
							  <td colspan="3" class="TableFullyBorderedLightGrayCell">
								<table width="300" border="0" cellspacing="0" cellpadding="4">
								<tbody><tr>
									<td align="center">
									<h3>Top 10 Best Landings</h3>
									</td>
								  </tr>
								</tbody>
								</table>
								</td>
							</tr>
<tr align="center" class="TableFullyBorderedLightGrayCell">
							  <td colspan="3" class="TableFullyBorderedLightGrayCell">
								<table width="300" border="0" cellspacing="0" cellpadding="4">
								  <tbody><tr>
									<td align="center"><h4>July 2010</h4></td>
								  </tr>
								</tbody></table></td>
							</tr>


       <tr valign="middle" class="TableFullyBorderedLightGrayCell">
									  <td align="right" class="TableFullyBorderedLightGrayCell">1st  </td>
									  <td width="384" class="TableFullyBorderedLightGrayCell"><table width="380" border="0" cellspacing="0" cellpadding="4">
										  <tbody><tr>
											<td>Pilot</td>
										  </tr>
										</tbody></table></td>
									  <td width="123" align="right" class="TableFullyBorderedLightGrayCell">-103 ft/min   </td>
									</tr>

	<tr valign="middle" class="TableFullyBorderedLightGrayCell">
									  <td align="right" class="TableFullyBorderedLightGrayCell">2nd  </td>
									  <td width="384" class="TableFullyBorderedLightGrayCell"><table width="380" border="0" cellspacing="0" cellpadding="4">
										  <tbody><tr>
											<td>Pilot</td>
										  </tr>
										</tbody></table></td>
									  <td width="123" align="right" class="TableFullyBorderedLightGrayCell">-104 ft/min   </td>
									</tr>
       <tr valign="middle" class="TableFullyBorderedLightGrayCell">
									  <td align="right" class="TableFullyBorderedLightGrayCell">3rd  </td>
									  <td width="384" class="TableFullyBorderedLightGrayCell"><table width="380" border="0" cellspacing="0" cellpadding="4">
										  <tbody><tr>
											<td>Pilot</td>
										  </tr>
										</tbody></table></td>
									  <td width="123" align="right" class="TableFullyBorderedLightGrayCell">-108 ft/min   </td>
									</tr>
       <tr valign="middle" class="TableFullyBorderedLightGrayCell">
									  <td align="right" class="TableFullyBorderedLightGrayCell">4th  </td>
									  <td width="384" class="TableFullyBorderedLightGrayCell"><table width="380" border="0" cellspacing="0" cellpadding="4">
										  <tbody><tr>
											<td>Pilot</td>
										  </tr>
										</tbody></table></td>
									  <td width="123" align="right" class="TableFullyBorderedLightGrayCell">-108 ft/min   </td>
									</tr>
       <tr valign="middle" class="TableFullyBorderedLightGrayCell">
									  <td align="right" class="TableFullyBorderedLightGrayCell">5th  </td>
									  <td width="384" class="TableFullyBorderedLightGrayCell"><table width="380" border="0" cellspacing="0" cellpadding="4">
										  <tbody><tr>
											<td>Pilot</td>
										  </tr>
										</tbody></table></td>
									  <td width="123" align="right" class="TableFullyBorderedLightGrayCell">-109 ft/min   </td>
									</tr>


<?php 
   foreach($stats as $stat) 
   { 
       echo '<tr>'; 
       echo '<td>'.$stat->PilotName.'</td>';
	echo '<td>'.$stat->AircraftName.'</td>'; 
       echo '<td>'.$stat->ArrivalIcaoName.'</td>'; 
       echo '<td>'.$stat->TouchDownVertSpeedFt.'</td>'; 
       echo '<td>'.$stat->datestamp.'</td>'; 
       echo '</tr>'; 
   } 
?> 
</table>

Could you please lead me to a correct path ?

Thanks for your patience

Posted

The function does not return anything to echo, it returns a variable filled with the info you requested. An example to use it would be to set the variable, preferably in your module:

$this->set('myvariable', TouchdownStatsData::get_stats('5'));

Then in your template use a foreach command to show what data you want to display:

foreach($myvariable as $variable)
   {
       Do Stuff
   }

To see what is available to echo do a:

print_r($myvariable);

in your template.

If you want to call the data within the template just do:

$myvariable = TouchdownStatsData::get_stats('5');

in your template before you need the info.

Yes I understand but WHERE in the modules after WHAT? do I have to replace some code line ?????

What is myvariable ? Does it have to remain as it is or should I replace it ???

Sorry guys if I insist but seen from the point of view of a newbe it is not as clear and easy as you super programmers think ! And the most important thing that when you post something for someone

who is not familiar with coding, it is much more efficient to demonstrate in more detailed way how to write stuff than post pro. coding and have the topic full of questions !

I appreciate your hard work and the dedication you offered and in this reply I mean no offence to you or anyone else .

Posted

Hi i am trying to get the touchdown stats working everything is in the correct place but i get this error

Notice: The template file "/hermes/bosweb/web128/b1285/ipg.cjvirtualaircom/home//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /hermes/bosweb/web128/b1285/ipg.cjvirtualaircom/home/core/classes/TemplateSet.class.php on line 248

any ideas

Craig

  • Administrators
Posted

Hi i am trying to get the touchdown stats working everything is in the correct place but i get this error

Notice: The template file "/hermes/bosweb/web128/b1285/ipg.cjvirtualaircom/home//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /hermes/bosweb/web128/b1285/ipg.cjvirtualaircom/home/core/classes/TemplateSet.class.php on line 248

any ideas

Craig

Looks like the template file is not in the correct path.... it needs to be as it is in the download or in your skin folder.

root/core/templates/touchdownstats/(tpl files)

or

root/lib/skins/(your skin folder)/touchdownstats/(tpl files)

Posted

Looks like the template file is not in the correct path.... it needs to be as it is in the download or in your skin folder.

root/core/templates/touchdownstats/(tpl files)

or

root/lib/skins/(your skin folder)/touchdownstats/(tpl files)

aWESOME GOT IT WORKING THANK YOU FOR YOUR HELP

regards

craig

  • Administrators
Posted

You can add a function in the data class to call just stats for a certain month, I have done it with my va for a monthly contest. Just remember to tell it what year as well or you will be pulling stats for that month for every year you have been in operation.

Posted

@SIMPILOT

Please Please Please dont let down on me :(

I saw this code you posted:

public function get_all_stats($month) { 
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` 
                   WHERE landingrate < '0'
                   AND MONTH(submitdate) = '$month'
                   ORDER BY landingrate DESC"; 

       return DB::get_results($query); 
   }

could you please transform it in an example ? I mean if I want the month of July how th could would be ?

Here' my code now :

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TouchdownStatsData extends CodonData  {

   public function get_all_stats() {
       $query = "SELECT * FROM flights
                   WHERE TouchDownVertSpeedFt < '-0' 
                   ORDER BY TouchDownVertSpeedFt DESC";

       return DB::get_results($query);
   }

    public function get_stats($howmany) {
       $query = "SELECT * FROM flights
                   WHERE TouchDownVertSpeedFt < '-0'
                   ORDER BY TouchDownVertSpeedFt DESC
                   LIMIT $howmany";

       return DB::get_results($query);
   }

}

Is your code has to be put in the second part or both of them ? I mean the ($howmany) part or also the first one ?

  • Administrators
Posted

<?php $data = TouchdownstatsData::get_all_stats('7'); ?>

In your template would fill the "$data" variable with all the stats for the month of July (7th month) if you change your data class to

public function get_all_stats($month) {  
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`  
                   WHERE landingrate < '0' 
                   AND MONTH(submitdate) = '$month' 
                   ORDER BY landingrate DESC";  

       return DB::get_results($query);  
   }

You really should add the year in as well or you will be pulling all the july data from every year

]<?php $data = TouchdownstatsData::get_all_stats('7', '2010'); ?>

public function get_all_stats($month, $year) {  
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`  
                   WHERE landingrate < '0' 
                   AND MONTH(submitdate) = '$month' 
                   AND YEAR(submitdate) = '$year' 
                   ORDER BY landingrate DESC";  

       return DB::get_results($query);  
   }

Posted

Dave,

A quick question out if interest, I have applied what you have done above, I have also placed a limiter on the quantity drawn for that specific month, lets say the top 10 touch down stats for a specific month. I have also put in the php date function as the filter, so the code will automatically grab the month and the year from the server.

But what would happen in the next month, while no pireps have been submitted? Basically what would the if then check look like to return something like, "No flights have been submitted for this month"

I hope that makes sense?

  • Administrators
Posted

Dave,

A quick question out if interest, I have applied what you have done above, I have also placed a limiter on the quantity drawn for that specific month, lets say the top 10 touch down stats for a specific month. I have also put in the php date function as the filter, so the code will automatically grab the month and the year from the server.

But what would happen in the next month, while no pireps have been submitted? Basically what would the if then check look like to return something like, "No flights have been submitted for this month"

I hope that makes sense?

In your template you will need to put an if statement to qualify if there is data or not. Maybe something like ->

<?php
  if(!$myvariable) //"if" it is empty
   {
     echo 'There are no flights this month';
   }
  else
   {
     Display your table
   }
?>

  • Like 1
Posted

Hallo Guy !!

I have this problem when i cklick touchdownstatus, the system answer this.

Notice: The template file "/web/htdocs/www.dfair.org/home//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /web/htdocs/www.dfair.org/home/core/classes/TemplateSet.class.php on line 248

I have the touchdownstats_index.tpl but don't work

Help me please !!!

  • Administrators
Posted

Notice: The template file "/web/htdocs/www.dfair.org/home//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /web/htdocs/www.dfair.org/home/core/classes/TemplateSet.class.php on line 248

The error is telling you that the template file does not exist or is not in the correct path. If you have uploaded it to the server chances are it is in the wrong place.

All the template files for touchdownstats should be in one of two places ->

root/core/templates/touchdownstats/"template files"

or

root/lib/skins/"your skin"/touchdownstats/"template files"

  • 1 month later...
  • Administrators
Posted

Hey, i was wondering.. is it easy to have the option "Worst Landingrate"?

Right now its the top landings.. but i would like to show the worst also :-)

You could add a couple new functions to the module and data class

Maybe something like this in your module file

public function worst_landings($howmany)  {
       $this->set('stats', TouchdownStatsData::get_worst_stats($howmany));
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

And something like this in your data class

public function get_worst_stats($howmany) {
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
                   WHERE landingrate < '0'
                   ORDER BY landingrate ASC
                   LIMIT $howmany";

       return DB::get_results($query);
   }

  • Like 1
  • 1 month later...
Posted

Hey guys,

Just a question about expanding this module a little... again, i have tried but no luck.

I would like to get the average touchdown stats for every pilot (got this already via this topic) but also for every pilot with the different airplanes... so the average for pilot 0001 with B747-400 is - 212.10 (just an example).

And i would like to do this for all airplanes.

Could you help me with a start?

Thanks a bunch guys!

Lucas

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