Пример #1
0
if (getParam('logout') == '1') {
    session_destroy();
    header("Location: auth.php");
    exit;
}
if (!$objAuth->estIdentifie()) {
    header("Location: auth.php");
    exit;
}
$ids = array();
$ids = $_POST['id'];
$objDemande = new demande();
foreach ($ids as $id) {
    $changementStatus = false;
    $objDemande->ouvrir($id);
    $objDemande->setStatus(getParam('form_status'));
    if (getParam('form_status') != $objDemande->getStatus()) {
        $changementStatus = true;
    }
    if (!$objDemande->setStatus(getParam('form_status'))) {
        $changementStatus = false;
    }
    if ($objDemande->sauvegarde()) {
        $statutEnMot = printLecture('statusLong', $objDemande->getStatus());
        $email = file_get_contents('emailStatut.txt');
        $email = preg_replace("/@@PRENOM@@/", $objDemande->getPrenom(), $email);
        $email = preg_replace("/@@NOM@@/", $objDemande->getNom(), $email);
        $email = preg_replace("/@@ID@@/", $objDemande->getID(), $email);
        $email = preg_replace("/@@STATUT@@/", $statutEnMot, $email);
        $headers = 'From: Stationnement AEP <*****@*****.**>' . "\r\n" . 'X-Mailer: pHP/' . phpversion();
        if (config::SendEmail) {
require_once "class.validation.php";
$objAuth = authentification::instance();
#$objLog  = log::instance();
#$objvalid= validation::instance();
if (getParam('logout') == '1') {
    session_destroy();
    header("Location: auth.php");
    exit;
}
if (!$objAuth->estIdentifie()) {
    header("Location: auth.php");
    exit;
}
$objDemande = new demande();
$objDemande->ouvrir(getParam('id'));
$objDemande->setStatus(DEMANDE_STATUS_IMPRIME);
if ($objDemande->sauvegarde()) {
    printn("Le statut est maintenant : imprimé.<br><br>Vous pouvez fermer la fenetre.");
} else {
    printn("Erreur!  Impossible de changer le statut!");
}
exit(0);
function getParam($param)
{
    if (isset($_POST[$param])) {
        return $_POST[$param];
    }
    if (isset($_GET[$param])) {
        return $_GET[$param];
    }
    return null;