<?php

include './core.php';

if( isset( $user ) && $user->can_access( 'stafflist_intern' ) )
{
    $list = array();
	for( $i = 1; $i < count( $user->groups ); $i++ )
	{
	    $list[] = $MySQL->fetch_complete( "SELECT * FROM server.accounts WHERE rank > 2 && `group` = ".$i." ORDER BY rank DESC" );
	}
	$Smarty->assign( 'list', $list );

	$page['content'] = $Smarty->fetch( 'stafflist_intern.tpl' );
}
else
{
	$fakeuser = new Account( 0 );
	$Smarty->assign( 'fakeuser', $fakeuser );

    $list = array();
    for( $i = 1; $i < count( $fakeuser->groups ); $i++ )
	{
	    $list[] = $MySQL->fetch_complete( "SELECT * FROM server.accounts WHERE rank > 2 && `group` = ".$i." ORDER BY rank DESC" );
	}
	$Smarty->assign( 'list', $list );

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

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

?>