<?php 
	if(isset($_GET['view']) AND $_GET['view'] != ''){
		$pageTitle 	= 'Событие: ' . get_event_name($_GET['view']);
	} elseif(isset($_GET['edit']) AND $_GET['edit'] != ''){
		$pageTitle 	= 'Редактирование события: ' . get_event_name($_GET['edit']);
	} elseif(isset($_GET['new'])){
		$pageTitle 	= "Добавление события";
	} else {
		$pageTitle 	= 'Предстоящие события';
	}
	
	if(!isset($_GET['view']) AND !isset($_GET['edit'])){$filters = '1';}
	
	require_once(ROOT . 'templates/header.php'); 
	
	require_once(ROOT . 'modules/events/list-events.php');
	
	require_once(ROOT . 'templates/main-menu.php');
?>
<div class="container<?php global $designView; echo $designView; ?>">
	<div class="row">
		<?php 
		if(isset($_GET['view']) and $_GET['view'] != ''){ 
			require_once(ROOT . 'modules/events/page-events-view.php');
		} elseif(isset($_GET['edit']) and $_GET['edit'] != '' or isset($_GET['new'])) {
			if(isset($_GET['new']) or $eventUser == $LoginCheck or $GroupCheck == 'admin' or $GroupCheck == 'manager'){
				require_once(ROOT . 'modules/events/page-events-edit.php');
			} else { echo '<meta http-equiv="refresh" content="0;/'.$folder.'/events">';}
		} else {
		?>
		<?php if ($GroupCheck != 'guest') { ?>
		<div class="col-lg-3 col-lg-push-9 col-md-4 col-md-push-8 col-sm-12">
			<?php require_once(ROOT . 'templates/side-block.php'); ?>
		</div>
		<div class="col-lg-9 col-lg-pull-3 col-md-8 col-md-pull-4 col-sm-12">
			
			<h1><?php if ( isset( $pageTitleBackLink ) ) { echo $pageTitleBackLink; } ?><?php echo $pageTitle; ?><span class="list-num"><i class="fa fa-fw fa-angle-double-down" aria-hidden="true"></i> <?php echo $countIndexEvents; ?></span></h1>
			
			<?php require_once(ROOT . 'templates/search-form.php'); ?>
			
			<div class="table-responsive">
				<table id="all-events" class="table table-hover all-events">
					<thead> 
						<tr> 
							<th width="6%"></th> 
							<th width="65%">Наименование</th> 
							<th width="15%" data-sorter="shortDate" data-date-format="yyyymmdd">Дата события</th>
							<th width="7%" title="Осталось дней"><i class="fa fa-hourglass-half" aria-hidden="true"></i></th> 
							<th width="6%"></th>
							<th width="6%"></th>
						</tr> 
					</thead> 
					<tbody>
						<?php require_once(ROOT . 'modules/events/list-events-m.php'); ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } else { include_once(ROOT . 'modules/access-denied.php'); } ?>
		<?php } ?>
	</div>
</div>
<?
	require_once(ROOT . 'templates/modal-wind.php');
	require_once(ROOT . 'templates/footer.php');
?>
	</body>
</html>