Location: PHPKode > projects > CMS Admin > www/modules/viewcontent.php
<?php
$module = new ViewContent();
$mod = 'viewcontent';
require_once dirname(__FILE__).'/../classes/user.php';
require_once dirname(__FILE__).'/../classes/content.php';
require_once dirname(__FILE__).'/../classes/contentmanager.php';
require_once dirname(__FILE__).'/../layout/layout.php';
require_once dirname(__FILE__).'/../include/login.php';


//ViewContent: Distribute course content to the students.

class ViewContent
{
	private $course;

	function main(User $user, Permissions $perm, $course)
	{
		$this->course = $course;
	
		if($user->userLevel <= $perm->permissions['viewContent']) {
		// send the file first. can't let any other headers get by or the file download scripting will silently fail.
			if(isset($_GET['get'])) {
				$cm = new ContentManager();
				$c = new Content($_GET['get']);
				$cm->getFile($c);
			} else {
				Layout::header('View Content');
				Layout::sidebar($user, $this->course);
				echo '<div id="main">';
				echo '<div id="linklist" class="linklist">';
				echo '<h5>Course Content</h5>';
				echo '<ul>';

//				$orderBy='LastName';
//				if(isset($_GET['order']))
//				$orderBy = $_GET['order'];
				$a = new ContentManager($this->course);
				$data = $a->ListContent();
				for ($i=0; $i<$data->numRows(); ++$i)
				{
					$rowData = $data->fetchRow();
					echo '<li><a href="viewcontent.php?c='.$this->course .'&amp;get=' . $rowData['ContentID'] .'">';
					echo $rowData['ContentID'] .' '. $rowData['FileName'] .' - '. $rowData['Description'] .' - '. $rowData['DatePosted'] .'</a></li>';
				}
				echo '</ul>';
				echo '</div>';
				Layout::footer();
			}
		} else {
				echo 'insufficient privledges';
		}
	}
}
?>
Return current item: CMS Admin