Code Snippets
Pieces of code you can use around your site
314 topics in this forum
-
- 11 replies
- 23.8k views
Some people asked me how do I create the custom modules/pages (however you would like to call them ) For example the recruitment page ( http://www.airserbia...php/recruitment ) It is actually really easy but for people who are new with PHP and MVC pattern ( like me not long ago ) it can be quite challenging to understand. First off, there is good documentation on this matter but not many people take a look there unfortunately. First of, MVC. The MVC pattern is really easy to describe. You 'separate' your code in three different sections/files. Models, Views, Controllers (MVC) Models are in charge for work with the database, the views are what are displayed to the e…
Last reply by Heritage1, -
- 1 follower
- 10 replies
- 14k views
Aloha Everyone! As a former CEO of a VA and a current web developer in self-training, I know how frustrating it is to spend hours playing with code trying to pull elements from your database or, maybe you just don't know where to find the scripts. To make your job easier, I have gone through the entire phpVMS Installation and pulled every PHP call I could find and compiled it into one document for easy use. If you find any errors, or more PHP calls, please post it here and I will update the original post. Cheers and happy coding! http://pastebin.com/ERuvPcmV I have updated this call sheet as of 5/20/14 to correct some bugs
Last reply by Vangelis, -
- 0 replies
- 1.7k views
-- Delete -- thanks
Last reply by Daniel, -
- 1 follower
- 10 replies
- 3.9k views
Instead of just showing a drop down for Signature banners, I would like to also show a preview of the sig ban. Anyone ever done this?
Last reply by freshJet, -
- 6 replies
- 4.2k views
Below is a function which will take any givin pilot and find the appropriate avatar for him and re-associate the avatar with the pilot after said pilot has been moved to another airline, or had their ID changed. ​it also deletes any unnecessary avatars. public static function fixAvatar($pilotid){ // Get the pilots Information. $pilotid = (int)$pilotid; $sql = "SELECT * FROM `".TABLE_PREFIX."pilots` WHERE `pilotid`=$pilotid"; $pilot = DB::get_row($sql); unset($pilotid); $err = DB::errno(); if($err != 0){ return false; } // Setting up the check (with regex) for an avatar with the pilots current ID. $pilotcode = PilotData::getPilotCode($pilot->code, $p…
Last reply by Ademar Andrade, -
- 3 replies
- 4.9k views
How to Change the Look of the ACARS Map As usual, We highly suggest backing up before making any changes. 1. Find the Style you want on https://snazzymaps.com 2. Click on "COPY" by the Code Snippet 3. Open up the file "acarsmap.tpl" located in your skins folder 4. Around line 38, BEFORE the acars_map_default variable add the following code: var myStyle = PASTE HERE 5. Paste what you copied in step #2 where it says "PASTE HERE" in the snippet above. 6. INSIDE the acars_map_default variable add the following code: var acars_map_defaults = { autozoom: true, styles: myStyle, // <-- ADD THIS zoom: 4, center: new google.maps.LatLng("<?php echo Config::…
Last reply by Ariel, -
- 0 replies
- 2.4k views
As I look throughout more and more virtual airlines, I notice the URL to contain a somewhat confusing string 'index.php' for some users. For example, one can access a module by typing out virtualairline.com/index.php/schedules. This small script removes the index.php and allows you to directly access that part of the website by typing in virtualairline.com/schedules instead. Open up file manager, and be sure to checkmark the box 'Show hidden files' on the root selector that pops up in cpanel. Browse to your Virtual airline root folder(Where phpvms is installed) Open up the .htaccess file Copy/Paste the following code RewriteEngine on RewriteCond %{REQUEST_FILE…
Last reply by magicflyer, -
- 2 replies
- 3.4k views
Ok I have spent a month now trying to write my own module... I simply want a list of all the airports and its details (name, icao, and chartlink) I have even tried using an existing class (operations data) and I just can't figure it out. I have a book on php code, but it seems to be different from the VMS. I have used this: and get a table with only the aiport name. The module file simply calls the template. My original class (that I gave up on and have now used the Operation Data one was: I was hoping that someone would be able to give me a very simple example of a class, module, and template so that I can reverse engineer it and figure this all out. I wou…
Last reply by kbohme, -
- 7 replies
- 3.4k views
I was looking for this code as I want to put a link on the frond page saying: there are 5 xacars flights - click hee to view Thanks for all the help, james
Last reply by James142, -
- 0 replies
- 2k views
Hello everyone, I have a French VA and I would like to know how to get the same theme one in English and one in French? Someone there can you help me please? Regards Fred. http://phpvms.p3d-simulation.fr session_start(); if(isset($_GET['template']) && $_GET['template'] != ''){ $_SESSION['template'] = $_GET['template']; define('CURRENT_SKIN',$_GET['template']); } if(isset($_SESSION['template']) && $_SESSION['template'] != '') { define('CURRENT_SKIN',$_SESSION['template']); } ?template=fr or ?template=uk Solution HERE Thanks to monkeypaw201
Last reply by FSX30HD, -
- 0 replies
- 3.3k views
Hello folks! I thought about to edit categories in the default download module and changed it to my needs. After you deactivate a download category, it wont show up in your list. Important information: BEFORE do this tutorial, backup the database tables and files you'll edit. lib/skins/pandaair_theme/downloads_list.php admin/modules/Downloads/Downloads.php admin/templates/downloads_categoryform.php core/common/DownloadData.class.php database table phpvms_downloads 1. Open your database and run the following command. It will add a column to your downloads table. Be sure to add the …
Last reply by Karamellwuerfel, -
% complete flight 1 2 3
by fsx- 1 follower
- 74 replies
- 36k views
how can I get this?
Last reply by Angel Air, -
- 2 replies
- 4.3k views
Hey guys, I'm not sure about you but I got a lot of fake BS messages through my contact form, and I got really tired of it so I looked for a solution. The fix was fairly simple, and with the same technology you can also stop fake registrations! Since this forum is visible to everyone, and therefore also to those who might be behind these messages, I decided to not share it here directly. You can only view the solution on my blog: http://www.virtualairlines.eu/index.php/Blog when you are logged in!
Last reply by ProAvia, -
- 4 replies
- 2k views
Whilst looking at my bookings list for my pilots the idea of having a reminder of bookings hit me. I know this can be done. I was considering something along the lines having an email sent to the pilot if their bid is more than one week old. And to prevent several emails at once (say the pilot booked a 10-leg journey) mention each booking in the one mail. I would do a rough code but my brain won't work. I've been working on a lot tonight. ----- Oh and one more thing, some of you may remember me asking what the cons of deleting a pilot were. Well, I found this in my PilotData.class.php: public static function deletePilot($pilotid) { $sql = array(); unset(self::$pi…
Last reply by freshJet, -
- 0 replies
- 1.6k views
I'm sure you've noticed that when you click on an aircraft on the ACARS map the dialog box will disappear when a position update occurs, is there a way to prevent this and simply update the data shown on the box instead?
Last reply by freshJet, -
- 0 replies
- 2.3k views
<img src="<?php echo SITE_URL?>/lib/images/acars/<%=flight.phasedetail%>.png" alt="<%=flight.phasedetail%>"/> Place the above code in your acarsmap.tpl file, in your lib/images folder create a folder called acars. and use your acars map to create the images and name the images exactly how it looks on your acars map. You should have something that looks like: http://malaysiava.org/index.php/acars
Last reply by Strider, -
- 2 followers
- 17 replies
- 12.8k views
Hi guys, These days our team changed our acars map using some codes below. acarsmap.tpl <head> <script language="javascript" type="text/javascript"> // function to calculate local time // in a different city // given the city's UTC offset function calcTime() { var index = document.getElementById('DropDownTimezone').selectedIndex; var offset = document.getElementById('DropDownTimezone').value; var timeZone = document.getElementById('DropDownTimezone').options[index].text; // create Date object for current location d = new Date(); // convert to msec // add local time zone offset // get UTC time in msec utc = d.getTime() + (d.getTimezoneOffset() * 60000)…
Last reply by LH154, -
- 18 replies
- 12.7k views
Add the following to lib/js/acarsmap.js var weatherLayer = new google.maps.weather.WeatherLayer({ temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT }); weatherLayer.setMap(map); var cloudLayer = new google.maps.weather.CloudLayer(); cloudLayer.setMap(map);
Last reply by simonecatalano, -
- 0 replies
- 1.7k views
Hello everyone ... it is possible to access a page (eg: liveries) only pilots who have completed certain routes for download of a premium (special livery)? thanks to a possible reply.
Last reply by gio1961, -
- 11 replies
- 7.1k views
Good Day everyone ! I have create a small piece of code to use at your pilots_list.tpl to add an icon (Active/Inactive) to the pilot list.(taking data from the pilots active/inactive in admin panel) Demo here: Demo Pilot List The steps you need to follow are: 1. Add this code to add a column at the table: <th>Status</th> 2. Add this code under the column to create a row with the code you need:(replace the "yourskin" with your skin folder name) <td><?php if($pilot->retired == '1') {echo '<img src="'.SITE_URL.'/lib/skins/yourskin/images/no.png" alt="warning" /> - Retired';} else …
Last reply by hurkulez, -
- 13 replies
- 10.2k views
This may have been covered before but is there a way to Put the ADD BID link on the Pilot Brief page. This would help my pilots so that instead of hitting the back button on their browser they could just add the bid to their schedules from the Pilot brief page. When you use the back tab it bring up all the current schedules. Any ideas? I tried to put the add bid code in from the schedule_results.tpl on to the schedule_briefing.tpl page and all I got was the word ADD BID but it had no action to it. Thanks for any help in this,
Last reply by AUZ, -
- 4 replies
- 5k views
I have created awards for our va and have no problem adding them to the pilots and they display just fine when you click the pilot id. What I would like to have and don't know how to code this so please help if you can, what do I need to add where to get the awards to appear in a horizontal row under each pilot when anyone guest or not clicks the Pilots tab on the main page of the phpvms of our va site.
Last reply by Steve Bartlett, -
- 20 replies
- 13k views
I know most of you would get this working yourself, but for you who dont here is a sample of the code I use to display custom chart snapshots and links in the pilot briefing page. Also included are the links we use for weather: First of all I gathered all the links for the airports we fly to, based the charts on the lokal vacc at vatsim because many AIP sites require you to log in: I placed snaphost of the ground layout with format ICAO.gif in folder named images/charts . Image size 387*594. It is a bit of work, but I think the result is good. Have only received possitve feedback so far ;D Links placed in the airporttable under 'chartlink' and added a row for link to l…
Last reply by jonesrobin, -
- 5 replies
- 6.7k views
Hi all, Anybody knows how to do it? http://aviancavirtual.net/br/operations/route-network It's making me crazy trying to do it to my VA. Any help? Regards,
Last reply by Fabiodm, -
- 1 reply
- 2.4k views
Hello, I'm trying to create a code that alter the condition of the aircraft when a pirep is been submitted. it looks to the landing rate, so when the landing rate is below 200 than 0.5% off the condition. when a landing rate is higher than 200 than 2% of condition. when a landing rate is higher than 500 than 50% off condition. so far i have: $pos = find_in_fsacars_log('TouchDown:Rate', $log); $landingrate = str_replace('TouchDown:Rate', '', $log[$pos]); $count = preg_match('/([0-9]*:[0-9]*).*([-+]\d*).*/i', $landingrate, $matches); if($count > 0) { PIREPData::editPIREPFields($report->pirepid, array('landingrate' => $matches[2])); } PIREPData…
Last reply by Jakes, -
- 4 replies
- 5.9k views
Hello, I'm looking for the code to show the airline logo on the schedule list when pilots search for it? Does anybody have this code? Regards
Last reply by fardly83, -
- 1 reply
- 2.3k views
Does anyone know the code to get stats based upon airlines in the system rather than HUBs?
Last reply by MaciejO, -
- 1 follower
- 22 replies
- 14.7k views
Ok, Since people is trying to find stats, so I'll post all of the stats here....... # Of Pilots <?php echo StatsData::PilotCount(); ?> Total Hours <?php echo StatsData::TotalHours(); ?> Total Flights <?php echo StatsData::TotalFlights(); ?> Total Distance <?php echo StatsData::TotalMilesFlown(); ?> Total Schedules <?php echo StatsData::TotalSchedules (); ?> Total News Posted <?php echo StatsData::TotalNewsItems (); ?> Total Passengers <?php echo StatsData::TotalPaxCarried (); ?> Total Fuel Burned <?php echo StatsData::TotalFuelBurned () ; ?> Total Aircraft <?php echo Sta…
Last reply by orobouros, -
- 7 replies
- 4.1k views
Exist module or way to display list of aircraft locations as follow based on pireps? maybe last 10 flights for each.... for example: Aircraft A date: LZIB-LZKZ date: LZKZ-EDDM ... Aircraft B date: XXXX-YYYY date: YYYY-FFFF Thans for help. Peter
Last reply by shiljo, -
- 1 follower
- 1 reply
- 1.6k views
Hello, Am wondering if anyone would be ever so kind to tell or send me some code. I have seen on various websites airport delays NOTAMS, I would like to implement this into my home page. Thanks
Last reply by Vangelis,