Jump to content
Sign in to follow this  
thefiercepilot

Check if all pireps are accepted

Recommended Posts

I was wondering if there was a way we could check if pireps are accepted or unaccepted. I was think of something like we can check if the user is an admin or not if he is then the system would check if there are unaccepted pireps. If there are the user would be redirected to the admin page or could be given a notification?

Share this post


Link to post
Share on other sites

Yes there is One easy way I've come up with, if you go to this link below, and scroll down. You will see a map towards the bottom. Accepted, Rejected, Pending, with all info inregards to Aircraft, and much more . Plus the route on the Map for said PIREP. You will have to make some changes to the code I've provided in regards to point to YOUR server ICON's. I have pasted the Code Snippet for anyone who so desires to use this. Hurry up and go to the Link provided, as I am shutting down my Server as of Jan.2nd, 2018. So don't wait to long. Remember, this pirep map is at the bottom near the footer. On one note, I have reversed the airplane icon for those who don't understand coding to the phpvms default aircraft. And, I've attached the actual file for everyone. Enjoy !

Jim L. CEO Heritage VA

The Link to view the PIREP Map ;

http://heritageva.net/hva

The Actual Code:

<?php /* The following script below was used by the old timers from Heritage VA.
This script of course is free to use by anyone. It is designed to work also with
ANY Bootstrap system, and is 100% automated for ALL pireps recorded, including any
staff members and Admins that fly. Sadly Heritage VA has closed, but we are still
active with phpvms forums and will help in anyway possible to fellow members. We
Hope you enjoy this little snippet, we did, and it looks awesome. Thank you all.
And may God speed ! December 19th, 2017 */ ?>

<!--SATELLITE REMARKED OUT FOR TERRAIN BELOW-->
<div id="arrivals" style="width:94%; height: 680px"></div>



<script type="text/javascript">

var MY_MAPTYPE_ID_2 = 'alaskamap'; <!--DO NOT CHANGE -->

<!-- Snazzy Maps, can be changed to whatever you want @ snazzymaps site.-->
var stylez_2 = 
[{"featureType":"all","elementType":"geometry","stylers":[{"hue":"#ff4400"},{"saturation":-68},{"lightness":-4},{"gamma":0.72}]},{"featureType":"landscape.man_made","elementType":"geometry","stylers":[{"hue":"#0077ff"},{"gamma":3.1}]},{"featureType":"landscape.natural.terrain","elementType":"geometry.fill","stylers":[{"visibility":"on"}]},{"featureType":"poi.park","elementType":"all","stylers":[{"hue":"#44ff00"},{"saturation":-23}]},{"featureType":"transit","elementType":"labels.text.stroke","stylers":[{"saturation":-64},{"hue":"#ff9100"},{"lightness":16},{"gamma":0.47},{"weight":2.7}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"lightness":-48},{"hue":"#ff5e00"},{"gamma":1.2},{"saturation":-23}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#00ccff"},{"gamma":0.44},{"saturation":-33}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"hue":"#007fff"},{"gamma":0.77},{"saturation":65},{"lightness":99}]},{"featureType":"water","elementType":"labels.text.stroke","stylers":[{"gamma":0.11},{"weight":5.6},{"saturation":99},{"hue":"#0091ff"},{"lightness":-86}]}]


	var latlng = new google.maps.LatLng(<?php echo Config::Get('MAP_CENTER_LAT')?>,<?php echo Config::Get('MAP_CENTER_LNG')?>);
	var bounds = new google.maps.LatLngBounds();
	bounds.extend(latlng);

	var center = bounds.getCenter();

	var options = {
		center : center,
		backgroundColor : '#FFFFFF',
		streetViewControl : true,
		zoomControlOptions : {
			style : google.maps.ZoomControlStyle.SMALL
		},
		minZoom : 2,
		mapTypeControlOptions : {
			mapTypeIds : [google.maps.MapTypeId.TERRAIN, MY_MAPTYPE_ID_2]
		},
		mapTypeId : MY_MAPTYPE_ID_2
	};
	var styledMapOptions_2 = {
		name : "RoadMap"
	};

	var map_2 = new google.maps.Map(document.getElementById("arrivals"), options);
	var alaskamap = new google.maps.StyledMapType(stylez_2, styledMapOptions_2);

	map_2.mapTypes.set(MY_MAPTYPE_ID_2, alaskamap);

	var flightMarkers_2 = [];
	
	var image = new google.maps.MarkerImage('<?php echo SITE_URL; ?>/lib/images/onground.png', <!--default phpvms,can be changed to what you want-->
			new google.maps.Size(32, 32),
			new google.maps.Point(0, 0),
			new google.maps.Point(5, 5));
	
	var depmarker = [];
	var arrmarker = [];
<?php
$pirep_list = PIREPData::getRecentReportsByCount(20);
$shown = array();
foreach($pirep_list as $pirep) {
	// Dont show repeated routes
	if(in_array($pirep->code.$pirep->flightnum, $shown))
		{ continue; }
	else
		$shown[] = $pirep->code.$pirep->flightnum;

	if(empty($pirep->arrlat) || empty($pirep->arrlng)
		|| empty($pirep->deplat) || empty($pirep->deplng))
	{ continue; }
?>
	dep_location = new google.maps.LatLng( <?php echo $pirep->deplat ?> ,  <?php echo $pirep->deplng ?> );
	arr_location = new google.maps.LatLng( <?php echo $pirep->arrlat ?> ,  <?php echo $pirep->arrlng ?> );

	flightMarkers_2[flightMarkers_2.length] = new google.maps.Marker({
			position : dep_location,
			map : map_2,
			icon : image,
			title : "<?php echo "$pirep->depname ($pirep->depicao)";?>"
		});

	flightMarkers_2[flightMarkers_2.length] = new google.maps.Marker({
			position : arr_location,
			map : map_2,
			icon : image,
			title : "<?php echo "$pirep->arrname ($pirep->arricao)";?>"
		});

	depmarker[depmarker.length] = new google.maps.Marker({
			position : dep_location,
			map : map_2,
			icon : new google.maps.MarkerImage(
				"http://chart.googleapis.com/chart?chst=d_text_outline&chld=80FF00|14|h|000000|b|<?php echo "$pirep->depicao";?>",
				null, null, new google.maps.Point(20, 22))
		});

	arrmarker[arrmarker.length] = new google.maps.Marker({
			position : arr_location,
			map : map_2,
			icon : new google.maps.MarkerImage(
				"http://chart.googleapis.com/chart?chst=d_text_outline&chld=BC1A15|14|h|000000|b|<?php echo "$pirep->arricao";?>",
				null, null, new google.maps.Point(29, 19))
		});

	var flightPath_2 = new google.maps.Polyline({
			path : [dep_location, arr_location],
			strokeColor : "#E68A01",
			strokeOpacity : 0.9,
			strokeWeight : 2,
			geodesic : true
		}).setMap(map_2);
<?php
}
?>
if (flightMarkers_2.length > 0) {
	var bounds = new google.maps.LatLngBounds();
	for (var i = 0; i < flightMarkers_2.length; i++) {
		bounds.extend(flightMarkers_2[i].position);
	}
}

map_2.fitBounds(bounds);
</script>
<?php
$count = 20;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table class="sky_table" width="94%" cellspacing="0" border="1">
    <tr>
        <th>Flight</th>
        <th>Pilot</th>
        <th>Departure</th>
        <th>Arrival</th>
        <th>Aircraft</th>
        <th>Duration</th>
        <th>V/S</th>
        <th>Status</th>
	</tr>
<?php
if(count($pireps) > 0)
{
  foreach ($pireps as $pirep)
  {
    $pilotinfo = PilotData::getPilotData($pirep->pilotid);
    $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
    $acrid = OperationsData::getAircraftByReg($pirep->registration);

    echo '<tr>';
    echo '<td><button type="button" class="btn btn-default"><a href="'.SITE_URL.'/index.php/pireps/viewreport/'.$pirep->pirepid.'">'.$pirep->code.$pirep->flightnum.'</a></td></button>';
    echo '<td><button type="button" class="btn btn-default"><a href="'.SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid.'">'.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</a></button></td>';
    echo '<td>'.$pirep->depicao.'</td>';
    echo '<td>'.$pirep->arricao.'</td>';
    echo '<td><button type="button" class="btn btn-primary btn-sm"><span class="badge">'.$pirep->aircraft.'</td></span></button>';
    echo '<td>'.$pirep->flighttime.'</td>';
    echo '<td><button type="button" class="btn btn-danger btn-sm"><span class="badge">'.$pirep->landingrate.' ft/m</td></span></button>';
if($pirep->accepted == PIREP_ACCEPTED)


echo '<td><button type="button" class="btn btn-success">Accepted</button></td>';

                                elseif($pirep->accepted == PIREP_REJECTED)

echo '<td><button type="button" class="btn btn-danger"><span class="label label-important"><font color="black">Rejected</font></span></button></td>';

                                elseif($pirep->accepted == PIREP_PENDING)

echo '<td><button type="button" class="btn btn-warning"><span class="label label-warning"><font color="black">Pending</font></span></button></td>';

                                elseif($pirep->accepted == PIREP_INPROGRESS)

echo '<td>On Progress</td>';
    echo '</tr>';
  }
}
else
{
    echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
</tbody>
</table>
<div class="clear"></div>
<div class="clear"></div>

 

frontpage_map.zip

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...