示例#1
0
 public function getDataFromPost($postData, $carId = null)
 {
     $this->isDataFromPost = true;
     if (isset($carId)) {
         $this->id = $carId;
     }
     $this->model = util::getParam($postData, $this->getModelParamName());
     $this->color = util::getParam($postData, $this->getColorParamName());
     $this->year = util::getParam($postData, $this->getYearParamName());
     $this->license = util::getParam($postData, $this->getLicenseParamName());
     if (!$this->isOptionnalCar() || $this->isOptionnalCar() && $this->hasValuesInAtLeastOneField()) {
         $this->insurance->loadFromPost($this->getInsuranceParamName(), util::$ALLOWED_EXTENSIONS, car::INSURANCE_DIRECTORY, car::INSURANCE_DB_FIELD, $carId);
     }
     $this->isElectric = util::getParam($postData, $this->getElectricParamName());
 }
示例#2
0
require_once "class.log.php";
require_once "class.validation.php";
require_once "class.userData.php";
require_once "class.car.php";
define('CANCEL_DEMAND_POST', 'cancelDemand');
define('REACTIVATE_DEMAND_POST', 'reactivateDemand');
$objAuth = authentification::instance();
$objLog = log::instance();
$objvalid = validation::instance();
$objDemandeListe = new demandeListe();
$objDemande = null;
$fileFieldIndex = 0;
if ($objAuth->estIdentifie()) {
    $matricule = $_SESSION['usager'];
    $submissionTarget = util::getParam($_POST, 'submissionTarget');
    $submissionType = util::getParam($_POST, 'submissionType');
    $demande = new demande($matricule);
    if ($submissionTarget == 'demande') {
        if ($submissionType == CANCEL_DEMAND_POST) {
            $demande->cancelDemand();
            header("Location: demande.php");
        } else {
            if ($submissionType == REACTIVATE_DEMAND_POST) {
                $demande->reactivateDemand();
                header("Location: demande.php");
            } else {
                $demande->getDataFromPost($_POST, $matricule);
                if ($demande->isValid()) {
                    if ($demande->saveToDatabase($matricule)) {
                        header("Location: demande.php");
                    }
<?php

error_reporting(E_ALL);
require_once 'class.authentification.php';
require_once 'class.database.php';
require_once 'class.util.php';
$statusId = util::getParam($_POST, 'statusId');
$db = database::instance();
$result = $db->requete("SELECT description FROM st_status WHERE st_status.statusId={$statusId}");
$resultArray = mysql_fetch_array($result);
print util::cleanUTF8($resultArray['description']);
<?php

require_once 'class.database.php';
require_once 'class.demande.php';
require_once 'class.tripInfo.php';
require_once 'class.util.php';
$database = database::instance();
$page = $_GET['page'];
// get the requested page
$limit = $_GET['rows'];
// get how many rows we want to have into the grid
$orderBy = $_GET['sidx'];
// get index row - i.e. user click to sort
$sortOrder = $_GET['sord'];
// get the direction
$status = util::getParam($_GET, 'status');
$result = $database->requete("SELECT COUNT(*) AS count FROM st_demande");
$row = mysql_fetch_array($result);
$count = $row['count'];
$totalPages = $count > 0 && $limit > 0 ? ceil($count / $limit) : 0;
if ($page > $totalPages) {
    $page = $totalPages;
}
$baseStart = $limit * $page - $limit;
$start = $baseStart < 0 ? 0 : $baseStart;
$statusQueryClause = "";
if (is_numeric($status)) {
    $statusQueryClause = !isset($status) || $status < 0 ? " " : "AND st_demande." . demande::STATUS_DB_FIELD . " = '" . $status . "' ";
} else {
    if (isset($status)) {
        switch ($status) {
示例#5
0
<?php

require_once 'class.authentification.php';
require_once 'class.util.php';
require_once 'class.demande.php';
require_once 'class.database.php';
$auth = authentification::instance();
if (!$auth->estIdentifie() || !$auth->isUserAdmin()) {
    header("Location: index.php");
    exit(0);
}
$status = util::getParam($_GET, 'status');
$matricules = util::getParam($_GET, 'matricules');
$details = util::getParam($_GET, 'details');
$includeDetails = util::getParam($_GET, 'includeDetailsInMail') == 'true';
$sendMail = util::getParam($_GET, 'sendMail') == 'true';
$errorIconPath = 'images/error_icon.png';
$successIconPath = 'images/success_icon.png';
$response->statusChangeIndicatorImagePath = $successIconPath;
$response->statusChangeMessage = "";
$response->hasError = false;
if (!isset($status) || !isset($matricules)) {
    $response->statusChangeIndicatorImagePath = $errorIconPath;
    $response->statusChangeMessage = "Argument manquant";
    $response->hasError = true;
    print json_encode($response);
    return;
}
$response->selectedDemands = json_decode($matricules);
try {
    //$matricules = json_decode($matricules);
<?php 
require_once 'class.authentification.php';
require_once 'class.util.php';
require_once 'class.demande.php';
define('licenseTabName', 'licenseTab');
define('residentialProofTabName', 'residentialProofTab');
define('car1TabName', 'car1Tab');
define('car2TabName', 'car2Tab');
$auth = authentification::instance();
$matricules = util::getParam($_POST, 'matricules');
$section = util::getParam($_GET, 'section');
if ($auth->estIdentifie() && isset($matricules) && isset($section)) {
    $matricules = json_decode($matricules);
    $demandCount = count($matricules);
    $demande = null;
    if ($demandCount == 1) {
        $demande = new demande($matricules[0]);
        $demande->updateDataFromDB();
        $options = $demande->getStatus()->getStatusSelectorOptions();
    } else {
        if ($demandCount == 0) {
            exit(0);
        }
    }
    if ($section == 'status') {
        if ($demandCount > 1) {
            generateStatusSectionContentMultiDemands($demandCount);
        } else {
            generateStatusSectionContent($demande);
        }
<?php

require_once 'class.authentification.php';
require_once 'class.util.php';
$auth = authentification::instance();
$imagePath = util::getParam($_GET, 'imagePath');
$angle = util::getParam($_GET, 'angle');
if (!$auth->estIdentifie() || !$auth->isUserAdmin()) {
    header('Location: index.php');
    exit(0);
}
if (!isset($angle) || !isset($imagePath)) {
    exit(0);
}
if (file_exists($imagePath)) {
    $ext = strtolower(pathinfo($imagePath, PATHINFO_EXTENSION));
    header("Content-type: image/" . $ext . "");
    if ($ext == 'gif') {
        rotateGifImage($angle, $imagePath);
    } else {
        if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'pjpeg') {
            rotateJpegImage($angle, $imagePath);
        } else {
            if ($ext == 'png' || $ext == 'x-png') {
                rotatePngImage($angle, $imagePath);
            } else {
            }
        }
    }
    imagedestroy($image);
} else {
<?php

require_once 'class.util.php';
require_once 'class.demande.php';
$auth = authentification::instance();
if (!$auth->estIdentifie() || !$auth->isUserAdmin()) {
    header("Location: index.php");
    exit(0);
}
$selectedTab = util::getParam($_GET, 'selectedTab');
$matricule = util::getParam($_GET, 'matricule');
$response->hasError = false;
if (!isset($selectedTab) || !isset($matricule)) {
    $response->hasError = true;
    print json_encode($response);
    exit(0);
}
$demande = new demande($matricule);
$demande->getDataGromDB($matricule);
$response->selectedTab = $selectedTab;
switch ($selectedTab) {
    case 'licenseTab':
        $response = loadLicenseData($demande);
        break;
    case 'residentialProofTab':
        $response = loadResidentialProofData($demande);
        break;
    case 'car1Tab':
        $response = loadFirstCarInsuranceData($demande);
        break;
    case 'car2Tab':
示例#9
0
 public function getDataFromPost($postData, $matricule)
 {
     $this->paymentMethod = util::getParam($postData, demande::PAYMENT_METHOD_FORM_FIELD);
     $this->carpooling = util::getParam($postData, demande::CARPOOLING_FORM_FIELD);
     $this->carpoolingOthers = util::getParam($postData, demande::CARPOOLING_OTHERS_FORM_FIELD);
     $this->details = util::getParam($postData, demande::DETAILS_FORM_FIELD);
     $this->drivingLicense = new demandTableFile();
     $this->proofOfResidence = new demandTableFile();
     $this->drivingLicense->loadFromPost(demande::DRIVING_LICENSE_FORM_FIELD, util::$ALLOWED_EXTENSIONS, demande::DRIVING_LICENSE_DIRECTORY, demande::DRIVING_LICENSE_DB_FIELD, $matricule);
     $this->proofOfResidence->loadFromPost(demande::PROOF_OF_RESIDENCE_FORM_FIELD, util::$ALLOWED_EXTENSIONS, demande::PROOF_OF_RESIDENCE_DIRECTORY, demande::PROOF_OF_RESIDENCE_DB_FIELD, $matricule);
     $this->car1 = new car(1);
     $this->car2 = new car(2);
     $result = $this->database->requete("SELECT * FROM st_demande WHERE matricule = '" . $matricule . "'");
     if (mysql_num_rows($result) == 0) {
         $this->car1->getDataFromPost($postData);
         $this->car2->getDataFromPost($postData);
     } else {
         $resultsArray = mysql_fetch_array($result);
         $this->car1->getDataFromPost($postData, $resultsArray[demande::CAR1_DB_FIELD]);
         $this->car2->getDataFromPost($postData, $resultsArray[demande::CAR2_DB_FIELD]);
     }
     $this->isDataFromPost = true;
 }
示例#10
0
<?php

require_once 'class.authentification.php';
require_once 'class.util.php';
require_once 'class.demande.php';
$auth = authentification::instance();
$matricule = util::getParam($_POST, 'matricule');
if ($auth->estIdentifie() && isset($matricule)) {
    $demande = new demande($matricule);
    $demande->updateDataFromDB();
    $userData = $demande->getUserData();
    $tripInfo = $demande->getTripInfo();
    print "<div id='rightSideInfoTabs'>\n\t\t\t\t  <ul>\n\t\t\t\t    <li><a href='#personInfo'><span>Informations</span></a></li>\n\t\t\t\t    <li><a href='#otherInfos'><span>Infos additionnelles</span></a></li>\n\t\t\t\t     <li><a href='#options'><span>Options</span></a></li>\n\t\t\t\t  </ul>\n\t\t\t\t  <div id='personInfo' style='height:100%'>\n\t\t\t\t  \t<label class='infoFieldTitleWithBar' ' >Nom</label>\n\t\t\t\t  \t<label class='infoFieldValue' >" . $userData->getLastName() . ", " . $userData->getFirstName() . " (" . $userData->getMatricule() . ")" . "</label>\n\t\t\t\t  \t\n\t\t\t\t  \t<label class='infoFieldTitleWithBar' >Email</label>\n\t\t\t\t  \t<a class='infoFieldValue' href='mailto:" . $userData->getEmail() . "' target='_blank'>" . $userData->getEmail() . "</a>\n\t\t\t\t  \t\n\t\t\t\t  \t<label class='infoFieldTitleWithBar' >T&eacutel&eacutephone</label>\n\t\t\t\t  \t<label class='infoFieldValue'>" . $userData->getPhone() . "</label>\n\t\t\t\t\t\n\t\t\t\t  \t<label class='infoFieldTitleWithBar' >Adresse</label>\n\t\t\t\t  \t<label class='infoFieldValue'>" . $userData->getAddress() . ", " . $userData->getCity() . ", " . $userData->getZipCode() . "</label>\n\t\t\t\t  \t\n\t\t\t\t  \t<img id='googleMap' src=" . getMapImageUrl($tripInfo) . "></img>\n\t\t\t\t  \t\n\t\t\t\t\t<div class='bottomBorderedElement' style='margin-top:8px'>\n\t\t\t\t\t\t<label style='display:inline'>D&eacutesire faire du covoiturage</label>\n\t\t\t\t\t\t<label class='infoFieldValue' style='float:right; font-weight:bold'>" . ($demande->isCarpooling() ? 'Oui' : 'Non') . "</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class='bottomBorderedElement' style='margin-top:4px'>\n\t\t\t\t\t\t<label style='display:inline'>D&eacutesire faire du covoiturage avec d'autres</label>\n\t\t\t\t\t\t<label class='infoFieldValue' style='float:right; font-weight:bold'>" . ($demande->isCarpoolingOthers() ? 'Oui' : 'Non') . "</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t  </div>\n\t\t\t\t  <div id='otherInfos' style='height:100%'>\n\t\t\t\t  \t<label class='infoFieldTitleWithBar' ' >M&eacutethode de paiement</label>\n\t\t\t\t  \t<label class='infoFieldValue' >" . util::getPaymentMethodNameFromId($demande->getPaymentMethod()) . "</label>\n\t\t\t\t  \t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' ' >Date de cr&eacuteation</label>\n\t\t\t\t  \t<label class='infoFieldValue' >" . $demande->getModificationDate() . "</label>\n\t\t\t\t  \t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' ' >Date de derni&egravere modification</label>\n\t\t\t\t  \t<label class='infoFieldValue' >" . $demande->getCreationDate() . "</label>\n\t\t\t\t  \t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' ' >Temps de trajet estim&eacute</label>\n\t\t\t\t  \t<label class='infoFieldValue' >" . $demande->getTripInfo()->getDurationInMinutes() . " minutes</label>\n\t\t\t\t  </div>\n\t\t\t\t  <div id='options' style='height:100%'>\n\t\t\t\t  \t\n\t\t\t\t  </div>\n\t\t\t  </div>";
} else {
    exit(0);
}
function getMapImageUrl(tripInfo $tripInfo)
{
    $location = $tripInfo->getLatitude() . "," . $tripInfo->getLongitude();
    $location = rawurlencode(mb_convert_encoding($location, "UTF-8"));
    $poly = "45.504448,-73.614204";
    return "http://maps.googleapis.com/maps/api/staticmap?center={$location}&zoom=10&size=375x200&markers=color:red%7Clabel:P%7C" . $poly . "&markers=color:blue%7Clabel:S%7C" . $location . "&maptype=roadmap&sensor=false";
}
示例#11
0
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <meta name="KEYWORDS" content="Stationnement" />
     <meta name="robots" content="index,follow" />
     <link rel="shortcut icon" href="http://www.aep.polymtl.ca/        favicon.ico" />
<title>Stationnement - AEP</title>
</head>
<!--<body onload="javascript:window.print()">-->
<?php 
error_reporting(E_ALL);
require_once 'class.authentification.php';
require_once 'class.util.php';
require_once 'class.demande.php';
require_once 'class.database.php';
$auth = authentification::instance();
$matricule = util::getParam($_GET, 'matricule');
$changeStatus = util::getParam($_GET, 'changeStatus');
if (!$auth->isUserAdmin() || empty($matricule)) {
    require_once "header.php";
    print util::cleanUTF8("Problème d'identification ou de matricule");
    exit(0);
}
$demande = new demande($matricule);
$user = new userData($matricule);
$db = database::instance();
if ($changeStatus == "1") {
    $printedStatus = demandStatus::PRINTED_STATUS;
    $result = $db->requete("SELECT description FROM st_status WHERE st_status.statusId={$printedStatus}");
    $resultArray = mysql_fetch_array($result);
    $demande->getStatus()->setToPrinted(util::cleanUTF8($resultArray[demandStatus::STATUS_DESC_DB_FIELD]));
    print '<body>';
} else {
示例#12
0
require_once 'class.demandsStatistics.php';
define('SELECTED_FILTER_PARAM', 'filter');
define('ALL_FILTER', 'all');
define('WAITING_FILTER', 'waiting');
define('VALID_PROOF_FILTER', 'validProof');
define('REFUSED_FILTER', 'refused');
define('ACCEPTED_FILTER', 'accepted');
define('PAID_FILTER', 'paid');
define('PRINTED_FILTER', 'printed');
define('INVALID_PROOF_FILTER', 'invalidProof');
define('CANCELED_FILTER', 'canceled');
define('CARPOOLING_FILTER', 'carpooling');
define('CARPOOLING_OTHERS_FILTER', 'carpoolingOther');
define('ELETRIC_CAR_FILTER', 'electricCar');
$radioButtonCount = 0;
$selectedFilter = util::getParam($_GET, SELECTED_FILTER_PARAM);
$selectedFilter = isset($selectedFilter) ? $selectedFilter : ALL_FILTER;
print "<div style='clear:both'>";
// Filter buttons
print '	<span >		
				<div id="filters">';
createStatusFilterButton('Tout', ALL_FILTER, demandsStatistics::getOverallDemandCount(), -1);
createStatusFilterButton('Attente', WAITING_FILTER, demandsStatistics::getWaitingDemandsCount(), demandStatus::WAITING_STATUS);
createStatusFilterButton('Preuves vérifiées', VALID_PROOF_FILTER, demandsStatistics::getValidatedInfosDemandsCount(), demandStatus::PROOF_OK_STATUS);
createStatusFilterButton('Refusé', REFUSED_FILTER, demandsStatistics::getRefusedDemandsCount(), demandStatus::REFUSED_STATUS);
createStatusFilterButton('Accepté', ACCEPTED_FILTER, demandsStatistics::getAcceptedDemandsCount(), demandStatus::ACCEPTED_STATUS);
createStatusFilterButton('Payé', PAID_FILTER, demandsStatistics::getPaidDemandsCount(), demandStatus::PAID_STATUS);
createStatusFilterButton('Imprimé', PRINTED_FILTER, demandsStatistics::getPrintedDemandsCount(), demandStatus::PRINTED_STATUS);
createStatusFilterButton('Preuves invalides', INVALID_PROOF_FILTER, demandsStatistics::getInvalidInfosDemandsCount(), demandStatus::INVALID_PROOF_STATUS);
createStatusFilterButton('Annulé', CANCELED_FILTER, demandsStatistics::getCanceledDemandsCount(), demandStatus::CANCELED_STATUS);
createStatusFilterButton('Covoiturage', CARPOOLING_FILTER, demandsStatistics::getCarpoolingDemandsCount(), 'carpooling');