Jump to content
Strider

Hubs page module

Recommended Posts

I have created another module, but this time for displaying the hubs you have in your VA. It uses Tom Sterritt's HubStats addon which will need to be downloaded and installed if you do not already have it.You can get it here. This module is currently at Version 1.0. To view what it does, click here. If you are wondering why the roster for the hub looks shorter then the amount of pilots in the hub, that is because there is code to hide all pilots with 0 flight hours. Once they filed a pirep and it is accepted they will show.

I have now since added a gcmap to show the location of the hub.

You can download this module here Enjoy it.

  • Like 2

Share this post


Link to post
Share on other sites

I have just updated this to V1.1. What is new is a GCmap of the location of the hub airport, and the ability to show who the hub manager is. It will link to the Hub managers public profile.

Share this post


Link to post
Share on other sites

I get an output that I think is not what it should look like

post-585-0-68611400-1390089098_thumb.png

full page but there is no navigation and rest of site is gone

another thing is that I can not find the fuel burn in the hubstat class

Share this post


Link to post
Share on other sites

That is a problem with the hubstats, as the code is looking for the function in the hubstats.class.php file, but not finding it. I did not create that file, Tom Sterritt did, so he is the person to have to go to to get support for his file. You can try downloading it from his github page. The link is in the readme file. Also the hub must be already listed as a hub in the airports database. If you just put in an airport, it will give out errors. So go into your airports section of the admin panel, and click on the airport, and chech the hub checkbox, and it should work fine then.

Share this post


Link to post
Share on other sites

That is a problem with the hubstats, as the code is looking for the function in the hubstats.class.php file, but not finding it. I did not create that file, Tom Sterritt did, so he is the person to have to go to to get support for his file. You can try downloading it from his github page. The link is in the readme file. Also the hub must be already listed as a hub in the airports database. If you just put in an airport, it will give out errors. So go into your airports section of the admin panel, and click on the airport, and chech the hub checkbox, and it should work fine then.

Actually your template is calling a function that does not exist in my code. You must have a modified version. Feel free to make a pull request but until then I'll provide no support for functions that don't exist in there.

Share this post


Link to post
Share on other sites

That is a problem with the hubstats, as the code is looking for the function in the hubstats.class.php file, but not finding it. I did not create that file, Tom Sterritt did, so he is the person to have to go to to get support for his file. You can try downloading it from his github page. The link is in the readme file. Also the hub must be already listed as a hub in the airports database. If you just put in an airport, it will give out errors. So go into your airports section of the admin panel, and click on the airport, and chech the hub checkbox, and it should work fine then.

airports are listed as hubs in Airport database

Share this post


Link to post
Share on other sites

I do not know where I got the modified version, but I did not modify it my self. I had no idea I was using a modified version.

Share this post


Link to post
Share on other sites

What I choose, I will get only the first HUB on my screen and the text $manager = HubData::get_hubs($hubs->icao);

Maybe a little bug inr a nice mod.

Regards,

Cor

Share this post


Link to post
Share on other sites

Found the problem, I had not put some code into php tags :ph34r: I have uploaded the fix to my github. so It should work. About it not getting all your hubs, make sure you have hub selected in the airports table, it should be noted with a 1.

Share this post


Link to post
Share on other sites

To get it working in the nav bar use the following code:

<?php $hubs = HubData::get_hub();
foreach($hubs as $hub)
{
?>
<li><a href="<?php echo url('/Hub/HubView/');?><?php echo $hub->id;?>"><?php echo $hub->icao .' - '. $hub->name;?></a></li>
<?php }?>

Share this post


Link to post
Share on other sites

To get it working in the nav bar use the following code:

<?php $hubs = HubData::get_hub();
foreach($hubs as $hub)
{
?>
<li><a href="<?php echo url('/Hub/HubView/');?><?php echo $hub->id;?>"><?php echo $hub->icao .' - '. $hub->name;?></a></li>
<?php }?>

where exactly does that need to be?

Share this post


Link to post
Share on other sites

one thing I have problem setting any hub manager admin backend shows only Airport Icao but let me not alter hub details

Share this post


Link to post
Share on other sites

some details are taken from the airports table and you would have to edit the airport itself. The link for the nav bar, goes into your layout.tpl or if you use the default nav, into the core_navigation.tpl file

Share this post


Link to post
Share on other sites

To get it working in the nav bar use the following code:

<?php $hubs = HubData::get_hub();
foreach($hubs as $hub)
{
?>
<li><a href="<?php echo url('/Hub/HubView/');?><?php echo $hub->id;?>"><?php echo $hub->icao .' - '. $hub->name;?></a></li>
<?php }?>

Strange in my website I put this to work

<?php $hubs = HubData::get_hub();
foreach($hubs as $hub)
{
?>
<li><a href="<?php echo url('/Hub/HubView/');?><?php echo $hub->hubid;?>"><?php echo $hub->hubicao .' - '. $hub->hubname;?></a></li>
<?php }?>

Share this post


Link to post
Share on other sites

That error usually happens when no pilots are in the hub. I will see about getting it to not show that error if no pilots are in the hub.

Share this post


Link to post
Share on other sites

think we need else if statements here

if it has something to return echo the pilots in Hub

else echo we have no pilots in this Hub! or something similar

but unsure how the statement has to look exactly;)

Share this post


Link to post
Share on other sites

in the hubview.tpl file bellow where it has:

if($pilot->totalhours == '0'){continue;}

put:

if(!$pilot){echo "Sorry, no pilot allocated to this hub yet.";}

and let me know if that helps.

Share this post


Link to post
Share on other sites

Hi all great module,

I have got it all working as it should but I have got the hubs on a dropdown menu on the homepage and the hubs writing overlap (see image) not sure how to fix it any help would be great.

Thanks in advance.

our hubs.jpg

Share this post


Link to post
Share on other sites

<?php $hubs = HubData::get_hub();
foreach($hubs as $hub)
{
?>
<li class="level-2"><a href="<?php echo url('/Hub/HubView/');?><?php echo $hub->icao;?>"><?php echo $hub->hubicao .' - '. $hub->hubname;?></a></li>
<?php }?>

take the <li class="level-2"> you typed in and paste that in where the code for the drop down is, and it should work

Share this post


Link to post
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...