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