예제 #1
0
        include 'model/' . $myClass . '.php';
    } elseif (file_exists('controller/' . $myClass . '.php')) {
        include 'controller/' . $myClass . '.php';
    }
}
spl_autoload_register("classLoad");
include 'config.php';
include 'lib/pagination.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav'])) {
    //classManagers
    $projetManager = new ProjetManager($pdo);
    $fournisseurManager = new FournisseurManager($pdo);
    $commandeManager = new CommandeManager($pdo);
    $commandeDetailManager = new CommandeDetailManager($pdo);
    //classes and vars
    $commandes = "";
    $projets = $projetManager->getProjets();
    $fournisseurs = $fournisseurManager->getFournisseurs();
    $projet = $projetManager->getProjets();
    $livraisonListDeleteLink = "";
    if (isset($_GET['mois']) and isset($_GET['annee'])) {
        $mois = $_GET['mois'];
        $annee = $_GET['annee'];
        $commandes = $commandeManager->getCommandesByMonthYear($mois, $annee);
    }
    ?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
예제 #2
0
        include 'model/' . $myClass . '.php';
    } elseif (file_exists('controller/' . $myClass . '.php')) {
        include 'controller/' . $myClass . '.php';
    }
}
spl_autoload_register("classLoad");
include 'config.php';
include 'lib/pagination.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav'])) {
    //classManagers
    $projetManager = new ProjetManager($pdo);
    $fournisseurManager = new FournisseurManager($pdo);
    $commandeManager = new CommandeManager($pdo);
    $commandeDetailManager = new CommandeDetailManager($pdo);
    //classes and vars
    $commandeDetailNumber = 0;
    $titreLivraison = "Détail de la commande";
    $commande = "Vide";
    $fournisseur = "Vide";
    $nomProjet = "Non mentionné";
    $idProjet = "";
    $fournisseurs = $fournisseurManager->getFournisseurs();
    $projets = $projetManager->getProjets();
    if (isset($_GET['codeCommande'])) {
        $commande = $commandeManager->getCommandeByCode($_GET['codeCommande']);
        $fournisseur = $fournisseurManager->getFournisseurById($commande->idFournisseur());
        if ($commande->idProjet() != 0) {
            $nomProjet = $projetManager->getProjetById($commande->idProjet())->nom();
            $idProjet = $projetManager->getProjetById($commande->idProjet())->id();
include '../config.php';
include '../lib/image-processing.php';
//classes loading end
session_start();
//post input processing
$action = htmlentities($_POST['action']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
$redirectLink = "";
$mois = $_POST['mois'];
$annee = $_POST['annee'];
$codeCommande = $_POST['codeCommande'];
$redirectLink = "Location:../commande-details-iaaza.php?codeCommande=" . $codeCommande . "&mois=" . $mois . "&annee=" . $annee;
//Component Class Manager
$commandeDetailManager = new CommandeDetailManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['reference'])) {
        $reference = htmlentities($_POST['reference']);
        $libelle = htmlentities($_POST['libelle']);
        $quantite = htmlentities($_POST['quantite']);
        $idCommande = htmlentities($_POST['idCommande']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $commandeDetail = new CommandeDetail(array('reference' => $reference, 'libelle' => $libelle, 'quantite' => $quantite, 'idCommande' => $idCommande, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $commandeDetailManager->add($commandeDetail);
        $actionMessage = "Opération Valide : Article Commande Ajouté(e) avec succès.";
        $typeMessage = "success";
예제 #4
0
            $typeMessage = "error";
        }
        if (isset($_POST['source']) and $_POST['source'] == "commande-mois-annee-iaaza") {
            $redirectLink = "Location:../commande-mois-annee-iaaza.php?mois=" . $mois . "&annee=" . $annee;
        } else {
            if (isset($_POST['source']) and $_POST['source'] == "commande-details-iaaza") {
                $redirectLink = "Location:../commande-details-iaaza.php?codeCommande=" . $codeCommande . "&mois=" . $mois . "&annee=" . $annee;
            }
        }
    } else {
        if ($action == "delete") {
            $idCommande = htmlentities($_POST['idCommande']);
            $codeCommande = htmlentities($_POST['codeCommande']);
            $mois = $_POST['mois'];
            $annee = $_POST['annee'];
            //delete commande and its details
            $commandeDetailsManager = new CommandeDetailManager($pdo);
            $commandeDetailsManager->deleteCommande($idCommande);
            $commandeManager->delete($idCommande);
            $actionMessage = "Opération Valide : Commande supprimé(e) avec succès.";
            $typeMessage = "success";
            if (isset($_POST['source']) and $_POST['source'] == "commande-mois-annee-iaaza") {
                $redirectLink = "Location:../commande-mois-annee-iaaza.php?mois=" . $mois . "&annee=" . $annee;
            }
        }
    }
}
//Action Delete Processing End
$_SESSION['commande-action-message'] = $actionMessage;
$_SESSION['commande-type-message'] = $typeMessage;
header($redirectLink);