cleanup
[bMailZu.git] / lib / Template.class.php
bloba59d433f51e86df81cbc5a69f39dc36b18fada04
1 <?php
2 /**
3 * This file provides output functions
4 * @author Nick Korbel <lqqkout13@users.sourceforge.net>
5 * @version 10-21-04
6 * @package phpScheduleIt
8 * Copyright (C) 2003 - 2005 phpScheduleIt
9 * License: GPL, see LICENSE
11 /**
12 * Base directory of application
14 @define('BASE_DIR', dirname(__FILE__) . '/..');
15 /**
16 * Include Auth class
18 include_once('Auth.class.php');
20 /**
21 * Provides functions for outputting template HTML
23 class Template {
24 var $title;
25 var $link;
26 var $dir_path;
28 /**
29 * Set the page's title
30 * @param string $title title of page
31 * @param int $depth depth of the current page relative to phpScheduleIt root
33 function Template($title = '', $depth = 0) {
34 global $conf;
36 $this->title = (!empty($title)) ? $title : $conf['ui']['welcome'];
37 $this->dir_path = str_repeat('../', $depth);
38 $this->link = CmnFns::getNewLink();
39 //Auth::Auth(); // Starts session
42 /**
43 * Print all XHTML headers
44 * This function prints the HTML header code, CSS link, and JavaScript link
46 * DOCTYPE is XHTML 1.0 Transitional
47 * @param none
49 function printHTMLHeader() {
50 global $conf;
51 global $languages;
52 global $lang;
53 global $charset;
55 $path = $this->dir_path;
56 echo "<?xml version=\"1.0\" encoding=\"$charset\"?" . ">\n";
58 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
59 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
60 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$languages[$lang][2]?>" lang="<?=$languages[$lang][2]?>">
61 <head>
62 <title>
63 <?=$this->title?>
64 </title>
65 <meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>" />
66 <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
67 <script language="JavaScript" type="text/javascript" src="<?=$path?>functions.js"></script>
68 <!--<link href="<?=$path?>css.css" rel="stylesheet" type="text/css" />-->
69 <style type="text/css">
70 @import url(<?=$path?>css.css);
71 </style>
72 </head>
73 <body>
78 /**
79 * Print welcome header message
80 * This function prints out a table welcoming
81 * the user. It prints links to My Control Panel,
82 * Log Out, Help, and Email Admin.
83 * If the user is the admin, an admin banner will
84 * show up
85 * @global $conf
87 function printWelcome() {
88 global $conf;
90 // Print out logoImage if it exists
91 echo (!empty($conf['ui']['logoImage']))
92 ? '<div align="left"><img src="' . $conf['ui']['logoImage'] . '" alt="logo" vspace="5" /></div>'
93 : '';
95 <table width="100%" border="0" cellspacing="0" cellpadding="5" class="mainBorder">
96 <tr>
97 <td class="mainBkgrdClr">
98 <h4 class="welcomeBack">
99 <?=
100 translate('Welcome Back', array($_SESSION['sessionName'], 1));
101 // Notify if the person logged in is admin
102 echo (Auth::isMailAdmin() ? ' (' . translate('Administrator') . ')' : '');
104 </h4>
105 <!--<p>
106 <? $this->link->doLink($this->dir_path . 'index.php?logout=true', translate('Log Out')) ?>
108 <? $this->link->doLink($this->dir_path . 'summary.php', translate('My Control Panel')) ?>
109 </p>-->
110 </td>
111 <td class="mainBkgrdClr" valign="top">
112 <div align="right">
114 <?= translate_date('header', mktime());?>
115 </p>
116 <!--<p>
117 <? $this->link->doLink('javascript: help();', translate('Help')) ?>
118 </p>-->
119 </div>
120 </td>
121 </tr>
122 </table>
128 * Start main HTML table
129 * @param none
131 function startMain() {
133 <p>&nbsp;</p>
134 <table width="100%" border="0" cellspacing="0" cellpadding="10" style="border: solid #CCCCCC 1px;">
135 <tr>
136 <td bgcolor="#FAFAFA">
142 * End main HTML table
143 * @param none
145 function endMain() {
147 </td>
148 </tr>
149 </table>
155 * Print HTML footer
156 * This function prints out a tech email
157 * link and closes off HTML page
158 * @global $conf
160 function printHTMLFooter() {
161 global $conf;
163 <p align="center"><a href="http://www.mailzu.net"><?=$conf['app']['title']?> v<?=$conf['app']['version']?></a></p>
164 </body>
165 </html>
170 * Sets the link class variable to reference a new Link object
171 * @param none
173 function set_link() {
174 $this->link = CmnFns::getNewLink();
178 * Returns the link object
179 * @param none
180 * @return link object for this class
182 function get_link() {
183 return $this->link;
187 * Sets a new title for the template page
188 * @param string $title title of page
190 function set_title($title) {
191 $this->title = $title;