Jump to content

Added MS Flight Sim Flight Plan Downloads


stuartpb

Recommended Posts

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 :D  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:

flplan.PNG

On the admin add schedule page:

flplan2.PNG

Hope some of you guys find it useful!

Cheers,

Stu

Link to comment
Share on other sites

Thanks :)

There was another file that needs modifying to make the tweak work, I forgot about it when writing the previous post.

It's /core/common/SchedulesData.class

Insert the line below after line 369:

'flplan=>''

Insert the line below after line 422:

'$data[flplan]',

Then after line 452 add:

'flplan'=>'',

Add this line after line 512:

`flplan`='$data[flplan]',

Then save the file.

Cheers,

Stu

Link to comment
Share on other sites

  • Administrators

Just a suggestion - if you are naming them all consistent (like, blt[FLIGHT_NUMBER].pln), you can just create a link like:

echo fileurl('/download/blt'.$schedule->flightnum.'.pln');

Which would echo out the link to that - that way it just depends on the flight number, and wherever it's placed - no need to manually change all that.

And the code you're changing SchedulesData has completely changed as of the next version (you pass the column names which need updating from the Operations class)

Link to comment
Share on other sites

And the code you're changing SchedulesData has completely changed as of the next version (you pass the column names which need updating from the Operations class)

So, I guess I will wait til the next release version then?!  Because I really like this addition!

Link to comment
Share on other sites

  • 1 year later...

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 :D  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:

flplan.PNG

On the admin add schedule page:

flplan2.PNG

Hope some of you guys find it useful!

Cheers,

Stu

Would it be possible to create a VA's Schedules from this and add them to phpvms?

Or am I missing the point of the add on?

Thanks Scott

Link to comment
Share on other sites

Would it be possible to create a VA's Schedules from this and add them to phpvms?

Or am I missing the point of the add on?

Thanks Scott

From a glance, this appears to be turning your phpVMS schedules into MSFS flight plans. Turning them back into schedules would be useless.

Link to comment
Share on other sites

From a glance, this appears to be turning your phpVMS schedules into MSFS flight plans. Turning them back into schedules would be useless.

I guess it would be great if you could create the schedule in flightsim or vroute or FSnav then convert them in to the .CSV format and add them to the website.

Link to comment
Share on other sites

I guess it would be great if you could create the schedule in flightsim or vroute or FSnav then convert them in to the .CSV format and add them to the website.

That sounds like a good idea for a little web app :P

I may look into it.

In fact, it would be pretty awkward to code, and equally as awkward to use. You'd need to enter the dep/arr times, days of the week, flight num, price... blah blah. It wouldn't really save any time.

Link to comment
Share on other sites

That sounds like a good idea for a little web app :P

I may look into it.

In fact, it would be pretty awkward to code, and equally as awkward to use. You'd need to enter the dep/arr times, days of the week, flight num, price... blah blah. It wouldn't really save any time.

would it be possible to change the way phpVMS asks for that infomation.

so that you match on the website the layout of what you are useing to set up your schedules?

Link to comment
Share on other sites

That wouldn't save you any time really, because the only useful information it could take from the plan is departure icao and arrival icao, possibly cruise altitude...

Thanks Tom always a font of knowledge I would really love to find someway of adding Schedules other than inputing them manually

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