1 | 13 | simandl | <?php |
2 | | | |
3 | | | // |
4 | | | // Mainly used to test editor functions. |
5 | | | // - reads in a config file |
6 | | | // - optional does "something" to it |
7 | | | // - writes it back out |
8 | | | // |
9 | | | // A good test that WriteConfig and ReadConfig are really in sync |
10 | | | // |
11 | | | include_once 'editor-config.php'; |
12 | | | require_once 'Weathermap.class.php'; |
13 | | | |
14 | | | $mapfile = "random-bits\\suite-2.conf"; |
15 | | | |
16 | | | $map = new WeatherMap; |
17 | | | |
18 | | | // $map->debugging = TRUE; |
19 | | | |
20 | | | $map->ReadConfig($mapfile); |
21 | | | |
22 | | | if(1==0) |
23 | | | { |
24 | | | $nodename = "Centre"; |
25 | | | $newnodename = "dave"; |
26 | | | |
27 | | | $newnode = $map->nodes[$nodename]; |
28 | | | $newnode->name = $newnodename; |
29 | | | $map->nodes[$newnodename] = $newnode; |
30 | | | unset($map->nodes[$nodename]); |
31 | | | |
32 | | | foreach ($map->links as $link) |
33 | | | { |
34 | | | if($link->a->name == $nodename) |
35 | | | { |
36 | | | $map->links[$link->name]->a = $newnode; |
37 | | | } |
38 | | | if($link->b->name == $nodename) |
39 | | | { |
40 | | | $map->links[$link->name]->b = $newnode; |
41 | | | } |
42 | | | } |
43 | | | |
44 | | | // print_r($map->nodes['main']); |
45 | | | |
46 | | | } |
47 | | | |
48 | | | $map->WriteConfig("output.conf"); |
49 | | | |
50 | | | print "Wrote config\n"; |
51 | | | // print_r($map); |
52 | | | |
53 | | | |
54 | | | // vim:ts=4:sw=4: |
55 | | | ?> |