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 ***********************************************************************/
13 If no context is set current page/menu screen is selected.
15 function help_url($context=null)
18 global $help_base_url, $help_context, $old_style_help;
20 $country = $_SESSION['language']->code;
25 $help_page_url = $context;
27 elseif (isset($help_context))
29 $help_page_url = $help_context;
32 $app = $_SESSION['sel_app'];
33 $help_page_url = $_SESSION['App']->applications[$app]->help_context;
38 $help_page_url = _($help_page_url);
41 $help_page_url = access_string($help_page_url, true);
43 return htmlspecialchars($help_base_url
44 .urlencode(strtr(ucwords($help_page_url), array(' '=>'', '/'=>'', '&'=>'And')))
45 .'&ctxhelp=1&lang='.$country);
48 function send_scripts()
50 global $js_static, $js_path, $js_userlib, $path_to_root, $go_debug;
53 foreach($js_static as $jsfile)
55 $fpath = company_path().'/js_cache/'.$jsfile;
56 // compress also static files
57 if (!file_exists($fpath) || $go_debug)
58 cache_js_file($fpath, file_get_contents($js_path.$jsfile));
60 $js .= '<script language="javascript" type="text/javascript" src="'.
61 $fpath . '"></script>';
63 foreach($js_userlib as $jsfile)
65 $js .= '<script language="javascript" type="text/javascript" src="'.
66 $jsfile . '"></script>';
72 function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="", $css='')
74 // titles and screen header
75 global $path_to_root, $def_app, $use_popup_windows, $help_base_url, $db_connections;
78 return; // just for speed up
80 // $jsext = substr_replace($_SERVER['PHP_SELF'], '.js', -4);
82 // if (file_exists($_SERVER['DOCUMENT_ROOT'].$jsext))
83 // add_js_ufile($jsext);
85 $theme = user_theme();
87 if ($help_base_url != null && $use_popup_windows && $js == '')
89 if (!function_exists('get_js_open_window'))
91 include_once($path_to_root.'/includes/ui/ui_view.inc');
93 add_js_source(get_js_open_window(900, 500));
102 if (isset($_SESSION["App"]) && is_object($_SESSION["App"]) && isset($_SESSION["App"]->selected_application) &&
103 $_SESSION["App"]->selected_application != "")
104 $sel_app = $_SESSION["App"]->selected_application;
105 elseif (isset($_SESSION["sel_app"]) && $_SESSION["sel_app"] != "")
106 $sel_app = $_SESSION["sel_app"];
108 $sel_app = user_startup_tab();
109 $_SESSION["sel_app"] = $sel_app;
111 // When startup tab for current user was set to already
112 // removed/inactivated extension module select Sales tab as default.
113 if (isset($_SESSION["App"]) && is_object($_SESSION["App"]))
114 $_SESSION["App"]->selected_application =
115 isset($_SESSION["App"]->applications[$sel_app]) ? $sel_app : 'orders';
117 $page_header_args = func_get_args();
118 if(isset($db_connections)) // skip before installation
119 hook_invoke_all('pre_header', $page_header_args);
121 $encoding = $_SESSION['language']->encoding;
123 if (!headers_sent()){
124 header("Content-type: text/html; charset=$encoding");
126 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
127 echo "<html dir='" . $_SESSION['language']->dir . "' >\n";
128 echo "<head profile=\"http://www.w3.org/2005/10/profile\"><title>$title</title>";
129 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') != -1) // IE 11 doesn't work with input file type in form.
130 echo "<meta http-equiv='X-UA-Compatible' content='IE=10'>\n";
131 echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding'>";
132 echo "<link href='$path_to_root/themes/$theme/default.css' rel='stylesheet' type='text/css'> \n";
133 echo "<link href='$path_to_root/themes/default/images/favicon.ico' rel='icon' type='image/x-icon'> \n";
135 echo '<link href="'.$css.'" rel="stylesheet" type="text/css">';
143 echo "<body onload=\"$onload\">";
145 include_once($path_to_root . "/themes/$theme/renderer.php");
146 $rend = new renderer();
147 $rend->menu_header($title, $no_menu, $is_index);