Jump to content

total flights


orobouros

Recommended Posts

Hello,

for my new VA website, the last big problem for me is the transfer of the number of flights.

When i update the number of flights in the pilot profile, this number turns to 1 when a pilot fly for the first time on the new site. It's resetting the number of flights in the database.

I've try to do the same thing wich works with the transfer hours. So i've created a new column "transferflights" in the pilots table of the database.

In my admin/template/pilots_details.php, i've added this code :

<td>Total flights</td>
<td><input type="text" name="totalflights" value="<?php echo $pilotinfo->totalflights;?>" /></td>
</tr>
<tr>
<td>Transfer flights</td>
<td><input type="text" name="transferflights" value="<?php echo $pilotinfo->transferflights;?>" /></td>
</tr>
<tr>
<td>Total hours</td>
<td><?php echo $pilotinfo->totalhours;?>
 <input type="hidden" name="totalhours" value="<?php echo $pilotinfo->totalhours;?>" />
</td>
</tr>
<tr>
<td>Transfer hours</td>
<td><input type="text" name="transferhours" value="<?php echo $pilotinfo->transferhours;?>" /></td>
</tr>

and after, i suppose i have to change this code in the pilot_public_profil.php to add transferflights and totalflights values.

<th width="25%">Flights</font></b></th>
<td width="25%"><?php echo $userinfo->totalflights?></td>

But i've tried several solutions without success. Anyone has an idea to solve my problem ?

Thank you by advance

Link to comment
Share on other sites

Not sure what you mean exactly, you mean it's resetting the flights every time someone files a PIREP? Or is this something you want to manually add for your VA?

This is the answer to above

<th width="25%">Transfer Flights</font></b></th>
<td width="25%"><?php echo $userinfo->transferflights; ?></td>

And that should work provided that you have set everything up right.

Make sure that the transferflights column is in the _pilots table

Link to comment
Share on other sites

I would like the same transfer system for number of flights than for the hours with transfer.

So, in the pilot profile in admin, a field to fill with transfer number of flights.

Here's the original code in admin/template/pilots_details.php :

<tr>
<td>Total flights</td>
<td><input type="text" name="totalflights" value="<?php echo $pilotinfo->totalflights;?>" /></td>
</tr>
<tr>
<td>Total hours</td>
<td><?php echo $pilotinfo->totalhours;?>
 <input type="hidden" name="totalhours" value="<?php echo $pilotinfo->totalhours;?>" />
</td>
</tr>
<tr>
<td>Transfer hours</td>
<td><input type="text" name="transferhours" value="<?php echo $pilotinfo->transferhours;?>" /></td>
</tr>

and after, the same addition in the pilot_public_profil.php, like it is for hours, where totalhours are added with transferhours :

<th width="25%">Hours</font></b></th>
<td width="25%"><?php echo Util::AddTime($userinfo->totalhours, $userinfo->transferhours); ?></td>

It works fine for Hours, but when i try to do the same thing for flights, it goes wrong.

Link to comment
Share on other sites

admin/template/pilots_details.php

<tr>
<td>Total flights</td>
<td><input type="text" name="totalflights" value="<?php echo $pilotinfo->totalflights;?>" /></td>
</tr>
<tr>
<td>Total hours</td>
<td><?php echo $pilotinfo->totalhours;?>
<input type="hidden" name="totalhours" value="<?php echo $pilotinfo->totalhours;?>" />
</td>
</tr>
<tr>
<td>Transfer hours</td>
<td><input type="text" name="transferhours" value="<?php echo $pilotinfo->transferhours;?>" /></td>
</tr>
<tr>
<td>Transfer Flights</td>
<td><input type="text" name="transferflights" value="<?php echo $pilotinfo->transferflights;?>" /></td>
</tr>

pilot_public_profile.php

<th width="25%">Total Flights</font></b></th>
<td width="25%"><?php echo $userinfo->totalflights + $userinfo->transferflights; ?></td>

admin/modules/PilotAdmin/PilotAdmin.php

Line 146 add this

'transferflights' => $this->post->transferflights,

That should make it work.

-------------------------------------------

I think it would be easier to make a custom field and then echo it out like this though

<th width="25%">Total Flights</font></b></th>
<td width="25%"><?php echo $userinfo->totalflights + PilotData::GetFieldValue($userinfo->pilotid, 'transferflights'); ?></td>

But it's up to you

Edited by web541
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...