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