made a copy
[atutor.git] / themes / greenmin / include / header.tmpl.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id: header.tmpl.php 3825 2005-03-11 15:35:51Z joel $
14 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 /* available header.tmpl.php variables:
16  * $this->lang_code                     the ISO language code
17  * SITE_NAME                            the site name from the config file
18  * $this->page_title            the name of this page to use in the <title>
19  * $this->lang_charset          the ISO language character set
20  * $this->content_base_href     the <base href> to use for this page
21  * $this->base_path                     the absolute path to this atutor installation
22  * $this->rtl_css                       if set, the path to the RTL style sheet
23  * $this->banner_style          -deprecated-
24  * $this->theme                         the directory name of the current theme
25  * $this->base_href                     the full url to this atutor installation
26  * $this->onload                        javascript onload() calls
27  * $this->img                           the absolute path to this theme's images/ directory
28  * $this->sequence_links        associative array of 'previous', 'next', and/or 'resume' links
29  * $this->path                          associative array of path to this page: aka bread crumbs
30  * $this->rel_url                       the relative url from the installation root to this page
31  * $this->nav_courses           associative array of this user's enrolled courses
32  * $this->section_title         the title of this section (course, public, admin, my start page)
33  * $this->top_level_pages       associative array of the top level navigation
34  * $this->current_top_level_page        the full path to the current top level page with file name
35  * $this->sub_level_pages                       associate array of sub level navigation
36  * $this->back_to_page                          if set, the path and file name to the part of this page (if parent is not a top level nav)
37  * $this->current_sub_level_page        the full path to the current sub level page with file name
38  * $this->guide                         the full path and file name to the guide page
39  * ======================================
40  * top_level_pages           array(array('url', 'title'))     the top level pages. ATutor default creates tabs.
41  * section_title             string                           the name of the current section. either name of the course, administration, my start page, etc.
42  * page_title                string                           the title of the current page.
43  * path                      array(array('url', 'title'))     the path to the current page.
44  * back_to_page              array('url', 'title')            the link back to the part of the current page, if needed.
45  * current_top_level_page    string                           full url to the current top level page in "top_leve_pages"
46  * current_sub_level_page    string                           full url to the current sub level page in the "sub_level_pages"
47  * sub_level_pages           array(array('url', 'title'))     the sub level pages.
48  */
49
50 // will have to be moved to the header.inc.php
51 global $system_courses, $_custom_css;
52
53 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
54
55 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $this->lang_code; ?>"> 
56
57 <head>
58         <title><?php echo SITE_NAME; ?> : <?php echo $this->page_title; ?></title>
59         <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $this->lang_charset; ?>" />
60         <meta name="Generator" content="ATutor - Copyright 2005 by http://atutor.ca" />
61         <base href="<?php echo $this->content_base_href; ?>" />
62         <link rel="shortcut icon" href="<?php echo $this->base_path; ?>favicon.ico" type="image/x-icon" />
63         <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/print.css" type="text/css" media="print" />
64         <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/styles.css" type="text/css" />
65         <!--[if IE]>
66           <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/ie_styles.css" type="text/css" />
67         <![endif]-->
68         <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/forms.css" type="text/css" />
69         <?php echo $this->rtl_css; ?>
70         <?php if ($system_courses[$_SESSION['course_id']]['rss']): ?>
71         <link rel="alternate" type="application/rss+xml" title="<?php echo SITE_NAME; ?> - RSS 2.0" href="<?php echo $this->base_href; ?>get_rss.php?<?php echo $_SESSION['course_id']; ?>-2" />
72         <link rel="alternate" type="application/rss+xml" title="<?php echo SITE_NAME; ?> - RSS 1.0" href="<?php echo $this->base_href; ?>get_rss.php?<?php echo $_SESSION['course_id']; ?>-1" />
73         <?php endif; ?>
74         <script src="<?php echo $this->base_path; ?>jscripts/infusion/InfusionAll.js" type="text/javascript"></script>
75         <?php echo $this->custom_css; ?>
76 </head>
77 <body onload="<?php echo $this->onload; ?>">
78 <script language="javascript" type="text/javascript">
79 //<!--
80 var newwindow;
81 function poptastic(url) {
82         newwindow=window.open(url,'popup','height=600,width=600,scrollbars=yes,resizable=yes');
83         if (window.focus) {newwindow.focus()}
84 }
85
86 function getexpirydate(nodays){
87         var UTCstring;
88         Today = new Date();
89         nomilli=Date.parse(Today);
90         Today.setTime(nomilli+nodays*24*60*60*1000);
91         UTCstring = Today.toUTCString();
92         return UTCstring;
93 }
94
95 function setcookie(name,value,duration){
96         cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
97         document.cookie=cookiestring;
98         if(!getcookie(name)){
99                 return false;
100         } else {
101                 return true;
102         }
103 }
104
105 function getcookie(cookiename) {
106         var cookiestring=""+document.cookie;
107         var index1=cookiestring.indexOf(cookiename);
108         if (index1==-1 || cookiename=="") return ""; 
109         var index2=cookiestring.indexOf(';',index1);
110         if (index2==-1) index2=cookiestring.length; 
111         return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
112 }
113
114 function setDisplay(objId) {
115         var toc = document.getElementById(objId);
116
117         var state = getcookie(objId);
118         if (document.getElementById(objId) && state && (state == 'none')) {
119                 toggleToc(objId);
120         }
121 }
122
123
124 function setstates() {
125         return;
126         var objId = "side-menu";
127         var state = getcookie(objId);
128         if (document.getElementById(objId) && state && (state == 'none')) {
129                 toggleToc(objId);
130         }
131
132         var objId = "toccontent";
133         var state = getcookie(objId);
134         if (document.getElementById(objId) && state && (state == 'none')) {
135                 toggleToc(objId);
136         }
137
138 }
139
140 function showTocToggle(objId, show, hide, key, selected) {
141         if(document.getElementById) {
142                 if (key) {
143                         var accesskey = " accesskey='" + key + "' title='"+ show + "/" + hide + " Alt - "+ key +"'";
144                 } else {
145                         var accesskey = "";
146                 }
147
148                 if (selected == 'hide') {
149                         document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +
150                         '<span id="' + objId + 'showlink" style="display:none;">' + show + '</span>' +
151                         '<span id="' + objId + 'hidelink">' + hide + '</span>'  + '</a>');
152                 } else {
153                         document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +
154                         '<span id="' + objId + 'showlink">' + show + '</span>' +
155                         '<span id="' + objId + 'hidelink" style="display:none;">' + hide + '</span>'    + '</a>');
156                 }
157         }
158 }
159
160 function toggleToc(objId) {
161         var toc = document.getElementById(objId);
162         if (toc == null) {
163                 return;
164         }
165         var showlink=document.getElementById(objId + 'showlink');
166         var hidelink=document.getElementById(objId + 'hidelink');
167         if (hidelink.style.display == 'none') {
168                 document.getElementById('contentcolumn').id="contentcolumn_shiftright";
169                 toc.style.display = '';
170                 hidelink.style.display='';
171                 showlink.style.display='none';
172         } else {
173                 document.getElementById('contentcolumn_shiftright').id="contentcolumn";
174                 toc.style.display = 'none';
175                 hidelink.style.display='none';
176                 showlink.style.display='';
177         }
178         setcookie(objId, toc.style.display, 1);
179 }
180 //-->
181 </script>
182 <!-- section title -->
183 <div><a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); ?>#content" accesskey="c"><img src="<?php echo $this->base_path; ?>images/clr.gif" height="1" width="1" border="0" alt="<?php echo _AT('goto_content'); ?> ALT+c" /></a>                <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); ?>#menu"  accesskey="m"><img src="<?php echo $this->base_path; ?>images/clr.gif" height="1" width="1" border="0" alt="<?php echo _AT('goto_menu'); ?> ALT+m" /></a><h1 id="section-title"><?php echo $this->section_title; ?><?php if (($_SESSION['course_id'] > 0) && ($_SESSION['enroll'] == AT_ENROLL_NO)) : ?>
184                 - <small><a href="<?php echo $this->base_path; ?>enroll.php?course=<?php echo $_SESSION['course_id']; ?>"><?php echo _AT('enroll_me'); ?></a></small>
185         <?php endif; ?></h1>
186 </div>
187
188 <!-- top help/search/login links -->
189 <div style="float:right;" id="top-links">
190 <!-- back to start page -->
191         <?php if (isset($_SESSION['member_id']) && $_SESSION['member_id']): ?>
192                 <!-- start the jump menu -->
193                 <?php if (empty($_GET)): ?>
194                         <form method="post" action="<?php echo $this->base_path; ?>bounce.php?p=<?php echo urlencode($this->rel_url); ?>" target="_top">
195                 <?php else: ?>
196                         <form method="post" action="<?php echo $this->base_path; ?>bounce.php" target="_top">
197                 <?php endif; ?>
198                 <label for="jumpmenu" accesskey="j"></label>
199                         <select name="course" id="jumpmenu" title="<?php echo _AT('jump'); ?>:  Alt-j">                                                 
200                                 <option value="0"><?php echo _AT('my_start_page'); ?></option>
201                                 <optgroup label="<?php echo _AT('courses_below'); ?>">
202                                         <?php foreach ($this->nav_courses as $this_course_id => $this_course_title): ?>
203                                                 <option value="<?php echo $this_course_id; ?>"><?php echo $this_course_title; ?></option>
204                                         <?php endforeach; ?>
205                                 </optgroup>
206                         </select> <input type="submit" name="jump" value="<?php echo _AT('jump'); ?>" id="jump-button" /> &nbsp; </form>
207                 <!-- /end the jump menu -->
208                 <?php if ($_SESSION['is_super_admin']): ?>
209                         <img src="<?php echo $this->img; ?>linkTransparent.gif" alt="" /> <a href="<?php echo $this->base_path; ?>bounce.php?admin"><?php echo _AT('return_to_admin_area'); ?></a> | 
210                 <?php endif; ?>
211
212                 <?php if ($_SESSION['course_id'] > -1): ?>
213                         <?php if (get_num_new_messages()): ?>
214                                 <img src="<?php echo $this->img; ?>linkTransparent.gif" alt="" /> <a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?> (<?php echo get_num_new_messages(); ?>)</a>
215                         <?php else: ?>
216                                 <img src="<?php echo $this->img; ?>linkTransparent.gif" alt="" /> <a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?></a>
217                         <?php endif; ?>
218                 <?php endif; ?>
219         <?php endif; ?>
220
221         <img src="<?php echo $this->img; ?>linkTransparent.gif" alt="" /> <a href="<?php echo $this->base_path; ?>search.php"><?php echo _AT('search'); ?></a> <img src="<?php echo $this->img; ?>linkTransparent.gif" alt="" /> <a href="<?php echo $this->base_path; ?>help/index.php"><?php echo _AT('help'); ?></a>
222 </div>
223 <br />
224 <div id="topnavlistcontainer">
225 <!-- the main navigation. in our case, tabs -->
226         <ul id="topnavlist">
227                 <?php foreach ($this->top_level_pages as $page): ?>
228                         <?php ++$accesscounter; $accesscounter = ($accesscounter == 10 ? 0 : $accesscounter); ?>
229                         <?php $accesskey_text = ($accesscounter < 10 ? 'accesskey="'.$accesscounter.'"' : ''); ?>
230                         <?php $accesskey_title = ($accesscounter < 10 ? ' Alt+'.$accesscounter : ''); ?>
231                         <?php if ($page['url'] == $this->current_top_level_page): ?>
232                                 <li><a href="<?php echo $page['url']; ?>" <?php echo $accesskey_text; ?> title="<?php echo $page['title'] . $accesskey_title; ?>" class="active"><?php echo $page['title']; ?></a></li>
233                         <?php else: ?>
234                                 <li><a href="<?php echo $page['url']; ?>" <?php echo $accesskey_text; ?> title="<?php echo $page['title'] . $accesskey_title; ?>"><?php echo $page['title']; ?></a></li>
235                         <?php endif; ?>
236                         <?php $accesscounter = ($accesscounter == 0 ? 11 : $accesscounter); ?>
237                 <?php endforeach; ?>
238         </ul>
239 </div>
240 <!-- the sub navigation -->
241 <div style="float: right; padding-top: 5px; padding-right: 5px; font-size:0.85em; text-transform: lowercase;" id="suv-nav-logout">
242         <?php if ($_SESSION['valid_user']): ?>                                  
243                 <strong><?php echo get_display_name($_SESSION['member_id']); ?></strong> &nbsp; <img src="<?php echo $this->img; ?>/linkOpaque.gif" alt="" /> <a href="<?php echo $this->base_path; ?>logout.php"><?php echo _AT('logout'); ?></a>
244         <?php else: ?>
245                  <img src="<?php echo $this->img; ?>/linkOpaque.gif" alt="" /> <a href="<?php echo $this->base_path; ?>login.php?course=<?php echo $_SESSION['course_id']; ?>"><?php echo _AT('login'); ?></a> &nbsp; <img src="<?php echo $this->img; ?>/linkOpaque.gif" alt="" /> <a href="<?php echo $this->base_path; ?>registration.php"><?php echo _AT('register'); ?></a>
246         <?php endif; ?>
247 </div>
248
249 <?php if ($this->sub_level_pages): ?>
250         <div id="sub-navigation">
251                 <?php if (isset($this->back_to_page)): ?>
252                         <a href="<?php echo $this->back_to_page['url']; ?>" id="back-to"><?php echo _AT('back_to').' '.$this->back_to_page['title']; ?></a> | 
253                 <?php endif; ?>
254
255                 <?php $num_pages = count($this->sub_level_pages); ?>
256                 <?php for ($i=0; $i<$num_pages; $i++): ?>
257                         <?php if ($this->sub_level_pages[$i]['url'] == $this->current_sub_level_page): ?>
258                                 <strong><?php echo $this->sub_level_pages[$i]['title']; ?></strong>
259                         <?php else: ?>
260                                 <a href="<?php echo $this->sub_level_pages[$i]['url']; ?>"><?php echo $this->sub_level_pages[$i]['title']; ?></a>
261                         <?php endif; ?>
262                         <?php if ($i < $num_pages-1): ?>
263                                 |
264                         <?php endif; ?>
265                 <?php endfor; ?>
266         </div>
267 <?php else: ?>
268         <div id="sub-navigation">
269                 &nbsp;
270         </div>
271 <?php endif; ?>
272
273 <?php if ($_SESSION["prefs"]["PREF_SHOW_BREAD_CRUMBS"]) { ?>
274 <!-- the bread crumbs -->
275 <div id="breadcrumbs">
276         <?php foreach ($this->path as $page): ?>
277                 <a href="<?php echo $page['url']; ?>"><?php echo htmlspecialchars($page['title'], ENT_COMPAT, "UTF-8"); ?></a> > 
278         <?php endforeach; ?> <?php echo $this->page_title; ?>
279 </div>
280 <?php } ?>
281
282 <!-- Extra div tag for IE fix in dealing with position:absolute (used by side menu)-->
283 <div>
284
285 <div id="contentwrapper">
286 <div id="contentcolumn"
287         <?php if (($_SESSION['course_id'] <= 0) && !$this->side_menu): ?>
288                 style="margin-right:0px;width:99%;"
289         <?php endif; ?>
290         >
291
292 <!-- the page title -->
293
294                 <?php if ($this->guide && ($_SESSION["prefs"]["PREF_SHOW_GUIDE"] || $_SESSION["course_id"] == "-1")): ?>
295         <div style="text-align: right; padding-bottom: 10px; padding-right: 10px; float:right ; margin-top: 10px; padding-right: 5px; font-size:0.95em;">
296                         <a href="<?php echo $this->guide; ?>" id="guide" onclick="poptastic('<?php echo $this->guide; ?>'); return false;" target="_new"><em><?php echo $this->page_title; ?></em></a>
297         </div>
298                 <?php endif; ?>
299         <div style="text-align: right; padding-bottom: 10px; padding-right: 10px; float:left ; margin-top: 10px; padding-right: 5px; font-size:0.95em;">
300
301                 <?php if ($_SESSION['course_id'] > 0 && $system_courses[$_SESSION['course_id']]['side_menu']): ?>
302                         <script type="text/javascript" language="javascript">
303                         //<![CDATA[
304                         var state = getcookie("side-menu");
305                         if (state && (state == 'none')) {
306                                 showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
307                         } else {
308                                 document.getElementById('contentcolumn').id="contentcolumn_shiftright";
309                                 showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "hide");
310                         }
311                         //]]>
312                         </script>
313                 <?php endif; ?>
314         </div>
315
316         <div  id="sequence-links">
317         <?php if ($_SESSION["prefs"]["PREF_SHOW_NEXT_PREVIOUS_BUTTONS"]) { ?>
318                 <?php if ($this->sequence_links['resume']): ?>
319                                 <a style="color:white;" href="<?php echo $this->sequence_links['resume']['url']; ?>" accesskey="."><img src="<?php echo $this->img; ?>resume.gif" border="0" title="<?php echo _AT('resume').': '.$this->sequence_links['resume']['title']; ?> Alt+." alt="<?php echo $this->sequence_links['resume']['title']; ?> Alt+." class="img-size-ascdesc" /></a>
320                 <?php else:
321                         if ($this->sequence_links['previous']): ?>
322                                 <a href="<?php echo $this->sequence_links['previous']['url']; ?>" title="<?php echo _AT('previous_topic').': '. $this->sequence_links['previous']['title']; ?> Alt+," accesskey=","><img src="<?php echo $this->img; ?>previous.gif" border="0" alt="<?php echo _AT('previous_topic').': '. $this->sequence_links['previous']['title']; ?> Alt+," class="img-size-ascdesc" /></a>
323                         <?php endif;
324                         if ($this->sequence_links['next']): ?>
325                                 <a href="<?php echo $this->sequence_links['next']['url']; ?>" title="<?php echo _AT('next_topic').': '.$this->sequence_links['next']['title']; ?> Alt+." accesskey="."><img src="<?php echo $this->img; ?>next.gif" border="0" alt="<?php echo _AT('next_topic').': '.$this->sequence_links['next']['title']; ?> Alt+." class="img-size-ascdesc" /></a>
326                         <?php endif; ?>
327                 <?php endif; ?>
328         <?php } ?>
329                 &nbsp;
330         </div>
331
332         <!-- the page title -->
333         <h2 class="page-title"><?php echo $this->page_title; ?></h2>
334
335 <a name="content"></a>
336 <?php global $msg; $msg->printAll(); ?>