示例#1
0
 private function enregistrerSession()
 {
     require_once 'modele/SessionSurf.php';
     require_once 'modele/Membre.php';
     $sessionSurf = new SessionSurf($this->proposition);
     $sessionSurf->setOrganisateur($_SESSION['Membre']);
     $manager = new SessionSurfsManager(null);
     $manager->ajoutSession($sessionSurf, $this->proposition['nomSpot'], $this->proposition['noVeh'], $this->proposition['nbrPlacesDispo'], $this->proposition['nbrPlanchesDispo']);
     $this->response_status = 1;
     $this->response_html = '<p>Ok, Proposition enregistrée! Go to surf !!! Recharges la page pour voir apparaitre dans la section je cherche ta proposition</p>';
     $sessionSurfEnBase = $manager->loadComplet($sessionSurf->noSes());
     require_once 'template.php';
     ob_start();
     ecrireJeChercheSection();
     $this->response_JeChercheSection = ob_get_contents();
     ob_end_clean();
 }
示例#2
0
function ecrireJeChercheItemSessionSurf(SessionSurf $sessionsurf)
{
    $session_title = $sessionsurf->lieuDep() . ' -> ' . $sessionsurf->spot()->nomSpot() . ' - ' . count($sessionsurf->listeParticipants()) . ' pax';
    $session_id = 'session-' . $sessionsurf->noSes();
    $dateAllerObj = new DateTime($sessionsurf->dateAller());
    $dateRetourObj = new DateTime($sessionsurf->dateRetour());
    $session_date = 'Du ' . $dateAllerObj->format('d-m-Y H:m') . ' au ' . $dateRetourObj->format('d-m-Y');
    $session_class = str_replace(' ', '', strtolower($sessionsurf->spot()->nomSpot()));
    $tick = '';
    if (isset($_SESSION['Membre']) && $sessionsurf->estParticipant($_SESSION['Membre'])) {
        $tick = "class=\"font-icon-ok\"";
    }
    ?>
		                    				<!-- Item SessionSurf and Filter Name -->
								<li id="item-<?php 
    echo $session_id;
    ?>
" class="item-thumbs span3 <?php 
    echo $session_class;
    ?>
">
		                        				<div align="center" <?php 
    echo $tick;
    ?>
> <?php 
    echo $session_title;
    ?>
	</div>
		                             			<!-- Fancybox - Gallery Enabled - Title - Full Image -->
									<a class="hover-wrap fancybox-session"
									data-fancybox-group="gallery"
									title="<?php 
    echo $session_title;
    ?>
"
									href="#<?php 
    echo $session_id;
    ?>
"> <span class="overlay-img"></span>
										<span class="overlay-img-thumb font-icon-plus"></span>
								</a> <!-- Thumb Image and Description --> <img
									src="<?php 
    echo $sessionsurf->spot()->photoSpot();
    ?>
"
									alt="<?php 
    echo $session_title;
    ?>
">
	
									<div style="display: none">
										<form id="<?php 
    echo $session_id;
    ?>
"
											class="session-inscription" method="post" action="">
											<input type="hidden" name="noSes" value="<?php 
    echo $sessionsurf->noSes();
    ?>
"> <input
												type="hidden" name="choix" value="session-inscription">
											<div id="item-form-<?php 
    echo $session_id;
    ?>
">
<?php 
    if (!isset($_SESSION['Membre'])) {
        ?>
											<div class="info-block">
												<div class="info-text">
													<p>Il faut se connecter pour participer à la session.</p>
												</div>
											</div>
<?php 
    } else {
        if (strlen($tick) <= 0) {
            ?>
											<p id="status">Je pars ...</p>
											<p>
												<label for="avecPlanche">Avec ma board: </label> <input
													type="checkbox" id="avecPlanche" name="avecPlanche"
													size="30" />
											</p>
												<p>
												<label for="avecVehicule">Je prends mon véhicule </label> <select
													id="avecVehicule" name="noVeh">
													<option value='-1'>Je ne prends pas ma voiture</option>
								            			<?php 
            $membre = $_SESSION['Membre'];
            foreach ($membre->listeVehicules() as $tuture) {
                $titre_voiture = $tuture->marqueVeh() . ' ' . $tuture->modeleVeh();
                echo '<option value="' . $tuture->noVeh() . '">' . $titre_voiture . '</option>';
            }
            ?>
								            		</select>
											</p>
	
											<p>
												<label for="nbrPlacesDispo">Nombre de places dispo</label> <input
													type="text" pattern="[1-9]"
													placeholder="Nombre de places dispo" id="nbrPlacesDispo"
													name="nbrPlacesDispo" size="3">
											</p>
											<p>
												<label for="nbrPlanchesDispo">Nombre de places pour planches
													dispo</label> <input type="text" pattern="[1-9]"
													placeholder="Nombre de places pour planches dispo"
													id="nbrPlanchesDispo" name="nbrPlanchesDispo" size="3">
											</p>
												
												<p>
												<input type="submit" value="Je pars avec vous ..." />
											</p>
<?php 
        } else {
            ?>
											<div class="info-block">
												<div class="info-text">
													<p>Tu es déjà inscris à cette session.</p>
												</div>
											</div>
<?php 
        }
    }
    ?>
										</div>
										</form>
									</div>
										
		                                		<div align="center"><?php 
    echo $session_date;
    ?>
</div>                   			
		                        			</li>
								<!-- End Item SessionSurf -->
<?php 
}
示例#3
0
 function ajoutSession(SessionSurf $sessionSurf, $nomSpot, $noVeh, $nbrPlacesDispo, $nbrPlanchesDispo)
 {
     $dbh = $this->_db;
     //ajoutSession
     $sql = "INSERT INTO SessionSurf (nomSpot, dateAller, dateRetour, lieuDep) VALUES (:nomSpot, :dateAller, :dateRetour, :lieuDep);";
     $sth = $dbh->prepare($sql);
     $sth->bindParam(":nomSpot", $nomSpot, PDO::PARAM_STR);
     $sth->bindParam(":dateAller", $sessionSurf->dateAller(), PDO::PARAM_STR);
     $sth->bindParam(":dateRetour", $sessionSurf->dateRetour(), PDO::PARAM_STR);
     $sth->bindParam(":lieuDep", $sessionSurf->lieuDep(), PDO::PARAM_STR);
     if ($sth->execute() == 0) {
         print $dbh->errorInfo();
         // affiche message d'érreur de la bdd
     } else {
         $noSes = $dbh->lastInsertId();
         //ajoutPropose
         $sql = "INSERT INTO Propose VALUES (:noMem, :noSes);";
         $sth = $dbh->prepare($sql);
         $sth->bindParam(":noMem", $sessionSurf->organisateur()->noMem(), PDO::PARAM_STR);
         $sth->bindParam(":noSes", $noSes, PDO::PARAM_STR);
         if ($sth->execute() == 0) {
             print $dbh->errorInfo();
         } else {
             //ajoutParticipant
             $sessionSurf->setNoSes($noSes);
             $this->ajoutParticipant($sessionSurf, $sessionSurf->organisateur()->noMem(), false);
         }
         //ajoutVehiculeSessionSurf
         if ($noVeh >= 0) {
             $this->ajoutVSS($sessionSurf, $noVeh, $nbrPlacesDispo, $nbrPlanchesDispo);
         }
     }
 }