<?php
/* **
 * @application PhpMyShopping
 * @part        Admin boutique (AB)
 * @file        client.php
 * @path        ./admin/
 * @author      Stephane DINE <stephane@phpmyshopping.org>
 * @site        http://www.phpmyshopping.org
 * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
 *
 * PHP version 5
 */

if ((!isset($_SESSION['LoginOk']) or $_SESSION['LoginOk'] != 'IdentOk')) {
    header('Location: ./login.php');
}

require_once 'include/class.customer.php';
$customer = new Customer();

switch ($C3) {
/** -------------------------------------------------------------------------------------
 * Affichage par defaut
 */
case 'list':
    echo $customer->customerList();
    break;

/** -------------------------------------------------------------------------------------
 * Mode edition du client
  */
case 'edit':

    break;

/** -------------------------------------------------------------------------------------
 * Demande de confirmation pour la suppression d'un client
 */
case 'delete_confirm':
    echo '
    <p class="message_confirm">Souhaitez-vous vraiment effacer ce client ?<br /><br />
      [<a class="lien_admin" href="?C1=CL&C2=CL&C3=delete_ok&ID_Customer='.$_GET['ID_Customer'].'">Oui</a>]
      <b>::</b>
      [<a class="lien_admin" href="?C1=CL&C2=CL&C3=list">Non</a>]
    </p>
    <p class="message_alerte">
    ATTENTION ! Cette action entra&icirc;nera la suppression du client de mani&egrave;re irr&eacute;versible.<br />
    Toutes l\'historique des commandes pass&eacute;es par ce client sera aussi effac&eacute;es.
    </p>';
    break;

/** -------------------------------------------------------------------------------------
 * Suppression d'un client
 */
case 'delete_ok':
    $customer->customerDelete($_GET['ID_Customer']);
    echo $customer->customerList();
    break;

/** -------------------------------------------------------------------------------------
 * Affichage par defaut
 */
default:
    echo $customer->customerList();
}
?>
