Location: PHPKode > projects > SASHA > SASHA/tests.php
<?php

/**
 * SASHA :: tests.php
 *
 * Manage tests.
 *
 * @package SASHA
 * @copyright (C) 2006-2010 Gordon P. Hemsley
 * @license docs/LICENSE BSD License
 * @version $Id: tests.php 85 2010-01-26 18:16:09Z gphemsley $
 */

/**
 * Define the path to the root directory, relative to this file.
 */
define( 'ROOT', './' );
define( 'THIS_FILE', 'tests.php' );

/**
 * Specify the title of the page and the tab currently highlighted.
 */
$page_title = array( 'Tests' );
$tab = 'tests';

require( ROOT . 'inc/inc.main.php' );

$mode = ( exists( $_REQUEST['mode'] ) ) ? $_REQUEST['mode'] : 'view';

/**
 * Have the title reflect the mode.
 */
switch( $mode )
{
	case 'add':
		$page_title[] = 'Add Test';
	break;

	case 'edit':
		$page_title[] = 'Edit Test';
	break;

	case 'view':
	default:
		$page_title[] = 'View Tests';
	break;
}

/**
 * Include the style header, required for proper page output.
 */
include( ROOT . 'style/default/header.php' );

/**
 * Output current user's tests.
 */
require( ROOT . 'inc/lib/lib.tests.php' );

$SASHA = new Tests();

$test_id = ( exists( $_REQUEST['test_id'] ) ) ? (int) $_REQUEST['test_id'] : FALSE;

$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';

$sub_nav = array(
	'view'	=>	array(
		'title'	=>	'View Tests',
		'url'	=>	ROOT . 'tests.php?mode=view' .  $institution_url . $semester_url
	),
	'add'	=>	array(
		'title'	=>	'Add Test',
		'url'	=>	ROOT . 'tests.php?mode=add' .  $institution_url . $semester_url
	)
);

?>
	<div id="tests">
<?php

$SASHA->print_sub_navigation( $sub_nav );

switch( $mode )
{
	case 'add':
		$SASHA->add_test();
	break;

	case 'edit':
		$SASHA->edit_test( $test_id );
	break;

	case 'view':
	default:
		$SASHA->list_tests();
	break;
}

?>
	</div>
<?php

/**
 * Include the style footer, required for proper page output.
 */
include( ROOT . 'style/default/footer.php' );

?>
Return current item: SASHA