Ejemplo n.º 1
0
function afficherPageGestionUti()
{
    require_once './Modele/utilisateurs.php';
    $idUti = $_SESSION["userID"];
    $uti = infosUti($db, $idUti);
    $themes = getThemeEvent();
    $uti["utilisateur_favoris"] = rechercheFavori($db, $idUti);
    $uti["utilisateur_alertes"] = alertesUti($db, $idUti);
    include './Vue/gestion/gestionProfil.php';
}
Ejemplo n.º 2
0
function recherche()
{
    require './Modele/evenements.php';
    $events = array(array());
    $eventsFavoris = NULL;
    if (isset($_POST["dateRecherche"]) && isset($_POST["themeRecherche"])) {
        $date = formattageDate($_POST["dateRecherche"], "bdd");
        $motCle = htmlspecialchars($_POST["motCleRecherche"]);
        $ville = htmlspecialchars($_POST["villeRecherche"]);
        $theme = $_POST["themeRecherche"];
        $condition = "WHERE DATEDIFF(evenement_date_debut, \"{$date}\") >= 0";
        $condition .= $motCle != "" ? " AND (UPPER(evenement_titre) LIKE UPPER('%{$motCle}%') OR UPPER(evenement_description) LIKE UPPER('%{$motCle}%'))" : "";
        $condition .= $ville != "" ? " AND evenement_adresse_id IN (SELECT adresse_id FROM adresse WHERE UPPER(adresse_ville) LIKE UPPER('%{$ville}%'))" : "";
        $condition .= $theme != "0" ? " AND evenement_theme_id = {$theme}" : "";
        $events = rechercheEvent($condition, $db);
    } else {
        if (isset($_SESSION['userID'])) {
            require_once './Modele/utilisateurs.php';
            $date = date("Y-m-d");
            $favoris = rechercheFavori($db, $_SESSION['userID']);
            if ($favoris != NULL) {
                $condition = "WHERE DATEDIFF(evenement_date_debut, \"{$date}\") >= 0 AND evenement_theme_id IN {$favoris}";
                $eventsFavoris = rechercheEvent($condition, $db);
                if ($eventsFavoris == NULL) {
                    $eventsFavoris = 1;
                }
                $condition2 = "WHERE DATEDIFF(evenement_date_debut, \"{$date}\") >= 0 AND evenement_theme_id NOT IN {$favoris}";
                $events = rechercheEvent($condition2, $db);
            } else {
                $condition = "WHERE DATEDIFF(evenement_date_debut, \"{$date}\") >= 0";
                $events = rechercheEvent($condition, $db);
            }
        } else {
            $date = date("Y-m-d");
            $condition = "WHERE DATEDIFF(evenement_date_debut, \"{$date}\") >= 0";
            $events = rechercheEvent($condition, $db);
        }
    }
    $retour = array($eventsFavoris, $events);
    return $retour;
}