Jump to content
simpilot

Vatsim Data Reader

Recommended Posts

Vatsim Data Reader

phpVMS module to display online pilot and atc data for a phpVMS based virtual airline.

Released under the following license:

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

A visible link to http://www.simpilotgroup.com must be provided on any webpage utilizing

this script for the license to be valid.

Developed by:

simpilot

www.simpilotgroup.com

Developed on:

phpVMS v2.1.934-158

php 5.3.4

mysql 5.0.7

apache 2.2.17

Install:

-Download the attached package.

-unzip the package and place the files as structured in your root phpVMS install.

core

--modules

----Vatsim

------Vatsim.php

--templates

----vatsim

------vatsim.tpl

The module will download a text data file using cURL from one of four random Vatsim servers

and place it in the root of your install. When the data is called the script will check

to see if the data is over 5 minutes old, if so it will refresh the data with a new file.

Usage:

To show a list of Vatsim online pilot data:

The last parameter is the id of the airline you are searching for and would like to display.

If you want to show everyone online leave an empty set of single quotes - ''

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', ''); ?>

If you want to show all online pilots of one airline use the icao (ex 'AAL')

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', 'AAL'); ?>

If you want to show the online pilots of multiple airlines use an array

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', array('AAL', 'UAL', 'SWA')); ?>

To show a count of Vatsim online pilots, the last parameter is used just as the function above

<?php echo MainController::Run('Vatsim', 'count_vatsim_data', '!CLIENTS:', 'PILOT', ''); ?>

To show a list of Vatsim online atc controllers:

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'ATC', ''); ?>

To show a count of Vatsim online atc controllers

<?php echo MainController::Run('Vatsim', 'count_vatsim_data', '!CLIENTS:', 'ATC', ''); ?>

The vatsim.tpl file simply shows all the available data to you in a list for each dataset available.

You can display what info you would like and build it into a list, table, or anything else you

would like for your site.

Code Hosted On Github - Link In My Signature

  • Like 4

Share this post


Link to post
Share on other sites

@servetas

Into some .tpl where you like the board to be shown ;) insert this line:

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', 'ICAO CODE GOES HERE'); ?>

Share this post


Link to post
Share on other sites

@MrBean - I have updated the module to accept an array of airline icao's to display multiple airlines. The original download has been updated. The only file changed is the core/modules/Vatsim/Vatsim.php file so you do not have to update any templates you have already created.

@servtas - As dimitris shows in his post, the module does not have a full page display function, it is built similar to the native news feed module and is designed to be inbeded into an existing page or a page you create for it.

Share this post


Link to post
Share on other sites

Were can we add these lines? Because i am having a problem Here.

I also have a problem with the same error. how can you fix it

in row 218 is at MainController.class.php:

$ret = call_user_func_array(array($$ModuleName, $call_function), CodonRewrite::$params);

---------------------------

sorry I done something wrong to the code (<php main controller:: run ('Vatsim', 'count_vatsim_data'? 'CLIENTS:'? 'PILOT', 'AAL')>) was added and there is only watch one (1) where is the rest

Share this post


Link to post
Share on other sites

Looks like you have gotten the code a little mixed up;

<php main controller:: run ('Vatsim', 'count_vatsim_data'? 'CLIENTS:'? 'PILOT', 'AAL')>

should be

<?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', 'AAL'); ?>

Share this post


Link to post
Share on other sites

i keep getting this error

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Vatsim' does not have a method 'index' in C:\xampp\htdocs\vms\core\classes\MainController.class.php on line 218

(I get nothing using <?php MainController::Run('Vatsim', 'create_vatsim_data', '!CLIENTS:', 'PILOT', 'AAL'); ?> in a .tpl, when I call the included vatsim.tpl directly I get that error)

Share this post


Link to post
Share on other sites

The text file should be getting saved to the root of the site. If it does not exist then the module has not been able to download a new copy for some reason.

Share this post


Link to post
Share on other sites

I get:

Warning: fopen(vatsimdata.txt) [function.fopen]: failed to open stream: Permission denied in /home/woodsdom/public_html/CPC/core/modules/Vatsim/Vatsim.php on line 31

Warning: fwrite(): supplied argument is not a valid stream resource in /home/woodsdom/public_html/CPC/core/modules/Vatsim/Vatsim.php on line 32

Warning: fclose(): supplied argument is not a valid stream resource in /home/woodsdom/public_html/CPC/core/modules/Vatsim/Vatsim.php on line 33

Warning: file(vatsimdata.txt) [function.file]: failed to open stream: No such file or directory in /home/woodsdom/public_html/CPC/core/modules/Vatsim/Vatsim.php on line 36

Warning: Invalid argument supplied for foreach() in /home/woodsdom/public_html/CPC/core/modules/Vatsim/Vatsim.php on line 39

I am guessing it is a permission thing, or no?!

Share this post


Link to post
Share on other sites

well actually, the server I am using has been down for the last 3 days and continues to be having problems so I haven't been able to test it. I will let you know. Thanks for the interest.

Share this post


Link to post
Share on other sites

I deleted the vatsim files and reinstalled fresh, and now the error I get is:

Notice: The template file "/home/woodsdom/public_html/CPC//core/templates/vatsim.tpl" doesn't exist in /home/woodsdom/public_html/CPC/core/classes/TemplateSet.class.php on line 248

What the heck am I missing?! After it gave me that error, I copied the vatsim.tpl file into the /core/templates/ directory, just to check(because it installs to the /core/templates/vatsim directory by default, and it came up on the page with the log data for AAL (because I was just testing the default AAL )

and I got this on the screen:

row_info 0 callsign-> = AAL109

row_info 1 cid-> = 1089801

row_info 2 realname-> = Benjimann Law VHHH

row_info 3 clienttype-> = PILOT

row_info 4 frequency-> =

row_info 5 latitude-> = 42.29617

row_info 6 longitude-> = -70.83425

row_info 7 altitude-> = 2699

row_info 8 groundspeed-> = 287

row_info 9 planned_aircraft-> = T/B752/F

row_info 10 planned_tascruise-> = 500

row_info 11 planned_depairport:-> = EGLL

row_info 12 planned_altitude:-> = 37000

row_info 13 planned_destairport:-> = KBOS

row_info 14 server:-> = USA-N

row_info 15 protrevision:-> = 100

row_info 16 rating:-> = 1

row_info 17 transponder:-> = 2200

row_info 18 facilitytype:-> =

row_info 19 visualrange:-> =

row_info 20 planned_revision:-> = 2

row_info 21 planned_flighttype:-> = I

row_info 22 planned_deptime:-> = 0

row_info 23 planned_actdeptime:-> = 712

row_info 24 planned_hrsenroute:-> = 0

row_info 25 planned_minenroute:-> = 0

row_info 26 planned_hrsfuel:-> = 0

row_info 27 planned_minfuel:-> = 0

row_info 28 planned_altairport:-> = KJFK

row_info 29 planned_remarks:-> =

row_info 30 planned_route:-> = CPT UL9 KENET UN14 BAKUR DCT RESNO 56N200W 56N300W 56N400W 55N500W OYSTR STEAM N220B TOPPS SCUPP

row_info 31 planned_depairport_lat:-> = 0

row_info 32 planned_depairport_lon:-> = 0

row_info 33 planned_destairport_lat:-> = 0

row_info 34 planned_destairport_lon:-> = 0

row_info 35 atis_message:-> =

row_info 36 time_last_atis_received:-> =

row_info 37 time_logon:-> = 20111031060131

row_info 38 heading:-> = 309

row_info 39 QNH_iHg:-> = 30.398

row_info 40 QNH_Mb:-> = 1029

-------

So, I assume that should have gone into the "vatsimdata.txt" file. Man, I am getting frustrated.

Things that should be easy seem to be made hard by my lack of intellect :(

Share this post


Link to post
Share on other sites

That is all the vatsim template shows, the information that it is finding. You can build that into a foreach loop and build a table or list with the data that you choose.

Share this post


Link to post
Share on other sites

Dave, I've never used anything like this before. Can you give me an example on how to pull data out and place it in a table. Say if I wanted to know the pilot, flight number, dep/arr airport, and altitude?

Share this post


Link to post
Share on other sites

Dave, I've never used anything like this before. Can you give me an example on how to pull data out and place it in a table. Say if I wanted to know the pilot, flight number, dep/arr airport, and altitude?

<?php
echo "<b>Pilot:</b> $row_info[2] [$row_info[4]]<br>";
echo "<b>Flight:</b> $row_info[4]<br>";
echo "<b>Name:</b> $row_info[2] ($row_info[1])<br>";
echo "<b>Route:</b> $row_info[11] to $row_info[13]<br>";
echo "<b>Altitude:</b> $row_info[7]<br>";
?>

Share this post


Link to post
Share on other sites

Im trying to play with this how am i supost to set it up. heres what im trying to do but the code is not right.

<table cellspacing="0" cellpadding="5" border="0" width="100%"><thead class="fparr">

<td width="14%">Call Sign</td>

<td width="11%">CID</td>

<td width="17%">Real Name</td>

<td width="21%">Frequency</td>

<td width="35%">Atis Message</td><td width="2%"></thead><tbody>

<?

</tbody></table>

Simmer to that trying to get the data in each colom do i edit the templet file or am i able to put the eco... part php in the coloms to get it to show that way or hows it work or if some one go do it for me that would be great thanks

Share this post


Link to post
Share on other sites

Im trying to play with this how am i supost to set it up. heres what im trying to do but the code is not right.

<table cellspacing="0" cellpadding="5" border="0" width="100%"><thead class="fparr">

<td width="14%">Call Sign</td>

<td width="11%">CID</td>

<td width="17%">Real Name</td>

<td width="21%">Frequency</td>

<td width="35%">Atis Message</td><td width="2%"></thead><tbody>

<?

</tbody></table>

Simmer to that trying to get the data in each colom do i edit the templet file or am i able to put the eco... part php in the coloms to get it to show that way or hows it work or if some one go do it for me that would be great thanks

http://forum.phpvms.net/topic/5946-vatsim-data-reader/page__view__findpost__p__43380

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×