Copyright notes at top op every source file
[fa-stable.git] / themes / default / renderer.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU Affero General Public License,
5         AGPL, as published by the Free Software Foundation, either version 
6         3 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/agpl-3.0.html>.
11 ***********************************************************************/
12         class renderer
13         {
14                 function wa_header()
15                 {
16                         page(_("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, $applications, $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                                 $local_path_to_root = $path_to_root;
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 => $name)
48                                 {
49                                         $acc = access_string($name);
50                                         echo "<a ".($sel_app == $app ? "class='selected' " : "").
51                                         "href='$local_path_to_root/index.php?application=".$app.
52                                                 SID ."'$acc[1]>" .$acc[0] . "</a>";
53                                 }
54                                 echo "</div>";
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 href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a>&nbsp;&nbsp;&nbsp;\n";
62                                 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";
63
64                                 if ($help_base_url != null)
65                                 {
66                                         echo "<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url($title, $sel_app)."'>" . _("Help") . "</a>&nbsp;&nbsp;&nbsp;";
67                                 }
68                                 echo "<a 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
73                         if ($title && !$no_menu && !$is_index)
74                         {
75                                 echo "<center><table width='100%'><tr><td width='100%' class='titletext'>$title</td>"
76                                 ."<td align=right>"
77                                 .(user_hints() ? "<span id='hints'></span>" : '')
78                                 ."</td>"
79                                 ."</tr></table></center>";
80                         }
81
82                         if (!$is_index)
83                                 echo "<br>";
84
85                 }
86
87                 function menu_footer($no_menu, $is_index)
88                 {
89                         global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root;
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                                         echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n";
101                                 echo "</tr></table>\n";
102                         }
103                         echo "</td></tr></table></td>\n";
104                         echo "</table>\n";
105                         if ($no_menu == false)
106                         {
107                                 echo "<table align='center' id='footer'>\n";
108                                 echo "<tr>\n";
109                                 echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffffff'>$app_title $version - " . _("Theme:") . " " . user_theme() . "</font></a></td>\n";
110                                 echo "</tr>\n";
111                                 echo "<tr>\n";
112                                 echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffff00'>$power_by</font></a></td>\n";
113                                 echo "</tr>\n";
114                                 if ($allow_demo_mode==true)
115                                 {
116                                         echo "<tr>\n";
117                                         //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";
118                                         echo "</tr>\n";
119                                 }
120                                 echo "</table><br><br>\n";
121                         }
122                 }
123
124                 function display_applications(&$waapp)
125                 {
126
127                         $selected_app = $waapp->get_selected_application();
128
129                         foreach ($selected_app->modules as $module)
130                         {
131                                 // image
132                                 echo "<tr>";
133                                 // values
134                                 echo "<td valign='top' class='menu_group'>";
135                                 echo "<table border=0 width='100%'>";
136                                 echo "<tr><td class='menu_group'>";
137                                 echo $module->name;
138                                 echo "</td></tr><tr>";
139                                 echo "<td class='menu_group_items'>";
140
141                                 foreach ($module->lappfunctions as $appfunction)
142                                 {
143                                         if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) 
144                                         {
145                                                 $lnk = access_string($appfunction->label);
146                                                 echo "<a href='$appfunction->link'$lnk[1]>$lnk[0]</a><br>";
147                                         }
148                                 }
149                                 echo "</td>";
150                                 if (sizeof($module->rappfunctions) > 0)
151                                 {
152                                         echo "<td width='50%' class='menu_group_items'>";
153                                         foreach ($module->rappfunctions as $appfunction)
154                                         {
155                                                 if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) 
156                                                 {
157                                                         $lnk = access_string($appfunction->label);
158                                                         echo "<a href='$appfunction->link'$lnk[1]>$lnk[0]</a><br>";
159                                                 }
160                                         }
161                                         echo "</td>";
162                                 }
163
164                                 echo "</tr></table></td></tr>";
165                         }
166
167                         echo "</table>";
168                 }
169         }
170
171 ?>