<?php
include("admin/include/config.php");
include_once("admin/include/auth.lib.php");
list($status, $user) = auth_get_status();
?>
<?php include('head.php'); ?>
<body>
<a id="up"></a>
<!-- wrap starts here -->
<div id="wrap">
<?php include('header.php'); ?>
<div id="sidebar" >
<?php include('tabellasx.php'); ?>
</div>
<div id="main">
<a name="TemplateInfo"></a>
<?php
$today = date('Y-m-d');
$query = "SELECT * FROM eventi WHERE data_inizio >= '$today' ORDER BY data_inizio ASC LIMIT 3 ";
$result = mysql_query($query) or die (mysql_error());
$numRaduni = mysql_num_rows($result);
if($numRaduni >= 1) {
echo '<h1>Prossimi eventi</h1>';
while ($array = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="eventi"><b><font color="#6297BC">'.$array['club'].'</b></font>';
echo '<br><b>'.$array['titolo'].'</b><br>';
echo ''; echo strtoupper(strftime ("%d %b %y", strtotime($array['data_inizio']))); echo '';
if ($array['allegato'] != '') {
echo '<div class="allegato"><a href="http://www.entinoprofit.org/raduni/'.$array['allegato'].'" target="_blank"><img src="images/download.png" class="no-border" alt="Scarica allegato"></a></div>';
}
echo'</div>';
}
echo '<a href="eventi.php" class="float-right clear">» Visualizza tutti gli eventi</a>';
}
?>
<div class="clear"></div>
<h1>News</h1>
<?php
setlocale(LC_ALL, 'it_IT');
$query = "SELECT COUNT(*) as num FROM news WHERE acsi = '1'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages['num'];
$limit = 5; //how many items to show per page
$adjacents = 1;
$page=1;
if (isset($_GET['page']))
$page=$_GET['page'];
if (isset($page) )
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
//Tony aggiunta colonna invisibile su tab piazza
$query = 'SELECT id,idclub,titolo,testo,date,acsi,view_all FROM news WHERE acsi = \'1\' ORDER BY date DESC LIMIT '.$start.' , '.$limit;
$risultato = mysql_query($query) or die("Query 1 failed");
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) {
$titolo = stripslashes($array['titolo']);
if($array['view_all'] == 0) {
$testo = cutHtmlText(stripslashes($array['testo']),200,'...',false, false, true);
} else {
$testo = $array['testo'];
}
echo '<div class="news">';
echo "<h2>".$titolo."</h2>";
$image = set_image(stripslashes($array['testo']));
echo $image;
$style = ($image != '') ? 'style="float:left;display:block;width:240px;"' : '';
echo "<div ".$style.">".$testo."</div><div style='clear:both;'></div> ";
echo "<p class='post-footer align-right clear'> <a href=\"news.php?id=".$array['id']."\">» Leggi Tutto: ".$titolo."</a></p>";
echo "<p align=\"right\">";
if ($array['idclub'] != 0) {
$idclub = $array['idclub'];
$query2 = 'SELECT id,nome,alias FROM club_list WHERE id = '.$idclub.'';
$risultato2 = mysql_query($query2) or die(mysql_error());
$array2 = mysql_fetch_array($risultato2, MYSQL_BOTH);
echo '<a href="/club/'.$array2['alias'].'">» Vai alla scheda di '.$array2['nome'].'</a> | ';
}
switch($status){
case AUTH_LOGGED:
if($user['admin'] == 1) {
echo "<a href=\"admin/mod_news.php?id=".$array['id']."\">Modifica news</a>";
}
break;
case AUTH_NOT_LOGGED:
echo 'NO';
break;
}
echo "<a href=\"#up\">» Torna su</a></p></div>";
}
?>
<?php include('include/paginazione.php'); ?>
</div>
<?php include('tabelladx.php'); ?>
<!-- content-wrap ends here -->
</div>
<!-- footer starts here -->
<?php include('footer.php'); ?>
<!-- footer ends here -->
<!-- wrap ends here -->
</div>
</body>
</html>