summaryrefslogtreecommitdiff
path: root/forum/utils/roadmap.php
diff options
context:
space:
mode:
authordeva <deva>2008-10-04 10:38:03 +0000
committerdeva <deva>2008-10-04 10:38:03 +0000
commitcce5e7710295021b41d9aaecc503a60fb99256be (patch)
tree660235be91fb821e976c7ae62347eb368ce87524 /forum/utils/roadmap.php
Initial revision
Diffstat (limited to 'forum/utils/roadmap.php')
-rw-r--r--forum/utils/roadmap.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/forum/utils/roadmap.php b/forum/utils/roadmap.php
new file mode 100644
index 0000000..f3e85ca
--- /dev/null
+++ b/forum/utils/roadmap.php
@@ -0,0 +1,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();
+ }
+
+}
+?> \ No newline at end of file