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
web541
October 3, 2016, 9:20pm
2
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
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.
web541
October 3, 2016, 10:49pm
4
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
I’ve done this modifications. It seems to work but i wait some flights from my pilots to confirm that this is not reseting number of flights to 1 as before.
I give you an answer as soon as possible.
Many thanks for your job and spending your time for other people.
It works fine. I’ve tested this with 3 flights this morning and all of them are ok.
A big thank you for this quick and efficient solution !