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