I have made a neat little tweak I made to my site, it may come in handy if anyone wants to enable FS flight plan downloads like I did for each scheduled flight. Basically, I use vRoute to create MS Flight Sim flight plans, and then put them in a folder on my server. I wanted other member pilots to be able to download these, so they could just load them up in the flight sim. The way I done it is probably very rough and ready as I am a newcomer to PHP and SQL.
First I added a new field to the phpvms_schedules table in the database. I called this table ‘flplan’. The field type was set to text.
Next I thought about how to add the flightplan to the database, and decided that I would use the flight plan’s filename as the stored data. In my case I have named each flight plan file bav####.pln (the #### being the flight schedule number). Here’s how I done it:
Open /admin/modules/Operations/Operations.php.
Added this - *‘flplan’=>$this->post->flplan,* on new line after Line 669: Don’t enter the *'s, I used these to show where the new line is entered. Here’s how it looks after inserting the line:
'price'=>$this->post->price,
'flighttype'=>$this->post->flighttype,
'notes'=>$this->post->notes,
'flplan'=>$this->post->flplan,
'enabled'=>$enabled);
And added the same new piece of code after line 724:
'price'=>$this->post->price,
'flighttype'=>$this->post->flighttype,
'notes'=>$this->post->notes,
'flplan'=>$this->post->flplan,
'enabled'=>$enabled);
Once that’s done save the file.
Next up is to create a field in the add schedule form. So open /admin/templates/ops_scheduleform.tpl
Insert a new line after the </tr> on line 191. On this new line add the following:
<tr>
<td valign="top"><strong>Flight Plan</strong></td>
<td valign="top" style="padding-top: 0px">
<textarea name="flplan" style="width: 40%; height: 30px"><?php echo $schedule->flplan?></textarea>
</tr>
This will create a text field for you to enter the flightplan’s filename on the schedule. Once filled in it will save the value to the database.
Next up, I wanted the link to the flightplan to be available on the pilots brief page. So open /core/templates/schedule_briefing.tpl
Add the following code so that the table appears where you want it:
<table align="center" padding="2" style="width: 98%">
<tr style="background-color: #333; color: #FFF; padding: 5px;">
<td style="width: 98%">Pre-compiled Flight Plans</td>
</tr>
<tr>
<td style="width: 98%px">
<a href=" *The full URL to the folder where your flight plans are stored* /<?php echo $schedule->flplan?>" target="_blank">Download MSFS Flight Plan</a><br><br></td>
</tr>
</table>
Once that’s done save the file.
Sorry about this post being a bit noobish, but this is the first time I have shared my tweaking efforts I can’t guarantee it will work on your site, but it works a treat for me. Here’s how it looks on my site:
On the pilots brief page:
On the admin add schedule page:
Hope some of you guys find it useful!
Cheers,
Stu