<?php

include './core.php';

if( !isset( $user ) || !$user->can_access( 'applications_view' )  ) access_error();

if( isset( $_REQUEST['view'] ) )
{
    $application = $MySQL->query_first( "SELECT applications.*, server.accounts.name, server.accounts.email, server.accounts.icq AS icq2 FROM applications, server.accounts WHERE server.accounts.accountid = applications.accountid && applications.applicationID = ".intval( $_REQUEST['view'] ) );
    switch( $application['state'] )
    {
    	case 'waiting':
        	$application['state'] = "Wartend"; break;
        case 'staffler':
        	$application['state'] = "Staffler (angenommen)"; break;
        case 'rejected':
        	$application['state'] = "Abgelehnt"; break;
        case 'self-rejected':
        	$application['state'] = "Zurückgezogen"; break;
        case 'leaved':
        	$application['state'] = "Staff verlassen"; break;
    }
    $Smarty->assign( 'application', $application );

    $page['content'] = $Smarty->fetch( 'applications_view.tpl' );
}

$Smarty->assign( 'page', $page );
$Smarty->display( 'main.tpl' );

?>