summaryrefslogtreecommitdiff
path: root/forum/utils/roadmap.php
blob: f3e85cabde012dcfe84936278bb5d860818a56c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php

include_once($UTIL_DIR . "/convert.php");

class Roadmap {
	private $file;
	private $groups = array(array());

	public function write()
	{
		$fp = fopen($this->file, "w");

		$block = TRUE;
		flock($fp, LOCK_EX, $block); // do an exclusive lock

		fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

		fwrite($fp, "<roadmap tid=\"" . $this-> . "\"\n");
		fwrite($fp, "         abc=\"" .  . "\">\n");

		// for each group
		for($gid = 0; $gid < length($groups); $gid++) {
			fwrite($fp, "  <group id=\"" . $gid . "\"\n");
			fwrite($fp, "         name=\"" . $name . "\">\n");

			for($iid = 0; $iid < length($groups[$gid]); $iid++) {
				fwrite($fp, "    <item id=\"" . $id . "\"\n");
				fwrite($fp, "          name=\"" . $name . "\"/>\n");
			}

			fwrite($fp, "  </group>\n");
		}

		fwrite($fp, "</thread>\n");

		fclose($fp);
	}

	public function show()
	{
	}

	private function read()
	{
		$dom = new DomDocument;
		$dom->resolveExternals = FALSE;
		$dom->substituteEntities = FALSE;
		$dom->preserveWhiteSpace = FALSE;
		$dom->load($this->file);
		
		
		$roadmap = $dom->documentElement;
		foreach($roadmap->childNodes as $group) {
			echo $group->getAttribute('id');
			echo $group->getAttribute('name');
			foreach($group->childNodes as $item) {
				echo $item->getAttribute('id');
				echo $item->getAttribute('name');
			}
		}
	}

	public function Roadmap($file)
	{
		$this->file = $file;
		if(file_exists($this->file))	$this->read();
	}

}
?>