Jump to content

Stats in public profile


Blu-Express VA

Recommended Posts

Hi,

i've idea to publish the stats of the pilot in his public profile.

I've copied the code for Your Stats page but work only with the stats of the pilot logged in, and i know it :D

So my new code is:

<?php
/*
Added in 2.0!
*/
$chart_width = '600';
$chart_height = '250';

/* Don't need to change anything below this here */
?>
<div align="center" style="width: 100%;">
<div align="center" id="pireps_chart"></div>
</div>

<script type="text/javascript" src="<?php echo fileurl('/lib/js/ofc/js/swfobject.js')?>"></script>
<script type="text/javascript">
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>", 
"pireps_chart", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>", 
"9.0.0", "expressInstall.swf", 
{"data-file":"<?php echo actionurl('/pilots/statsdaysdata/'.$userinfo->pilotid);?>"});

</script>
<?php
/*
Added in 2.0!
*/
$chart_width = '600';
$chart_height = '250';

/* Don't need to change anything below this here */
?>
<div align="center" style="width: 100%;">
<div align="center" id="months_data"></div>
</div>
<br />
<div align="center" style="width: 100%;">
<div align="center" id="aircraft_data"></div>
</div>

<script type="text/javascript" src="<?php echo fileurl('/lib/js/ofc/js/swfobject.js')?>"></script>
<script type="text/javascript">
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>", 
"months_data", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>", 
"9.0.0", "expressInstall.swf", 
{"data-file":"<?php echo actionurl('/pilots/statsmonthsdata/'.Auth::$userinfo->pilotid);?>"});


<?php
$chart_width = '600';
$chart_height = '300';

/* Don't need to change anything below this here */
?>
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>", 
"aircraft_data", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>", 
"9.0.0", "expressInstall.swf", 
{"data-file":"<?php echo actionurl('/pilots/statsaircraftdata/'.Auth::$userinfo->pilotid);?>"});
</script>
<?php
if(!$pireps)
{
echo '<p>Sorry No recent flights have been found</p>';
  return;
}
        $flights = PIREPData::getLastReports($userinfo->pilotid, '20');                                                                     
       $string = "";
       foreach($flights as $flight)
       {       
               $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
       }
?>
<p align="center"><strong>Pilots Recent Flights</strong><br /><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=600x360&PM=pemr:star10:white%2b%22%25I%22:white&PC=orange" /><br />

My Question:

If this code work only with the stats of the pilot logged in and if i want so see the public profile of other pilots i see my stats in his public profile,

How to change this and can work in public profile for see the stats of the public profile that i now see?

Thanks..

Link to comment
Share on other sites

This is the original code for the pilot_public_profile.tpl see if it works now.

<?php
if(!$userinfo)
{
echo '<h3>This pilot does not exist!</h3>';
return;
}
?>
<h3>Profile For <?php echo $userinfo->firstname . ' ' . $userinfo->lastname?></h3>
<table>
<tr>
	<td align="center" valign="top">
		<?php
		if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
		{
			echo 'No avatar';
		}
		else
		{
			echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> ';
		}
		?>
		<br /><br />
		<img src="<?php echo $userinfo->rankimage?>"  alt="" />
	</td>
	<td valign="top">
		<ul>
			<li><strong>Pilot ID: </strong><?php echo $pilotcode ?></li>
			<li><strong>Rank: </strong><?php echo $userinfo->rank;?></li>
			<li><strong>Total Flights: </strong><?php echo $userinfo->totalflights?></li>
			<li><strong>Total Hours: </strong><?php echo Util::AddTime($userinfo->totalhours, $userinfo->transferhours); ?></li>
			<li><strong>Location: </strong>
				<img src="<?php echo Countries::getCountryImage($userinfo->location);?>" 
							alt="<?php echo Countries::getCountryName($userinfo->location);?>" />
				<?php echo Countries::getCountryName($userinfo->location);?> 
			</li>

			<?php
			// Show the public fields
			if($allfields)
			{
				foreach($allfields as $field)
				{
					echo "<li><strong>$field->title: </strong>$field->value</li>";
				}
			}
			?>
		</ul>

		<p>
		<strong>Awards</strong>
		<?php
		if(is_array($allawards))
		{			
		?>
		<ul>
			<?php foreach($allawards as $award)
			{ 
				/* To show the image:

					<img src="<?php echo $award->image?>" alt="<?php echo $award->descrip?>" />
				*/

			?>
				<li><?php echo $award->name ?></li>
			<?php } ?>
		</ul>	
		<?php
		}
		?>
	</p>
	</td>

</tr>
</table>
<?php
/*
Added in 2.0!
*/
$chart_width = '800';
$chart_height = '250';

/* Don't need to change anything below this here */
?>
<div align="center" style="width: 100%;">
<div align="center" id="pireps_chart"></div>
</div>

<script type="text/javascript" src="<?php echo fileurl('/lib/js/ofc/js/swfobject.js')?>"></script>
<script type="text/javascript">
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>", 
"pireps_chart", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>", 
"9.0.0", "expressInstall.swf", 
{"data-file":"<?php echo actionurl('/pilots/statsdaysdata/'.$userinfo->pilotid);?>"});
</script>

Link to comment
Share on other sites

I think I misunderstood you. I think you are wanting to show the pie chart of the pilot, correct? I don't think you can place that in the pilot_public_profile.tpl, as I could never get it to work for me. Unless someone else has an idea on how to achieve it.

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