Release 1.16. Look in CHANGELOG.txt for changes.
[fa-stable.git] / includes / page / header.inc
index b23ecc87b7787bc1fc17f193b9b75f996e50359d..c421a66587c0f3f7c4620953623e6ab40417d0a6 100644 (file)
@@ -3,21 +3,33 @@
 function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="")
 {
        // titles and screen header
-       global $db_connections, $path_to_root;
+       global $db_connections, $path_to_root, $def_app;
        $theme = user_theme();
        $local_path_to_root = $path_to_root;
 
-       if (!isset($no_menu)) 
+       if (!isset($no_menu))
        {
                $no_menu = false;
        }
+       if (!isset($_SESSION["sel_app"]))
+               session_register("sel_app");
+       if (isset($_SESSION["App"]) && is_object($_SESSION["App"]) && isset($_SESSION["App"]->selected_application) &&
+               $_SESSION["App"]->selected_application != "")
+               $sel_app = $_SESSION["App"]->selected_application;
+       elseif (isset($_SESSION["sel_app"]) && $_SESSION["sel_app"] != "")
+               $sel_app = $_SESSION["sel_app"];
+       else
+               $sel_app = $def_app;
+       $_SESSION["sel_app"] = $sel_app;
 
     echo "<html dir='" . $_SESSION['language']->dir . "' >";
     echo "<head><title>$title</title>";
     $encoding = $_SESSION['language']->encoding;
+    $local_stylesheet = $_SESSION['language']->get_stylesheet();
        echo "<meta http-equiv='Content-type' content='text/html'; charset='$encoding'>";
        echo "<link href='$local_path_to_root/themes/$theme/default.css' rel='stylesheet' type='text/css' /> \n";
-       echo "<link href='$local_path_to_root/" . $_SESSION['language']->get_stylesheet() . "' rel='stylesheet' type='text/css' /> \n";
+       if (file_exists($local_path_to_root. "/".$local_stylesheet))
+               echo "<link href='$local_path_to_root/$local_stylesheet' rel='stylesheet' type='text/css' /> \n";
        if ($js != "")
                echo $js;
        echo "</head> \n";
@@ -35,17 +47,17 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
     echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
        echo "<tr>\n";
     echo "<td class='quick_menu'>\n";
-       if (!$no_menu) 
+       if (!$no_menu)
        {
                echo "<table cellpadding=0 cellspacing=0 width='100%'><tr><td>";
                echo "<div class=tabs>";
-               echo "<a href='$local_path_to_root/index.php?application=orders". SID ."'>" . _("Sales") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=AP". SID ."'>" . _("Purchases") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=stock". SID ."'>" . _("Items and Inventory") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=manuf". SID ."'>" . _("Manufacturing") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=proj". SID ."'>" . _("Dimensions") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=GL". SID ."'>" . _("Banking and General Ledger") . "</a>";
-               echo "<a href='$local_path_to_root/index.php?application=system". SID ."'>" . _("Setup") . "</a>";
+               echo "<a ".($sel_app == "orders" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=orders". SID ."'>" . _("Sales") . "</a>";
+               echo "<a ".($sel_app == "AP" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=AP". SID ."'>" . _("Purchases") . "</a>";
+               echo "<a ".($sel_app == "stock" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=stock". SID ."'>" . _("Items and Inventory") . "</a>";
+               echo "<a ".($sel_app == "manuf" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=manuf". SID ."'>" . _("Manufacturing") . "</a>";
+               echo "<a ".($sel_app == "proj" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=proj". SID ."'>" . _("Dimensions") . "</a>";
+               echo "<a ".($sel_app == "GL" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=GL". SID ."'>" . _("Banking and General Ledger") . "</a>";
+               echo "<a ".($sel_app == "system" ? "class='selected' " : "")."href='$local_path_to_root/index.php?application=system". SID ."'>" . _("Setup") . "</a>";
                echo "</div>";
 
                echo "</td></tr></table>";
@@ -58,7 +70,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
 
        echo "</td></tr></table>";
 
-       if ($title && !$no_menu && !$is_index) 
+       if ($title && !$no_menu && !$is_index)
        {
                echo "<center><table width='100%'><tr><td width='100%' class='titletext'>$title</td></tr></table></center>";
        }