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

<form name="" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
	<tr>
		<td class="sep" width="5%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="5%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="5%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="30%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="5%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="10%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="5%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="10%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="sep" width="30%"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
	</tr>
	<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>
	<tr><td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
<?php
$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="acl_gest.php?azione=disattiva&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="acl_gest.php?azione=attiva&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>
	<tr><td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>

<?php
} ?>
</table>
</form>
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
<?php view_footer(); ?>
