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