<div id="header">  <!-- header section start -->

 <div id="header1"> <!-- top of banner with institution name/hompage link -->

  <div id="institution">
     <a href="<?php echo api_get_path(WEB_PATH);?>index.php" target="_top"><?php echo get_setting('siteName') ?></a>
       -
   <a href="<?php echo get_setting('InstitutionUrl') ?>" target="_top"><?php echo get_setting('Institution') ?></a>
  </div>

<?php
if (isset ($nameTools))
{
	$nameTools = htmlentities($nameTools);
}

//Put the name of the course in the header
if (isset ($_cid)) /* --- Course Title Section --- */
{
?>

	 <div id="my_courses"><a href="<?php echo api_get_path(WEB_COURSE_PATH).$_course['path']; ?>/index.php" target="_top">
	 	<?php

	echo $_course['name']." ";
	if (get_setting("display_coursecode_in_courselist") == "true")
	{
		echo $_course['official_code'];
	}
	if (get_setting("display_coursecode_in_courselist") == "true" AND get_setting("display_teacher_in_courselist") == "true")
	{
		echo " - ";
	}
	if (get_setting("display_teacher_in_courselist") == "true")
	{
		echo $_course['titular'];
	}
?></a></div>
		<?php


}
//Put the name of the user-tools in the header
elseif (isset ($nameTools) && $langFile != 'course_home')
{
	if (!isset ($_uid))
		echo " ";
	elseif(!$noPHP_SELF)
	{
		echo "<div id=\"my_courses\"><a href=\"".$_SERVER['PHP_SELF']."?".api_get_cidreq(), "\" target=\"_top\">", $nameTools, "</a></div>", "\n";
	}
	else
	{
		echo "<div id=\"my_courses\">$nameTools</div>\n";
	}
}
//not to let the header disappear if there's nothing on the left
echo "&nbsp;";

//load appropriate plugins for banner section
if (is_array($plugins['banner']))
{
	foreach ($plugins['banner'] as $this_plugin)
	{
		include (api_get_path(PLUGIN_PATH)."$this_plugin/index.php");
	}
}
?>



<?php

/**
==============================================================================
*	This script contains the actual html code to display the "header"
*	or "banner" on top of every Dokeos page.
*
*	@package dokeos.include
==============================================================================
*/

$web_course_path = api_get_path(WEB_COURSE_PATH);

if ($_course['extLink']['name'] != "") /* --- External Link Section --- */
{
	echo " / ";
	if ($_course['extLink']['url'] != "")
	{
		echo "<a href=\"".$_course['extLink']['url']."\" target=\"_top\">";
		echo $_course['extLink']['name'];
		echo "</a>";
	}
	else
		echo $_course['extLink']['name'];
}
?>
 </div> <!-- end of #header1 -->

<?php

if ($_uid) /* --- User Section --- */
{
?>
<div id="header2"> <!-- start user section line with name, my course, my profile, scorm info, etc -->

<form method="get" action="<?php echo api_get_path(WEB_PATH); ?>index.php" class="banner_links" target="_top">
 <input type="hidden" name="logout" value="true"/>
 <input type="hidden" name="uid" value="<?php echo $_uid; ?>"/>

 <div id="logout">
<input type="submit" name="submit" value="<?php echo get_lang("Logout"); ?>"
 onmouseover="this.style.textDecoration='underline'" onmouseout="this.style.textDecoration='none'"
 class="logout"/>
 </div>

<?php echo $_user ['lastName']," ",$_user ['firstName'] ?> :
<a href="<?php echo api_get_path(WEB_PATH); ?>index.php" target="_top">
 <?php echo get_lang("MyCourses"); ?></a>
 |
<a href="<?php echo $clarolineRepositoryWeb ?>auth/profile.php<?php if(!empty($_course['path'])) echo '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code']; ?>" target="_top">
 <?php echo get_lang("ModifyProfile"); ?></a>
 |
<a href="<?php echo $clarolineRepositoryWeb ?>calendar/myagenda.php<?php if(!empty($_course['path'])) echo '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code']; ?>" target="_top">
 <?php echo get_lang("MyAgenda"); ?></a>
 <?php

	if (api_is_platform_admin())
	{
		echo "| <a href=\"".$rootAdminWeb."\" target=\"_top\">".get_lang("PlatformAdmin")."</a>";
	}
?>

</form>

</div> <!-- end of header2 (user) section -->

<?php

}
?>
<div id="header3">
<div id="Header3Right">
	<?php

echo '<ul>';
if (get_setting('showonline') == "true")
{
	$statistics_database = Database :: get_statistic_database();
	$number = count(WhoIsOnline(api_get_user_id(), $statistics_database, 30));
	echo "<li><a href='".api_get_path(WEB_PATH)."whoisonline.php?referer=".urlencode($_SERVER['REQUEST_URI'])."' target='_top'>".get_lang('UsersOnline').": ".$number."</a></li>";
}
if ($_uid)
{
	if (api_is_course_admin() && is_student_view_enabled())
	{
		echo '<li>|';
		display_tool_view_option($_GET['isStudentView']);
		echo '</li>';
	}
}
if ( api_is_allowed_to_edit() )
{
	if( $help != null)
	{
	// Show help
	?>
	<li>|
	<a href="#" onclick="MyWindow=window.open('<?php echo api_get_path(WEB_CODE_PATH)."help/help.php"; ?>?open=<?php echo $help; ?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600,left=200,top=20'); return false;">
	<img src="<?php echo api_get_path(WEB_CODE_PATH); ?>img/buoy.gif" style="vertical-align: middle;" alt="<?php echo get_lang("Help") ?>"/>&nbsp;<?php echo get_lang("Help") ?></a>
	</li>
	<?php
	}
}
echo '</ul></div>';
?>


<?php


if (isset ($_cid))
{
?>
		 <a href="<?php echo api_get_path(WEB_PATH) ?>index.php" target="_top">
		 <?php echo get_setting('siteName'); ?></a> &gt;
		 <a href="<?php echo $web_course_path . $_course['path']; ?>/index.php" target="_top">
		 <?php

	//old: echo ($langFile == 'course_home')?''.$_course['official_code'].'':$_course['official_code'];
	//new suggestion fro usability discussion:
	echo get_lang("CourseHomepageLink");
?></a>

		<?php


}

// if name tools or interbredcrump defined, we don't set the Site name bold

elseif (isset ($nameTools) || is_array($interbredcrump))
{
	if (!isset ($_uid))
		echo " ";
	else
	{
?>
		  <a href="<?php echo api_get_path(WEB_PATH); ?>index.php" target="_top"> <?php echo get_setting('siteName');?></a>

		<?php

	}
}

// else we set the Site name bold

if (is_array($interbredcrump))
{
	while (list (, $bredcrumpStep) = each($interbredcrump))
	{
		$sep = '?';
		if (strrchr($bredcrumpStep['url'], '?'))
		{
			$sep = '&';
		}
		echo " &gt; <a href=\"", htmlentities($bredcrumpStep['url']).$sep.api_get_cidreq(), "\" target=\"_top\">", htmlentities($bredcrumpStep['name']), "</a>\n";
	}
}

if (isset ($nameTools) && $langFile != 'course_home')
{
	if (!isset ($_uid))
		echo " ";
	else
	{
		if ($noPHP_SELF)
			echo " &gt; ", $nameTools, "\n";

		else
			echo " &gt; ", "<a href=\"".htmlentities($_SERVER['REQUEST_URI'])."\" target=\"_top\">", $nameTools, "</a>", "\n";
	}
}
//not to let the empty header disappear and ensure help pic is inside the header
echo "<div class=\"clear\">&nbsp;</div>";
?>
</div> <!-- End of header 3-->

<?php

/*}*/
?>

	<div id="toolshortcuts">
		<?php if(get_setting('show_toolshortcuts')=="true") { include('tool_shortcuts.inc.php'); } ?>
	</div>

<?php

if (isset ($dokeos_database_connection))
{
	// connect to the main database.
	// if single database, don't pefix table names with the main database name in SQL queries
	// (ex. SELECT * FROM `table`)
	// if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in
	// the main database)
	// (ex. SELECT * FROM `table_from_main_db`  -  SELECT * FROM `courseDB`.`table_from_course_db`)
	mysql_select_db($mainDbName, $dokeos_database_connection);
}
?>

</div> <!-- end of the whole #header section -->

<div id="main"> <!-- start of #main wrapper for #content and #menu divs -->

<?php

// ===== "call for chat" module section =====

$chat = strpos($_SERVER['PHP_SELF'], 'chat_banner.php');
if (!$chat)
{
	include_once (api_get_library_path()."/online.inc.php");
	echo $accept;
	$chatcall = chatcall();
	if ($chatcall)
	{
		Display :: display_normal_message($chatcall);
	}
}

// ===== end "call for chat" module section =====
?>

<!--   Begin Of script Output   -->

