<?php
include("postget.php");
include_once("common.php");
$pagetitle = lang("_ANNOUNCEMENTS");
moduleaccess(68);


$paging = new pagination;
if ($_REQUEST['orderby']) {
	$orderby = $_REQUEST['orderby'];
}else{
	$orderby ='status ASC,date DESC';
}


if ($_SESSION['hd_accesslvl']>0) {
	include("head_template.php");
}else{
	include("head_template_guest.php");
}


if (!$_SESSION['hd_accesslvl']) {$w = " AND onlyclients = '0' ";}else{$w = " ";}
$query = "SELECT * FROM hd_announcements WHERE in_mainpage='0' AND status='1'".$w." AND langs LIKE '%".$currentlang."%' ORDER by date DESC";

$paging->agregarConsulta($query);
$paging->porPagina($config[32][1]);
$paging->paginasAntes(3, 10, 20, 50);
$paging->paginasDespues(3, 10, 20, 50);
$paging->linkSeparador('&nbsp;');
$paging->linkSeparadorEspecial('...');
$paging->linkClase('pag');
$paging->mostrarActual("<span class=\"pagthis\">{n}</span>");

$paging->ejecutar();

echo '
<div class="container">
<div class="row">';

if ($paging->numTotalPaginas() > 1) {
	echo "<div class='pagination'><b>".ucfirst(_PAGES)."</b>: ".$paging->fetchNavegacion()."</div>";
}

echo '
<table class="table table-striped table-hover">';

print("<thead><tr>");
print("
<th>" . _PRIORITY . "</th>
<th>" . _DATE . "</th>
<th>" . _ANNOUNCEMENT . "</th>");
print("<tr></thead>");

print("<tbody>");

if (mysql_affected_rows()>0) {
	while($row = $paging->fetchResultado()) {
		print("
                    <tr>
                        <td>".lang('_'.strtoupper($row[priority]))."</td>
                        <td>".date($df,$row[date])."</td>
                        <td>".$row[comment]."</td>
                    </tr>
                    ");
	}
}
print("<tbody>");

echo '
</table>
</div>
</div>
';

include("foot_template.php");

?>