<?php
extract( $this -> _data[ 'sub_content' ][ 'header' ] );
?>
<!DOCTYPE html>
<html>
	<head>
		<title>Logfiles</title>
		<meta charset="UTF-8"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<link rel="stylesheet" type="text/css" href="PHP_SITE_PATH/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="PHP_SITE_PATH/css/cs_l1.css"/>
		<script type="text/javascript" src="PHP_SITE_PATH/js/jquery-2.1.1.min.js"></script>
		<script type="text/javascript" src="PHP_SITE_PATH/js/portal.js"></script>
	</head>
	<body class="grid_40col">
		<div id="page" class="grid_40col">
			<div class="grid_40col spacer"></div>
			<div class="grid_40col spacer"></div>
			<div id="sub_content" class="grid_40col">
				<div class="grid_40col">
					<form action="index.php" name="filterForm" id="filterForm" method="get">
						<input type="hidden" name="siteId" value="<?php echo $this -> _formdata[ 'siteId' ]; ?>" />
						<input type="hidden" name="orderBy" id="orderBy" value="<?php echo $this -> _formdata[ 'orderBy' ]; ?>" />
						<input type="hidden" name="orderDir" id="orderDir" value="<?php echo $this -> _formdata[ 'orderDir' ]; ?>" />
						<div id="sub_content_header" class="grid_40col">
							<div class="grid_4col">
								<label class="grid_4col select">
									<select name="year" id="year" onchange="$( '#filterForm' ).submit( );">
									<?php
									
										foreach ( $year as $key => $value )
											{
												?>
												<option name="year" value="<?php echo $key; ?>" <?php echo ( $key == $this -> _formdata[ 'year' ] ) ? 'selected="selected"' : ''; ?>><?php echo $value; ?></option>
												<?php
											}
											
									?>
									</select>
								</label>
							</div>
							<div class="grid_1col spacer"></div>
							<div class="grid_5col">
								<label class="grid_5col select">
									<select name="month" id="month" onchange="$( '#filterForm' ).submit( );">
									<?php
									
										foreach ( $month as $key => $value )
											{
												?>
												<option name="month" value="<?php echo $key; ?>" <?php echo ( $key == $this -> _formdata[ 'month' ] ) ? 'selected="selected"' : ''; ?>><?php echo $value; ?></option>
												<?php
											}
											
									?>
									</select>
								</label>
							</div>
						</div>
						<div class="grid_40col spacer"></div>
						<div class="grid_40col spacer"></div>
						<div class="grid_40col">
							<div class="grid_24col tbl_head"><?php echo $this -> _lang[ 'entry' ]; ?></div>
							<div class="grid_8col tbl_head" style="cursor:pointer;" onclick="$( '#orderBy' ).val( 'logUser' ); $( '#orderDir' ).val( '<?php echo ( $this -> _formdata[ 'orderDir' ] === 'DESC' ) ? 'ASC' : 'DESC'; ?>' ); $( '#filterForm' ).submit( ); "><img src="<?php echo ( $this -> _formdata[ 'orderBy' ] === 'logUser' ) ? ( ( $this -> _formdata[ 'orderDir' ] === 'ASC' ) ? PATH_IMG . 'icon-sortup.png' : PATH_IMG . 'icon-sortdown.png' ) : PATH_IMG . 'icon-sortwo.png'; ?>" />&nbsp;<?php echo $this -> _lang[ 'name' ]; ?></div>
							<div class="grid_8col tbl_head" style="cursor:pointer;" onclick="$( '#orderBy' ).val( 'logTS' ); $( '#orderDir' ).val( '<?php echo ( $this -> _formdata[ 'orderDir' ] === 'DESC' ) ? 'ASC' : 'DESC'; ?>' ); $( '#filterForm' ).submit( ); "><img src="<?php echo ( $this -> _formdata[ 'orderBy' ] === 'logTS' ) ? ( ( $this -> _formdata[ 'orderDir' ] === 'ASC' ) ? PATH_IMG . 'icon-sortup.png' : PATH_IMG . 'icon-sortdown.png' ) : PATH_IMG . 'icon-sortwo.png'; ?>" />&nbsp;<?php echo $this -> _lang[ 'time' ]; ?></div>
						</div>
						<div id="sub_content_main" class="grid_40col">
							<?php
								foreach ( $this -> _data[ 'sub_content' ][ 'main' ] as $data )
									{
										?>
										<div class="grid_40col">
											<div class="grid_40col main_row">
												<div class="grid_24col tbl_cell highlight" data-name="logEntry"><?php echo $data[ 'logEntry' ]; ?></div>
												<div class="grid_8col tbl_cell highlight" data-name="logUser"><?php echo $data[ 'logUser' ]; ?></div>
												<div class="grid_8col tbl_cell highlight" data-name="logTS"><?php echo $data[ 'logTS' ]; ?></div>
											</div>
										</div>
										<?php
									}
							?>
						</div>
					</form>
				</div>
			</div>
			<div class="grid_40col spacer"></div>
			<div class="grid_40col spacer"></div>
		</div>
	</body>
</html>