1748 |
/** |
/** |
1749 |
* \brief Affiche la cartouche de la liste des documents d'une propale, facture... |
* \brief Affiche la cartouche de la liste des documents d'une propale, facture... |
1750 |
* \param modulepart propal=propal, facture=facture, ... |
* \param modulepart propal=propal, facture=facture, ... |
1751 |
* \param filename Nom fichier |
* \param filename Nom fichier sans extension |
1752 |
* \param filedir Repertoire à scanner |
* \param filedir Repertoire à scanner |
1753 |
* \param urlsource Url page origine |
* \param urlsource Url page origine |
1754 |
* \param genallowed Génération autorisée |
* \param genallowed Génération autorisée |
1765 |
$var=true; |
$var=true; |
1766 |
|
|
1767 |
$filename = sanitize_string($filename); |
$filename = sanitize_string($filename); |
1768 |
if ($modulepart != 'expedition') $relativepath = "${filename}/${filename}.pdf"; |
// Par defaut |
1769 |
else $relativepath = get_exdir("${filename}")."${filename}.pdf"; |
$extension = 'pdf'; $relativepath = "${filename}/${filename}.${extension}"; |
1770 |
|
// Autre cas |
1771 |
|
if ($modulepart == 'expedition') { $extension='pdf'; $relativepath = get_exdir("${filename}")."${filename}.pdf"; } |
1772 |
|
if ($modulepart == 'don') { $extension='html'; $relativepath = get_exdir("${filename}")."${filename}.html"; } |
1773 |
|
|
1774 |
$i=0; |
$i=0; |
1775 |
if (is_dir($filedir)) |
if (is_dir($filedir)) |
1776 |
{ |
{ |
1778 |
while (($file = readdir($handle))!==false) |
while (($file = readdir($handle))!==false) |
1779 |
{ |
{ |
1780 |
// Si fichier non lisible ou non .pdf, on passe au suivant |
// Si fichier non lisible ou non .pdf, on passe au suivant |
1781 |
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue; |
if (! is_readable($filedir."/".$file) || ! eregi('\.'.$extension.'$',$file)) continue; |
1782 |
|
|
|
|
|
1783 |
if ($i==0) |
if ($i==0) |
1784 |
{ |
{ |
1785 |
// Affiche en-tete tableau |
// Affiche en-tete tableau |
1820 |
} |
} |
1821 |
|
|
1822 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
1823 |
if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>'; |
$mimetype=strtoupper($extension); |
1824 |
else print '<td nowrap>PDF</td>'; |
if ($extension == 'pdf') $mimetype='PDF'; |
1825 |
|
if ($extension == 'html') $mimetype='HTML'; |
1826 |
|
if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé'; |
1827 |
|
print '<td nowrap>'.$mimetype.'</td>'; |
1828 |
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a></td>'; |
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a></td>'; |
1829 |
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>'; |
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>'; |
1830 |
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>'; |
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>'; |