Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Graphic and report based on data from application server
Maps, Graphics and Geographics example from a Well House Consultants training course
More on Maps, Graphics and Geographics [link]

This example is described in the following article(s):
   • Dynamic maps / geographics in PHP - [link]

If you're searching for a page where you can view this page, select here

This example references the following resources:
http://abcdef.ghi/xyza/vavava.php?shorter=1
http://www.wellho.net/demo/popup.php?time=$bits[1]')\
http://www.wellho.net/demo/train_graphic.php?thicken=2
http://www.firstgreatwestern.co.uk/LiveUpdateList.aspx
http://www.firstgreatwestern.co.uk/Default.aspx
http://www.savethetrain.org.uk/running.php
http://www.savethetrain.org.uk/
http://www.firstgreatwestern.info/coffeeshop
http://www.wellho.net/course/php.html
http://www.wellho.net/share/melksham.html

Source code: tgf.html Module: H309
<?php
# Cache - update every 10 minutes (max)
if (time()- filemtime("tfd.txt") > 0) {
        $logrecs = file("http://abcdef.ghi/xyza/vavava.php?shorter=1");
        $fh = fopen("tfd.txt","w");
        foreach ($logrecs as $line) { fputs($fh,$line); }
        fclose ($fh);
} else {
        $logrecs = file("tfd.txt");
}

# Analyse the data

$textform = "";
$tc = 0;
$uq = array();
foreach ($logrecs as $logline) {
        list($date,$service,$detail) = explode("\t",$logline);

        $col = "#888888";
        if (eregi("cancel",$detail)) {
                if (! ereg("planned engin.*cancelled",$detail)){
                        $col = "#ff0000"; }}
        if (eregi("divert",$detail) or eregi("start",$detail)
                        or eregi("termina",$detail)) {
                        $col = "#0000ff"; }
        if (eregi("revise",$detail) or eregi(" fast ",$detail)) {
                        if (eregi("no longer",$detail)) {
                        $col = "#00ff00"; }}
        if (eregi("refresh",$detail) or
                        eregi("buffet",$detail) or
                        eregi("catering",$detail) or
                        eregi("brasse",$detail)) {
                        $col = "#ffff00";
        } elseif (eregi("carria",$detail) ) {
                        $col = "#cc6600"; }

        if (! ereg("^[012]",$service)) continue;
        if (ereg('(.....).(.*) to (.*) due (.*)',$service,$bits)) {
                $tfl = "$bits[1] $bits[2] to $bits[4] $bits[3] - ";
                if (! $uq[$tfl]) {
                        $uq[$tfl] = 1;
                        $textform .= "<font color=$col>$tfl</font>";
$textform .= "<a  href=\"javascript:popUp('http://www.wellho.net/demo/popup.php?time=$bits[1]')\">more</a><br>";
                        $tc++;
                }
        }
}

?>
<html>
<head>
<script type="text/javascript">

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=250,height=200');");
}
// End -->
</script>
<style type="text/css">
<!--
h4 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 36px;
        font-weight: bold;
        color: #CC00CC;
}
.tabtext {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #004400;
}
-->
</style>

<title>Train Running - the last 6 hours</title>
</head>
<body>
<center><h4>First Great Western - current and recent issues</h4></center>
<table cellpadding=3 class=tabtext><tr><td width=360 valign=top bgcolor=#ffffdd>
This diagram shows late notice cancellations and other changes
to First Great Western train services, as notified within the
last six hours.
<center><img src=http://www.wellho.net/demo/train_graphic.php?thicken=2 width=350></center>
Trains are shown from start to end point "as the crow flies" ...<br><br>
Events that may stop you travelling as you intended ...<br>
<font color=#ff0000>Red</font> - Cancelled Completely<br>
<font color=#0000ff>Blue</font> - Short working<br>
<font color=#00ff00>Green</font> - Skipping Stops<br><br>
Events that may otherwise degrade your journey<br>
<font color=#cc6600>Orange</font> - Short train<br>
<font color=#ffff00>Yellow</font> - Catering Change<br>
<font color=#888888>Grey</font> - Other change (e.g. extra stops, reinstated)<br><br>
Page under test<br>
The thicker the line, the more services effected
</td><td valign=top >
Report at <?= date("l jS F Y H:i") ?><br /><br />
Effected trains:<br>
<?= $textform ?>
A total of <?= $tc ?> trains<br><br>
To see the full official report of each train currently being reported, see
<a href=http://www.firstgreatwestern.co.uk/LiveUpdateList.aspx target=traffic>here</a>
on the
<a href=http://www.firstgreatwestern.co.uk/Default.aspx target=traffic>official
First Great Western site</a>. To see a report (text only) for the last 24 hours,
see <a href=http://www.savethetrain.org.uk/running.php target=traffic>here</a>
on the
<a href=http://www.savethetrain.org.uk/ target=traffic>Save the Train</a>
site.<br><br>
This page is provided by a customer of First Great Western using freely
available information. We also host the <a href=http://www.firstgreatwestern.info/coffeeshop>First Great Western Coffeeshop</a> - a forum where customers of
First Great Western can discuss issues relating to trains and travel in the
Thames Valley, South West of England, Cotswold and South Wales. Whilst
every attempt has been made to ensure that this page is accurate, we
cannot take any responsibility for any shortfall on data or errors that
creep in.
<?php if ($tc < 15) { ?>
<br><br><i>Note - I wrote this page as a demonstration to show some features
in use on our <a href=http://www.wellho.net/course/php.html>PHP courses</a>
that we run in <a href=http://www.wellho.net/share/melksham.html>Melksham, in Wiltshire</a> - a town of 24,000 from which First have withdrawn most trains, leaving
us with just 2 each way daily. Some 40% of our customers used to arrive in the train by town ... but now it's the car, the bus or the taxi. What a shame - and what a shortsighted decision by someone (not necessarily First)!</i>
<?php } ?>

</td></tr></table>
</body>
</html>

Learn about this subject
This module and example are covered on our public PHP Techniques course. If you have a group of three or more trainees who need to learn the subject, we can also arrange a private or on site course for you.

Books covering this topic
Yes. We have over 700 books in our library. Books covering PHP are listed here and when you've selected a relevant book we'll link you on to Amazon to order.

Other Examples
This example comes from our "Maps, Graphics and Geographics" training module. You'll find a description of the topic and some other closely related examples on the "Maps, Graphics and Geographics" module index page.

Full description of the source code
You can learn more about this example on the training courses listed on this page, on which you'll be given a full set of training notes.

Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License.

Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre.
The Horse's mouth provides a daily tip or thought.
• Further resources are available via the resources centre.
• All of these resources can be searched through through our search engine
• And there's a global index here.

Purpose of this website
This is a sample program, class demonstration or answer from a training course. It's main purpose is to provide an after-course service to customers who have attended our public private or on site courses, but the examples are made generally available under conditions described below.

Web site author
This web site is written and maintained by Well House Consultants.

Conditions of use
Past attendees on our training courses are welcome to use individual examples in the course of their programming, but must check the examples they use to ensure that they are suitable for their job. Remember that some of our examples show you how not to do things - check in your notes. Well House Consultants take no responsibility for the suitability of these example programs to customer's needs.

This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details.

Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.info/resources/ex.php • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb