Tring Web DesignSpecialist Web Designers in the Tring Area, Berkhamsted, Bucks and Herts - info@tring-web-design.co.uk
PHP-GTK SWK Desktop Widgets
The comany boss wants pertinent accounts information at his fingertips. The current method of retreiving this information from the company accounts package produces confusing, large reports which don't mean anything to him.
Create a display of collated accounts information and present it to the boss in nice colurful graphs so he can make better business decisions
This example is a proof of concept. It will take the output from a special user file for 'top', format the data with PHP, then create a fancy SWF graph of the 'top' data which can then be displayed in a PHP-GTK window as an HTML file. This concept has been done before, an example is Conky.
As I dont have any relevant accounts information to play with I will use 'top', which is a linux specific program for showing current computer activity, much like task manager in WinXP. This will then proof the concept. I know that the accounts program will export report data into CSV, so it should be a small matter to format that data with PHP to be usable as graph data.
Step 1 - Get output from top
This extract has been lifted from http://howtoforge.com/extract-values-from-top-and-plot-them. Essentially run the following commands from the shell
top -b -d 1 > top.txtPress ctrl+c to stop this after a few seconds, then enter the following;
cat top.txt | grep Cpu | cut -c 8-12 | nl > top.txtThis will give you CPU usage every second, formatted as two columns, one is time, the other usage in %, example output from top.txt;
1 26.2
2 76.2
3 74.5
4 87.3
5 85.3
6 47.5
7 54.4
8 71.8Now we have a txt file of values, we need to get PHP Array to plug these values into the PHP/SWF chart class.
Step 5 - Get PHP-GTK to disply the graph using GTKHTML
I've actually skipped a few steps, I thought that it would be too time consuming just for this PoC, so the graph works! Next step is to get it into a PHP-GTK window.
Step 6 - Compile the whole package
Final step is to create bytecode for the whole shebang, allowing it ti store and pull in data at will.

New to content management or need some help using our system? View our video tutorials

E-mail us or complete our requirements questionnaire for a more detailed quote

Technical resources for web designers, developers and IT professionals

Keep up-to-date with the projects we have been involved in
Specialist web designers in Tring, Berkhamsted, Bucks and Herts