* @copyright Copyright © 2003 OpenWeb.eu.org
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
 */
define('OW_BACKEND_ACTION', 'ACT_DOCCLASSE');
require_once '../../include/backend/init.inc.php';
require_once PATH_INC_BACKEND_JPACK . 'JHtml.lib.php';
require_once PATH_INC_BACKEND_JPACK . 'JUrl.class.php';
require_once PATH_INC_BACKEND_SERVICE . 'ReferenceManager.class.php';
require_once PATH_INC_BACKEND_SERVICE . 'UserManager.class.php';
require_once PATH_INC_BACKEND_SERVICE . 'DocumentManager.class.php';
echo html_liste_actions();
$ref = new ReferenceManager($db);
$listeCrit = $ref->getCriterionList();
$listeCat = array();
foreach ($listeCrit as $crit => $name) {
    $listeCat[$name] = $ref->getEntriesList($crit);
    if (empty($listeCat[$name])) {
        /* on enlève lorsqu'aucun classement n'existe */
        unset($listeCat[$name]);
    }
}
$listeArticles = array();
if (isset($_GET['catid'])) {
    $catid = $_GET['catid'];
    $am = new DocumentManager($db);
    $am->nbParPage = $am->nbrDocs();
    if (isset($_POST['liste'])) {
        $am->setDocumentOrder($catid, array_flip($liste));
    }
    $listeArticles = $am->getListBy1Critere($catid);
} else {
<label>Type : <?php 
htmlSelect('type', $ref->getTypeList(), $contraintes['type'], '', false, 'none', '-- tous --');
?>
</label>
<label>Utilisateur : <?php 
htmlSelectDB('uti', $um->getUserList(), $contraintes['uti'], 'uti_id', array('uti_prenom', 'uti_nom'), 1, false, 0, '-- tous --');
?>
</label>
<label>État : <?php 
htmlSelect('status', $statusLib, $contraintes['status'], 1, false, 'none', '-- tous --');
?>
</label>
<?php 
foreach ($critereLib as $nom => $critere) {
    echo '<label>', $critere, " : ";
    htmlSelect("cri_{$nom}", $ref->getEntriesList($nom), $contraintes["cri_{$nom}"], '', false, 'none', '-- tous --');
    echo "</label>\n";
}
?>

<input type="submit" value="Filtrer" name="filtrer" id="filtrer" />
</fieldset>
</form>

<?php 
/* On affiche la liste des articles */
$am = new DocumentManager($db);
$infosPages = array();
$listeArticles = $am->getListPage($contraintes, $infosPages);
if (count($listeArticles) == 0) {
    echo '<p>Aucun document ne correspond à ces critères.</p>', "\n";