Location: PHPKode > projects > CMS Admin > www/layout/layout.php
<?php

class Layout 
{

    public function header($title = '', $user = '')
    {
        $greet = ($user != '') ? "Welcome, $user." : '';
        $logo = SystemConfig::webroot . '/img/logo.png';
        $style = SystemConfig::webroot . '/style.css';
		$logout = SystemConfig::webroot . '/?logout';

		echo '<? xml version="1.0" encoding="UTF-8"?>';
        echo <<< END

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <title>Argus - $title</title>
    <link rel="stylesheet" type="text/css" href="$style" />
</head>
<body>

<div id="wrap">
	<div id="header"><img src="$logo" width="70" height="66" alt="Argus Logo"/>MyArgus</div>
	<div id="nav">
		<div>$greet</div> <div><a href="$logout">Logout</a></div>
	</div>
END;
    }

	public function sidebar(User $user, $courseID)
	{
		$u = new Users($courseID);
		$data = $u->UserCourseList($user->userID);
		if($user->userLevel <= ADMIN)
			$data = $u->CourseList();

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

		echo '<div id="linklist"  class="linklist">';
		echo "<h5>Welcome $user->firstName $user->lastName</h5>";
		echo '<h5 style="background: #aaa">';
		switch($user->userLevel)
		{
			case(ADMIN):{echo 'Administrator'; break;}
			case(INSTRUCTOR):{echo 'Instructor'; break;}
			case(TA):{echo 'TA'; break;}
			case(STUDENT):{echo 'Student'; break;}
		}


		echo '</h5></div>';
		

		if($courseID) {
			if($user->userLevel <= TA) {
				Layout::mainSidebar($courseID);
			} else {
				Layout::studentSidebar($courseID);
			}
		}

		echo '<div id="linklist"  class="linklist">';
		echo '<h5>Courses</h5>';
		echo '<ul>';
		for ($i=0; $i<$data->numRows(); ++$i)
		{
			$rowData = $data->fetchRow();
			
			if($courseID == $rowData['CourseID']) {
				echo '<li style="background: #aaa">' . $rowData['CourseName'] . '</li>';

			} else {
				echo '<li><a href="?c=' . $rowData['CourseID'] .'">';
				echo $rowData['CourseName'] . '</a></li>'; 
			}
		}
		echo '</ul>';
		echo '</div>';

	

		echo '</div>';
	}


    public function mainSidebar($courseID)
    {
		$wr = SystemConfig::webroot;
		global $mod;

		switch($mod){
		case 'manageassignments':  {$m1 = 'style="background: #aaa"'; break;}
		case 'managecourses': { $m2 = 'style="background: #aaa"'; break;}
		case 'managecontent': { $m3 = 'style="background: #aaa"'; break;}
		case 'managegroups': { $m4 = 'style="background: #aaa"'; break;}
		case 'manageusers': { $m5 = 'style="background: #aaa"'; break;}
		}

        echo <<< END

    <div id="linklist" class="linklist"> 
    <h5><a href="$wr/index.php">Main</a></h5>
    <ul>
        <li $m1><a href="$wr/modules/manageassignments.php?c=$courseID">Manage Assignments</a></li>
        <li $m2><a href="$wr/modules/managecourses.php?c=$courseID">Manage Course</a></li>
        <li $m3><a href="$wr/modules/managecontent.php?c=$courseID">Manage Content</a></li>
        <li $m4><a href="$wr/modules/managegroups.php?c=$courseID">Manage Groups</a></li>
        <li $m5><a href="$wr/modules/manageusers.php?c=$courseID">Manage Users</a></li>
    </ul>
    </div>

END;
    }


    public function studentSidebar($courseID)
    {
		$wr = SystemConfig::webroot;
		global $mod;
		switch($mod){
		case 'viewassignments':  {$m1 = 'style="background: #aaa"'; break;}
		case 'viewgrades': { $m2 = 'style="background: #aaa"'; break;}
		case 'viewcontent': { $m3 = 'style="background: #aaa"'; break;}
		}

        echo <<< END

    <div id="linklist" class="linklist"> 
    <h5><a href="$wr/index.php">Main</a></h5>
    <ul>
        <li $m1><a href="$wr/modules/viewassignments.php?c=$courseID">Assignments</a></li>
        <li $m2><a href="$wr/modules/viewgrades.php?c=$courseID">Grades</a></li>
        <li $m3><a href="$wr/modules/viewcontent.php?c=$courseID">Content</a></li>
    </ul>
    </div>
END;
    }

    public function footer()
    {
		echo "</div>\n";
        echo "</body>\n";
        echo "</html>\n";

    }

}

?>
Return current item: CMS Admin