Where pilots and airlines come together

The virtual airline blog

This is our blog with lots of useful tips about PHPvms and running VA's in general. We've just started but we got a lot in the pipeline, so keep an eye on this space!
Note that not all blog posts are public, so if you're not a member, sign up now to get the best out of this site. If you have any questions, don't hesitate to contact us.

Admin dashboard hacks

The standard PHPvms admin dashboard is a bit of a dog: the line graph, based on shockwave flash, was hacked a few years ago, and the "Latest news" never shows any news. So here are some tips for improvement.

Open up /admin/modules/dashboard/dashboard.php and add the following to the index function, before $this->render

$this->set('pireps', PIREPData::getIntervalDataByDays(array(), 30)); 
$this->set('allbids', SchedulesData::getAllBids());
$this->set('screenshots', ScreenshotsData::getscreenshots_toapprove());  

You can change the 30 to however many days you want to show up on your graph.

The third line only applies if you have the screenshot/gallery module installed. If you do, you must copy screenshots_approval.tpl to your /core/admin/templates folder! 

Next, open up the file /admin/templates/dashboard.tpl or php. Look for the lines after "click here to send them", approximately line 36. After the } that ends the block, paste this:


IMPORTANT: If you use the php version, you should change .tpl to .php

Last but not least, go to the end of the script where it says: Don't need to change anything below this here. Well you'll have to if you want a nice graph! Delete the entire script block and replace it with this:

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
  google.charts.load('current', {'packages':['corechart']});

  function drawChart() {
    var data = google.visualization.arrayToDataTable([
      ['Day', 'Pireps'],
	$len = count($pireps);
	foreach($pireps as $row)
		echo "['".date('j M',$row->timestamp)."',".$row->total."]";
		if ($counter<$len-1)
		{ 	echo ","; }

    var options = {
      title: '',
      legend: { position: 'none' }

    var chart = new google.visualization.LineChart(document.getElementById('reportcounts'));

    chart.draw(data, options);

Then upload the dashboard template to your server and check everything is working. If the graph looks a bit flat, you can change the height of the div:



Once everything is working, your admin panel should look like the screenshot below

Warning: Unknown: open(/var/cpanel/php/sessions/ea-php56/sess_oa151aneb0l1oenti2a79cdkh0, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php56) in Unknown on line 0