<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti('Admin');
view_top();
?>

<form name="" method="post">
<?php	
$tabella = new html (0,"90%",array(5,5,5,30,5,10,5,10,0));
?>
	<tr>
		<td ><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td width="5%"><a href="acl_edit.php"><img src="<?php print $CONF['base_url'] ?>/img/addresource.png"></a></td>
		<td colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
	</tr>
<?php
$tabella->riga();
$query = "	SELECT 
			proxy_acl_list.id,
			proxy_acl_list.sys,
			proxy_acl_list.attivo,
			proxy_acl_list.nome,
			proxy_acl_list.data,
			count(proxy_acl.id) AS numero
		FROM
			proxy_acl_list
		JOIN
			proxy_acl
		ON
			proxy_acl_list.id = proxy_acl.idacllist
			GROUP BY
				id
		UNION DISTINCT SELECT
			proxy_acl_list.id,
			proxy_acl_list.sys,
			proxy_acl_list.attivo,
			proxy_acl_list.nome,
			proxy_acl_list.data,
			0 AS numero
		FROM
			proxy_acl_list
		WHERE
			proxy_acl_list.id NOT IN (SELECT idacllist FROM proxy_acl GROUP BY idacllist)
		ORDER BY
			sys DESC,
			nome
	";

$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
	if (is_null($dato['nome'])) {
		continue;
	}
?>
	<tr>
<?php
	if ($dato['sys']) { ?>
		<td rowspan=2><img src="<?php print $CONF['base_url'] ?>/img/attivo_grey.gif" ALT="ACL non modificabile" TITLE="ACL non modificabile"></td>
		<td rowspan=2><img src="<?php print $CONF['base_url'] ?>/img/modify_grey.gif" ALT="ACL non modificabile" TITLE="ACL non modificabile"></td>
<?php	} else {
		if ($dato['attivo']) {
?>
		<td rowspan=2 class="spazio"><a href="proxy_gest.php?azione=acl_down&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="ACL attiva" TITLE="ACL attiva"></a></td>
<?php		} else { ?>
		<td rowspan=2 class="spazio"><a href="proxy_gest.php?azione=acl_up&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="ACL non attiva" TITLE="ACL non attiva"></a></td>
<?php		} ?> 
		<td rowspan=2><a href="acl_edit.php?id=<?php print $dato['id'] ?>"><img src="<?php print $CONF['base_url'] ?>/img/modify.gif" ALT="Dettaglio" TITLE="Dettaglio"></a></td>
<?php 	} ?>
		<td rowspan=2 class="spazio"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="descrizione">Nome lista</td>
		<td rowspan=2 class="spazio"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="descrizione">Elementi</td>
		<td rowspan=2 class="spazio"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="descrizione">Ultima modifica</td>
		<td rowspan=2 class="spazio"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
	</tr>
	<tr>
		<td class="colip"><?php print $dato['nome'] ?></td>
		<td class="colip"><?php print $dato['numero'] ?></td>
		<td class="colip"><?php print $dato['data'] ?></td>

	</tr>
<?php
$tabella->riga();
} 
$tabella->close();
?>
</form>
<?php view_footer(); ?>
