2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto */
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:51 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->icon the path to a course icon
24 * $this->banner_style -deprecated-
25 * $this->theme the directory name of the current theme
26 * $this->base_href the full url to this atutor installation
27 * $this->onload javascript onload() calls
28 * $this->img the absolute path to this theme's images/ directory
29 * $this->sequence_links associative array of 'previous', 'next', and/or 'resume' links
30 * $this->path associative array of path to this page: aka bread crumbs
31 * $this->rel_url the relative url from the installation root to this page
32 * $this->nav_courses associative array of this user's enrolled courses
33 * $this->section_title the title of this section (course, public, admin, my start page)
34 * $this->top_level_pages associative array of the top level navigation
35 * $this->current_top_level_page the full path to the current top level page with file name
36 * $this->sub_level_pages associate array of sub level navigation
37 * $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)
38 * $this->current_sub_level_page the full path to the current sub level page with file name
39 * $this->guide the full path and file name to the guide page
40 * ======================================
41 * top_level_pages array(array('url', 'title')) the top level pages. ATutor default creates tabs.
42 * section_title string the name of the current section. either name of the course, administration, my start page, etc.
43 * page_title string the title of the current page.
44 * path array(array('url', 'title')) the path to the current page.
45 * back_to_page array('url', 'title') the link back to the part of the current page, if needed.
46 * current_top_level_page string full url to the current top level page in "top_leve_pages"
47 * current_sub_level_page string full url to the current sub level page in the "sub_level_pages"
48 * sub_level_pages array(array('url', 'title')) the sub level pages.
51 // will have to be moved to the header.inc.php
52 global $system_courses, $_custom_css, $db, $_base_path, $contentManager;
54 // 1. any click on the page closes the content menu but the link "content_link" itself
55 // 2. the click on link "content_link" opens the content menu
57 jQuery(document).click(function () {jQuery('#content').hide('slow');});
59 jQuery('#content_link').click(function(e) {
61 jQuery('#content').slideToggle();
65 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
67 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $this->lang_code; ?>">
70 <title><?php echo SITE_NAME; ?> : <?php echo $this->page_title; ?></title>
71 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $this->lang_charset; ?>" />
72 <meta name="Generator" content="ATutor - Copyright 2005 by http://atutor.ca" />
73 <base href="<?php echo $this->content_base_href; ?>" />
74 <link rel="shortcut icon" href="<?php echo $this->base_path; ?>favicon.ico" type="image/x-icon" />
75 <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/print.css" type="text/css" media="print" />
76 <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/styles.css" type="text/css" />
78 <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/ie_styles.css" type="text/css" />
80 <link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/forms.css" type="text/css" />
81 <?php echo $this->rtl_css; ?>
82 <?php if (isset($this->course_id) && $system_courses[$this->course_id]['rss']): ?>
83 <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 $this->course_id; ?>-2" />
84 <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 $this->course_id; ?>-1" />
86 <script src="<?php echo $this->base_path; ?>jscripts/infusion/InfusionAll.js" type="text/javascript"></script>
87 <script src="<?php echo $this->base_path; ?>jscripts/infusion/jquery.autoHeight.js" type="text/javascript"></script>
88 <script language="javascript" type="text/javascript">
93 <script src="<?php echo $this->base_path; ?>jscripts/ATutor.js" type="text/javascript"></script>
94 <?php echo $this->custom_css; ?>
95 <style id="pref_style" type="text/css"></style>
97 <body onload="<?php echo $this->onload; ?>">
98 <script language="javascript" type="text/javascript">
100 function getexpirydate(nodays){
103 nomilli=Date.parse(Today);
104 Today.setTime(nomilli+nodays*24*60*60*1000);
105 UTCstring = Today.toUTCString();
109 function setcookie(name,value,duration){
110 cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
111 document.cookie=cookiestring;
112 if(!getcookie(name)){
119 function getcookie(cookiename) {
120 var cookiestring=""+document.cookie;
121 var index1=cookiestring.indexOf(cookiename);
122 if (index1==-1 || cookiename=="") return "";
123 var index2=cookiestring.indexOf(';',index1);
124 if (index2==-1) index2=cookiestring.length;
125 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
128 function setDisplay(objId) {
129 var toc = document.getElementById(objId);
131 var state = getcookie(objId);
132 if (document.getElementById(objId) && state && (state == 'none')) {
138 function showTocToggle(objId, show, hide, key, selected) {
139 if(document.getElementById) {
141 var accesskey = " accesskey='" + key + "' title='"+ show + "/" + hide + " Alt - "+ key +"'";
146 if (selected == 'hide') {
147 document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +
148 '<span id="' + objId + 'showlink" style="display:none;">' + show + '</span>' +
149 '<span id="' + objId + 'hidelink">' + hide + '</span>' + '</a>');
151 document.writeln('<a href="javascript:toggleToc(\'' + objId + '\')" ' + accesskey + '>' +
152 '<span id="' + objId + 'showlink">' + show + '</span>' +
153 '<span id="' + objId + 'hidelink" style="display:none;">' + hide + '</span>' + '</a>');
158 function toggleToc(objId) {
159 var toc = document.getElementById(objId);
163 var showlink=document.getElementById(objId + 'showlink');
164 var hidelink=document.getElementById(objId + 'hidelink');
166 if (hidelink.style.display == 'none') {
167 document.getElementById('contentcolumn').id="contentcolumn_shiftright";
168 jQuery("[id="+objId+"]").slideDown("slow");
169 hidelink.style.display='';
170 showlink.style.display='none';
172 document.getElementById('contentcolumn_shiftright').id="contentcolumn";
173 jQuery("[id="+objId+"]").slideUp("slow");
174 hidelink.style.display='none';
175 showlink.style.display='';
177 setcookie(objId, hidelink.style.display, 1);
180 // toggle content folder in side menu "content navigation"
181 function toggleFolder(cid)
183 if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
184 jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
185 jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
186 setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
189 jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
190 jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
191 setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
194 jQuery("#folder"+cid).slideToggle();
197 // toggle elements in side menu
198 function elementToggle(elem, title)
200 element_collapse_icon = "<?php echo $_base_path; ?>images/mswitch_minus.gif";
201 element_expand_icon = "<?php echo $_base_path; ?>images/mswitch_plus.gif";
203 if (jQuery(elem).attr("src") == element_collapse_icon) {
204 jQuery(elem).attr("src", element_expand_icon);
205 jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
206 jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
207 setcookie("m_"+title, 0, 1);
210 jQuery(elem).attr("src", element_collapse_icon);
211 jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
212 jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
213 jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
214 setcookie("m_"+title, null, 1);;
217 jQuery(elem).parent().next().slideToggle();
220 function printSubmenuHeader(title)
222 if (getcookie("m_"+title) == "0")
224 image = "<?php echo $_base_path?>images/mswitch_plus.gif";
225 alt_text = "<?php echo _AT('show'); ?> " + title;
229 image = "<?php echo $_base_path?>images/mswitch_minus.gif";
230 alt_text = "<?php echo _AT('hide'); ?> " + title;
233 document.writeln('<h4 class="box">'+
234 ' <input src="'+image+'"' +
235 ' onclick="elementToggle(this, \''+title+'\'); return false;"' +
236 ' alt="'+ alt_text + '" ' +
237 ' title="'+ alt_text + '"' +
238 ' style="float:right" type="image" /> '+ title +
243 <div class="page_wrapper">
245 <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); ?>#content" accesskey="c">
246 <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>
248 <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); ?>#menu<?php echo $_REQUEST['cid'] ?>" 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>
249 <div id="top-links"> <!-- top help/search/login links -->
250 <?php if (isset($_SESSION['member_id']) && $_SESSION['member_id']): ?>
251 <?php if(!$this->just_social): ?>
252 <!-- start the jump menu -->
253 <?php if (empty($_GET)): ?>
254 <form method="post" action="<?php echo $this->base_path; ?>bounce.php?p=<?php echo urlencode($this->rel_url); ?>" target="_top">
256 <form method="post" action="<?php echo $this->base_path; ?>bounce.php" target="_top">
258 <label for="jumpmenu" accesskey="j"></label>
259 <select name="course" id="jumpmenu" title="<?php echo _AT('jump'); ?>: Alt-j">
260 <option value="0"><?php echo _AT('my_start_page'); ?></option>
261 <optgroup label="<?php echo _AT('courses_below'); ?>">
262 <?php foreach ($this->nav_courses as $this_course_id => $this_course_title): ?>
263 <option value="<?php echo $this_course_id; ?>"><?php echo $this_course_title; ?></option>
266 </select> <input type="submit" name="jump" value="<?php echo _AT('jump'); ?>" class="button" /> </form>
267 <!-- /end the jump menu -->
270 <?php if ($_SESSION['is_super_admin']): ?>
271 <a href="<?php echo $this->base_path; ?>bounce.php?admin"><?php echo _AT('return_to_admin_area'); ?></a> |
274 <?php if ($this->course_id > -1): ?>
275 <?php if (get_num_new_messages()): ?>
276 <a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?> (<?php echo get_num_new_messages(); ?>)</a>
278 <a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?></a>
282 <?php if(!$this->just_social): ?>
283 <a href="<?php echo $this->base_path; ?>search.php"><?php echo _AT('search'); ?></a>
285 <a href="<?php echo $this->base_path; ?>help/index.php"><?php echo _AT('help'); ?></a>
287 <?php if (!empty($this->icon)) { // if a course icon is available, display it here. ?>
288 <a href="<?php echo $this->base_path.url_rewrite('index.php'); ?>"><img src="<?php echo $this->icon; ?>" class="headicon" alt="<?php echo _AT('home'); ?>" /></a>
294 // If there is a custom course banner in the file manager called banner.html, display it here
295 @readfile(AT_CONTENT_DIR . $this->course_id.'/banner.txt');
298 and example banner.html file might look like:
299 <div style="width: 760px; height: 42px; background: white;"><img src="http://[mysite]/atutor15rc3/banners/kart-camb.jpg"></div>
303 <!-- section title -->
304 <?php if (isset($_SESSION['valid_user']) && $_SESSION['valid_user']):
305 echo '<div style="font-size:small;font-weight:bold;padding-left:1em;color:white;">'.stripslashes(SITE_NAME).'</div>';
309 <h1 id="section-title"><?php echo $this->section_title; ?>
310 <?php if ((isset($this->course_id) && $this->course_id > 0) && ($_SESSION['enroll'] == AT_ENROLL_NO)) : ?>
311 - <small><a href="<?php echo $this->base_path; ?>enroll.php?course=<?php echo $this->course_id; ?>"><?php echo _AT('enroll_me'); ?></a></small>
317 <div id="topnavlistcontainer">
318 <!-- the main navigation. in our case, tabs -->
320 <?php $accesscounter = 0; //initialize ?>
321 <?php foreach ($this->top_level_pages as $page): ?>
322 <?php ++$accesscounter; $accesscounter = ($accesscounter == 10 ? 0 : $accesscounter); ?>
323 <?php $accesskey_text = ($accesscounter < 10 ? 'accesskey="'.$accesscounter.'"' : ''); ?>
324 <?php $accesskey_title = ($accesscounter < 10 ? ' Alt+'.$accesscounter : ''); ?>
325 <?php if ($page['url'] == $this->current_top_level_page): ?>
326 <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>
328 <li><a href="<?php echo $page['url']; ?>" <?php echo $accesskey_text; ?> title="<?php echo $page['title'] . $accesskey_title; ?>"><?php echo $page['title']; ?></a></li>
330 <?php $accesscounter = ($accesscounter == 0 ? 11 : $accesscounter); ?>
335 <div style="background-color:#E6E6E6; font-size:0.85em; padding-top: 5px; border-bottom:1px solid black; height:2em;">
336 <!-- the sub navigation -->
337 <div style="float: right; padding-right: 5px; text-transform: lowercase;">
338 <?php if (isset($_SESSION['valid_user']) && $_SESSION['valid_user']): ?>
339 <strong><?php echo get_display_name($_SESSION['member_id']); ?></strong> | <a href="<?php echo $this->base_path; ?>logout.php"><?php echo _AT('logout'); ?></a>
341 <a href="<?php echo $this->base_path; ?>login.php?course=<?php echo $this->course_id; ?>"><?php echo _AT('login'); ?></a> | <a href="<?php echo $this->base_path; ?>registration.php"><?php echo _AT('register'); ?></a>
345 <div style="padding-left: 5px;">
346 <a id="content_link" href="javascript:void(0);">Content</a>
347 <div id="content" style="background-color:#E6E6E6; width: 22em; display: none; position: relative; z-index: 1;">
348 <?php $contentManager->printMainMenu(); ?>
352 <?php if ($this->sub_level_pages): ?>
353 <!-- <div id="sub-navigation">
354 <?php if (isset($this->back_to_page)): ?>
355 <a href="<?php echo $this->back_to_page['url']; ?>" id="back-to"><?php echo _AT('back_to').' '.$this->back_to_page['title']; ?></a> |
358 <?php $num_pages = count($this->sub_level_pages); ?>
359 <?php for ($i=0; $i<$num_pages; $i++): ?>
360 <?php if ($this->sub_level_pages[$i]['url'] == $this->current_sub_level_page): ?>
361 <strong><?php echo $this->sub_level_pages[$i]['title']; ?></strong>
363 <a href="<?php echo $this->sub_level_pages[$i]['url']; ?>"><?php echo $this->sub_level_pages[$i]['title']; ?></a>
365 <?php if ($i < $num_pages-1): ?>
371 <!-- <div id="sub-navigation">
377 <div style="padding:3px;">
378 <?php if (isset($_SESSION["prefs"]["PREF_SHOW_BREAD_CRUMBS"]) && $_SESSION["prefs"]["PREF_SHOW_BREAD_CRUMBS"]) { ?>
379 <!-- the bread crumbs -->
380 <div id="breadcrumbs">
381 <?php foreach ($this->path as $page): ?>
382 <a href="<?php echo $page['url']; ?>"><?php echo htmlspecialchars($page['title'], ENT_COMPAT, "UTF-8"); ?></a> >
383 <?php endforeach; ?> <?php echo $this->page_title; ?>
387 <?php if (isset($this->guide) && isset($_SESSION["course_id"]) && $this->guide && ($_SESSION["prefs"]["PREF_SHOW_GUIDE"] || $_SESSION["course_id"] == "-1")) : ?>
388 <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>
393 <div id="contentwrapper">
394 <div id="contentcolumn"
395 <?php if ((isset($this->course_id) && $this->course_id <= 0)): ?>
396 style="margin-left:0.5em;width:99%;"
400 <?php if (isset($this->course_id) && $this->course_id > 0): ?>
401 <div id="sequence-links">
402 <?php if ($_SESSION["prefs"]["PREF_SHOW_NEXT_PREVIOUS_BUTTONS"]) { ?>
403 <?php if ($this->sequence_links['resume']): ?>
404 <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>
406 if ($this->sequence_links['previous']): ?>
407 <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>
409 if ($this->sequence_links['next']): ?>
410 <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>
418 <!-- the page title -->
419 <a name="content" title="<?php echo _AT('content'); ?>"></a>
420 <h2 class="page-title"><?php echo $this->page_title; ?></h2>
421 <?php global $msg; $msg->printAll(); $_base_href;?>
423 <?php if (count($this->sub_level_pages) > 0): ?>
425 <!-- <div id="topnavlistcontainer">
427 <?php $accesscounter = 0; //initialize ?>
428 <?php foreach ($this->top_level_pages as $page): ?>
429 <?php ++$accesscounter; $accesscounter = ($accesscounter == 10 ? 0 : $accesscounter); ?>
430 <?php $accesskey_text = ($accesscounter < 10 ? 'accesskey="'.$accesscounter.'"' : ''); ?>
431 <?php $accesskey_title = ($accesscounter < 10 ? ' Alt+'.$accesscounter : ''); ?>
432 <?php if ($page['url'] == $this->current_top_level_page): ?>
433 <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>
435 <li><a href="<?php echo $page['url']; ?>" <?php echo $accesskey_text; ?> title="<?php echo $page['title'] . $accesskey_title; ?>"><?php echo $page['title']; ?></a></li>
437 <?php $accesscounter = ($accesscounter == 0 ? 11 : $accesscounter); ?>
442 <div id="subnavlistcontainer">
443 <div id="subnavbacktopage">
444 <?php if (isset($this->back_to_page)): ?>
445 <a href="<?php echo $this->back_to_page['url']; ?>">
446 <img border="0" width="10" height="11" alt="<?php echo _AT('back_to').' '.$this->back_to_page['title']; ?>" src="<?php echo $this->base_href; ?>images/arrowicon.gif" style="float:left;"/></a>
451 <?php $num_pages = count($this->sub_level_pages); ?>
452 <?php for ($i=0; $i<$num_pages; $i++): ?>
454 <?php if ($this->sub_level_pages[$i]['url'] == $this->current_sub_level_page): ?>
455 <li><?php echo $this->sub_level_pages[$i]['title']; ?></li>
457 <li><a href="<?php echo $this->sub_level_pages[$i]['url']; ?>"><?php echo $this->sub_level_pages[$i]['title']; ?></a></li>
459 <?php if ($i < $num_pages-1):
467 <!-- the main navigation. in our case, tabs -->