Exemple #1
0
    if (file_exists('model/' . $myClass . '.php')) {
        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'])) {
    //les sources
    $fournisseurManager = new FournisseurManager($pdo);
    $employesManager = new EmployeManager($pdo);
    $annuaireManager = new AnnuaireManager($pdo);
    $fournisseurs = $fournisseurManager->getFournisseurs();
    $employes = $employesManager->getEmployes();
    $annuaires = $annuaireManager->getAnnuaires();
    ?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8" />
    <title>ImmoERP - Management Application</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    } elseif (file_exists('../controller/' . $myClass . '.php')) {
        include '../controller/' . $myClass . '.php';
    }
}
spl_autoload_register("classLoad");
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 = "";
//Component Class Manager
$annuaireManager = new AnnuaireManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['nom']) and !empty($_POST['telephone1'])) {
        $nom = htmlentities($_POST['nom']);
        $description = htmlentities($_POST['description']);
        $telephone1 = htmlentities($_POST['telephone1']);
        $telephone2 = htmlentities($_POST['telephone2']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $annuaire = new Annuaire(array('nom' => $nom, 'description' => $description, 'telephone1' => $telephone1, 'telephone2' => $telephone2, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $annuaireManager->add($annuaire);
        $actionMessage = "Opération Valide : Numéro Ajouté(e) avec succès.";
        $typeMessage = "success";