<?php
if(!defined('panel'))
	die('Nope.');
if(!isset(Config::$_url[1])) echo '<meta http-equiv="refresh" content="5;URL=\''.Config::$_PAGE_URL.'factionslist\'/>';
?>
<title>Faction complaints - <?php echo Config::$_SITE_NAME; ?></title>
</div>
	<div class="main-content">
		<div class="main-content-inner">
					<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 class="active">Faction Complaints</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">
<div class="pull-left control-group">
<form method="POST" action="<?php echo Config::$_PAGE_URL; ?>search">
<button name="search" class="btn btn-danger">New Complaint</button>
</form>
</div>
</div>
<br />
	<div class="table-responsive">
		<table id="login-table" class="table table-striped table-hover table-bordered">
			<thead>
			<tr>
				<td>Title</td>
				<td>Created By</td>
				<td><i class="fa fa-clock-o"></i> Date</td>
				<td>Status</td>
			</tr>	
			</thead>
			<tbody>
				<?php
					$q = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `factionid` = ? AND `status` = 0 ORDER BY `id` DESC');
					$q->execute(array(Config::$_url[1]));
					while($row = $q->fetch(PDO::FETCH_OBJ)) {
						if($row->reasoncomplaint == 1) {
							$reason = "Factiune";
						} else if($row->reasoncomplaint == 2) {
							$reason = "DM";
						} else if($row->reasoncomplaint == 3) {
							$reason = "Jigniri, injurii, limbaj vulgar";
						} else if($row->reasoncomplaint == 4) {
							$reason = "Inselatorie";
						} else if($row->reasoncomplaint == 5) {
							$reason = "Altceva (abuz, comportament non RP)";
						} else if($row->reasoncomplaint == 6) {
							$reason = "Abuz admin/helper";
						} else if($row->reasoncomplaint == 7) {
							$reason = "Greseli ca lider";
						}				
						echo 
						"<tr>			
							<td><a href='". Config::$_PAGE_URL ."complaint/". $row->id ."'>{$row->playername} - ". $reason ."</a></td>
							<td>{$row->createdby}</td>
							<td>{$row->time}</td>
							<td>" . ($row->status ? "Closed" : "Open") . "</td>
						</tr>";
					}
				?>
			</tbody>
		</table>
	</div>
	
<center>
	<h2>Archive</h2>
</center>

	<div class="table-responsive">
		<table id="login-table" class="table table-striped table-hover table-bordered">
			<thead>
			<tr>
				<td>Title</td>
				<td>Created By</td>
				<td><i class="fa fa-clock-o"></i> Date</td>
				<td>Status</td>
			</tr>	
			</thead>
			<tbody>
				<?php
					$q = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `factionid` = ? AND `status` = 1 ORDER BY `id` DESC');
					$q->execute(array(Config::$_url[1]));
					while($row = $q->fetch(PDO::FETCH_OBJ)) {
						if($row->reasoncomplaint == 1) {
							$reason = "Factiune";
						} else if($row->reasoncomplaint == 2) {
							$reason = "DM";
						} else if($row->reasoncomplaint == 3) {
							$reason = "Jigniri, injurii, limbaj vulgar";
						} else if($row->reasoncomplaint == 4) {
							$reason = "Inselatorie";
						} else if($row->reasoncomplaint == 5) {
							$reason = "Altceva (abuz, comportament non RP)";
						} else if($row->reasoncomplaint == 6) {
							$reason = "Abuz admin/helper";
						} else if($row->reasoncomplaint == 7) {
							$reason = "Greseli ca lider";
						}				
						echo 
						"<tr>			
							<td><a href='". Config::$_PAGE_URL ."complaint/". $row->id ."'>{$row->playername} - ". $reason ."</a></td>
							<td>{$row->createdby}</td>
							<td>{$row->time}</td>
							<td>" . ($row->status ? "Closed" : "Open") . "</td>
						</tr>";
					}
				?>
			</tbody>
		</table>
	</div>	