science-ation/nav.php

73 lines
2.6 KiB
PHP
Raw Normal View History

<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2010 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
include "common.inc.php";
$id=intval($_GET['id']);
$level=intval($_GET['level']);
if($id && $level) {
switch($level) {
case 1: //populate the scecondary menu
if($_SESSION['nav']['primary']!=$id) {
$_SESSION['nav']['primary']=$id;
}
unset($_SESSION['nav']['secondary']);
unset($_SESSION['nav']['tertiary']);
unset($_SESSION['nav']['tertiarylink']);
$q=mysql_query("SELECT * FROM rolestasks WHERE pid='$id' AND level=1 ORDER By ord,task");
echo "<ul class=\"secondarynav\">";
$cl="";
while($r=mysql_fetch_object($q)) {
if($_SESSION['nav']['secondary'] == $r->id) {
$cl="class=\"secondarynav-selected\"";
}
else $cl="";
echo "<li id=\"secondary_nav_{$r->id}\" $cl>";
//echo "<a href=\"#\" onclick=\"return taskNavLevel($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a>";
echo "<a href=\"#\" onclick=\"return taskNavLevel($r->pid, $r->id)\">".i18n($r->task)."</a>";
echo "</li>\n";
}
echo "</ul>\n";
break;
case 2: //populate the tertiary menu
$_SESSION['nav']['secondary']=$id;
unset($_SESSION['nav']['tertiary']);
unset($_SESSION['nav']['tertiarylink']);
$q=mysql_query("SELECT * FROM rolestasks WHERE pid='$id' AND level=2 ORDER By ord,task");
while($r=mysql_fetch_object($q)) {
echo "<h3 id=\"tertiary_nav_{$r->id}\"><a href=\"{$config['SFIABDIRECTORY']}$r->link\">".i18n("$r->task")."</a></h3>\n";
echo "<ul class=\"tertiary_nav\">";
$q2=mysql_query("SELECT * FROM rolestasks WHERE pid='$r->id' AND level=3 ORDER BY ord,task");
while($r2=mysql_fetch_object($q2)) {
echo "<li id=\"tertiarylink_nav_{$r2->id}\"><a href=\"".$config['SFIABDIRECTORY']."$r2->link\">".i18n($r2->task)."</a></li>\n";
}
echo "</ul>";
}
echo "</ul>\n";
break;
}
}
?>