<title>Wars log - <?php echo Config::$_SITE_NAME; ?></title>
</div>
	<div class="main-content">
<?php
if(!defined('panel'))
	die('Nope.');
if(isset(Config::$_url[1])) { ?>
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
				</script>

				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
					</li>
					<li>
						<a href="<?php echo Config::$_PAGE_URL; ?>factionslist">Factions</a>
					</li>
					<li>
						<a href="<?php echo Config::$_PAGE_URL; ?>wars">Wars</a>
					</li>
						<?php
							$q = Config::$g_con->prepare('SELECT * FROM `wars` WHERE `id` = ?');
							$q->execute(array(Config::$_url[1]));
							while($row = $q->fetch(PDO::FETCH_OBJ)) { ?>
					<li class="active">War <?php echo $row->id; ?>: <?php echo Config::$factions[$row->Attacker]; ?> - <?php echo Config::$factions[$row->Defender] ?></li>
					<?php } ?>
				</ul><!-- /.breadcrumb -->

				<div class="nav-search" id="nav-search">
					<form method="POST" action="search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
							<i class="ace-icon fa fa-search nav-search-icon"></i>
						</span>
					</form>
				</div> <!-- /.nav-search -->
			</div>	
			
<div class="page-content">
<div class="row-fluid">
	<?php
		$q = Config::$g_con->prepare('SELECT * FROM `wars` WHERE `id` = ?');
		$q->execute(array(Config::$_url[1]));
		while($row = $q->fetch(PDO::FETCH_OBJ)) {
			if($row->Result == 1) {
				$result = "".Config::$factions[$row->Attacker]." won";
			} else if($row->Result == 2) {
				$result = "".Config::$factions[$row->Defender]." won";
			} else if($row->Result == 3) {
				$result = "".Config::$factions[$row->Defender]." won  (".Config::$factions[$row->Attacker]." left the turf)";
			}
		?>
<div class="span12">
			<div class="page-header">
				<h1><?php echo Config::$factions[$row->Attacker]; ?> - <?php echo Config::$factions[$row->Defender] ?></h1>
			</div>
</div>
<div>
<p>
Result status: <?php echo $result ?><br>
Date: <?php echo $row->Time ?><br>
Score: <?php echo $row->Atscore ?> - <?php echo $row->Defscore ?>
</p>
</div>
<hr>


<div class="span5">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="hidden-100">Player name</th>
<th class="hidden-50">Kills</th>
<th class="hidden-50">Deaths</th>
</tr>
</thead>
<tbody>
	<?php
		$q = Config::$g_con->prepare('SELECT * FROM `warlogs` WHERE `WarID` = ? AND `Faction` = ?');
		$q->execute(array(Config::$_url[1],$row->Attacker));
		while($row2 = $q->fetch(PDO::FETCH_OBJ)) { ?>
<tr>
<td class="hidden-100">
		<a href="<?php echo Config::$_PAGE_URL ?>profile/<?php echo Config::getData("users","id",$row2->PlayerID) ?>"><?php echo Config::getData("users","name",$row2->PlayerID) ?></a>
</td>
<td class="hidden-50">
<?php echo $row2->Kills ?>
</td>
<td class="hidden-50">
<?php echo $row2->Deaths ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="span5">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="hidden-100">Player name</th>
<th class="hidden-50">Kills</th>
<th class="hidden-50">Deaths</th>
</tr>
</thead>
<tbody>
	<?php
		$q = Config::$g_con->prepare('SELECT * FROM `warlogs` WHERE `WarID` = ? AND `Faction` = ?');
		$q->execute(array(Config::$_url[1],$row->Defender));
		while($row2 = $q->fetch(PDO::FETCH_OBJ)) { ?>
<tr>
<td class="hidden-100">
		<a href="<?php echo Config::$_PAGE_URL ?>profile/<?php echo Config::getData("users","id",$row2->PlayerID) ?>"><?php echo Config::getData("users","name",$row2->PlayerID) ?></a>
</td>
<td class="hidden-50">
<?php echo $row2->Kills ?>
</td>
<td class="hidden-50">
<?php echo $row2->Deaths ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>

<?php } } else { ?>
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
				</script>

				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
					</li>
					<li>
						<a href="<?php echo Config::$_PAGE_URL; ?>factionslist">Factions</a>
					</li>
					<li>
						<a href="<?php echo Config::$_PAGE_URL; ?>wars">Wars</a>
					</li>
					<li class="active">Invalid War ID</li>

				</ul><!-- /.breadcrumb -->

				<div class="nav-search" id="nav-search">
					<form method="POST" action="search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
							<i class="ace-icon fa fa-search nav-search-icon"></i>
						</span>
					</form>
				</div> <!-- /.nav-search -->
			</div>	
			
<div class="page-content">
<div class="row-fluid">
<p class="alert alert-danger">
Invalid War ID
</p>
<?php } ?>
