<?php
/* **
 * @application PhpMyShopping
 * @part        Admin general (AG)
 * @file        index.php
 * @path        ./
 * @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
 *
 * Affichage des differentes parties de l'administration a partir de cette page
 */

session_start();

require_once './include/class.admin.php';
$admin = new Admin();

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

$title = $admin->getField('Shop', 'ShortNameShop', 'ID_Shop', 1);
$domain = $admin->getParam('param', 'domain_name_1');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr" lang="en">
<head>
  <title>Administration - <?php echo $title; ?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Pragma" content="no-cache" />
  <link rel="stylesheet" href="./css/default.css" type="text/css" />
  <link rel="stylesheet" href="./css/onglet.css" type="text/css" media="screen" />
  <!--<link href="./css/style.css" rel="stylesheet" type="text/css" />-->
  <script type="text/javascript" src="./js/ajax.js"></script>
  <script type="text/javascript" src="./js/scripts.js"></script>
  <script type="text/javascript" src="./js/onglet.js"></script>
  <script type="text/javascript">
  document.write('<style type="text/css">.tabber{display:none;}<\/style>');
  </script>
</head>
<body>

<div id="header"><h1>Administration</h1>
  <div class="a">Vous &ecirc;tes connect&eacute; en tant qu'<b><?php echo $_SESSION['Username']; ?></b></div>
</div>

<?php
//include_once '../ident.php';
include('menu.php');

if ((isset($_POST['C1'])) and ($_POST['C1'])) {
	$C1 = $_POST['C1'];
} elseif ((isset($_GET['C1'])) and ($_GET['C1'])) {
	$C1 = $_GET['C1'];
} else {
	$C1 = '';
}

if ((isset($_POST['C2'])) and ($_POST['C2'])) {
	$C2 = $_POST['C2'];
} elseif ((isset($_GET['C2'])) and ($_GET['C2'])) {
	$C2 = $_GET['C2'];
} else {
	$C2 = '';
}

if ((isset($_POST['C3'])) and ($_POST['C3'])) {
	$C3 = $_POST['C3'];
} elseif ((isset($_GET['C3'])) and ($_GET['C3'])) {
	$C3 = $_GET['C3'];
} else {
	$C3 = '';
}

if (empty($_REQUEST['debut']) or (!isset($_REQUEST['debut']))) {
	$debut = 0;
} else {
	$debut = $_REQUEST['debut'];
}

switch ($C1) {
/** -------------------------------------------------------------------------------------
 * Partie "Catalogue"
 */
case 'CA':
	include('catalogue.php');
	break;

/** -------------------------------------------------------------------------------------
 * Partie "Clients"
 */
case 'CL':
	switch ($C2) {
	case 'CL':
		include('client.php');
		break;

	case 'CO':
		include('commande.php');
		break;

	case 'MA':
		include('newsletter.php');
		break;
	}

	break;

/** -------------------------------------------------------------------------------------
 * Partie "Configuration"
 */
case 'CO':
	switch ($C2) {
	case 'TP':
		include('template.php');
		break;

	case 'TA':
		include('taxe.php');
		break;

	case 'PE':
		include('personnalisation.php');
		break;

	case 'MP':
		include('paiement.php');
		break;

	case 'CO':
		include('configuration.php');
        break;
	}

	break;

/** -------------------------------------------------------------------------------------
 * Partie "Frais d'envoi"
 */
case 'FE':
	include('frais_envoi.php');
	break;

/** -------------------------------------------------------------------------------------
 * Partie "Gestion des admins"
 */
case 'AD':
	include('admin.php');
	break;

/** -------------------------------------------------------------------------------------
 * Affichage par defaut
 */
default:
	echo '<div class="heading">Bienvenue sur l\'interface d\'administration de votre boutique</div>
	<!--<div class="description"></div>-->';
	break;

}



/**
 * Affichage infos de debug
 */
/*
echo '<div style="float: left; width="100%">
<br /><br /><table width="100%"><tr>
<td style="border: 1px solid red;" valign="top"><b><pre>Contenu de $_SESSION</b><br />'; echo print_r($_SESSION); echo '</pre></td>
<td style="border: 1px solid green;" valign="top"><b><pre>Contenu de $_GET</b><br />'; echo print_r($_GET); echo '</pre></td>
<td style="border: 1px solid blue;" valign="top"><b><pre>Contenu de $_POST</b><br />'; echo print_r($_POST); echo '</pre></td>
</tr></table></div>';
*/
?>



</body>
</html>
