<?php 
    //aggiunto il campo costante tabella = richiedenti/tecnici per portarmi sul form il nome della tabella
    $tabella->set_titolo("Scheda allegato", "modifica", array("allegato" => $nome_doc, "id" => $id, "pratica" => ""));
    $tabella->elenco();
    ?>
			<!-- fine contenuto-->
			 </TD>
	      </TR>
		  		 <tr>
		       
			   <td width="100%"> <br><br>
		<b>  &nbsp;Elenco file allegati:</b>
       <table class="stiletabella" width=100% border="0" cellpadding=1 cellspacing=0>
	   <?php 
    if (!isset($db)) {
        $db = $tabella->get_db();
    }
    $pr = new pratica($idpratica);
    $sql = "SELECT numero FROM pe.avvioproc WHERE pratica={$idpratica};";
    $db->sql_query($sql);
    $numero = $db->sql_fetchfield('numero');
    $numero = preg_replace("|([^A-z0-9\\-]+)|", '', str_replace('/', '-', str_replace('\\', '-', $numero)));
    $sql = "select * from pe.file_allegati where allegato={$id} order by ordine";
    $db->sql_query($sql);
    $elenco = $db->sql_fetchrowset();
    //print_r($elenco);
    $nfile = $db->sql_numrows();
    for ($i = 0; $i < $nfile; $i++) {
        if ($elenco[$i]["tipo_file"] == "application/pdf") {
            $immagine = "images/pdf_icon.jpg";
        } elseif ($elenco[$i]["tipo_file"] == "application/vnd.sun.xml.writer") {