Exemplo n.º 1
0
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         // Si aucune instance de DBConnectionManager trouvée
         self::$_instance = new DBConnectionManager();
         // alors créer une instance
     }
     return self::$_instance;
     // Retour de l'objet connection
 }
Exemplo n.º 2
0
 public function __construct($type, $phase)
 {
     try {
         $i = 0;
         $db = DBConnectionManager::getInstance();
         $resultMatch = $db->getListeMatch($type, $phase);
         foreach ($resultMatch as $data) {
             $this->_listeMatch[$i] = new Match($data['noMatch'], $data['noCourt'], $data['noCreneau'], $data['phase'], $data['noJoueur1'], $data['noJoueur2'], $data['noJoueur3'], $data['noJoueur4'], $data['nbPlacesRestantes'], $data['date'], $data['resultatJ1'], $data['resultatJ2'], $data['gagnant'], $data['Type']);
             $i++;
         }
         $db->closeCursor();
     } catch (Exception $e) {
         die('Erreur : ' . $e->getMessage());
     }
 }
Exemplo n.º 3
0
 public function __construct()
 {
     try {
         $i = 0;
         $db = DBConnectionManager::getInstance();
         $resultCourt = $db->getCourts();
         foreach ($resultCourt as $data) {
             $this->_listeCourt[$i] = new Court($data['noCourt'], $data['nomCourt'], $data['typeCourt'], $data['reserve']);
             $i++;
         }
         $db->closeCursor();
     } catch (Exception $e) {
         die('Erreur : ' . $e->getMessage());
     }
 }
Exemplo n.º 4
0
 public function __construct()
 {
     try {
         $i = 0;
         $db = DBConnectionManager::getInstance();
         $resultJoueur = $db->getJoueurs();
         foreach ($resultJoueur as $data) {
             $this->_listeJoueur[$i] = new Joueur($data['noJoueur'], $data['nomJoueur'], $data['prenomJoueur'], $data['dob'], $data['nationalite'], $data['typeEntree']);
             $i++;
         }
         $db->closeCursor();
     } catch (Exception $e) {
         die('Erreur : ' . $e->getMessage());
     }
 }
Exemplo n.º 5
0
 public static function ExecuteQuery($sql)
 {
     $connection = DBConnectionManager::get_connection(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME);
     $db = MDB::cursor($connection, '');
     return $db->fetchObject($db->query($sql));
 }
Exemplo n.º 6
0
 public function __construct()
 {
     $DBManager = new DBConnectionManager();
     $this->db = $DBManager->connect();
 }
Exemplo n.º 7
0
 public function escapeString($string)
 {
     #Para poder executar o realEscapeString, precisamos ter uma conexão aberta.
     if (!$this->conn) {
         $this->SetConnection(DBConnectionManager::getMasterConnection());
     }
     return mysqli_real_escape_string($this->conn, $string);
 }
Exemplo n.º 8
0
$CDAO = new ClimbingAreaDAO();
$areaid = 7;
$indoor = 1;
var_dump($CDAO->climbingAreaExists($areaid, $indoor));
$UserDAO = new UserDAO();
echo $UserDAO->getNumUsers();
var_dump($UserDAO->getUserPrefs(954));
var_dump($UserDAO->setUserPrefs(954, array("show_boulder" => 1, "minL" => 3)));
var_dump($UserDAO->getUserPrefs(954));
var_dump($UserDAO->getUserProfile(954));
var_dump($UserDAO->getUserRecords(954));
$WorkoutService = new WorkoutLoggingService();
$workout_segments_abs = array(array("climb_type" => "boulder", "ascent_type" => "flash", "grade_index" => 1, "reps" => 1), array("climb_type" => "toprope", "ascent_type" => "project", "grade_index" => 9, "reps" => 5), array("climb_type" => "lead", "ascent_type" => "redpoint", "grade_index" => 11, "reps" => 6), array("climb_type" => "boulder", "ascent_type" => "onsight", "grade_index" => 13, "reps" => 2));
var_dump($WorkoutService->calcWorkoutPoints($workout_segments_abs));
// Save a workout
$DBManager = new DBConnectionManager();
$db = $DBManager->connect();
// userid, date_workout, gymid, boulder_notes,
// tr_notes, lead_notes, other_notes
$userid = 4;
$workout_info = array("userid" => $userid, "date_workout" => "2015-10-23", "gymid" => 1, "boulder_notes" => "bouldering!", "tr_notes" => "tr rocks", "lead_notes" => "", "other_notes" => "other notes!!!");
$workout_info["boulder_points"] = 200;
$workout_info["TR_points"] = 300;
$workout_info["Lead_points"] = 400;
$userrecordDAO = new UserRecordsDAO();
var_dump($userrecordDAO->getUserRecords($userid));
$results = $WorkoutService->saveWorkoutAbsGrades($workout_info, $workout_segments_abs);
echo $results;
//$grading_systems = array("boulder"=>2,"route"=>4);
//$results = $WorkoutService->saveWorkoutRelGrades($workout_info, $workout_segments_abs, $grading_systems);
//$gradingConversionService = new GradingConversionService();
Exemplo n.º 9
0
 public static function ExecuteQuery($sql, $use_memcache = USE_MEMCACHE, $memcache_seconds = MEMCACHE_SECONDS, $memcache_custom_key = NULL)
 {
     $db = MDB::cursor('');
     $db->SetConnection(DBConnectionManager::getProperConnection($sql));
     return $db->query($sql, $use_memcache, $memcache_seconds, $memcache_custom_key);
 }
Exemplo n.º 10
0
<?php

require_once '../Model/DBConnectionManager.php';
require_once '../Model/ListeMatch.php';
require_once '../Model/ListeJoueur.php';
require_once '../Model/Commande.php';
try {
    $dbb = DBConnectionManager::getInstance();
    if (isset($_COOKIE['id']) && isset($_COOKIE['prenom'])) {
        session_start();
        $_SESSION['id'] = $_COOKIE['id'];
        $_SESSION['prenom'] = $_COOKIE['prenom'];
        $_SESSION['type'] = $_COOKIE['type'];
        $_SESSION['phase'] = $_COOKIE['phase'];
    }
    $listeMatch = new ListeMatch($_COOKIE['type'], $_COOKIE['phase']);
    $errormsg = '';
    $listeJoueur = new ListeJoueur();
    //$commande = Commande::getInstance(null,null,null,null,null,null);
    if (isset($_GET['action'])) {
        if ($_GET['action'] == 'reservation') {
            require_once '../View/choixtype.php';
        } else {
            if ($_GET['action'] == 'type') {
                if ($_GET['value'] == 'simple') {
                    //$commande->setTypeMatch('simple');
                    setcookie('type', 'simple', time() + 365 * 24 * 3600, null, null, false, true);
                    require_once '../View/choixphase.php';
                } elseif ($_GET['value'] == 'double') {
                    //$commande->setTypeMatch('double');
                    setcookie('type', 'double', time() + 365 * 24 * 3600, null, null, false, true);