コード例 #1
0
ファイル: medias.php プロジェクト: Bivi/pluxml_bvi
/**
 * Méthode qui affiche les documents du dossier en cours
 *
 * @return	stdout
 * @author	Stephane F.
 **/
function displayDocuments($dir, $plxMedias, $view)
{
    if (!empty($plxMedias->aContent['files'])) {
        echo '<table class="table">';
        echo '<thead>';
        echo '<tr>';
        echo '<th style="width:75%">Nom du fichier</th>';
        echo '<th style="width:25%">Action</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        # Initialisation variable de boucles
        $i = 1;
        foreach ($plxMedias->aContent['files'] as $k => $v) {
            $i++;
            echo '<tr class="line-' . $i % 2 . '">';
            echo '<td class="tc1">&nbsp;' . plxUtils::strCut($v['name'], 100) . '</td>';
            echo '<td class="tc1">&nbsp;';
            if ($view != '') {
                # Icone pour lien crypté
                echo '<a href="javascript:void(0)" title="Ajouter le lien pour t&eacute;l&eacute;charger le fichier" onclick="opener.insDoc(\'' . $view . '\', \'' . str_replace('../', '', plxEncrypt::encryptId($plxMedias->path . $dir . $v['name'])) . '\', \'' . $v['name'] . '\', \'1\')">';
                echo '<img src="img/lock_go.png" alt="Ajouter fichier" /></a>&nbsp;';
                # Icone pour lien en clair
                echo '<a href="javascript:void(0)" title="Ajouter le lien du fichier" onclick="opener.insDoc(\'' . $view . '\', \'' . str_replace('../', '', $plxMedias->path . $dir . $v['name']) . '\', \'' . $v['name'] . '\', \'0\')">';
                echo '<img src="img/square.png" alt="Ajouter fichier" /></a>&nbsp;';
            }
            echo "\n" . '<select name="files[' . $dir . $v['name'] . ']">' . $plxMedias->getDirs($dir) . '</select>&nbsp;';
            echo '<a href="medias.php?delfile=' . $dir . $v['name'] . '&amp;dir=' . urlencode($dir) . '&amp;hash=' . $_SESSION['hash'] . ($view != '' ? '&amp;v=' . $view : '') . '" title="Supprimer le fichier" onclick="Check=confirm(\'Supprimer ce fichier ?\');if(Check==false) return false;"><img src="img/delete.gif" alt="Supprimer" /></a>';
            echo '</td>';
            echo '</tr>';
        }
        echo '</tbody>';
        echo '</table>';
    } else {
        echo '<p style="padding:10px;">Aucun fichier</p>';
    }
}