<?php

// fileattached table

$fileattachedlist = new WA_MySQLi_RS("fileattachedlist",$cmctrfdb,0);

$fileattachedlist->setQuery("SELECT * FROM fileattached  WHERE fileattached.idtrfdetails='$idtrf'");

$fileattachedlist->execute();

if (!empty($fileattachedlist->getColumnVal("idfileattached"))) {

$pdf->SetFont('','B','10');

$pdf->Cell(190,6,$fileattachedtitle,1,0,'C');

$pdf->SetFillColor(232, 242, 255);

$pdf->Ln();

$pdf->SetFont('','',8);

$pdf->Cell(90,6,$filenametitle,1,0,'C');

$pdf->Cell(100,6,$descriptionfiletitle,1,0,'C');

$pdf->Ln();

$wa_startindex = 0;

while(!$fileattachedlist->atEnd()) {

 $wa_startindex = $fileattachedlist->Index;

$pdf->SetTextColor(0, 0, 0);

$linkspecific='public/uploaddocuments/'.$fileattachedlist->getColumnVal("filename_fileattached");

$linkfile=$linkglobal.$linkspecific;

$fileattachedlimited=substr($fileattachedlist->getColumnVal("filename_fileattached"), 0, 30);

$pdf->Cell(90,6,$fileattachedlimited,1,0,'C',true,$linkfile);

$pdf->SetTextColor(0, 0, 0);

$descriptionlimited=substr($fileattachedlist->getColumnVal("description_fileattached"), 0, 30);

$pdf->Cell(100,6,$descriptionlimited,1,0,'C',true);

$pdf->Ln();

  $fileattachedlist->moveNext();

}

$fileattachedlist->moveFirst(); //return RS to first record

unset($wa_startindex);

unset($wa_repeatcount);

//download zip

$pdf->SetTextColor(0, 0, 0);

$pdf->Cell(190,6,'Scarica da questo link un file ZIP con tutti gli allegati',1,0,'C',false,$namefilezippathpdf);

}

$pdf->SetTextColor(0, 0, 0);

?>