Changed so that average item material price is automatic updated whenever a PO Delive...
[fa-stable.git] / includes / page / header.inc
1 <?php
2
3 function help_url($title, $app)
4 {
5
6         global $help_page_url, $help_base_url, $applications, $help_page_title;
7
8         if (isset($help_page_url))
9         {
10                 return $help_base_url.$help_page_url;
11         }
12
13         $help_page_url = '';
14         if (isset($help_page_title))
15         {
16                 $help_page_url = $help_page_title;
17         }
18         elseif ($title==_("Main Menu"))
19         {
20                 $help_page_url = $applications[$app];
21         }
22         else
23         {
24                 $help_page_url = $title;
25         }
26
27         return $help_base_url.urlencode(str_replace(' ', '', ucwords($help_page_url)));
28 }
29
30 function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="")
31 {
32         // titles and screen header
33         global $db_connections, $path_to_root, $def_app, $applications,
34                 $help_base_url, $help_page_url, $use_popup_windows;
35         $theme = user_theme();
36         $local_path_to_root = $path_to_root;
37
38         if ($help_base_url != null && $use_popup_windows && $js == '')
39         {
40                 if (!function_exists('get_js_open_window'))
41                 {
42                         include_once($path_to_root.'/includes/ui/ui_view.inc');
43                 }
44                 $js = get_js_open_window(900, 500);
45         }
46
47         if (!isset($no_menu))
48         {
49                 $no_menu = false;
50         }
51         if (!isset($_SESSION["sel_app"]))
52                 session_register("sel_app");
53         if (isset($_SESSION["App"]) && is_object($_SESSION["App"]) && isset($_SESSION["App"]->selected_application) &&
54                 $_SESSION["App"]->selected_application != "")
55                 $sel_app = $_SESSION["App"]->selected_application;
56         elseif (isset($_SESSION["sel_app"]) && $_SESSION["sel_app"] != "")
57                 $sel_app = $_SESSION["sel_app"];
58         else
59                 $sel_app = $def_app;
60         $_SESSION["sel_app"] = $sel_app;
61
62         echo "<html dir='" . $_SESSION['language']->dir . "' >";
63         echo "<head><title>$title</title>";
64         $encoding = $_SESSION['language']->encoding;
65         $local_stylesheet = $_SESSION['language']->get_stylesheet();
66         echo "<meta http-equiv='Content-type' content='text/html'; charset='$encoding'>";
67         echo "<link href='$local_path_to_root/themes/$theme/default.css' rel='stylesheet' type='text/css' /> \n";
68         if (file_exists($local_path_to_root. "/".$local_stylesheet))
69                 echo "<link href='$local_path_to_root/$local_stylesheet' rel='stylesheet' type='text/css' /> \n";
70         if ($js != "")
71                 echo $js;
72         echo "</head> \n";
73         if ($onload == "")
74                 echo "<body>";
75         else
76                 echo "<body onload=\"$onload\">";
77         echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
78         echo "<tr>\n";
79         echo "<td colspan='2' rowspan='2'>\n";
80
81         echo "<table class='main_page' border='0' cellpadding='0' cellspacing='0'>\n";
82         echo "<tr>\n";
83         echo "<td>\n";
84         echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
85         echo "<tr>\n";
86         echo "<td class='quick_menu'>\n";
87         if (!$no_menu)
88         {
89                 echo "<table cellpadding=0 cellspacing=0 width='100%'><tr><td>";
90                 echo "<div class=tabs>";
91                 foreach($applications as $app => $name)
92                 {
93                         echo "<a ".($sel_app == $app ? "class='selected' " : "").
94                         "href='$local_path_to_root/index.php?application=".$app.
95                                 SID ."'>" .$name . "</a>";
96                 }
97                 echo "</div>";
98
99                 echo "</td></tr></table>";
100
101                 echo "<table class=logoutBar>";
102                 echo "<tr><td class=headingtext3>" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "</td>";
103                 if ($help_base_url != null)
104                 {
105
106                         echo "<td align=right ><a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url($title, $sel_app)."'>" . _("Help") . "</a></td>";
107                 }
108                 echo "<td class=logoutBarRight><a href='$local_path_to_root/access/logout.php?'>" . _("Logout") . "</a>";
109                 echo "</td></tr></table>";
110         }
111
112         echo "</td></tr></table>";
113
114         if ($title && !$no_menu && !$is_index)
115         {
116                 echo "<center><table width='100%'><tr><td width='100%' class='titletext'>$title</td></tr></table></center>";
117         }
118
119         if (!$is_index)
120                 echo "<br>";
121 }
122
123 ?>