summaryrefslogtreecommitdiffstats
path: root/code/nav.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'code/nav.inc.php')
-rw-r--r--code/nav.inc.php160
1 files changed, 78 insertions, 82 deletions
diff --git a/code/nav.inc.php b/code/nav.inc.php
index 642efe0..0a28cba 100644
--- a/code/nav.inc.php
+++ b/code/nav.inc.php
@@ -1,100 +1,96 @@
<?PHP
- if(!defined('NAV_INC')) {
- define('NAV_INC', 1);
+ require_once('code/links.inc.php');
+
+ class Nav {
+ var $entries = array();
- require_once('code/links.inc.php');
-
- class Nav {
- var $entries = array();
+ function Nav() {
+ $res = $GLOBALS['db']->Execute('SELECT * FROM nav ORDER BY id');
- function Nav() {
- $res = $GLOBALS['db']->Execute('SELECT * FROM nav ORDER BY id');
-
- while(!$res->EOF) {
- $this->entries[$res->fields[0]] = new NavEntry($res->fields[1], $res->fields[2], $res->fields[3]);
-
- $res->MoveNext();
- }
-
- foreach($this->entries as $entry)
- if($entry->GetParentId() != 0)
- $this->entries[$entry->GetParentId()]->Add($entry);
+ while(!$res->EOF) {
+ $this->entries[$res->fields[0]] = new NavEntry($res->fields[1], $res->fields[2], $res->fields[3]);
+
+ $res->MoveNext();
}
- function ParseEntries() {
- $ret = '<ul>';
-
- foreach($this->entries as $entry)
- if($entry->GetParentId() == 0)
- $ret .= $entry->Parse();
-
- $ret .= '</ul>';
-
- return $ret;
- }
+ foreach($this->entries as $entry)
+ if($entry->GetParentId() != 0)
+ $this->entries[$entry->GetParentId()]->Add($entry);
}
- class NavEntry {
- var $parent, $text, $link;
- var $children = array();
+ function ParseEntries() {
+ $ret = '<ul>';
- function NavEntry($parent, $text, $link) {
- $this->parent = $parent;
- $this->text = $text;
- $this->link = $link;
- }
+ foreach($this->entries as $entry)
+ if($entry->GetParentId() == 0)
+ $ret .= $entry->Parse();
- function Add($entry) {
- array_push($this->children, $entry);
- }
+ $ret .= '</ul>';
- function GetChildren() {
- return $this->children;
- }
+ return $ret;
+ }
+ }
+
+ class NavEntry {
+ var $parent, $text, $link;
+ var $children = array();
+
+ function NavEntry($parent, $text, $link) {
+ $this->parent = $parent;
+ $this->text = $text;
+ $this->link = $link;
+ }
+
+ function Add($entry) {
+ array_push($this->children, $entry);
+ }
+
+ function GetChildren() {
+ return $this->children;
+ }
+
+ function GetParentId() {
+ return $this->parent;
+ }
+
+ function GetText() {
+ return $this->text;
+ }
+
+ function GetLink() {
+ return $this->link;
+ }
+
+ function Parse() {
+ $ccount = 0;
+ $ret = '<li>';
- function GetParentId() {
- return $this->parent;
- }
+ $a = $GLOBALS['links']->ParseNavLink($this->text, $this->link);
- function GetText() {
- return $this->text;
- }
+ $ret .= $a;
- function GetLink() {
- return $this->link;
+ if(count($this->children) > 0) {
+ $ret .= '<ul>';
+
+ foreach($this->children as $child) {
+ $cret = $child->Parse();
+
+ if($cret) {
+ $ret .= $cret;
+
+ $ccount++;
+ }
+ }
+
+ $ret .= '</ul>';
}
- function Parse() {
- $ccount = 0;
- $ret = '<li>';
-
- $a = $GLOBALS['links']->ParseNavLink($this->text, $this->link);
-
- $ret .= $a;
-
- if(count($this->children) > 0) {
- $ret .= '<ul>';
-
- foreach($this->children as $child) {
- $cret = $child->Parse();
-
- if($cret) {
- $ret .= $cret;
-
- $ccount++;
- }
- }
-
- $ret .= '</ul>';
- }
-
- if(!$ccount && $a == $this->text)
- return '';
-
- return $ret . '</li>';
- }
+ if(!$ccount && $a == $this->text)
+ return '';
+
+ return $ret . '</li>';
}
-
- $nav = new Nav;
}
+
+ $GLOBALS['nav'] = new Nav;
?>