stuartpb Posted January 29, 2010 Report Posted January 29, 2010 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 Quote
Administrators simpilot Posted January 29, 2010 Administrators Report Posted January 29, 2010 Very nice - Great Idea, think I might incorporate it into the route builder and aircraft location system I am building for my VA. Thanks for the post! Quote
stuartpb Posted January 29, 2010 Author Report Posted January 29, 2010 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 Quote
Administrators Nabeel Posted January 29, 2010 Administrators Report Posted January 29, 2010 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) Quote
stuartpb Posted January 29, 2010 Author Report Posted January 29, 2010 Ahh cool, thanks for that! As I said, I am a noob when it comes to PHP, glad to see there is a much simpler way than how I done it. Cheers, Stu Quote
TAV1702 Posted January 29, 2010 Report Posted January 29, 2010 Nice job! I was thinking of a good way to incorporate something like this into my site. Quote
CPC900 Posted February 2, 2010 Report Posted February 2, 2010 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! Quote
Angel Air Posted March 25, 2011 Report Posted March 25, 2011 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 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 Quote
Tom Posted March 25, 2011 Report Posted March 25, 2011 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. Quote
Angel Air Posted March 26, 2011 Report Posted March 26, 2011 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. Quote
Tom Posted March 26, 2011 Report Posted March 26, 2011 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 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. Quote
Angel Air Posted March 26, 2011 Report Posted March 26, 2011 That sounds like a good idea for a little web app 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? Quote
Tom Posted March 26, 2011 Report Posted March 26, 2011 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? What do you mean? Quote
Angel Air Posted March 26, 2011 Report Posted March 26, 2011 What do you mean? So phpVMS asks for code,DepICAO,ArrICAO,Route,etc etc say you use FSnav and that gives all that info but in a different way could the .TPL file that handles that info be changed to accept it in the format from FSnav. Hope that makes more sense. Quote
Tom Posted March 26, 2011 Report Posted March 26, 2011 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... Quote
Angel Air Posted March 26, 2011 Report Posted March 26, 2011 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.