<?php include_once '../../inc/inc.config.php'; include_once '../inc-auth-granted.php'; include_once '../classes/utils.php'; require '../classes/Categorie.php'; $debug = false; $categorie = new Categorie(); // ---- Modification ---------------------------- // if (!empty($_GET)) { $action = 'modif'; $categorie = new Categorie(); $result = $categorie->load($_GET["id"]); if (!empty($result)) { $titre_page = 'Catégorie "' . $result[0]["nom"] . '"'; $id = $_GET["id"]; $id_parent = $result[0]["id_parent"]; $nom = $result[0]["nom"]; $image[1] = $result[0]["image"]; $tag = $result[0]["tag"]; if (empty($image[1]) || !isset($image[1])) { $img[1] = "/img/favicon.png"; $imgval[1] = "/img/favicon.png"; } else { $img[1] = '/photos/categorie' . $image[1]; $imgval[1] = $image[1]; } } else { $message = 'Aucun enregistrement'; } } else {
<th class="col-md-2" style="">Catégorie</th> <th class="col-md-5" style="">Description</th> <th class="col-md-1" style="">Photo</th> <th class="col-md-1" style="">Online</th> <th class="col-md-1" colspan="2" style="">Actions</th> </tr> </thead> <tbody> <? if ( !empty( $liste_produit ) ) { $i=0; foreach ( $liste_produit as $value ) { $i++; // ---- Chargement de la catégorie associée $data = $categorie->load( $value[ "id_categorie" ] ); $classe_affichage = ( $i % 2 != 0 ) ? "info" : ""; $description = couper_correctement( $value[ "description" ], 50 ); if ( strlen( $value[ "description" ] ) > 50 ) $description .= " ..."; $image_ok = ( !empty( $value[ "image" ] ) && isset( $value[ "image" ] ) ) ? "image OK" : " "; $online = ( $value[ "online" ] == '1' ) ? 'check' : 'vide'; echo "<tr class='" . $classe_affichage . "'>\n"; echo " <td>" . $value[ "nom" ] . "</td>\n"; echo " <td>" . $data[ 0 ][ "nom" ] . "</td>\n"; echo " <td>" . $description . "</td>\n"; echo " <td>" . $image_ok . "</td>\n"; echo " <td><img src='../img/" . $online . ".png' width='30' ></td>\n"; echo " <td><a href='./edition.php?id=" . $value[ "id" ] . "'><img src='../img/modif.png' width='30' alt='Modifier' ></a></td>\n"; echo " <td>\n";
require $_SERVER["DOCUMENT_ROOT"] . "/inc/inc.config.php"; require $_SERVER["DOCUMENT_ROOT"] . "/admin/classes/Categorie.php"; $debug = false; $categorie = new Categorie(); $id = $_GET["id"]; $btn_creation_categorie = "Créer la catégorie"; // ---- Liste des catégories de niveau 0 ------ // if (1 == 1) { unset($recherche); $recherche["id_parent"] = 0; $liste_categorie = $categorie->getListe($recherche, $debug); } // -------------------------------------------- // // ---- Chargement d'une catégorie ------------ // if ($_GET["id"] != '') { $datas = $categorie->load($id); if (!empty($datas[0])) { $id_parent = $datas[0]["id_parent"]; $nom = $datas[0]["nom"]; $btn_creation_categorie = "Modifier la catégorie"; } } // -------------------------------------------- // if (empty($liste_categorie)) { $message = 'Aucun enregistrement'; } else { $message = ''; } ?> <!doctype html>