<?php
//---[CZ]: ověříme přístup
if ($login->check_access("overview")==1):

//---[CZ]: načteme potřebné třídy
include CLASSES_PATH."Overview.php";
include CLASSES_PATH."Comments.php";

//---[CZ]: vytvoříme instance
$overview=new Overview();
$comments=new Comments();

//---[CZ]: ověření komentáře
if ($_GET["tab"]=="" AND $_GET["action"]=="confirm") { $comments->confirm(); }

//---[CZ]: smazání komentáře
if ($_GET["tab"]=="" AND $_GET["action"]=="delete") { $comments->delete(); }
?>

<h2><?php echo LANG_OVERVIEW; ?></h2>

<ul id="tab-bar">
<li<?php if ($_GET["tab"]=="") { echo " class=\"active-item\""; } ?>><a href="./admin.php?function=overview"><?php echo LANG_LAST_COMMENTS; ?></a></li>
<li<?php if ($_GET["tab"]=="most_read_articles") { echo " class=\"active-item\""; } ?>><a href="./admin.php?function=overview&amp;tab=most_read_articles"><?php echo LANG_MOST_READ_ARTICLES; ?></a></li>
<li><span class="float-ending"><!-- --></span></li>
</ul>

<?php if ($_GET["tab"]==""): ?>

<table>
<tr>
<th style="width: 85%;"><?php echo LANG_TEXT; ?></th>
<th style="width: 15%;"><?php echo LANG_OPTIONS; ?></th>
</tr>
<?php $comments->output(); ?>
</table>

<?php endif; ?>

<?php if ($_GET["tab"]=="most_read_articles"): ?>

<table>
<tr>
<th style="width: 50%;"><?php echo LANG_ARTICLE_TITLE; ?></th>
<th style="width: 15%;"><?php echo LANG_NUMBER_OF_VIEWS; ?></th>
<th style="width: 15%;"><?php echo LANG_NUMBER_OF_COMMENTS; ?></th>
<th style="width: 20%;"><?php echo LANG_PUBLICATION_DATE; ?></th>
</tr>
<?php $overview->most_read_articles(); ?>
</table>

<?php endif; ?>

<?php else: $access_denied=1; endif; ?>