summaryrefslogtreecommitdiff
path: root/includes/menu.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-01-14 20:33:42 +0000
committerDries Buytaert <dries@buytaert.net>2003-01-14 20:33:42 +0000
commitd268783669922eab6d6b8a2fb4fffc1400af61dc (patch)
tree3927e6c63b10a6cd103e52e8ee22c2f671cc9b41 /includes/menu.inc
parent20e8f9eba973a469095c7da2abe52b01a140f922 (diff)
downloadbrdo-d268783669922eab6d6b8a2fb4fffc1400af61dc.tar.gz
brdo-d268783669922eab6d6b8a2fb4fffc1400af61dc.tar.bz2
- Small improvement to the admin menu based on feedback from Michael.
Diffstat (limited to 'includes/menu.inc')
-rw-r--r--includes/menu.inc26
1 files changed, 20 insertions, 6 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 345f42d03..df54d7232 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -36,6 +36,17 @@ function menu_trail() {
return $trail;
}
+function menu_in_trail($item) {
+ $trail = menu_trail();
+
+ foreach ($trail as $menu) {
+ if ($menu->link == $item->link) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
function menu_item($item) {
/*
@@ -99,15 +110,18 @@ function menu_help() {
return $output;
}
-function menu_tree($parent = "", $overview = 0) {
+function menu_tree($parent = "", $all = 1) {
- $result = db_query("SELECT * FROM menu WHERE parent = '%s' AND overview = '%d' ORDER BY weight, name", $parent, $overview);
+ if ($all) {
+ $result = db_query("SELECT * FROM menu WHERE parent = '%s' ORDER BY weight, name", $parent);
+ }
if (db_num_rows($result)) {
$output = "<ul>";
while ($item = db_fetch_object($result)) {
+ $all = (stristr(request_uri(), $item->link) == $item->link) ? 1 : 0;
$output .= "<li>". menu_item($item) ."</li>";
- $output .= menu_tree($item->name, 1);
+ $output .= menu_tree($item->name, menu_in_trail($item));
}
$output .= "</ul>";
}
@@ -115,10 +129,10 @@ function menu_tree($parent = "", $overview = 0) {
return $output;
}
-function menu_add($name, $link, $title = NULL, $help = NULL, $parent = NULL, $weight = 1, $overview = 0) {
+function menu_add($name, $link, $title = NULL, $help = NULL, $parent = NULL, $weight = 1) {
if (!db_result(db_query("SELECT name FROM menu WHERE link = '%s'", $link))) {
- db_query("INSERT INTO menu (name, link, title, help, parent, weight, overview) VALUES ('%s', '%s', '%s', '%s', '%s', '%d', '%d')", $name, $link, $title, $help, $parent, $weight, $overview);
+ db_query("INSERT INTO menu (name, link, title, help, parent, weight) VALUES ('%s', '%s', '%s', '%s', '%s', '%d')", $name, $link, $title, $help, $parent, $weight);
}
}
-?> \ No newline at end of file
+?>