Fix: N'affiche le titre du tableau "Document" si le tableau n'est pas affiché.

This commit is contained in:
Laurent Destailleur 2005-09-04 11:51:40 +00:00
parent 4a1ba47948
commit 96db11b011

View File

@ -1554,11 +1554,25 @@ class Form
$relativepath = "${filename}/${filename}.pdf"; $relativepath = "${filename}/${filename}.pdf";
$fullpathfile = $filedir . "/" . $filename . ".pdf"; $fullpathfile = $filedir . "/" . $filename . ".pdf";
$i=0;
if (is_dir($filedir))
{
$handle=opendir($filedir);
while (($file = readdir($handle))!==false)
{
// Si fichier non lisible ou non .pdf, on passe au suivant
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue;
if ($i==0)
{
// Affiche en-tete tableau
if ($genallowed) if ($genallowed)
{ {
print '<form action="'.$urlsource.'" method="post">'; print '<form action="'.$urlsource.'" method="post">';
print '<input type="hidden" name="action" value="setpdfmodel">'; print '<input type="hidden" name="action" value="setpdfmodel">';
} }
print_titre($langs->trans("Documents")); print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -1587,15 +1601,7 @@ class Form
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">'; print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">';
print '</td></tr>'; print '</td></tr>';
} }
}
$i=0;
if (is_dir($filedir))
{
$handle=opendir($filedir);
while (($file = readdir($handle))!==false)
{
// Si fichier non lisible ou non .pdf, on passe au suivant
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>'; if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>';
@ -1612,11 +1618,15 @@ class Form
} }
} }
if ($i > 0)
{
// Affiche pied du tableau
print "</table>\n"; print "</table>\n";
if ($genallowed) if ($genallowed)
{ {
print '</form>'; print '</form>';
} }
}
} }