/**
  *	Add activity in database
  *	@param : Activity object
  *	@return : false if the insert failed / else true
  */
 public function add(Activity $activite)
 {
     $title = $activite->getTitle();
     $descr = $activite->getDescription();
     $pos = $activite->getGeoPos();
     $type = $activite->getType();
     $priority = $activite->getPriority();
     $sd = $activite->getStartDate();
     $ed = $activite->getEndDate();
     $sh = $activite->getStartHour();
     $eh = $activite->getEndHour();
     $per = $activite->getPeriodic();
     $nbOcc = $activite->getNbOccur();
     $isInBreak = $activite->getIsInBreak();
     $sub = $activite->getIsPossibleToSubscribe();
     $public = $activite->getIsPublic();
     $idAgenda = $activite->getIdAgenda();
     $sql = "INSERT INTO activite (titre, description, positionGeographique, type, priorite, dateDebut, dateFin, heureDebut, heureFin, periodicite, nbOccurence, estEnPause, estPossibleDeSinscrire, estPublic, idAgenda)\n\t\t\tVALUES (:titre, :description, :positionGeographique, :type, :priorite, :dateDebut, :dateFin, :heureDebut, :heureFin, :periodicite, :nbOccurence, :estEnPause, :estPossibleDeSinscrire, :estPublic, :idAgenda)";
     $req = $this->_db->prepare($sql);
     $req->bindParam(':titre', $title, PDO::PARAM_STR);
     $req->bindParam(':description', $descr, PDO::PARAM_STR);
     $req->bindParam(':positionGeographique', $pos, PDO::PARAM_STR);
     $req->bindParam(':type', $type, PDO::PARAM_STR);
     $req->bindParam(':priorite', $priority, PDO::PARAM_INT);
     $req->bindParam(':dateDebut', $sd, PDO::PARAM_STR);
     $req->bindParam(':dateFin', $ed, PDO::PARAM_STR);
     $req->bindParam(':heureDebut', $sh, PDO::PARAM_STR);
     $req->bindParam(':heureFin', $eh, PDO::PARAM_STR);
     $req->bindParam(':periodicite', $per, PDO::PARAM_STR);
     $req->bindParam(':nbOccurence', $nbOcc, PDO::PARAM_INT);
     $req->bindParam(':estEnPause', $isInBreak, PDO::PARAM_INT);
     $req->bindParam(':estPossibleDeSinscrire', $sub, PDO::PARAM_INT);
     $req->bindParam(':estPublic', $public, PDO::PARAM_INT);
     $req->bindParam(':idAgenda', $idAgenda, PDO::PARAM_INT);
     $req->execute();
     $nbTupleInsere = $req->rowCount();
     $req->closeCursor();
     //check if insert has failed
     if ($nbTupleInsere < 1) {
         return false;
     }
     return true;
 }
    public function showActivity(Activity $act, $idUser)
    {
        $html = "";
        $html .= '
            <div class="row">
                <div class="col-md-12">
                    <div class="center" id="successSub">
                    </div>
                    <div class="alert alert-info center" role="alert"> 
                        <div class="row">
                            <div class="col-md-6">
                                Priorité : ' . $act->getPriority() . '
                            </div>
                            <div class="col-md-6">
                            ';
        if ($act->getIsPublic()) {
            $html .= 'Activité publique';
        } else {
            $html .= 'Activité privée';
        }
        $html .= '
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-8">
                    <h1>' . $act->getIdActivity() . ' - ' . $act->getTitle() . ' à ' . $act->getGeoPos() . '</h1>
                </div>
                
                <div class="col-md-4">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="notationDiv">
                                <p>Notation : </p>
                                <script src="js/ListeEtoile.js"></script>
                                <div id="notation"> 
                                    <script type="text/javascript"> 
                                        CreateListeEtoile(\'notation\',5); 
                                    </script> 
                                </div> 
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12 center">
                        ';
        //if the event is private the button is disabled
        if ($act->getIsPossibleToSubscribe()) {
            $html .= '<button type="button" id="buttonInscriptionAct" data-idAct=' . $act->getIdActivity() . ' data-idUser='******' class="btn btn-default">S\'inscrire</button>';
        } else {
            $html .= '<button type="button" class="btn btn-default" disabled="disabled">S\'inscrire</button>';
        }
        $html .= '
                        </div>
                    </div>
                </div>
            </div>
            <div class="row marginBot">
                <div class="col-md-12">
                    Du : ' . $act->getStartDate() . ' au ' . $act->getEndDate() . ' <br/>
                    De : ' . $act->getStartHour() . ' à ' . $act->getEndHour() . ' <br/>
                    <br/>
                    <h3>Description : </h3>
                    ' . $act->getDescription() . '


                </div>

            </div>

            <div class="row">
                <div class="col-md-12">
                    <div id="showComment2">
                    </div>
                </div>
            </div>
            
        ';
        echo $html;
    }