<?php
/**
 * This file is part of
 * pragmaMx - Web Content Management System.
 * Copyright by pragmaMx Developer Team - http://www.pragmamx.org
 *
 * pragmaMx 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, either version 3 of the License, or
 * (at your option) any later version.
 *
 * $Revision: 1.12 $
 * $Author: tora60 $
 * $Date: 2007/12/30 02:16:39 $
 */

defined('mxMainFileLoaded') or die('access denied');

mxGetLangfile("Your_Account");
require_once(PMX_SYSTEM_DIR . '/mx_userfunctions.php');
// // mit dieser Konstanten kann die maximale Anzahl
// // der Menüpunkte nebeneinander verändert werden
if (!defined("YA_NAVITEMSPERROW")) define("YA_NAVITEMSPERROW", 6);
// //////////////////////////////////////////////////
function nav($main_up = 0)
{
    if (!MX_IS_USER) return;
    // / Definition der Menüpunkte
    if (function_exists('nav_option')) {
        $item = nav_option();
    } else {
        $item[] = "<a href=\"modules.php?name=Your_Account&amp;op=edituser\">" . mxCreateImage("images/menu/info.gif", _CHANGEYOURINFO) . "<br />" . _CHANGEYOURINFO . "</a>";
        $item[] = "<a href=\"modules.php?name=Your_Account&amp;op=edithome\">" . mxCreateImage("images/menu/home.gif", _CHANGEHOME) . "<br />" . _CHANGEHOME . "</a>";
        if (mxModuleAllowed("UserGuest")) { // falls gaestebuch vorhanden
            $item[] = "<a href=\"modules.php?name=UserGuest&amp;op=view\">" . mxCreateImage("images/menu/guestbook.gif", _GUESTBOOKVIEW) . "<br />" . _GUESTBOOKVIEW . "</a>";
        }
        if (mxModuleAllowed("Private_Messages")) {
            $item[] = "<a href=\"modules.php?name=Private_Messages\">" . mxCreateImage("images/menu/comments.gif", _PRIVATEMESSAGES) . "<br />" . _PRIVATEMESSAGES . "</a>";
        }
        if (mxModuleAllowed("Avatar")) { // falls Avatar Upload Modul vorhanden
            $item[] = "<a href=\"modules.php?name=Avatar\">" . mxCreateImage("images/menu/avatar.gif", _AVATARUPLOAD) . "<br />" . _AVATARUPLOAD . "</a>";
        }

		if (mxModuleAllowed("JSM_Friendlist")){   # falls Friendlist Upload Modul vorhanden
        	$item[] = "<a href=\"modules.php?name=JSM_Friendlist\">".mxCreateImage("images/menu/friendlist.gif", "Freundesliste")."<br>Freundesliste</a>"; 
         }

		 if (mxModuleAllowed("User_Fotoalbum")) { // falls User Fotoalbum Modul vorhanden
            $item[] = "<a href=\"modules.php?name=User_Fotoalbum\">" . mxCreateImage("images/menu/fotoalbum.gif", _FOTOALBUM2) . "<br />" . _FOTOALBUM2 . "</a>";
        }
        $item[] = "<a href=\"modules.php?name=Your_Account&amp;op=logout\">" . mxCreateImage("images/menu/exit.gif", _LOGOUTEXIT) . "<br />" . _LOGOUTEXIT . "</a>";
        // $item[] = "<a href=\"modules.php?name=Your_Account&amp;op=delete\">".mxCreateImage("images/menu/delete.gif", eregi_replace("<br />"," ",_DELETEACCT))."<br />"._DELETEACCT."</a>";
    }
    // / Ausgabegenerierung
    $c_items = count($item);
    if ($c_items == 0) {
        return;
    } else if ($c_items <= YA_NAVITEMSPERROW) {
        $tdwidth = intval(100 / $c_items);
        $menu = "<tr valign=\"top\">
		<td width=\"" . $tdwidth . "%\" align=\"center\"><span class=\"tiny\">" . (implode("</span></td>\n<td width=\"" . $tdwidth . "%\" align=\"center\"><span class=\"tiny\">", $item)) . "</span></td>
		</tr>\n";
    } else {
        $trows = ceil($c_items / YA_NAVITEMSPERROW);
        $tcols = ceil($c_items / $trows);
        $off = 0;
        $len = $tcols;
        $menu = "";
        for($i = 1; $i <= $trows; $i++) {
            $xitem[$i] = array_slice($item, $off, $len);
            $icount = count($xitem[$i]);
            $tdwidth = (100 / $icount);
            $off = $off + $len;
            if ($icount < $tcols) $menu .= "</table>\n<table border=\"0\" width=\"100%\">";
            $menu .= "<tr valign=\"top\">
			<td width=\"" . $tdwidth . "%\" align=\"center\"><span class=\"tiny\">" . (implode("</span></td>\n<td width=\"" . $tdwidth . "%\" align=\"center\"><span class=\"tiny\">", $xitem[$i])) . "</span></td>
			</tr>\n";
        }
        // print $c_items."<br />".$trows."<br />".$tcols;
    }
    // / die Ausgabe
    echo "<div align='center'>";
    echo "<span class=\"title\">" . _THISISYOURPAGE . "</span><br /><br />";
    echo "<table border=\"0\" width=\"100%\">" . $menu . "</table>";
    if (empty($main_up)) {
        echo "<br />[&nbsp;<a href=\"modules.php?name=Your_Account\">" . _RETURNACCOUNT . "</a>&nbsp;]\n";
    }
    echo "</div>";
}

?>
