Jump to content

TouchdownStats 1.0


simpilot

Recommended Posts

I believe some time ago Nabeel integrated this into the default install. Am I correct in saying that? And if so, do we still need this module to get his version to work?

I tried the original version but could never get the table or the database to populate the info. I am wanting to add top landings to my site just not sure how to go about it now.

Is this module now deprecated?

Link to comment
Share on other sites

  • Administrators

The old LandingStats module is no longer needed, it had the code to catch pireps and extract the landing rate which has been rolled into the main application. The landing stats module is just a way to extract the data from the table and have a few displays. B)

  • Like 1
Link to comment
Share on other sites

The old LandingStats module is no longer needed, it had the code to catch pireps and extract the landing rate which has been rolled into the main application. The landing stats module is just a way to extract the data from the table and have a few displays. B)

I went and grabbed the file from the first post and sure enough, it is exactly as you say. Worked like a charm. Thanks for the reply. I appreciate it. +1

Link to comment
Share on other sites

  • 2 weeks later...

Hi guys,

got touchdown in and is running and displaying stats for the guys who are flying FSpax only and not the Xacars guys.

I have checked the pireps and those who are using Xacars show a landing rate of 0 and the guys with FSpax show -168 for example, any ideas on how to get the data from Xacars?

cheers.

Deano

Link to comment
Share on other sites

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.

You know, from time to time the strangest of things happen. I have been struggling with this stuff (phpVMS)for a year or more now. And now somehow, after reading this very post, it just clicked in my head what each part does and how to use it. I can

t believe it took me this long. Better late than never I suppose. The funny part is, I bet I have read this very post no less then 20 times.

Since I have my hubs broken up in to individual pages, I am going to attempt to extract the data to those hub pages that show the landing rate for that hubs pilots only. Think this plan of mine will work?

Link to comment
Share on other sites

  • 1 month later...

Hi!

I'm trying to filter results by aircraft, and added the following code to TouchdownStats.php:

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

and this code to TouchdownStatsData.class.php:

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

	return DB::get_results($query);
}

When I invoke the listing (/index.php/Touchdownstats/by_aircraft/2), I get:

Fatal error: Call to undefined method TouchdownStatsData::get_stats_by_aircraft() in .../core/modules/TouchdownStats/TouchdownStats.php on line 25

What am I missing? :unsure:

Link to comment
Share on other sites

Error! :(, please help me

Well...without you posting any information of what LINE 21 is :blink: then maybe you can check your code against mine to see what your problem may be.

<?php
if(Auth::LoggedIn() == false)
{
  echo 'You must be logged in to view this page!';
  return;
}
?>
<?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" bgcolor="#042233">
   <tr>
       <td align = "center"><b><font color="#CCCCCC">Pilot</b></td>
       <td align = "center"><b><font color="#CCCCCC">Aircraft</b></td>
       <td align = "center"><b><font color="#CCCCCC">Arrival Field</b></td>
       <td align = "center"><b><font color="#CCCCCC">Landing Rate</b></td>
       <td align = "center"><b><font color="#CCCCCC">Date Posted</b></td>
   </tr>
<?php
   foreach($stats as $stat)
   {
       $pilot = PilotData::getPilotData($stat->pilotid);
       $aircraft = OperationsData::getAircraftInfo($stat->aircraft);
       echo '<tr>';
       echo '<td align = "center"><font color="#CCCCCC">'.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - '.$pilot->firstname.' '.$pilot->lastname.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$aircraft->fullname.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$stat->arricao.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$stat->landingrate.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.date(DATE_FORMAT, strtotime($stat->submitdate)).'</td>';
       echo '</tr>';
   }
?>
</table>

You do not need to have this code in there. I just use it for members eyes only.

<?php
if(Auth::LoggedIn() == false)
{
  echo 'You must be logged in to view this page!';
  return;
}
?>

Link to comment
Share on other sites

Well...without you posting any information of what LINE 21 is :blink: then maybe you can check your code against mine to see what your problem may be.

<?php
if(Auth::LoggedIn() == false)
{
  echo 'You must be logged in to view this page!';
  return;
}
?>
<?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" bgcolor="#042233">
   <tr>
       <td align = "center"><b><font color="#CCCCCC">Pilot</b></td>
       <td align = "center"><b><font color="#CCCCCC">Aircraft</b></td>
       <td align = "center"><b><font color="#CCCCCC">Arrival Field</b></td>
       <td align = "center"><b><font color="#CCCCCC">Landing Rate</b></td>
       <td align = "center"><b><font color="#CCCCCC">Date Posted</b></td>
   </tr>
<?php
   foreach($stats as $stat)
   {
       $pilot = PilotData::getPilotData($stat->pilotid);
       $aircraft = OperationsData::getAircraftInfo($stat->aircraft);
       echo '<tr>';
       echo '<td align = "center"><font color="#CCCCCC">'.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - '.$pilot->firstname.' '.$pilot->lastname.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$aircraft->fullname.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$stat->arricao.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.$stat->landingrate.'</td>';
       echo '<td align = "center"><font color="#CCCCCC">'.date(DATE_FORMAT, strtotime($stat->submitdate)).'</td>';
       echo '</tr>';
   }
?>
</table>

You do not need to have this code in there. I just use it for members eyes only.

<?php
if(Auth::LoggedIn() == false)
{
  echo 'You must be logged in to view this page!';
  return;
}
?>

THNXXXXX!!!! WORKED FOR ME :))))

Link to comment
Share on other sites

  • 4 weeks later...

Hello Mark,

Yes, I have a problem with frontpage_main.tpl and I think that the problem is the '<div>'

Picture:

preuba.png

CODE (frontpage_main.tpl):

<div id="mainbox">
<h3>Bienvenido a Fly Green Virtual<h3>
</div>
<div id="mainbox">
<?php
       $flights = PIREPData::getRecentReportsByCount(10);                                                                      
       $string = "";
       foreach($flights as $flight)
       {       
               $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
       }                                                                       
?>

<img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /><br />
             Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a> 
             <div>    
             </div>                     
<div id="mainbox">
<?php
// Show the News module, call the function ShowNewsFront
//	This is in the modules/Frontpage folder
MainController::Run('News', 'ShowNewsFront', 5);
?>
</div>


<div id="sidebar">
<div class="mcbox01">

                       <div class="mc01t2">

                           Acceso

                       </div>

                       <div class="mc01cc">

                           <p>

                           <?php 
	/* 
	Quick example of how to see if they're logged in or not
	Only show this login form if they're logged in */
	if(Auth::LoggedIn() == false)
	{ ?>
		<form name="loginform" action="<?php echo url('/login'); ?>" method="post">
			<p>Log in to your pilot center or <a href="<?php echo url('/registration'); ?>">register</a><br />
		<input type="text" name="email" value="Email/Pilot ID" onClick="this.value=''" />
			</p>
			<p>
			  <input type="password" name="password" value="Password" />
		  </p>
			<p>
			  <input type="hidden" name="remember" value="on" />
			  <input type="hidden" name="redir" value="index.php/profile" />
			  <input type="hidden" name="action" value="login" />
			  <input type="submit" name="submit" value="Log In" />
		  </p>
 </form>
		<p>
		<?php
	}	
	/* End the Auth::LoggedIn() if */
	else /* else - they're logged in, so show some info about the pilot, and a few links */
	{

	/*	Auth::$userinfo has the information about the user currently logged in
		We will use this next line - this gets their full pilot id, formatted properly */
	$pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid);
	?>
	    <strong>Pilot ID: </strong> <?php echo $pilotid ; ?>
	    <strong>Rank: </strong><?php echo Auth::$userinfo->rank;?><br />
	    <strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?>, <strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?>
	<br />
	<a href="<?php echo url('/pireps/new');?>">File a New PIREP</a></p>
		<p><a href="<?php echo url('/schedules/bids');?>">View My Bids</a></p>
		<p><a href="<?php echo url('/profile/');?>">View Pilot Center</a><?php
	} /* End the else */
	?>

 </p>
		<p>
		  <?php MainController::Run('Mail', 'checkmail'); ?>
		</p>


 <div class="mc01b">

                           <img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
     </div>


<div class="mcbox01">

                       <div class="mc01t2">

                            Spotting

                       </div>

                       <div class="mc01cc">

<?php Screenshots::show_random_screenshot(); ?>


                           <div align="center"><img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
 </div>
 <div class="mcbox01">

                       <div class="mc01t2">

                           Usuarios On line

                       </div>

                       <div class="mc01cc">

<p><i>Había <?php echo count($usersonline)?> usuario(s), y <?php echo count($guestsonline);?> visitante(s) On line hace <?php echo Config::Get('USERS_ONLINE_TIME')?> minutos.</i></p>

<?php
/* $usersonline also has the list of users -
	really simple example

	Or if you're not on the frontpage:
	$usersonline = StatsData::UsersOnline();


foreach($usersonline as $pilot)	
{
	echo "{$pilot->firstname} {$pilot->lastname}<br />";
}
*/
?>


                           <div align="center"><img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
 </div>
     </div>


 <div align="center">
      <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    </div>
    <fb:like-box href="http://www.facebook.com/pages/Fly-Green-Virtual/233652459983234" width="205" show_faces="true" border_color="#298625" stream="false" header="false"></fb:like-box>

</div>

Kind Regards.

Link to comment
Share on other sites

Take a look at those dive on line 3 and also below the map code you have an empty div there fir no reason, your right it is a div issue just finding the right one ;)

As a start get rid of that div id mainbox extra one so remove lines 3 and 4

Hello Mark, the problem was solved, now i have the problem with the table of info pilot:

avionr.png

<style type="text/css">
<!--
.Estilo1 {font-size: 10px}
-->
</style>
<div id="mainbox">
<h3>Vuelos Recientes</h3>


 <div align="left">
   <?php
       $flights = PIREPData::getRecentReportsByCount(10);                                                                      
       $string = "";
       foreach($flights as $flight)
       {       
               $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
       }                                                                       
?>

   <img src="http://www.gcmap.com/map?P=&MS=bm&MP=RECT&MR=350x350&PM=pemr:star10:white%2b%22%25I%22:white&PC=orange" /><br />
   <span class="Estilo1">   Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a></span>
   <?php
$count = 15;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table width="94%" border="0" bordercolor="#FFFFFF">
  <thead>
    <tr align="center" valign="middle" bgcolor="#7D95AF">
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>Landing Rate</th>
      <th>Aircraft</th>
    </tr>
   </thead>
   <tbody>

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   echo "<tr>";
   echo "<td align=center> $pirep->code $pirep->flightnum </td>";
   echo "<td align=center> $pirep->depicao </td>";
   echo "<td align=center> $pirep->arricao </td>";
   echo "<td align=center> $pirep->flighttime </td>";
   echo "<td align=center> $pilotid $pilotinfo->firstname $pilotinfo->lastname </td>";
   echo "<td align=center> $pirep->landingrate </td>";
   echo "<td align=center> $pirep->aircraft </td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td>There are no recent flights!</td></tr>";
}
?>


   <?php

// Show the News module, call the function ShowNewsFront
//	This is in the modules/Frontpage folder

MainController::Run('News', 'ShowNewsFront', 5);
?>
 </div>
</div>

</div>



<div id="sidebar">
       <div class="mcbox01">

                       <div class="mc01t2">

                           Acceso

                       </div>

                       <div class="mc01cc">

                           <p>

                           <?php 
               /* 
               Quick example of how to see if they're logged in or not
               Only show this login form if they're logged in */
               if(Auth::LoggedIn() == false)
               { ?>
                       <form name="loginform" action="<?php echo url('/login'); ?>" method="post">
                               <p> Sí aú no estas registrado</p>
                               <p>registrate <a href="<?php echo url('/registration'); ?>">aquí</a>.<br />
                                 <input type="text" name="email" value="FLE" onClick="this.value=''" />
                               </p>
                   <p>
                                 <input type="password" name="password" value="Password" />
                         </p>
                               <p>
                                 <input type="hidden" name="remember" value="on" />
                                 <input type="hidden" name="redir" value="index.php/profile" />
                                 <input type="hidden" name="action" value="login" />
                                 <input type="submit" name="submit" value="Log In" />
                         </p>
 </form>
                       <p>
                       <?php
               }       
               /* End the Auth::LoggedIn() if */
               else /* else - they're logged in, so show some info about the pilot, and a few links */
               {

               /*      Auth::$userinfo has the information about the user currently logged in
                       We will use this next line - this gets their full pilot id, formatted properly */
               $pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid);
               ?>
                   <strong>Pilot ID: </strong> <?php echo $pilotid ; ?>
                   <strong>Rank: </strong><?php echo Auth::$userinfo->rank;?><br />
                   <strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?>, <strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?>
               <br />
               <a href="<?php echo url('/pireps/new');?>">File a New PIREP</a></p>
                       <p><a href="<?php echo url('/schedules/bids');?>">View My Bids</a></p>
                       <p><a href="<?php echo url('/profile/');?>">View Pilot Center</a><?php
               } /* End the else */
               ?>

 </p>
                       <p>
                         <?php MainController::Run('Mail', 'checkmail'); ?>
                       </p>


 <div class="mc01b">

                           <img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
     </div>


       <div class="mcbox01">

                       <div class="mc01t2">

                            Spotting

                       </div>

                       <div class="mc01cc">

<?php Screenshots::show_random_screenshot(); ?>


                           <div align="center"><img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
 </div>
 <div class="mcbox01">

                       <div class="mc01t2">

                           Usuarios On line

                       </div>

                       <div class="mc01cc">

<p><i>Había <?php echo count($usersonline)?> usuario(s), y <?php echo count($guestsonline);?> visitante(s) On line hace <?php echo Config::Get('USERS_ONLINE_TIME')?> minutos.</i></p>

       <?php
       /* $usersonline also has the list of users -
               really simple example

               Or if you're not on the frontpage:
               $usersonline = StatsData::UsersOnline();


       foreach($usersonline as $pilot) 
       {
               echo "{$pilot->firstname} {$pilot->lastname}<br />";
       }
       */
       ?>


                           <div align="center"><img src="http://flygreenva.com/img_272.jpg" alt="" />                        </div>
 </div>
     </div>


 <div align="center">
      <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    </div>
    <fb:like-box href="http://www.facebook.com/pages/Fly-Green-Virtual/233652459983234" width="205" show_faces="true" border_color="#298625" stream="false" header="false"></fb:like-box>

</div>

Kind Regards.

Link to comment
Share on other sites

Notice: The template file "/var/www/vhosts/athensairwaysva.gr/httpdocs//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /var/www/vhosts/athensairwaysva.gr/httpdocs/core/classes/TemplateSet.class.php on line 248

ANY IDEAS??? I TRY TO FIX A FEW DAYS NOW AND I CANT! PLEASE HELP!!! THANKS A LOT

Link to comment
Share on other sites

  • Moderators

Notice: The template file "/var/www/vhosts/athensairwaysva.gr/httpdocs//core/templates/touchdownstats/touchdownstats_index.tpl" doesn't exist in /var/www/vhosts/athensairwaysva.gr/httpdocs/core/classes/TemplateSet.class.php on line 248

ANY IDEAS??? I TRY TO FIX A FEW DAYS NOW AND I CANT! PLEASE HELP!!! THANKS A LOT

Is the file there?

/core/templates/touchdownstats/touchdownstats_index.tpl"

Link to comment
Share on other sites

  • Administrators

@fsx

I do not think xacars reports any landing rates. Look in your pireps database table and see if there is any data in the landing rate field. By your error it looks to me like there is no data in that column.

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