aaee7125ccff889b85c497fae961ef5b99e534f3
[fa-stable.git] / themes / default / renderer.php
1 <?php
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 ***********************************************************************/
12         class renderer
13         {
14                 function wa_header()
15                 {
16 //                      add_js_ufile("themes/default/renderer.js");
17                         page(_($help_context = "Main Menu"), false, true);
18                 }
19
20                 function wa_footer()
21                 {
22                         end_page(false, true);
23                 }
24
25                 function menu_header($title, $no_menu, $is_index)
26                 {
27                         global $path_to_root, $help_base_url, $db_connections;
28                         echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
29                         echo "<tr>\n";
30                         echo "<td colspan='2' rowspan='2'>\n";
31
32                         echo "<table class='main_page' border='0' cellpadding='0' cellspacing='0'>\n";
33                         echo "<tr>\n";
34                         echo "<td>\n";
35                         echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
36                         echo "<tr>\n";
37                         echo "<td class='quick_menu'>\n";
38                         if (!$no_menu)
39                         {
40                                 $applications = $_SESSION['App']->applications;
41                                 $local_path_to_root = $path_to_root;
42                                 $img = "<img src='$local_path_to_root/themes/default/images/login.gif' width='14' height='14' border='0' alt='"._('Logout')."'>&nbsp;&nbsp;";
43                                 $himg = "<img src='$local_path_to_root/themes/default/images/help.gif' width='14' height='14' border='0' alt='"._('Help')."'>&nbsp;&nbsp;";
44                                 $sel_app = $_SESSION['sel_app'];
45                                 echo "<table cellpadding=0 cellspacing=0 width='100%'><tr><td>";
46                                 echo "<div class=tabs>";
47                                 foreach($applications as $app)
48                                 {
49                                         $acc = access_string($app->name);
50                                         echo "<a ".($sel_app == $app->id ? 
51                                                 ("class='selected'") : "")
52                                                 ." href='$local_path_to_root/index.php?application=".$app->id
53                                                 ."'$acc[1]>" .$acc[0] . "</a>";
54                                 }
55                                 echo "</div>";
56                                 echo "</td></tr></table>";
57
58                                 echo "<table class=logoutBar>";
59                                 echo "<tr><td class=headingtext3>" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "</td>";
60                                 $indicator = "$path_to_root/themes/".user_theme(). "/images/ajax-loader.gif";
61                                 echo "<td class='logoutBarRight'><img id='ajaxmark' src='$indicator' align='center' style='visibility:hidden;'></td>";
62                                 echo "  <td class='logoutBarRight'><a href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a>&nbsp;&nbsp;&nbsp;\n";
63                                 echo "  <a href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>" . _("Change password") . "</a>&nbsp;&nbsp;&nbsp;\n";
64
65                                 if ($help_base_url != null)
66                                 {
67                                         echo "$himg<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url()."'>" . _("Help") . "</a>&nbsp;&nbsp;&nbsp;";
68                                 }
69                                 echo "$img<a href='$local_path_to_root/access/logout.php?'>" . _("Logout") . "</a>&nbsp;&nbsp;&nbsp;";
70                                 echo "</td></tr><tr><td colspan=3>";
71                                 echo "</td></tr></table>";
72                         }
73                         echo "</td></tr></table>";
74
75                         if ($no_menu)
76                                 echo "<br>";
77                         elseif ($title && !$is_index)
78                         {
79                                 echo "<center><table id='title'><tr><td width='100%' class='titletext'>$title</td>"
80                                 ."<td align=right>"
81                                 .(user_hints() ? "<span id='hints'></span>" : '')
82                                 ."</td>"
83                                 ."</tr></table></center>";
84                         }
85                 }
86
87                 function menu_footer($no_menu, $is_index)
88                 {
89                         global $version, $allow_demo_mode, $app_title, $power_url, 
90                                 $power_by, $path_to_root, $Pagehelp, $Ajax;
91                         include_once($path_to_root . "/includes/date_functions.inc");
92
93                         if ($no_menu == false)
94                         {
95                                 if ($is_index)
96                                         echo "<table class=bottomBar>\n";
97                                 else
98                                         echo "<table class=bottomBar2>\n";
99                                 echo "<tr>";
100                                 if (isset($_SESSION['wa_current_user'])) {
101                                         $phelp = implode('; ', $Pagehelp);
102                                         echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n";
103                                         $Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
104                                         echo "<td id='hotkeyshelp'>".$phelp."</td>";
105                                 }
106                                 echo "</tr></table>\n";
107                         }
108                         echo "</td></tr></table></td>\n";
109                         echo "</table>\n";
110                         if ($no_menu == false)
111                         {
112                                 echo "<table align='center' id='footer'>\n";
113                                 echo "<tr>\n";
114                                 echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffffff'>$app_title $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
115                                 echo "</tr>\n";
116                                 echo "<tr>\n";
117                                 echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffff00'>$power_by</font></a></td>\n";
118                                 echo "</tr>\n";
119                                 if ($allow_demo_mode==true)
120                                 {
121                                         echo "<tr>\n";
122                                         //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&amp;type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='middle' /></a></div></td>\n";
123                                         echo "</tr>\n";
124                                 }
125                                 echo "</table><br><br>\n";
126                         }
127                 }
128
129                 function display_applications(&$waapp)
130                 {
131                         global $path_to_root;
132
133                         $selected_app = $waapp->get_selected_application();
134
135                         $img = "<img src='$path_to_root/themes/default/images/right.gif' style='vertical-align:middle;' width='17' height='17' border='0'>&nbsp;&nbsp;";
136                         foreach ($selected_app->modules as $module)
137                         {
138                                 // image
139                                 echo "<tr>";
140                                 // values
141                                 echo "<td valign='top' class='menu_group'>";
142                                 echo "<table border=0 width='100%'>";
143                                 echo "<tr><td class='menu_group'>";
144                                 echo $module->name;
145                                 echo "</td></tr><tr>";
146                                 echo "<td class='menu_group_items'>";
147
148                                 foreach ($module->lappfunctions as $appfunction)
149                                 {
150                                         if ($appfunction->label == "")
151                                                 echo "&nbsp;<br>";
152                                         elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) 
153                                         {
154                                                         echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
155                                         }
156                                         else 
157                                         {
158                                                         echo $img.'<span class="inactive">'
159                                                                 .access_string($appfunction->label, true)
160                                                                 ."</span><br>\n";
161                                         }
162                                 }
163                                 echo "</td>";
164                                 if (sizeof($module->rappfunctions) > 0)
165                                 {
166                                         echo "<td width='50%' class='menu_group_items'>";
167                                         foreach ($module->rappfunctions as $appfunction)
168                                         {
169                                                 if ($appfunction->label == "")
170                                                         echo "&nbsp;<br>";
171                                                 elseif ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) 
172                                                 {
173                                                                 echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
174                                                 }
175                                                 else 
176                                                 {
177                                                                 echo $img.'<span class="inactive">'
178                                                                         .access_string($appfunction->label, true)
179                                                                         ."</span><br>\n";
180                                                 }
181                                         }
182                                         echo "</td>";
183                                 }
184
185                                 echo "</tr></table></td></tr>";
186                         }
187
188                         echo "</table>";
189                 }
190         }
191
192 ?>