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 ***********************************************************************/
17 page(_($help_context = "Main Menu"), false, true);
22 end_page(false, true);
24 function shortcut($url, $label)
27 $pars = access_string($label);
28 echo "<a href='$url' class='menu_option' $pars[1]>$pars[0]</a>";
32 function menu_header($title, $no_menu, $is_index)
34 global $path_to_root, $SysPrefs, $version;
36 $sel_app = $_SESSION['sel_app'];
37 echo "<div class='fa-main'>\n";
40 $applications = $_SESSION['App']->applications;
41 $local_path_to_root = $path_to_root;
42 $img = "<img src='$path_to_root/themes/".user_theme()."/images/login.gif' style='width:14px;height:14px;border:0;vertical-align:middle;padding-bottom:3px;' alt='"._('Logout')."'> ";
43 $pimg = "<img src='$local_path_to_root/themes/".user_theme()."/images/preferences.gif' style='width:14px;height:14px;border:0;vertical-align:middle;padding-bottom:3px;' alt='"._('Preferences')."'> ";
44 $limg = "<img src='$local_path_to_root/themes/".user_theme()."/images/lock.gif' style='width:14px;height:14px;border:0;vertical-align:middle;padding-bottom:3px;' alt='"._('Change Password')."'> ";
45 $himg = "<img src='$path_to_root/themes/".user_theme()."/images/help.gif' style='width:14px;height:14px;border:0;vertical-align:middle;padding-bottom:3px;' alt='"._('Help')."'> ";
46 echo "<div id='header'>\n";
48 echo " <li><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>$pimg" . _("Preferences") . "</a></li>\n";
49 echo " <li><a class='shortcut' href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>$limg" . _("Change password") . "</a></li>\n";
50 if ($SysPrefs->help_base_url != null)
51 echo " <li><a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='".
52 help_url()."'>$himg" . _("Help") . "</a></li>";
53 echo " <li><a class='shortcut' href='$path_to_root/access/logout.php?'>$img" . _("Logout") . "</a></li>";
55 $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif";
56 echo "<h1>$SysPrefs->power_by $version<span style='padding-left:300px;'><img id='ajaxmark' src='$indicator' align='center' style='visibility:hidden;'></span></h1>\n";
57 echo "</div>\n"; // header
58 echo "<div class='fa-menu'>";
60 foreach($applications as $app)
62 if ($_SESSION["wa_current_user"]->check_application_access($app))
64 $acc = access_string($app->name);
65 echo "<li ".($sel_app == $app->id ? "class='active' " : "") . "><a class='"
66 .($sel_app == $app->id ? 'selected' : 'menu_tab')
67 ."' href='$path_to_root/index.php?application=" . $app->id
68 ."'$acc[1]><b>" . $acc[0] . "</b></a></li>\n";
72 echo "</div>\n"; // menu
73 echo "<div class='clear'></div>\n";
76 echo "<div class='fa-body'>\n";
79 echo "<div id='fa-submenu'>\n";
81 switch ($sel_app) // Shortcuts
84 $this->shortcut($local_path_to_root."/sales/sales_order_entry.php?NewOrder=Yes'",_("Sales Order"));
85 $this->shortcut($local_path_to_root."/sales/sales_order_entry.php?NewInvoice=0",_("Direct Invoice"));
86 $this->shortcut($local_path_to_root."/sales/customer_payments.php?", _("Payments"));
87 $this->shortcut($local_path_to_root."/sales/inquiry/sales_orders_view.php?", _("Sales Order Inquiry"));
88 $this->shortcut($local_path_to_root."/sales/inquiry/customer_inquiry.php?", _("Transactions"));
89 $this->shortcut($local_path_to_root."/sales/manage/customers.php?", _("Customers"));
90 $this->shortcut($local_path_to_root."/sales/manage/customer_branches.php?", _("Branch"));
91 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=0", _("Reports and Analysis"));
94 $this->shortcut($local_path_to_root."/purchasing/po_entry_items.php?NewOrder=0", _("Purchase Order"));
95 $this->shortcut($local_path_to_root."/purchasing/inquiry/po_search.php?", _("Receive"));
96 $this->shortcut($local_path_to_root."/purchasing/supplier_invoice.php?New=1", _("Supplier Invoice"));
97 $this->shortcut($local_path_to_root."/purchasing/supplier_payment.php?", _("Payments"));
98 $this->shortcut($local_path_to_root."/purchasing/inquiry/supplier_inquiry.php?", _("Transactions"));
99 $this->shortcut($local_path_to_root."/purchasing/manage/suppliers.php?", _("Suppliers"));
100 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=1", _("Reports and Analysis"));
103 $this->shortcut($local_path_to_root."/inventory/adjustments.php?NewAdjustment=1", _("Inventory Adjustments"));
104 $this->shortcut($local_path_to_root."/inventory/inquiry/stock_movements.php?", _("Inventory Movements"));
105 $this->shortcut($local_path_to_root."/inventory/manage/items.php?", _("Items"));
106 $this->shortcut($local_path_to_root."/inventory/prices.php?", _("Sales Pricing"));
107 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=2", _("Reports and Analysis"));
110 $this->shortcut($local_path_to_root."/manufacturing/work_order_entry.php?", _("Work Order Entry"));
111 $this->shortcut($local_path_to_root."/manufacturing/search_work_orders.php?outstanding_only=1", _("Ourstanding Work Orders"));
112 $this->shortcut($local_path_to_root."/manufacturing/search_work_orders.php?", _("Work Order Inquiry"));
113 $this->shortcut($local_path_to_root."/manufacturing/manage/bom_edit.php?", _("Bills Of Material"));
114 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=3", _("Reports and Analysis"));
117 $this->shortcut($local_path_to_root."/purchasing/po_entry_items.php?NewInvoice=Yes&FixedAsset=1", _("Fixed Assets Purchase"));
118 $this->shortcut($local_path_to_root."/fixed_assets/inquiry/stock_inquiry.php?", _("Fixed Assets Inquiry"));
119 $this->shortcut($local_path_to_root."/inventory/manage/items.php?FixedAsset=1", _("Fixed Assets"));
120 $this->shortcut($local_path_to_root."/fixed_assets/process_depreciation.php?", _("Depreciations"));
121 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=7", _("Reports and Analysis"));
124 $this->shortcut($local_path_to_root."/dimensions/dimension_entry.php?", _("Dimension Entry"));
125 $this->shortcut($local_path_to_root."/dimensions/inquiry/search_dimensions.php?", _("Dimension Inquiry"));
126 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=4", _("Reports and Analysis"));
129 $this->shortcut($local_path_to_root."/gl/gl_bank.php?NewPayment=Yes",_("Payments"));
130 $this->shortcut($local_path_to_root."/gl/gl_bank.php?NewDeposit=Yes",_("Deposits"));
131 $this->shortcut($local_path_to_root."/gl/gl_journal.php?NewJournal=Yes",_("Journal Entry"));
132 $this->shortcut($local_path_to_root."/gl/inquiry/bank_inquiry.php?",_("Bank Account Inquiry"));
133 //$this->shortcut($local_path_to_root."/gl/inquiry/gl_account_inquiry.php?",_("GL Account Inquiry"));
134 $this->shortcut($local_path_to_root."/gl/inquiry/gl_trial_balance.php?",_("Trial Balance"));
135 $this->shortcut($local_path_to_root."/gl/manage/exchange_rates.php?",_("Exchange Rates"));
136 $this->shortcut($local_path_to_root."/gl/manage/gl_accounts.php?",_("GL Accounts"));
137 $this->shortcut($local_path_to_root."/reporting/reports_main.php?Class=6",_("Reports and Analysis"));
140 $this->shortcut($local_path_to_root."/admin/company_preferences.php?",_("Company Setup"));
141 $this->shortcut($local_path_to_root."/admin/gl_setup.php?",_("General GL"));
142 $this->shortcut($local_path_to_root."/taxes/tax_types.php?",_("Taxes"));
143 $this->shortcut($local_path_to_root."/taxes/tax_groups.php?",_("Tax Groups"));
144 $this->shortcut($local_path_to_root."/admin/forms_setup.php?",_("Forms Setup"));
145 $this->shortcut($local_path_to_root."/admin/backups.php?",_("Backup and Restore"));
148 $this->shortcut($local_path_to_root."/admin/dashboard.php?sel_app=$sel_app", _("Dashboard"));
150 echo "</div>\n"; // fa-submenu
151 echo "<div class='clear'></div>\n";
152 echo "<div class='fa-content'>\n";
156 elseif ($title && !$no_menu && !$is_index)
158 echo "<center><table id='title'><tr><td width='100%' class='titletext'>$title</td>"
160 .(user_hints() ? "<span id='hints'></span>" : '')
162 ."</tr></table></center>";
166 function menu_footer($no_menu, $is_index)
168 global $path_to_root, $SysPrefs, $version, $db_connections;
169 include_once($path_to_root . "/includes/date_functions.inc");
172 echo "</div>\n"; // fa-content
173 echo "</div>\n"; // fa-body
176 echo "<div class='fa-footer'>\n";
177 if (isset($_SESSION['wa_current_user']))
179 echo "<span class='power'><a target='_blank' href='$SysPrefs->power_url'>$SysPrefs->power_by $version</a></span>\n";
180 echo "<span class='date'>".Today() . " " . Now()."</span>\n";
181 echo "<span class='date'>" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . "</span>\n";
182 echo "<span class='date'>" . $_SERVER['SERVER_NAME'] . "</span>\n";
183 echo "<span class='date'>" . $_SESSION["wa_current_user"]->name . "</span>\n";
184 echo "<span class='date'>" . _("Theme:") . " " . user_theme() . "</span>\n";
185 echo "<span class='date'>".show_users_online()."</span>\n";
187 echo "</div>\n"; // footer
189 echo "</div>\n"; // fa-main
192 function display_applications(&$waapp)
194 global $path_to_root;
196 $sel_app = $waapp->get_selected_application();
197 if (!$_SESSION["wa_current_user"]->check_application_access($sel_app))
199 if ($sel_app->id == "system")
200 $imgs2 = array("page_edit.png", "page_edit.png", "page_edit.png", "page_edit.png", "folder.gif");
202 $imgs2 = array("folder.gif", "report.png", "page_edit.png", "money.png", "folder.gif");
203 foreach ($sel_app->modules as $module)
205 if (!$_SESSION["wa_current_user"]->check_module_access($module))
208 echo "<table width='95%' align='center'><tr>";
209 echo "<td valign='top' class='menu_group'>";
210 echo "<table border=0 width='100%'>";
211 echo "<tr><td class='menu_group'>";
213 echo "</td></tr><tr>";
214 echo "<td width='50%' class='menu_group_items'>";
215 $img = "<img src='$path_to_root/themes/".user_theme()."/images/".$imgs2[$i]."' style='width:14px;height:14px;border:0;vertical-align:middle;padding-bottom:3px;'> ";
216 if ($_SESSION["language"]->dir == "rtl")
220 foreach ($module->lappfunctions as $appfunction)
222 if ($appfunction->label == "")
223 echo "<div class='empty'> <br></div>\n";
224 elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access))
225 echo "<div>".$img.menu_link($appfunction->link, $appfunction->label."</div>");
226 elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
227 echo "<div>".$img."<span class='inactive'>".access_string($appfunction->label, true)."</span></div>\n";
230 if (sizeof($module->rappfunctions) > 0)
232 echo "<td width='50%' class='menu_group_items'>";
233 foreach ($module->rappfunctions as $appfunction)
235 if ($appfunction->label == "")
236 echo "<div class='empty'> <br></div>\n";
237 elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access))
238 echo "<div>".$img.menu_link($appfunction->link, $appfunction->label."</div>");
239 elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
240 echo "<div>".$img."<span class='inactive'>".access_string($appfunction->label, true)."</span></div>\n";
244 echo "</tr></table></td></tr></table>\n";