0 ) {
while ($zeile=mysql_fetch_array($result)) {
$PageArray[$zeile["Id"]] = array (
"Id" => $zeile["Id"],
"UpperId" => $zeile["UpperId"],
"Sort" => $zeile["Sort"],
"Name" => $zeile["Name"] );
}
}
else {
$PageArray = -1;
}
return $PageArray;
}
/*
*************************************************************************************
*/
function GetDeepFolderFromId ($PageId) {
$result = mysql_query( "SELECT Name,UpperId,Id FROM AllPages WHERE Id =
'$PageId'" );
if ( mysql_num_rows($result) > 0 ) {
$zeile = mysql_fetch_array($result);
$Folders = 1;
if ($zeile["UpperId"] != 0) {
$Folders = GetDeepFolderFromId ($zeile["UpperId"]) + 1;
}
}
return $Folders;
}
/*
*************************************************************************************
*/
function GetTopFoldersFromId ($PageId) {
$result = mysql_query( "SELECT Name,UpperId,Id FROM AllPages WHERE Id =
'$PageId'" );
if ( mysql_num_rows($result) > 0 ) {
$zeile = mysql_fetch_array($result);
$Folders = $zeile["Id"];
if ($zeile["UpperId"] != 0) {
$Folders = GetTopFoldersFromId ($zeile["UpperId"]) . "|" . $Folders;
}
}
return $Folders;
}
/*
*************************************************************************************
*/
function GetTopFolderFromId ($PageId) {
$result = mysql_query( "SELECT Name,UpperId,Id FROM AllPages WHERE Id =
'$PageId'" );
if ( mysql_num_rows($result) > 0 ) {
$zeile = mysql_fetch_array($result);
$Folder = $zeile["UpperId"];
}
return $Folder;
}
/*
*************************************************************************************
*/
function GetNavigationFromId ($StartPageId, $SpaceWidth, $ActivePage, $Recursiv,
$admin) {
global $PHP_SELF;
$SpaceIMG = "";
if ($SpaceWidth==0) {
$SpaceIMG = "";
$SpaceWidth = -3;
}
$array_temp = GetSubPageFromId($StartPageId, $admin);
$folder = "|" . GetTopFoldersFromId($ActivePage) . "|";
if ($array_temp!=-1) {
while(list($key,$value) = each($array_temp)) {
// if ($ActivePage == $array_temp[$key][Id]) { $active_zusatz =
"class=\"active\""; } else { $active_zusatz = ""; }
if (strstr($folder,"|$key|")) { $active_zusatz = "class=\"active\""; } else
{ $active_zusatz = ""; }
$NavigationString.= " ".$SpaceIMG."".$array_temp[$key][Name]."
\n";
if ( ($Recursiv > 0) && strstr($folder, "|".$array_temp[$key][Id]."|") ) {
$NavigationString.= GetNavigationFromId ($array_temp[$key][Id],
$SpaceWidth+3, $ActivePage, $Recursiv-1, $admin);
}
}
$Recursiv--;
}
return $NavigationString;
}
?>