2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
14 function get_icon($category)
16 global $path_to_root, $SysPrefs;
18 if ($SysPrefs->show_menu_category_icons)
19 $img = $category == '' ? 'right.gif' : $category.'.png';
22 return "<img src='$path_to_root/themes/".user_theme()."/images/$img' style='vertical-align:middle;' border='0'> ";
27 page(_($help_context = "Main Menu"), false, true);
32 end_page(false, true);
35 function menu_header($title, $no_menu, $is_index)
37 global $path_to_root, $SysPrefs, $db_connections;
38 echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
40 echo "<td colspan='2' rowspan='2'>\n";
42 echo "<table class='main_page' border='0' cellpadding='0' cellspacing='0'>\n";
45 echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
47 echo "<td class='quick_menu'>\n"; // tabs
49 $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif";
52 $applications = $_SESSION['App']->applications;
53 $local_path_to_root = $path_to_root;
54 $sel_app = $_SESSION['sel_app'];
55 echo "<table cellpadding='0' cellspacing='0' width='100%'><tr><td>";
56 echo "<div class='tabs'>";
57 foreach($applications as $app)
59 if ($_SESSION["wa_current_user"]->check_application_access($app))
61 $acc = access_string($app->name);
62 echo "<a class='".($sel_app == $app->id ? 'selected' : 'menu_tab')
63 ."' href='$local_path_to_root/index.php?application=".$app->id
64 ."'$acc[1]>" .$acc[0] . "</a>";
68 echo "</td></tr></table>";
70 $rimg = "<img src='$path_to_root/themes/".user_theme()."/images/report.png' style='width:14px;height:14px;border:0;vertical-align:middle;' alt='"._('Dashboard')."'> ";
71 $pimg = "<img src='$local_path_to_root/themes/".user_theme()."/images/preferences.gif' style='width:14px;height:14px; border:0;vertical-align:middle;' alt='"._('Preferences')."'> ";
72 $limg = "<img src='$local_path_to_root/themes/".user_theme()."/images/lock.gif' style='width:14px;height:14px;border:0;vertical-align:middle;' alt='"._('Change Password')."'> ";
73 $img = "<img src='$local_path_to_root/themes/".user_theme()."/images/login.gif' style='width:14px;height:14px;border:0;vertical-align:middle;' alt='"._('Logout')."'> ";
74 $himg = "<img src='$local_path_to_root/themes/".user_theme()."/images/help.gif' style='width:14px;height:14px;border:0;vertical-align:middle;'' alt='"._('Help')."'> ";
75 echo "<table class='logoutBar'>";
76 echo "<tr><td class='headingtext3'>" . $db_connections[user_company()]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "</td>";
77 echo "<td class='logoutBarRight'><img id='ajaxmark' src='$indicator' align='center' style='visibility:hidden;' alt='ajaxmark'></td>";
78 echo "<td class='logoutBarRight'><a href='$path_to_root/admin/dashboard.php?sel_app=$sel_app'>$rimg" . _("Dashboard") . "</a> \n";
80 echo "<a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>$pimg" . _("Preferences") . "</a> \n";
81 echo " <a class='shortcut' href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>$limg" . _("Change password") . "</a> \n";
83 if ($SysPrefs->help_base_url != null)
85 echo "<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url()."'>$himg" . _("Help") . "</a> ";
87 echo "<a class='shortcut' href='$local_path_to_root/access/logout.php?'>$img" . _("Logout") . "</a> ";
88 echo "</td></tr><tr><td colspan=3>";
89 echo "</td></tr></table>";
91 echo "</td></tr></table>";
94 { // ajax indicator for installer and popups
95 echo "<center><table class='tablestyle_noborder'>"
96 ."<tr><td><img id='ajaxmark' src='$indicator' align='center' style='visibility:hidden;' alt='ajaxmark'></td></tr>"
98 } elseif ($title && !$is_index)
100 echo "<center><table id='title'><tr><td width='100%' class='titletext'>$title</td>"
102 .(user_hints() ? "<span id='hints'></span>" : '')
104 ."</tr></table></center>";
108 function menu_footer($no_menu, $is_index)
110 global $version, $path_to_root, $Pagehelp, $Ajax, $SysPrefs;
112 include_once($path_to_root . "/includes/date_functions.inc");
114 echo "</td></tr></table>\n"; // 'main_page'
115 if ($no_menu == false) // bottom status line
118 echo "<table class='bottomBar'>\n";
120 echo "<table class='bottomBar2'>\n";
122 if (isset($_SESSION['wa_current_user'])) {
123 $phelp = implode('; ', $Pagehelp);
124 echo "<td class='bottomBarCell'>" . Today() . " | " . Now() . "</td>\n";
125 $Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
126 echo "<td id='hotkeyshelp'>".$phelp."</td>";
128 echo "</tr></table>\n";
130 echo "</td></tr> </table>\n"; // 'callout_main'
131 if ($no_menu == false)
133 echo "<table align='center' id='footer'>\n";
135 echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'><font color='#ffffff'>".$SysPrefs->app_title
136 ." $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
139 echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url
140 ."' tabindex='-1'><font color='#ffff00'>".$SysPrefs->power_by."</font></a></td>\n";
142 if ($SysPrefs->allow_demo_mode)
145 //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='center' /></a></div></td>\n";
148 echo "</table><br><br>\n";
152 function display_applications(&$waapp)
154 global $path_to_root;
156 $selected_app = $waapp->get_selected_application();
157 if (!$_SESSION["wa_current_user"]->check_application_access($selected_app))
160 if (method_exists($selected_app, 'render_index'))
162 $selected_app->render_index();
166 echo "<table width='100%' cellpadding='0' cellspacing='0'>";
167 foreach ($selected_app->modules as $module)
169 if (!$_SESSION["wa_current_user"]->check_module_access($module))
174 echo "<td valign='top' class='menu_group'>";
175 echo "<table border=0 width='100%'>";
176 echo "<tr><td class='menu_group'>";
178 echo "</td></tr><tr>";
179 echo "<td class='menu_group_items'>";
181 foreach ($module->lappfunctions as $appfunction)
183 $img = $this->get_icon($appfunction->category);
184 if ($appfunction->label == "")
186 elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access))
188 echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
190 elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
192 echo $img.'<span class="inactive">'
193 .access_string($appfunction->label, true)
198 if (sizeof($module->rappfunctions) > 0)
200 echo "<td width='50%' class='menu_group_items'>";
201 foreach ($module->rappfunctions as $appfunction)
203 $img = $this->get_icon($appfunction->category);
204 if ($appfunction->label == "")
206 elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access))
208 echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
210 elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
212 echo $img.'<span class="inactive">'
213 .access_string($appfunction->label, true)
220 echo "</tr></table></td></tr>";