Location: PHPKode > projects > DoceboLMS, e-learning platform and SCORM > menu/menu.php
<?php

/*************************************************************************/
/* SPAGHETTILEARNING - E-Learning System                                 */
/* ============================================                          */
/*                                                                       */
/* Copyright (c) 2002 by Claudio Erba (hide@address.com)  */
/* & Fabio Pirovano (hide@address.com) http://www.spaghettilearning.com*/
/*                                                                       */
/* Modification fot the create courses autentication made by overnet	 */
/* hide@address.com					                                     */
/*																		 */
/* This program is free software. You can redistribute it and/or modify  */
/* it under the terms of the GNU General Public License as published by  */
/* the Free Software Foundation; either version 2 of the License.        */
/*************************************************************************/
if(isset($_SESSION['sesUser'])) {

require('menu/language/lang-'.$defaultLanguage.'.php');

//retriving useful information

$lvUserCourse = $_SESSION['levCourse'];
$inCourse = isset($_SESSION['idCourse']);
list($nameCourse) = mysql_fetch_row(mysql_query("SELECT nome FROM ".$prefix."_course WHERE idCourse=\"".$_SESSION['idCourse']."\""));

//funzione per il riconoscimento dei permessi di visualizzazione di una voce del menu

function access($lvPerm) {
	global $lvUserCourse;
	$lvPerm = $lvPerm >> ($lvUserCourse - 1);
	if ($lvPerm % 2) return true;
	else return false;
}

if ($inCourse) {
	


//ricerca nome corso


	//updating status onair
	if($_SESSION['levCourse'] > "3") {
		if($online == "off") mysql_query("UPDATE ".$prefix."_usercourse SET onair='0' WHERE idCourse=\"".$_SESSION['idCourse']."\" AND idUser=\"".$_SESSION['sesUser']."\"");
		if($online == "on") mysql_query("UPDATE ".$prefix."_usercourse SET onair='1' WHERE idCourse=\"".$_SESSION['idCourse']."\" AND idUser=\"".$_SESSION['sesUser']."\"");
	}
	//retriving number of on-air prof
	if($_SESSION['levCourse'] > "3") $query = "SELECT idUser FROM ".$prefix."_usercourse WHERE idCourse=\"".$_SESSION['idCourse']."\" AND idUser=\"".$_SESSION['sesUser']."\" AND onair=\"1\"";
	else  $query = "SELECT idUser FROM ".$prefix."_usercourse WHERE idCourse=\"".$_SESSION['idCourse']."\" AND onair=\"1\"";
	$onair = mysql_num_rows(mysql_query($query));
	//retriving course name
	list($nameCourse) = mysql_fetch_row(mysql_query("SELECT nome FROM ".$prefix."_course WHERE idCourse=\"".$_SESSION['idCourse']."\""));
	//print info
	echo '<div id="nameCourseBox">';
	if($_SESSION['levCourse'] > "3") {
		if($op == "aula") $opOn = "visuprofile";
		else $opOn = $op;
		if($onair != 0) echo '<a href="index.php?op='.$opOn.'&amp;online=off"><img class="imageonair" src="templates/'.$_SESSION['sesTemplate'].'/images/profile/onairprof.gif"></a>';
		else echo '<a href="index.php?op='.$opOn.'&amp;online=on"><img class="imageonair" src="templates/'.$_SESSION['sesTemplate'].'/images/profile/offairprof.gif"></a>';
	}
	elseif($onair != 0) echo '<img class="imageonair" src="templates/'.$_SESSION['sesTemplate'].'/images/profile/onair.gif">';
	echo $nameCourse.'</div>';
}


if($whoisonline == "on") include("modules/whoisonline/whoisonline_block.php");

/*blocco contenitore per il menu*/

echo '<div id="menuBox">';

echo '<div class="lineaMenuTitle">'._MENUAULA.'</div>';
 echo '<div class="lineaMenu">'
					.'<a href="index.php?op=deletecourse&amp;learning='.session_id().'">'._COURSEM.'</a>'
					.'</div>';

echo '<div class="lineaMenu">'
	.'<a href="index.php?op=logout&amp;learning='.session_id().'">'._LOGOUT.'</a>'
	.'</div>';

if ($activeAutosubscribe=="on") {
echo '<div class="lineaMenu">'
	.'<a href="index.php?op=freecourses&amp;learning='.session_id().'">'._FREECOURSES.'</a>'
	.'</div>';
}

list($lvUser) = mysql_fetch_row(mysql_query("SELECT livello FROM ".$prefix."_user WHERE idUser='".$_SESSION['sesUser']."'"));

if(($lvUser > '3') && ($autoCreatecourse=="on")) { 

	echo '<div class="lineaMenu">'
		.'<span class="boxTitle">'
			.'<a href="index.php?op=showmycourses&amp;learning='.session_id().'">'._CREATECOURSES.'</a>'
		.'</span>'
		.'<span class="boxImg">';
		echo '
		<a href="index.php?op=createmycourses&amp;learning='.session_id().'">'
			.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/ins.gif" alt="'._INSIMG.'" /></a>';
		echo '
		<a href="index.php?op=modifymycourses&amp;learning='.session_id().'">'
			.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/mod.gif" alt="'._MODIMG.'" /></a>';
		echo '
		<a href="index.php?op=deletemycourses&amp;learning='.session_id().'">'
			.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/rem.gif" alt="'._REMIMG.'" /></a>';
	echo '</span>'
		.'</div>';
}

//Print menu
if ($inCourse) {
	/*Ricerca delle voci principali del menu*/
	$reMain = mysql_query("SELECT idMain,name,permAccess FROM ".$prefix."_coursemainmenu ORDER BY sequence");
	while(list($idMain, $name, $permMain) = mysql_fetch_row($reMain)) {
	if (access($permMain)) {
		echo '
			<div class="lineaMenuTitle">'.$langMenu[$name].'</div>';
		/*Ricerca delle voci secondarie del menu*/
		$reUnderM = mysql_query("SELECT name,caseOp,permOp,caseNew,permNew,caseMod,permMod,caseRem,permRem FROM ".$prefix."_courseundermenu WHERE idMain=\"$idMain\" ORDER BY sequence");
		while(list($nameU,$caseOp,$permOp,$New,$permNew,$Mod,$permMod,$Rem,$permRem)=mysql_fetch_row($reUnderM)) {
		if (access($permOp)) {
			echo '
				<div class="lineaMenu">';
			if($caseOp != '') {
				echo '
					<span class="boxTitle">'
					.'
					<a href="index.php?op='.$caseOp.'&amp;learning='.session_id().'">'.$langMenu[$nameU].'</a>'
					.'</span>';
			}
			else echo '<span class="boxTitle">'.$langMenu[$nameU].'</span>';
			if(($New != "")||($Mod != "")||($Rem != "")) {
				echo '
					<span class="boxImg">';
				if(($New != "")&&(access($permNew))) {
					echo '
						<a href="index.php?op='.$New.'&amp;learning='.session_id().'">'
						.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/ins.gif" alt="'._INSIMG.'" /></a>';
				}
				if(($Mod != "")&&(access($permMod))) {
					echo '
						<a href="index.php?op='.$Mod.'&amp;learning='.session_id().'">'
						.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/mod.gif" alt="'._MODIMG.'" /></a>';
				}			
				if(($Rem != "")&&(access($permRem))) {
					echo '
						<a href="index.php?op='.$Rem.'&amp;learning='.session_id().'">'
						.'<img class="image" src="templates/'.$defaultTemplate.'/images/menu/rem.gif" alt="'._REMIMG.'" /></a>';
				}
				echo '</span>';
			}
			echo '</div>';
		}
		}
	}
	}
}
echo '</div>';
if($whoisonline == "on") include("modules/whoisonline/whoisonline_footer.php");
}

?>
Return current item: DoceboLMS, e-learning platform and SCORM