Compare commits

..

89 Commits

Author SHA1 Message Date
Antoine PEREDERII e72636c4d7 Update 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine PEREDERII 97623ba062 Merge branch 'master' of codefirst.iut.uca.fr:HeartDev/Web
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine PEREDERII 32afdd093c 📝 Add MCD on the readme file
1 year ago
David D'ALMEIDA 81b7a60267 Mise à jour de 'Sources/public/index.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 134f3ae997 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA f80492db66 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 3bc50ae677 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 9c03d12906 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA bfd039d9bb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 701563d0ee Mise à jour de 'Sources/config/httpd.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b4fe541a4f Ajouter 'Sources/config/httpd.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 505d4cd71d Mise à jour de 'Sources/src/app/controller/Controller.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8d000f997b Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 88d778f245 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 32b05eeb11 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8d5f1ddefe Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA ac7b90f0fb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 7cdd12df73 Ajouter 'Sources/config/virtual-host.conf'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA bcd043ceb1 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 1b66f277b5 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 1fb406c58a Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f78276dbec Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b52ba793d3 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA bb6e76f54f Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 4ce92111d1 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c7f0ab60d6 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA ddc7d843ed Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b20436b938 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 3fb3822ac7 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 23e04e3d71 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA cb04fc199b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 0d090a7183 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e4a74cb353 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8b14c2c95b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 0653af150b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c334f89aba Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 2acea545ae Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA f1b97a1c0d Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 884307f6b0 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b0b34843b3 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build encountered an error Details
1 year ago
David D'ALMEIDA f750992a07 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build encountered an error Details
1 year ago
David D'ALMEIDA 99405eb8b7 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 4f314cf7e3 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 93f68abf43 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f6212b6d5e Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f0bb8fed65 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 8b1ca8d371 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 837941721d Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 664f270062 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is running Details
1 year ago
David D'ALMEIDA 9d53db8000 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA b6fdae005b Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 39cc037569 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c5632a47fb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 373cc847ab Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 99f9e2ec22 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 43bd7295f9 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 2d5bc5303f Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 255a81c29c Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 92e196c7e3 Mise à jour de 'Sources/config/.htaccess'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA d0db1ad041 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 176e70d020 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 64a5a2c7c6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 65b63b0f2f Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA eeb2b8e3ab Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b5c62a9791 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e827554413 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e4688dbe28 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA d241bd15a1 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 7042c6a2b6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 71d1f58cc4 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA db8ed755db Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA b58ebcf3e8 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e2ed1aa3e6 Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA f7016ba5b5 Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA b1a486622e Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA 5caaf280b6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 397cc32336 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 4b8e69eec6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 06a5b72d1a Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 3a579bb606 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA d2296ff7d0 Mise à jour de 'README.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 8cf1786672 update some diagrams for futur evaluation
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 705edbf4e5 Merge branch 'master' of codefirst.iut.uca.fr:HeartDev/Web
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII af00c88542 add MLD and update somes diagrams
1 year ago
Antoine PEREDERII d6484b9f16 Update 'README.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII c4adf90c8d Update 'Documents/Diagramme/DiagrammeDeClasses/README_accesDonnees.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 4609a3e3d1 Merge remote-tracking branch 'origin/merged'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII d57f95ca62 Merge remote-tracking branch 'origin/merged'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 52ac902d0f problemes de git
continuous-integration/drone/push Build is failing Details
1 year ago

@ -0,0 +1,90 @@
kind: pipeline
type: docker
name: HeartWave
trigger:
event:
- push
steps:
# Test ✔️
- name: test
image: composer:2.6
commands:
- cd Sources
- rm -r vendor
- rm composer.lock
# Installe les dépendances PHP si nécessaire
- php composer.phar install --no-interaction
- ./vendor/bin/phpunit tests
# Sonar static code analisis deployment
# TODO : use an image that already have unzip
- name: code-analysis
image: php:8.1-cli
environment:
SONAR_TOKEN:
from_secret: SONAR_TOKEN
commands:
- apt-get update && apt-get install -y curl unzip
- export SONAR_SCANNER_VERSION=4.7.0.2747
- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
- export SONAR_SCANNER_OPTS="-server"
- cd Sources
- sonar-scanner -D sonar.projectKey=HeartTrack -D sonar.host.url=https://codefirst.iut.uca.fr/sonar
depends_on: [ test ]
# build image and push on the registry ✔️
- name: rewrite-urls
image: 'busybox:latest'
commands:
- cd Sources
- ls
- >-
find . -type f -exec sed -i -r
"s@(href|src)=\"/@\1=\"$${PLUGIN_CONTAINER_PATH}@g" {} +
settings:
container_path: https://codefirst.iut.uca.fr/containers/HeartDev-web/
- name: docker-build-and-push
image: plugins/docker
settings:
commands: ls
dockerfile: Sources/config/Dockerfile
context: Sources
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/david.d_almeida/web
mirror: https://proxy.iut.uca.fr:8443
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
from_secret: SECRET_REGISTRY_PASSWORD
depends_on:
- rewrite-urls
- name: deploy-container
image: >-
hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: 'hub.codefirst.iut.uca.fr/david.d_almeida/web:latest'
CONTAINERNAME: web
COMMAND: create
OVERWRITE: true
ADMINS: david.d_almeida
depends_on:
- docker-build-and-push
- name: notify
image: ruby:2.1
when:
status: [ success ]
ref:
include:
- refs/tags/*-demo
commands:
- sh ./notifymail.sh
depends_on: [ docker-build-and-push ]

@ -4,6 +4,56 @@
# BDD
## Modèle Logique de Données (MLD)
Le MLD représente la structure de données de l'application, décrivant les entités et les relations entre elles. Voici un aperçu des principales entités du MLD :
### Athlète (Athlete)
L'entité principale représentant un athlète avec ces informations propre à lui telles que l'identifiant, le nom, le prénom, l'email, etc. Les athlètes peuvent être coach avec le boolean idCoach et être liés par des amitiés, ou par un coaching via la table `Amitie`.
### Amitié (Friendship)
Une entité qui modélise les relations d'amitié entre les athlètes et de coaching entre les athlètes et les coachs. Elle stocke les identifiants des deux utilisateurs impliqués.
### Notification (Notification)
L'entité qui stocke les notifications destinées aux athlètes, avec des détails tels que le message, la date, le statut, et le degré d'urgence.
### Envoi de Notification (SendNotification)
Une entité de liaison entre les athlètes et les notifications, indiquant quel athlète ou coach a envoyé quelle notification. Cela peut-être utile lors d'une notification d'ajout d'amie par exemple.
### Statistique (Statistic)
Les statistiques relatives à un athlètes, y compris le poids, la fréquence cardiaque moyenne, la fréquence cardiaque maximale, etc.
### Entraînement (Training)
Détails sur les sessions d'entraînement planifiés par un coach pour ses athlètes, comprenant la date, la description, la localisation, etc. Les athlètes peuvent participer à des entraînements et donner leur feedback sur l'entrainement donné.
### Participation (Participate)
Une entité de liaison entre les athlètes et les entraînements, indiquant quels athlètes participent à quels entraînements.
### Don (GiveParticipation)
Une entité de liaison entre les coachs et les entraînements, indiquant quels coachs ont attribué quels entraînements.
### Source de Données (DataSource)
L'entité représentant la source des données des enregistrements sportif, telle que le type, le modèle, la précision, etc., utilisée par les athlètes pour enregistrer une ou des activités.
### Activité (Activity)
Les détails des activités des athlètes, y compris le type, la date, les heures de début et de fin, l'effort ressenti, etc.
### Fréquence Cardiaque (HeartRate)
Les données de fréquence cardiaque enregistrées pendant les activités, avec des informations telles que l'altitude, la température, etc.
Ce MLD forme la base de données sous-jacente pour l'application, offrant une structure organisée pour stocker et récupérer les informations relatives aux athlètes et à leurs activités.
```plantuml
@startuml
skinparam classAttributeIconSize 0
@ -129,9 +179,10 @@ athlete <-- friendship
```plantuml
@startuml
class Athlete {
idAthlete
skinparam classAttributeIconSize 0
package MCD{
entity "Athlete" as athlete {
{static} idAthlete
username
nom
prenom
@ -144,65 +195,45 @@ class Athlete {
isCoach
}
class Amitie {
idAthlete1
idAthlete2
}
class Notification {
idNotif
entity "Notification" as notif {
{static} idNotif
message
date
statut
urgence
athleteId
}
class Envoi {
idAthlete
idNotif
#athleteId
}
class Statistique {
idStatistique
entity "Statistique" as stats {
{static} idStatistique
poids
fcMoyenne
fcMax
caloriesBruleesMoy
date
athleteId
#athleteId
}
class Entrainement {
idEntrainement
entity "Entrainement" as training {
{static} idEntrainement
date
description
latitude
longitude
feedback
athleteId
}
class Participe {
athleteId
entrainementId
}
class Donne {
coachId
entrainementId
#athleteId
}
class SourceDonnee {
idSource
entity "SourceDonnee" as source {
{static} idSource
type
modele
precision
athleteId
#athleteId
}
class Activite {
idActivite
entity "Activite" as activity {
{static} idActivité
type
date
heureDeDebut
@ -215,29 +246,31 @@ class Activite {
maximum
minimum
temperatureMoyenne
athleteId
sourceId
#athleteId
#sourceId
}
class FrequenceCardiaque {
idFc
entity "FréquenceCardiaque" as fc {
{static} idFc
altitude
temps
temperature
temps : time
température
bpm
longitude
latitude
activiteId
#activitéId
}
Athlete "1" --o "0..*" Amitie
Athlete "1" --o "0..*" Notification
Athlete "1" --o "0..*" Statistique
Athlete "1" --o "0..*" Entrainement
Entrainement "0..*" --o "0..*" Athlete : Participants
Entrainement "0..*" --o "0..*" Athlete : Coachs
Athlete "1" --o "0..*" SourceDonnee
Activite "1" --o "0..*" FrequenceCardiaque
}
activity "0..n" --- "1..1" athlete : réalise
activity "1..n" --- "1..1" source : possede
activity "1..1" --- "1..n" fc : enregistre
athlete "1..n" --- "0..1" source : possede
stats "0..n" --- "1..1" athlete : possede
training "0..n" --- "1..n" athlete : participe
training "0..n" --- "1..1" athlete : donne
athlete "0..n" --- "1..n" athlete : est ami
notif "0..n" --- "1..n" athlete : recoit
notif "0..n" --- "1..1" athlete : envoie
@enduml
```

@ -28,11 +28,11 @@ Bienvenue dans l'écosystème dynamique de notre plateforme de gestion d'activit
- Les Utilisateurs ont un rôle spécifique (Athlete, Coach) qui détermine leurs fonctionnalités.
- Un Athlète peut enregistrer plusieurs Activités, Statistiques, et interagir avec différentes Sources de Données.
- Un Athlète peut enregistrer plusieurs Activités, possède des Statistiques, et une Sources de Données qui est la plus utilisé.
- Les Entraînements sont liés aux Utilisateurs, permettant une planification efficace.
- Les Notifications informent les Utilisateurs des événements importants.
- Les Notifications informent les Utilisateurs des événements importants tels qu'une demande d'amis ou une notification d'avertissement de ban.
Explorez ce diagramme pour comprendre comment notre plateforme offre une expérience complète, de la gestion des utilisateurs à l'enregistrement des activités sportives et au suivi des performances.

@ -18,7 +18,7 @@ Bienvenue dans le cœur de notre système, où les données prennent vie à trav
- **NotificationRepository :** Responsable de la gestion des notifications, assurant un accès structuré et une manipulation sécurisée de ces informations cruciales.
- **RelationshipRequestRepository :** Facilite la gestion des demandes de relations entre utilisateurs, garantissant une interaction claire et ordonnée.
- **RelationshipRequestRepository :** Facilite la gestion des demandes de relations entre utilisateurs (amitiés), garantissant une interaction claire et ordonnée au sein de l'application.
- **TrainingRepository :** Permet l'accès et la manipulation des données liées aux entraînements, facilitant le suivi des performances athlétiques.
@ -26,7 +26,7 @@ Explorez ce diagramme pour découvrir la robustesse de notre architecture de ges
```plantuml
@startuml couche_acces_aux_donnees
abstract class IGenericRepository {
interface IGenericRepository {
+ getItemById(int id) : object
+ getNbItems() : int
+ getItems(int index, int count, string orderingPropertyName, bool descending) : array

@ -4,15 +4,15 @@
# Introduction au Diagramme de Classes : Statistiques pour Coach
Bienvenue dans l'univers captivant de notre système de gestion d'activités sportives avec une mise au point spéciale sur les statistiques destinées aux coaches. Ce diagramme de classes offre une vue approfondie de la manière dont les utilisateurs, en particulier les athlètes et les coaches, interagissent avec les données de performance.
Bienvenue dans l'univers captivant de notre système de gestion d'activités sportives avec une mise au point spéciale sur les statistiques destinées aux athlètes. Ce diagramme de classes offre une vue approfondie de la manière dont les utilisateurs, en particulier les athlètes, interagissent avec leurs statistiques.
**Entités Principales :**
- **Utilisateur (User) :** Représente les individus inscrits sur notre plateforme, avec des détails personnels et un rôle spécifique dans l'écosystème sportif.
- **Athlète (Athlete) :** Un type spécialisé d'utilisateur qui peut enregistrer des statistiques liées à ses activités sportives.
- **Athlète (Athlete) :** Un type spécialisé d'utilisateur qui possède des statistiques liées à ses activités sportives.
- **Coach (Coach) :** Un rôle qui s'étend à partir de la classe abstraite Role, dédié à la gestion des athlètes et de leurs statistiques.
- **Coach (Coach) :** Un rôle qui s'étend à partir de la classe abstraite Role, dédié à la gestion des athlètes et de la vision de leurs statistiques.
- **Statistique (Statistique) :** Contient des informations détaillées sur les performances sportives d'un athlète, telles que la distance totale, le poids, le temps total, la fréquence cardiaque moyenne, minimale et maximale, ainsi que les calories brûlées.
@ -22,11 +22,11 @@ Bienvenue dans l'univers captivant de notre système de gestion d'activités spo
- Un Coach peut gérer une liste d'athlètes et avoir accès à leurs statistiques.
- Un Athlète peut enregistrer plusieurs statistiques liées à ses activités.
- Un Athlète peut enregistrer plusieurs activités afin d'avoir des statistiques liées à celle-ci.
**Objectif Principal :**
- Permettre aux coaches d'accéder et de surveiller les statistiques détaillées de leurs athlètes, offrant ainsi un aperçu complet de leurs performances sportives.
- Permettre aux coachs d'accéder et de surveiller les statistiques détaillées de leurs athlètes, offrant ainsi un aperçu complet de leurs performances sportives.
Explorez ce diagramme pour découvrir comment notre application crée une synergie entre les utilisateurs, les rôles, et les statistiques, contribuant ainsi à une expérience enrichissante dans le suivi des activités sportives.

@ -4,7 +4,7 @@
# Introduction au Modèle de Données de l'Application
L'architecture de données de notre application de suivi d'activités sportives repose sur un modèle robuste, avec des entités clés pour représenter les activités, les athlètes et les coachs. Découvrez les composants principaux de notre modèle de données :
L'architecture de données de notre application de suivi d'activités sportives repose sur un modèle robuste, avec des entités clés pour représenter les activités, les athlètes et les coachs et la récupération de ces données au sein de notre application. Découvrez les composants principaux de notre modèle de données :
## Activité
L'entité Activité représente une session d'activité sportive avec des détails variés tels que le type d'activité, la date, la durée, l'effort ressenti, etc. Le `ActiviteEntity` encapsule ces données, tandis que le `ActiviteGateway` gère la communication avec la base de données pour les activités.

@ -4,12 +4,12 @@
# Diagramme de classes pour l'importation de fichiers .fit
Bienvenue dans le monde de la gestion d'activités sportives avec notre application innovante ! Cette user story se concentre sur une fonctionnalité essentielle qui améliorera l'expérience des utilisateurs : l'importation de fichiers .fit. Nous avons conçu un diagramme de classes pour vous offrir une vision claire et structurée de la manière dont cette fonctionnalité est implémentée au sein de notre application.
Bienvenue dans le monde de la gestion d'activités sportives avec notre application innovante ! Ce diagramme de classe se concentre sur une fonctionnalité essentielle qui améliorera l'expérience des utilisateurs : l'importation de fichiers .fit. Nous avons conçu un diagramme de classes pour vous offrir une vision claire et structurée de la manière dont cette fonctionnalité est implémentée au sein de notre application.
**Acteurs Principaux :**
- Utilisateur (User) : Représente un individu inscrit sur notre plateforme, avec la capacité d'importer des fichiers .fit.
- Athlète (Athlete) : Un type spécialisé d'utilisateur, bénéficiant de fonctionnalités supplémentaires liées à la gestion d'activités sportives.
- Utilisateur (User) : Représente un individu inscrit sur notre plateforme.
- Athlète (Athlete) : Un type spécialisé d'utilisateur, bénéficiant de fonctionnalités supplémentaires liées à la gestion d'activités sportives et avec la capacité d'importer des fichiers .fit.
**Entités Clés :**
@ -18,13 +18,13 @@ Bienvenue dans le monde de la gestion d'activités sportives avec notre applicat
**Fonctionnalité Clé :**
- Importation de fichiers .fit : Permet aux utilisateurs de charger des données provenant de fichiers .fit, générés par des dispositifs de suivi d'activité. Ces fichiers contiennent des informations précieuses telles que la fréquence cardiaque, la distance parcourue et d'autres métriques essentielles.
- Importation de fichiers .fit : Permet aux utilisateurs de charger des données provenant de fichiers .fit via la bibliothèque `php-fit-file-analysis`, générés par des dispositifs de suivi d'activité. Ces fichiers contiennent des informations précieuses telles que la fréquence cardiaque, la distance parcourue et d'autres données de santé importante pour nos analyses.
**Architecture :**
- AuthService (Service d'Authentification) : Gère l'authentification des utilisateurs, garantissant un accès sécurisé à la fonction d'importation.
- UserManager (Gestionnaire d'Utilisateurs) : Gère les opérations liées aux utilisateurs, y compris l'importation de fichiers .fit.
ActivityManager (Gestionnaire d'Activités) : Responsable du stockage et de la gestion des activités importées.
- ActivityManager (Gestionnaire d'Activités) : Responsable du stockage et de la gestion des activités importées.
**Objectif :**

@ -21,3 +21,6 @@
- [Cas d'utilisation pour la gestion du compte et des amitiés](CasUtilisations/README_gestionCompteAmitie.md)
- [Cas d'utilisation pour la gestion des activités et données](CasUtilisations/README_gestionActivites.md)
- [Cas d'utilisation pour la suivi d'une équipe sportive](CasUtilisations/README_coachSuiviSportif.md)
## Base de Données
- [MLD](BDD/README_BDD.md)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 27 KiB

@ -71,7 +71,8 @@ Documentation et informations à propos de `HearthTrack` disponible [ici]()
### Prerequisites
* [Visual Studio code](https://code.visualstudio.com/) - exemple d'IDE gratuit
* [Git](https://git-scm.com/) - Versioning
* [XAMPP : X, Apache, MySQL, Perl, PHP](https://www.apachefriends.org/fr/index.html) - Langages
* [XAMPP : X, Apache, MySQL, Perl, PHP](https://www.apachefriends.org/fr/index.html) - Languages
* [PostgreSQL](https://www.postgresql.org/) - Base de Donnée
## Getting Started
1. Cloner le répos

@ -18,15 +18,13 @@
"Shared\\": "src/shared",
"App\\Router\\": "src/app/router",
"App\\Controller\\": "src/app/controller",
"App\\Router\\Response\\": "src/app/router/response",
"App\\Router\\Middleware\\": "src/app/router/middleware",
"App\\Router\\Request\\": "src/app/router/request",
"App\\Router\\Response\\" : "src/app/router/response",
"App\\Router\\Middleware\\" : "src/app/router/middleware",
"App\\Router\\Request\\" : "src/app/router/request",
"Shared\\Exception\\": "src/shared/exception",
"Shared\\Attributes\\": "src/shared/attributes",
"App\\Views\\Directives\\" : "src/app/views/directives",
"Data\\Core\\": "src/data/core/",
"Database\\": "src/data/core/database",
"Json\\": "src/data/core/json"
"Data\\Core\\": "src/data/core/"
}
},
"require": {
@ -34,12 +32,7 @@
"altorouter/altorouter": "1.1.0",
"vlucas/phpdotenv": "^5.5",
"psr/container": "^2.0",
"adriangibbons/php-fit-file-analysis": "^3.2.0",
"ext-couchbase": "*",
"ext-pdo": "*"
},
"config": {
"process-timeout": 2000
"adriangibbons/php-fit-file-analysis": "^3.2.0"
},
"require-dev": {
"phpunit/phpunit": "*"
@ -47,6 +40,6 @@
"scripts": {
"dev": "php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL",
"dev:console": "export APP_ENV=console && php public/index.php",
"dev:html": "export APP_ENV=html && php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL"
"dev:html" : "export APP_ENV=html && php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL"
}
}

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5a409c8bab8a792898aeb0f32ad5cf48",
"content-hash": "1887e85fc3cfddacf8d7e17588dae6f1",
"packages": [
{
"name": "adriangibbons/php-fit-file-analysis",
@ -756,27 +756,25 @@
},
{
"name": "nikic/php-parser",
"version": "v5.0.0",
"version": "v4.17.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
"php": ">=7.0"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
},
"bin": [
"bin/php-parse"
@ -784,7 +782,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
"dev-master": "4.9-dev"
}
},
"autoload": {
@ -808,9 +806,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1"
},
"time": "2024-01-07T17:17:35+00:00"
"time": "2023-08-13T19:53:39+00:00"
},
{
"name": "phar-io/manifest",
@ -925,23 +923,23 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.11",
"version": "10.1.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145"
"reference": "a56a9ab2f680246adcf3db43f38ddf1765774735"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735",
"reference": "a56a9ab2f680246adcf3db43f38ddf1765774735",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.18 || ^5.0",
"nikic/php-parser": "^4.15",
"php": ">=8.1",
"phpunit/php-file-iterator": "^4.0",
"phpunit/php-text-template": "^3.0",
@ -991,7 +989,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.9"
},
"funding": [
{
@ -999,7 +997,7 @@
"type": "github"
}
],
"time": "2023-12-21T15:38:30+00:00"
"time": "2023-11-23T12:23:20+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -1246,16 +1244,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.5.5",
"version": "10.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856"
"reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
"reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cacd8b9dd224efa8eb28beb69004126c7ca1a1a1",
"reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1",
"shasum": ""
},
"require": {
@ -1295,7 +1293,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "10.5-dev"
"dev-main": "10.4-dev"
}
},
"autoload": {
@ -1327,7 +1325,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.2"
},
"funding": [
{
@ -1343,7 +1341,7 @@
"type": "tidelift"
}
],
"time": "2023-12-27T15:13:52+00:00"
"time": "2023-10-26T07:21:45+00:00"
},
{
"name": "sebastian/cli-parser",
@ -1591,20 +1589,20 @@
},
{
"name": "sebastian/complexity",
"version": "3.2.0",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "68ff824baeae169ec9f2137158ee529584553799"
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799",
"reference": "68ff824baeae169ec9f2137158ee529584553799",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957",
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.18 || ^5.0",
"nikic/php-parser": "^4.10",
"php": ">=8.1"
},
"require-dev": {
@ -1613,7 +1611,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.2-dev"
"dev-main": "3.1-dev"
}
},
"autoload": {
@ -1637,7 +1635,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues",
"security": "https://github.com/sebastianbergmann/complexity/security/policy",
"source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0"
"source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0"
},
"funding": [
{
@ -1645,20 +1643,20 @@
"type": "github"
}
],
"time": "2023-12-21T08:37:17+00:00"
"time": "2023-09-28T11:50:59+00:00"
},
{
"name": "sebastian/diff",
"version": "5.1.0",
"version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
"shasum": ""
},
"require": {
@ -1671,7 +1669,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "5.1-dev"
"dev-main": "5.0-dev"
}
},
"autoload": {
@ -1704,7 +1702,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.0"
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.3"
},
"funding": [
{
@ -1712,7 +1710,7 @@
"type": "github"
}
],
"time": "2023-12-22T10:55:06+00:00"
"time": "2023-05-01T07:48:21+00:00"
},
{
"name": "sebastian/environment",
@ -1920,20 +1918,20 @@
},
{
"name": "sebastian/lines-of-code",
"version": "2.0.2",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0"
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0",
"reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d",
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.18 || ^5.0",
"nikic/php-parser": "^4.10",
"php": ">=8.1"
},
"require-dev": {
@ -1966,7 +1964,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2"
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1"
},
"funding": [
{
@ -1974,7 +1972,7 @@
"type": "github"
}
],
"time": "2023-12-21T08:38:20+00:00"
"time": "2023-08-31T09:25:50+00:00"
},
{
"name": "sebastian/object-enumerator",
@ -2316,10 +2314,7 @@
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"ext-couchbase": "*",
"ext-pdo": "*"
},
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

@ -0,0 +1,2 @@
AddType text/css .css
AddType application/javascript .js

@ -1,17 +1,31 @@
FROM php:8.2-fpm
FROM php:8.2-apache as base
# Installation de dépendances nécessaires pour Composer
RUN apt-get update && apt-get install -y \
git \
unzip
# Installation de Composer
# TODO : should use a image with composer install
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo pdo_mysql
COPY . /var/www/
# Copy configs
COPY ./config/virtual-host.conf /etc/apache2/sites-available/000-default.conf
COPY ./config/httpd.conf /etc/apache2/httpd.conf
# Setup App
RUN mkdir -p /app/public && chown -R www-data:www-data /app
WORKDIR /app
WORKDIR /var/www/
# add sources code
COPY . /app
ENV VOLUME_PATH /app/public
RUN composer install
EXPOSE 80
CMD ["apache2-foreground"]

@ -5,18 +5,18 @@ use Shared\Log;
$dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env');
$dotenv->safeLoad();
// echo($_ENV);
// apenrently getEnv is not a good thing cause
// const DB_HOST = $_ENV['DB_HOST'] ?? 'localhost';
// const DB_DATABASE = $_ENV['DB_DATABASE'] ?? 'heartTrack';
// const DB_USER = $_ENV['DB_USER'] ?? 'toto';
// const DB_PASSWORD = $_ENV['DB_PASSWORD'] ?? 'achanger';
define("APP_ENV", getenv('APP_ENV'));
define("APP_ENV", 'development');
const DB_SERVER = 'mysql';
const DB_HOST = 'localhost';
const DB_DATABASE = 'sae_3';
const DB_USER = 'Perederii';
const DB_PASSWORD = '';
const DB_DATABASE = 'heartTrack';
const DB_USER = 'toto';
const DB_PASSWORD = 'achanger';
//const APP_ENV = 'console';
const DSN = DB_SERVER . ":host=" . DB_HOST . ";dbname=" . DB_DATABASE;
const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE;

@ -0,0 +1 @@
SetEnv ASSET_PREFIX containers/HeartDev-web/

@ -1,28 +1,19 @@
server {
listen 80;
index index.php;
root /var/www/public;
index index.php index.html index.htm;
root /usr/share/nginx/html;
error_page 404 /index.php;
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /var/www/public;
}
location ~ \.php$ {
fastcgi_pass web:9000; # service name defined in docker-compose.yml file like web
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
root /usr/share/nginx/html;
try_files $uri /index.php;
}
}

@ -0,0 +1,39 @@
<VirtualHost *:80>
ServerName default
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory ${VOLUME_PATH}>
AllowOverride All
Require all granted
</Directory>
DocumentRoot ${VOLUME_PATH}
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Multiple DirectoryIndex directives within the same context will add
# to the list of resources to look for rather than replace
# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
DirectoryIndex disabled
DirectoryIndex index.php index.html
</VirtualHost>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

After

Width:  |  Height:  |  Size: 586 B

File diff suppressed because it is too large Load Diff

@ -12,7 +12,7 @@ use Manager\DataManager;
use Repository\IUserRepository;
use Shared\ArgumentControllerResolver;
use Shared\IArgumentResolver;
use Network\AuthService;
use Stub\AuthService;
use Stub\NotificationRepository;
use Stub\TrainingRepository;
use Stub\UserRepository;
@ -30,18 +30,19 @@ use Network\RelationshipService;
use Network\INotificationService;
use Stub\NotificationService;
use App\Router\Session;
use Stub\StubData;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
use Shared\IHashPassword;
use Shared\HashPassword;
use Shared\Log;
$appFactory = new AppCreator();
$appFactory->registerService(IArgumentResolver::class, ArgumentControllerResolver::class);
$appFactory->registerSingleton(UserManager::class, UserManager::class);
$appFactory->registerService(UserManager::class, UserManager::class);
$appFactory->registerService(DataManager::class, StubData::class);
$appFactory->registerSingleton(IAuthService::class, AuthService::class);
$appFactory->registerService(IAuthService::class, AuthService::class);
$appFactory->registerService(IFriendRequestService::class, RelationshipService::class);
$appFactory->registerService(IHashPassword::class, HashPassword::class);
$appFactory->registerService(INotificationService::class, NotificationService::class);
@ -53,6 +54,7 @@ $appFactory->registerService(IUserRepository::class, UserRepository::class);
$appFactory->registerService(\Twig\Loader\LoaderInterface::class, function() {
return new FilesystemLoader(__DIR__ . '/../src/app/views/Templates');
});
@ -63,13 +65,4 @@ $appFactory->registerService(\Twig\Environment::class,\Twig\Environment::class);
// $databaseContext = DatabaseContext::getInstance();
$appFactory->AddControllers();
$app = $appFactory->create();
if (!is_null($app)){
// Ajout des Middleware
/*$app->use(new LoggingMiddleware());*/
$app->use(new AuthMiddleware($appFactory->getDicontainer()->get(IAuthService::class) ));
$app->mapControllers();
$app->run(RequestFactory::createFromGlobals());
}

@ -1,34 +0,0 @@
/*!
* Start Bootstrap - New Age v6.0.7 (https://startbootstrap.com/theme/new-age)
* Copyright 2013-2023 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-new-age/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Activate Bootstrap scrollspy on the main nav element
const mainNav = document.body.querySelector('#mainNav');
if (mainNav) {
new bootstrap.ScrollSpy(document.body, {
target: '#mainNav',
offset: 74,
});
};
// Collapse responsive navbar when toggler is visible
const navbarToggler = document.body.querySelector('.navbar-toggler');
const responsiveNavItems = [].slice.call(
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

@ -1,34 +0,0 @@
/*!
* Start Bootstrap - New Age v6.0.7 (https://startbootstrap.com/theme/new-age)
* Copyright 2013-2023 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-new-age/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Activate Bootstrap scrollspy on the main nav element
const mainNav = document.body.querySelector('#mainNav');
if (mainNav) {
new bootstrap.ScrollSpy(document.body, {
target: '#mainNav',
offset: 74,
});
};
// Collapse responsive navbar when toggler is visible
const navbarToggler = document.body.querySelector('.navbar-toggler');
const responsiveNavItems = [].slice.call(
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

@ -29,6 +29,9 @@ class App
private FrontController $frontController;
private Session $session;
public function __construct(string $appName, int $version, \App\Container $diContainer)
{
$this->appName = $appName;
@ -36,7 +39,7 @@ class App
$this->container = $diContainer;
$this->router = new Router("");
$this->frontController = new FrontController($this->router,$this->container);
Session::getInstance();
$this->session = Session::getInstance();
}
public function use(IHttpMiddleware $middleware)
@ -139,7 +142,7 @@ class App
$route = $attribute->newInstance();
$this->router->addControllerRoute(
$route->getMethods(),
implode('|', $route->getMethods()),
$prefix . $route->getPath(),
$controllerClass,
$method->getName(),

@ -24,13 +24,6 @@ class AppCreator
return $this;
}
public function registerSingleton(string $serviceId, $service): self
{
$this->container->set($serviceId, $service, Container::SINGLETON);
$this->services[] = $serviceId;
return $this;
}
/**
* Create an instance or perform actions based on the current application environment.
*
@ -40,7 +33,6 @@ class AppCreator
{
// Check the application environment
switch (APP_ENV) {
case 'console':
// Load the Console.php file in case of the 'console' environment
require_once __DIR__ . '/../console/Console.php';
@ -48,6 +40,7 @@ class AppCreator
case 'development':
// Create a new instance of the App class in the 'development' environment
return new App("HeartTrack", 1, $this->container);
break;
case 'html':
// Load the index.test.php file in case of the 'html' environment
require_once __DIR__ . '/index.test.php';
@ -60,6 +53,7 @@ class AppCreator
}
function AddControllers($namespacePrefix = 'App\Controller', $pathToControllers = __DIR__ . '/controller'): self
{
$controllerFiles = glob($pathToControllers . '/*.php');
@ -77,8 +71,7 @@ class AppCreator
if ($reflectionClass->isSubclassOf(BaseController::class)) {
// Register in DI container
$this->container->set($fullClassName, function () use ($fullClassName) {
/** @var $controllerInstance * */
$controllerInstance = $this->container->resolve($fullClassName);
$controllerInstance = new $fullClassName();
$controllerInstance->setContainer($this->container);
return $controllerInstance;
});
@ -88,15 +81,11 @@ class AppCreator
return $this;
}
public function getServiceRegistered(): array
{
return $this->services;
}
public function getDicontainer()
{
return $this->container;
}
}

@ -11,45 +11,31 @@ class Container implements ContainerInterface
{
private array $entries = [];
const SINGLETON = 'singleton';
const TRANSIENT = 'transient';
public function get(string $id)
{
if ($this->has($id)) {
$entry = $this->entries[$id];
if ($entry['lifecycle'] === self::SINGLETON) {
if ($entry['instance'] === null) {
$entry['instance'] = $this->resolve($entry['concrete']);
}
return $entry['instance'];
if (is_callable($entry)) {
return $entry($this);
}
if (is_callable($entry['concrete'])) {
return $entry['concrete']($this);
}
return $this->resolve($entry['concrete']);
$id = $entry;
}
return $this->resolve($id);
}
public function has(string $id): bool
{
return isset($this->entries[$id]);
}
public function set(string $id, callable|string $concrete, string $lifecycle = self::TRANSIENT): void
public function set(string $id, callable|string $concrete): void
{
$this->entries[$id] = [
'concrete' => $concrete,
'lifecycle' => $lifecycle,
'instance' => null
];
$this->entries[$id] = $concrete;
}
public function resolve(string $id)

@ -1,131 +0,0 @@
<?php
namespace App\Controller;
use App\Router\Request\IRequest;
use App\Router\Response\Response;
use Database\ActivityGateway;
use Database\ActivityMapper;
use Database\Connexion;
use Json\JsonSerializer;
use Manager\UserManager;
use Shared\Attributes\Route;
use Shared\Log;
class ApiController extends BaseController
{
private UserManager $userMgr;
public function __construct(UserManager $manager){
parent::__construct();
$this->userMgr = $manager;
}
#[Route(path: '/api/activities', name: 'api-activities', methods: ['GET'])]
public function apiActivities(IRequest $request)
{
$activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$listSearch = $activityGateway->getActivity();
$map = new ActivityMapper();
$activityGateway = $map->activitySqlToEntity($listSearch);
$listActivity = [];
foreach ($activityGateway as $entity) {
$activity = $map->activityEntityToModel($entity);
$listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
'date' => $activity->getDate()->format("Y-m-d"), 'heureDebut' => $activity->getHeureDebut()->format("Y-m-d"), 'heureFin' => $activity->getHeureFin()->format("Y-m-d"),
'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' => $activity->getAvrTemperature()];
}
$jsonSerializer = new JsonSerializer();
$jsonData = $jsonSerializer::serialize($listActivity);
$response = new Response();
$response->setContent($jsonData);
$response->setHeader('Content-Type', 'application/json');
return $response;
}
// cela ne trouve pas la methode avec la route '/api/activities/1'
#[Route(path: '/api/activities/{id}', name: 'api-activities-by-id', methods: ['GET'])]
public function apiActivityById(IRequest $request, int $id)
{
$activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$listSearch = $activityGateway->getActivityById($id);
Log::dd($listSearch);
$map = new ActivityMapper();
$activityGateway = $map->activitySqlToEntity($listSearch);
$listActivity = [];
foreach ($activityGateway as $entity) {
$activity = $map->activityEntityToModel($entity);
$listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
'date' => $activity->getDate()->format("Y-m-d"), 'heureDebut' => $activity->getHeureDebut()->format("Y-m-d"), 'heureFin' => $activity->getHeureFin()->format("Y-m-d"),
'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' => $activity->getAvrTemperature()];
}
$jsonSerializer = new JsonSerializer();
$jsonData = $jsonSerializer::serialize($listActivity);
$response = new Response();
$response->setContent($jsonData);
$response->setHeader('Content-Type', 'application/json');
// pour delete renvoyer 204 pour dire ok et supprimer
// update 200
return $response;
}
//
// #[Route(path: '/api/activities', name: 'api-activities-post', methods: ['POST'])]
// public function apiAddActivity(IRequest $request)
// {
// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
// $listSearch = $activityGateway->getActivity();
// $map = new ActivityMapper();
// $activityGateway = $map->activitySqlToEntity($listSearch);
// $listActivity = [];
// foreach ($activityGateway as $entity) {
// $activity = $map->activityEntityToModel($entity);
// $listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
// 'date' => $activity->getDate()->format("Y-m-d"), 'heureDebut' => $activity->getHeureDebut()->format("Y-m-d"), 'heureFin' => $activity->getHeureFin()->format("Y-m-d"),
// 'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
// 'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
// 'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' => $activity->getAvrTemperature()];
// }
//
// $jsonSerializer = new JsonSerializer();
// $jsonData = $jsonSerializer::serialize($listActivity);
//
// $response = new Response();
// $response->setContent($jsonData);
// $response->setHeader('Content-Type', 'application/json');
//
// return $response;
// }
// #[Route(path: '/api/activities/{id}', name: 'api-activities-post', methods: ['DELETE'])]
// public function apiDeleteActivity(IRequest $request, int $id)
// {
// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
// $listSearch = $activityGateway->removeActivityById($id);
//
// $response = new Response();
// $response->setContent($jsonData);
// $response->setHeader('Content-Type', 'application/json');
//
// return $response;
// }
// #[Route(path: '/api/activities/{id}', name: 'api-activities-post', methods: ['PUT'])]
// public function apiUpdateActivity(IRequest $request, int $id)
// {
// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
// $listSearch = $activityGateway->updateActivity($id);
//
// $response = new Response();
// $response->setContent($jsonData);
// $response->setHeader('Content-Type', 'application/json');
//
// return $response;
// }
}

@ -2,19 +2,6 @@
namespace App\Controller;
use Database\ActivityGateway;
use Database\ActivityMapper;
use Database\AnalyzeGateway;
use Database\AthleteEntity;
use Database\AthleteMapper;
use Database\EntrainementGateway;
use Database\EntrainementMapper;
use Database\NotificationEntity;
use Database\NotificationGateway;
use Database\NotificationMapper;
use DateTime;
use Model\Notification;
use Shared\Validation;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\Response;
@ -22,272 +9,87 @@ use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
use Manager\UserManager;
use Database\Connexion;
use Database\AthleteGateway;
class AthleteController extends BaseController
{
private Environment $twig;
protected Preferences $preference;
// private UserManager $userMgr;
public function __construct()
{
$this->preference = new Preferences();
// $this->userMgr = $manager;
}
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
// {
// $taberror = [];
// if(!Validation::val_string($username)){
// print("Nom invalide.");
// }
// else {
// try {
// $athleteGateway = new AthleteGateway(new Connexion("mysql:host=localhost;dbname=sae_3", "Perederii", ""));
//// $listSearch=$this->container->get(UserManager::class)->searchUsersByName($username);
// $listSearch = $athleteGateway->getAthlete();
// $map = new AthleteMapper ();
// $athleteEntity = $map->athleteSqlToEntity($listSearch);
// foreach ($athleteEntity as $entity) {
// $users = $map->athleteEntityToModel($entity);
// $listUsers[$i++]=['nom' => $users->getNom(), 'prenom'=>$users->getPrenom(), 'img'=>'john_doe'];
// }
//
// $i=0;
// foreach ($users as $user){
// echo "<h1> HELLO </h1>";
// $listUsers[$i++]=['nom' => $user->getNom(), 'prenom'=>$user->getPrenom(), 'img'=>'john_doe', 'username'=>$user->getUsername()];
// }
// echo "<h1> HEllO </h1>";
// //$currentUser=$this->container->get(UserManager::class)->getCurrentUser();
// //$currentUser=$_SESSION['user'];
// $response = $this->render('./page/addfriend.html.twig',[
// 'css' => $_COOKIE['preferences'],
// 'pp' => "test",
// 'user' => 'johndoe',//$currentUser->getUsername(),
// 'role' => 'Athlete',//$currentUser->getRole(),
// 'users' => $listUsers
// ]);
// } catch (\Throwable $th) {
// throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// }
// return $response;
//
// }
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
#[Route(path: '/search-ath', name: 'search-ath', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response
{
$taberror = [];
if (!Validation::val_string($username)) {
print("Nom invalide.");
} else {
try {
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
if($username==null){
$listSearch=$athleteGateway->getAthlete();
} else {
$listSearch = $athleteGateway->getAthleteByName($username);
}
$map = new AthleteMapper();
$athleteEntity = $map->athleteSqlToEntity($listSearch);
$listUsers = [];
foreach ($athleteEntity as $entity) {
$user = $map->athleteEntityToModel($entity);
$listUsers[] = ['idathlete' => number_format($user->getId(), 1), 'nom' => $user->getNom(),
'prenom' => $user->getPrenom(),'email' => $user->getEmail(), 'sexe' => $user->getSexe(),
'taille' => $user->getTaille(), 'poids' => $user->getPoids(), 'motdepasse' => $user->getMotDePasse(),
'datenaissance' => $user->getDateNaissance(), 'iscoach' => $user->getRole(), 'img' => 'test',
'username' => $user->getUsername()];
}
$response = $this->render('./page/addfriend.html.twig',[
'css' => $_COOKIE['preferences'],
'pp' => 'test',
'user' => 'John',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'users' => $listUsers
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror]);
}
}
return $response;
}
#[Route(path: '/analyze', name: 'analyze_details', methods: ['GET'])]
public function activityDetails(int $id): Response
{
try {
// Utilisez $id pour récupérer les détails de l'activité depuis la base de données
// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
// $activityEntity = $activityGateway->getActivityById($id); // Assurez-vous d'avoir une méthode similaire dans votre gateway
$analyzeGateway = new AnalyzeGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$analyzeEntity = $analyzeGateway->getFrequenceCardiaqueByIdActivity($id);
$response = $this->render('./page/analyze.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
'activity' => [],
'analyzes' => $analyzeEntity,
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("./page/analyze.html.twig", ['tabError' => $taberror]);
}
return $response;
}
//
// #[Route(path: '/analyses/{id}', name: 'analyses', methods: ['GET'])]
// public function analyses(): Response
// {
// try {
// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
// $listSearch = $activityGateway->getActivity();
// $map = new ActivityMapper();
// $activityGateway = $map->activitySqlToEntity($listSearch);
// $listActivity = [];
// foreach ($activityGateway as $entity) {
// $activity = $map->activityEntityToModel($entity);
// $listActivity[] = ['idactivity' => number_format($activity->getIdActivity(), 1), 'type' => $activity->getType(),
// 'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
// 'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
// 'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
// 'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' =>$activity->getAvrTemperature()];
// }
//
// $response = $this->render('./page/analyze.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => 'johndoe',//$currentUser->getUsername(),
// 'role' => 'Athlete',//$currentUser->getRole(),
// 'friendship' => [],
// 'analyzes' => $listActivity,
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// } catch (\Throwable $th) {
// throw $th;
// return $this->render("./page/analyze.html.twig", ['tabError' => $taberror]);
// }
// return $response;
// }
#[Route(path: '/activity', name: 'activity', methods: ['GET'])]
public function activity(): Response
{
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
$activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$listSearch = $activityGateway->getActivity();
$map = new ActivityMapper();
$activityGateway = $map->activitySqlToEntity($listSearch);
$listActivity = [];
foreach ($activityGateway as $entity) {
$activity = $map->activityEntityToModel($entity);
$listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' => $activity->getAvrTemperature()];
}
$response = $this->render('./page/activity.html.twig', [
//code...
// $model->userMgr->getUser($name);
return $this->render('./page/addfriend.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => $listActivity,
'analyzes' => [],
'mails' => [],
'users' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => []
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("./page/analyze.html.twig", ['tabError' => $taberror]);
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
return $response;
// }
}
#[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
public function exercice(): Response
#[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
public function analyses(): Response
{
try {
$entrainementGateway = new EntrainementGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$listSearch = $entrainementGateway->getEntrainements();
$map = new EntrainementMapper();
$entrainementEntity = $map->entrainementSqlToEntity($listSearch);
$listUsers = [];
foreach ($entrainementEntity as $entity) {
$training = $map->entrainementEntityToModel($entity);
$listUsers[] = ['idTraining' => number_format($training->getId(), 1), 'date' => $training->getDate()->format("D j F Y"),
'location' => $training->getLocation(), 'description' => $training->getDescription(),
'feedback' => $training->getFeedback()];
}
$response = $this->render('./page/exercice.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => $listUsers,
'member' => []
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror]);
}
return $response;
return $this->render('./page/analyze.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8
public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
#[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
public function exercice(): Response
{
$exercicesArray = [
[
'date' => $date,
'type' => $type,
'intensite' => $intensite,
'status' => 'A venir',
]
];
return $this->render('./page/exercice.html.twig',[
return $this->render('./page/exercice.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => $exercicesArray,
'exos' => [],
'member' => []
]);
}
@ -295,81 +97,54 @@ class AthleteController extends BaseController
#[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])]
public function addFriend(string $username, IRequest $req): Response
{
$taberror = [];
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$map = new AthleteMapper();
$userSearched = $athleteGateway->getAthleteByFirstName("Bryan");
$athleteEntity = $map->athleteSqlToEntity($userSearched);
$users=[];
foreach ($athleteEntity as $user) {
// $this->userMgr->getCurrentUser()->addFriend($user);
// $currentUser->addFriend($user);
$users = ['nom' => $user->getNom(), 'prenom' => $user->getPrenom(), 'img' => 'test', 'username' => $user->getUsername()];
}
$notif = new NotificationGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$mapper = new NotificationMapper();
$date = new DateTime();
$myNotif = new Notification(21, "Demande d'ami de la part de " . $users['nom'], $date, true, 7, 1);
$notif->addNotification($mapper->notificationToEntity($myNotif));
return $this->render('./page/addfriend.html.twig',[
//code...
// $model->userMgr->addFriend($name);
return $this->render('./page/addfriend.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $users,
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
}
// }
#[Route(path: '/friend', name: 'friend', methods: ['GET'])]
public function friend(): Response
{
try {
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$map=new AthleteMapper();
$friendEntity = $athleteGateway->getAthlete();
$listUserEntity = $map->athleteSqlToEntity($friendEntity);
}
$friendList = [];
foreach ($listUserEntity as $userEntity) {
$friendList[] = ['nom' => $userEntity->getNom(), 'prenom' => $userEntity->getPrenom(), 'img' => 'test', 'username' => 'test'];
}
$response = $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'John',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $friendList,
'infoUser' => [],
'exos' => [],
'member' => [],
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror]);
}
return $response;
}
/*#[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
public function friendlist(string $username, IRequest $req): Response
#[Route(path: '/friend', name: 'friend', methods: ['GET'])]
public function friend(): Response
{
$friendList = [
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
@ -383,58 +158,19 @@ class AthleteController extends BaseController
'username' => 'alicesmith',
],
];
// TODO
// -> Enlever ou bloquer un utilisateur en fonction de son username
//$friendList = currentUser->getFriends();
return $this->render('./page/friend.html.twig',[
return $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => $friendList,
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
]);
}*/
#[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
public function friendlist2(): Response
{
try {
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$map=new AthleteMapper();
$friendEntity = $athleteGateway->getListIdFriends(1/*$currentUser->getId()*/);
$friendList = [];
$listUserEntity = [];
foreach($friendEntity as $users) {
if ($users['idathlete1']==1/*$currentUser->getId()*/){
$user=(int)$users['idathlete2'];
} else {
$user=(int)$users['idathlete1'];
}
$listUserEntity[] = $map->athleteSqlToEntity($athleteGateway->getAthleteById(1));
}
foreach ($listUserEntity as $user) {
$friendList[] = ['nom' => $user[0]->getNom(), 'prenom' => $user[0]->getPrenom(), 'img' => 'test', 'username' => 'test'];
}
$response = $this->render('./page/friend.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => $friendList,
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror]);
}
return $response;
}
// #[Route(path: '/delete-friend', name: 'delete-friend', methods: ['POST'])]
}
?>

@ -4,167 +4,144 @@ namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response;
use App\Router\Response\IResponse;
use App\Router\Session;
use Database\ActivityGateway;
use Database\ActivityMapper;
use Database\AthleteGateway;
use Database\AthleteMapper;
use Database\Connexion;
use Json\JsonSerializer;
use Manager\UserManager;
use Couchbase\UserManager;
use Shared\Attributes\Route;
use Shared\Validation;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
use function PHPUnit\Framework\isEmpty;
class AuthController extends BaseController
{
private UserManager $userMgr;
public function __construct(UserManager $manager){
parent::__construct();
$this->userMgr = $manager;
}
#[Route('/login', name: 'login',methods: ['POST'])]
public function login(string $email,string $password, IRequest $request): IResponse {
public function login(IRequest $request): IResponse {
$error = [];
try {
$log=$email; // should check email with verrify email
$mdp=Validation::clean_string($password);
if($this->userMgr->login($log,$mdp)){
// Log::dd("gg");
return new RedirectResponse('/home');
}
else{
$error [] = "Erreur de connexion. Essayez encore";
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(),
'login_error'=> $error,
]);
}
// should only cath a type of Exception not all
$log=Validation::clean_string($request->getBody()['email']);
$mdp=Validation::clean_string($request->getBody()['password']);
} catch (\Throwable $th) {
$error [] =$th->getMessage();
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(),
'login_error'=> $error,
]);
$error = "Wrong cred";
}
if($this->container->get(UserManager::class)->login($log,$mdp)){
return $this->redirectToRoute('/');
}
else{
$error [] = "Erreur de connexion. Essayez encore";
}
return $this->render('./page/login.html.twig', ['error' => $error]);
}
#[Route('/login', name: 'login2',methods: ['GET'])]
public function login2(IRequest $request): IResponse {
#[Route('/log', name: 'baseLog',methods: ['GET'])]
public function index(IRequest $request): IResponse {
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie()
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route('/register', name: 'register2' , methods:['GET'])]
public function register2(IRequest $request): IResponse{
return $this->render('./page/register.html.twig',[
'css' => $this->preference->getCookie()
]);
}
#[Route('/register', name: 'register' , methods:['POST'])]
public function register(
string $nom,
string $prenom,
string $username,
string $mail,
string $motDePasse,
string $sexe,
float $taille,
float $poids,
string $dateNaissance,
string $roleName,
IRequest $request): IResponse
#[Route('/register', name: 'register' , methods:['GET'])]
public function register(IRequest $request): IResponse
{
$error = [];
if ($request->getMethod() == 'POST') {
$nom = $request->getBody()['nom'];
$prenom = $request->getBody()['prenom'];
$username = $request->getBody()['username'];
$email = $request->getBody()['email'];
$motDePasse = $request->getBody()['motDePasse'];
$sexe = $request->getBody()['sexe'];
$taille = $request->getBody()['taille'];
$poids = $request->getBody()['poids'];
$dateNaissanceStr = $request->getBody()['nom'];
$dateNaissance = new \DateTime($dateNaissanceStr);
if (!$dateNaissance) {
throw new \Exception("Date de naissance non valide. Format attendu : YYYY-MM-DD");
}
$roleName = $request->getBody()['roleName'];
try {
$registrationData = [
'nom' => $nom,
'prenom' => $prenom,
'username' => $username,
'email' => $mail,
'email' => $email,
'sexe' => $sexe,
'taille' => $taille,
'poids' => $poids,
'dateNaissance' => $dateNaissance,
'dateNaissance' => $dateNaissance,
'roleName' => $roleName
];
if ($this->userMgr->register($mail, $motDePasse, $registrationData) ) {
return new RedirectResponse('/');
} else {
$error [] = 'L\'inscription a échoué. Veuillez réessayer.';
try {
if ($this->container->get(UserManager::class)->register($email, $motDePasse, $registrationData)) {
return $this->redirectToRoute('/');
} else {
return $this->render('./page/register.html.twig',[
'css' => $this->preference->getCookie(),
'register_error'=> $error,
]);
$error [] = 'L\'inscription a échoué. Veuillez réessayer.';
}
} catch (\Exception $e) {
$error [] = 'Erreur lors de l\'inscription: ' . $e->getMessage();
}
} catch (\Throwable $e) {
$error [] =$e->getMessage();
return $this->render('./page/register.html.twig', ['css' => $this->preference->getCookie(),"register_error" => $error ]);
}
return $this->render('/register.html.twig');
}
//string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse,
#[Route(path: '/forgetPassword', name: 'forget-password2', methods: ['GET'])]
public function forgetPassword2(IRequest $request): IResponse
#[Route(path: '/mdp', name: 'mdp', methods: ['POST'])]
public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response
{
return $this->render('./page/password.html.twig',[
'css' => $this->preference->getCookie(),
]);
}
#[Route(path: '/forgetPassword', name: 'forget-password', methods: ['POST'])]
public function forgetPassword(string $mail, IRequest $request): IResponse
{
// CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/password.html.twig',[
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/logout', name: 'logout', methods: ['GET'])]
public function logout(IRequest $request): IResponse
{
$error = [];
try {
if($this->userMgr->deconnecter()){
return new RedirectResponse('/');
}
else{
$error [] = "Erreur de deconnexion. Essayez encore";
return new RedirectResponse('/');
}
} catch (\Throwable $th) {
$error [] =$th->getMessage();
return new RedirectResponse('/');
}
}
}
?>

@ -8,14 +8,13 @@ use App\Router\Response\RedirectResponse;
use App\Router\Response\Response;
use Psr\Container\ContainerInterface;
use Shared\Log;
abstract class BaseController
{
protected Preferences $preference;
public function __construct(){
$this->preference = new Preferences();
}
protected ContainerInterface $container;
@ -63,5 +62,18 @@ abstract class BaseController
return new RedirectResponse($url, $status);
}
protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
}
/*
* TODO : Should hanle ierror if the route is not existing
* */
protected function generateUrl(string $route, array $parameters = []): string
{
return $this->container->get(\App\Router\Router::class)->generate($route, $parameters);
}
}

@ -1,35 +1,49 @@
<?php
namespace App\Controller;
// namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\Response;
use App\Router\Response\IResponse;
// use App\Container;
// use App\Router\Request\IRequest;
// use App\Router\Response\Response;
// use App\Router\Response\IResponse;
use Manager\DataManager;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
// use Shared\Attributes\Route;
// use Twig\Environment;
// use Data\Core\Preferences;
// use Shared\Log;
class CoachController extends BaseController
{
// private ICoachManager $coachManager;
// private $security;
// private Environment $twig;
protected Preferences $preference;
// #[Route(path: '/coach', name: 'coach')]
// class CoachController extends BaseController
// {
public function __construct()
{
// session_start();
// $this->coachManager = $dataManager->coachMgr;
// $this->security = $security;
$this->preference = new Preferences();
}
// private ICoachManager $coachManager;
// private $security;
// public function __construct(DataManager $dataManager, Security $security)
// {
// $this->coachManager = $dataManager->coachMgr;
// $this->security = $security;
// }
// #[Route(path: '/', name: 'home', methods: ['GET'])]
// public function index(): Response
// {
// return $this->render('./page/home.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
// public function globalStats(): Response
// {
@ -37,145 +51,41 @@ class CoachController extends BaseController
// return $this->render('coach/global_stats.html.twig');
// }
// #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
// public function exercice(): Response
// {
// return $this->render('./page/exercice.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
public function coaching(): Response
{
return $this->render('./page/coaching.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Coach",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
public function searchMember(string $username, IRequest $req): Response
{
$taberror = [];
// FILTER
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
//code...
// $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// }
}
#[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
public function addmember(string $username, IRequest $req): Response
{
$taberror = [];
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
//code...
// $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// }
}
#[Route(path: '/member', name: 'member', methods: ['GET'])]
public function member(): Response
{
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
]);
}
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
// public function coaching(): Response
// {
// return $this->render('./page/coaching.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// #[Route('/list-athletes', name: 'coach_list_athletes')]
// public function listAthletes(): Response
@ -211,4 +121,4 @@ class CoachController extends BaseController
// // }
}
// }

@ -1,423 +0,0 @@
<?php
//
//namespace App\Controller;
//
//use App\Container;
//use App\Router\Request\IRequest;
//use App\Router\Response\Response;
//use Shared\Attributes\Route;
//use Twig\Environment;
//use Data\Core\Preferences;
//use Shared\Log;
//
//// TODO : Remove this BaseClass
//class Controller extends BaseController
//{
//
// #[Route(path: '/activity', name: 'activity', methods: ['GET'])]
// public function activity(): Response
// {
// return $this->render('./page/activity.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8
// public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
// {
// $exercicesArray = [
// [
// 'date' => $date,
// 'type' => $type,
// 'intensite' => $intensite,
// 'status' => 'A venur',
// ]
// ];
// return $this->render('./page/exercice.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => $exercicesArray,
// 'member' => []
// ]);
// }
//
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
// {
// $taberror = [];
// // FILTER
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addfriend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
// public function searchMember(string $username, IRequest $req): Response
// {
// $taberror = [];
// // FILTER
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
// public function addmember(string $username, IRequest $req): Response
// {
// $taberror = [];
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/member', name: 'member', methods: ['GET'])]
// public function member(): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
//
// #[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
// public function friendlist(string $username, IRequest $req): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// /* TODO */
//
// // -> Enlever ou bloquer un utilisateur en fonction de son username
//
// return $this->render('./page/friend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => $utiliArray,
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
// #[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
// public function friendlist2(): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'test',
// 'status' => 'johndoe',
// 'username' => 'jdoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'test2',
// 'status' => 'alicesmith',
// 'username' => 'asmith',
// ],
// ];
// return $this->render('./page/friend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => $utiliArray,
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
// public function coaching(): Response
// {
// return $this->render('./page/coaching.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
// #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
// public function mail(): Response
// {
// return $this->render('./page/mail.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/profile', name: 'profile', methods: ['GET'])]
// public function profile(): Response
// {
// return $this->render('./page/profile.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
// public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
// {
//
//
// return $this->render('./page/settings.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => $prenom,
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
//
//
// #[Route(path: '/pass', name: 'pass', methods: ['GET'])]
// public function pass(): Response
// {
//
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
// return $this->render('./page/password.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
// #[Route(path: '/password', name: 'password', methods: ['POST'])]
// public function password(string $email, IRequest $req): Response
// {
//
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
// return $this->render('./page/login.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//}
//
//
//

@ -48,7 +48,6 @@ class FrontController {
$this->handleError(404, $e->getMessage());
}
catch(\Throwable $e){
Log::dd($e->getLine() . $e->getFile() . $e->getMessage() );
$this->handleError(501, $e->getMessage());
}
}
@ -66,7 +65,7 @@ class FrontController {
// TODO : Don't work need Antoine help
private function handleError(int $statusCode, $message) : void {
if (!$this->container->has(\Twig\Environment::class)) {
throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require ".');
throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
}
$response = new Response($this->container->get(\Twig\Environment::class)->render('./error/error.html.twig',['title'=> $message , "code" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode);

@ -1,94 +1,36 @@
<?php
namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\IResponse;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response;
use Manager\ActivityManager;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
class HeartRateController extends BaseController
{
private ActivityManager $activityMgr;
public function __construct(ActivityManager $manager)
{
parent::__construct();
$this->activityMgr = $manager;
}
#[Route(path: '/import', name: 'import', methods: ['GET'])]
public function import(): Response
{
return $this->render('./page/import.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/upload', name: 'upload', methods: ['POST'])]
public function uploadFile(string $activityType, int $effort, IRequest $req): IResponse
{
$error = $this->validateRequest($effort);
if (!empty($error)) {
return $this->renderError($error);
}
$tmp_file = $_FILES['uploaded_file']['tmp_name'];
if (!$this->isValidFile($tmp_file)) {
return $this->renderError(['Failed to get file be sure that you provide the file']);
}
$content = file_get_contents($tmp_file);
try {
if ($this->activityMgr->uploadFile($activityType, 5, $content)) {
return new RedirectResponse('/home');
}
} catch (\Exception $e) {
return $this->renderError([$e->getMessage()]);
}
return $this->renderError(['Failed to save activity.']);
}
private function validateRequest(int $effort): array
{
$error = [];
if ($effort < 0 || $effort > 5) {
$error[] = 'Invalid effort level.';
}
$fileExtension = pathinfo($_FILES['uploaded_file']['name'], PATHINFO_EXTENSION);
if ($fileExtension !== 'fit') {
$error[] = 'Invalid file type. Only .fit files are allowed.';
}
return $error;
}
private function isValidFile(string $tmp_file): bool
{
return file_exists($tmp_file) && is_uploaded_file($tmp_file);
}
private function renderError(array $error): Response
{
// Consolidez la logique de rendu ici
return $this->render('./error/error.html.twig', ['title'=> "Failed" , "code" => 400, "name" => "error import", "descr" => $error[0] ], new Response('$error', 400));
}
}
// namespace App\Controller;
// use App\Container;
// use App\Router\Request\IRequest;
// use App\Router\Response\Response;
// use Shared\Attributes\Route;
// use Twig\Environment;
// use Data\Core\Preferences;
// use Shared\Log;
// class HeartRateController extends BaseController
// {
// #[Route(path: '/import', name: 'import', methods: ['GET'])]
// public function import(): Response
// {
// return $this->render('./page/import.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// }

@ -1,66 +1,19 @@
<?php
namespace App\Controller;
// namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\Response;
use Database\AthleteGateway;
use Database\AthleteMapper;
use Database\Connexion;
use Database\NotificationGateway;
use Database\NotificationMapper;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
// use App\Container;
// use App\Router\Request\IRequest;
// use App\Router\Response\Response;
// use App\Router\Response\IResponse;
class SocialController extends BaseController
{
protected Preferences $preference;
// use Shared\Attributes\Route;
// use Twig\Environment;
// use Data\Core\Preferences;
// use Shared\Log;
public function __construct(){
$this->preference = new Preferences();
}
#[Route(path: '/notification', name: 'notification', methods: ['GET'])]
public function mail(): Response
{
try {
$notificationGateway = new NotificationGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$listSearch = $notificationGateway->getNotifications();
$map = new NotificationMapper();
$notificationEntity = $map->notificationSqlToEntity($listSearch);
$listUsers = [];
foreach ($notificationEntity as $entity) {
$notification = $map->notificationEntityToModel($entity);
$listUsers[] = ['idnotif' => $notification->getId(), 'message' => $notification->getMessage(),
'date' => $notification->getDate()->format("D j F Y"),'statut' => $notification->getStatut(), 'urgence' => $notification->getUrgence(),
'idathlete' => $notification->getToUserId()];
}
$response = $this->render('./page/notification.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => $listUsers,
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("notification.html.twig", ['tabError' => $taberror]);
}
return $response;
}
}
// #[Route(path: '/coach', name: 'coach')]
// class CoachController extends BaseController
// {

@ -4,147 +4,20 @@ namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response;
use App\Router\Response\IResponse;
use App\Router\Session;
use DateInterval;
use DateTime;
use Manager\UserManager;
use Shared\Attributes\Route;
use Shared\Validation;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
use function PHPUnit\Framework\isEmpty;
use Database\Athletegateway;
use Database\Connexion;
class UserController extends BaseController
{
private UserManager $userMgr;
public function __construct(UserManager $manager){
parent::__construct();
$this->userMgr = $manager;
}
#[Route(path: '/', name: 'index', methods: ['GET'])]
#[Route(path: '/', name: 'home', methods: ['GET'])]
public function index(): Response
{
return $this->render('./page/index.html',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/home', name: 'home', methods: ['GET'])]
public function home(): Response
{
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
$activity = $athleteGateway->getListActivity('1');//$currentUser->getId()
// $charts = [];
// $i = 0;
// while ($i <= 12) {
// if ($activity[$i]['mois'] == null) {
// $activity[$i]['mois'] = $i;
// $activity[$i]['nbactivite'] = 0;
// } elseif (($indice = intval($activity[$i]['mois'])) != $i) {
// $temp = $activity[$i]; // Stocker temporairement les données actuelles
// $activity[$i]['mois'] = $i;
// $activity[$i]['nbactivite'] = 0;
// $activity[$indice]['mois'] = $indice;
// $activity[$indice]['nbactivite'] = $temp['nbactivite']; // Restaurer les données
// }
// $charts[] = ['act' => $activity[$i]['nbactivite'], 'mois' => $activity[$i]['mois']];
// $i++;
// }
$charts = [];
$monthNames = [
'Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin',
'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'
];
$currentDate = new DateTime();
$interval = new DateInterval('P1M'); // Période d'un mois
for ($i = 0; $i < 12; $i++) {
$currentMonth = $currentDate->format('n'); // Format numérique du mois (1 à 12)
$currentMonthName = $monthNames[$currentMonth - 1]; // Mois correspondant dans le tableau
// Recherche de l'indice du mois dans le tableau $activity
$activityIndex = null;
for ($j = 0; $j < count($activity); $j++) {
if (!empty($activity[$j]['mois']) && $activity[$j]['mois'] == $currentMonth) {
$activityIndex = $j;
break;
}
}
// Récupération du nombre d'activités et réinitialisation à 0
$nbActivity = isset($activityIndex) ? $activity[$activityIndex]['nbactivite'] : 0;
if (isset($activityIndex)) {
$activity[$activityIndex]['nbactivite'] = 0;
}
// Log::dd($currentMonth);
$charts[] = ['act' => $nbActivity, 'mois' => $currentMonth];
$currentDate->sub($interval);
}
// Inverser l'ordre des éléments si nécessaire
$charts = array_reverse($charts);
// Log::dd($charts);
//
// $charts = [];
// $monthNames = [
// 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
// 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'
// ];
//
// $currentDate = new DateTime();
// $interval = new DateInterval('P1M'); // Période d'un mois
//
// for ($i = 0; $i < 12; $i++) {
//// $currentDate; // Soustraire un mois
//// Log::dd($currentDate);
// $currentMonth = $currentDate->format('n'); // Format numérique du mois (1 à 12)
//// Log::dd($currentMonth);
// $currentMonthName = $monthNames[$currentMonth - 1]; // Mois correspondant dans le tableau
// for($j = 12; $j > 0; $j--) {
// if(!empty($activity[$j]['mois']) || $activity[$j]['mois'] == $currentMonth) {
// $nbAct = $activity[$j]['nbactivite'];
// $activity[$j]['nbactivite'] = 0;
//// Log::dd($activity);
// break;
// }
// }
//
// $nbActivity = isset($nbAct) ? $nbAct : 0;
//// Log::dd($nbActivity);
//
// $charts[] = ['act' => $nbActivity, 'mois' => $currentMonthName];
// $currentDate->sub($interval);
// }
// Log::dd($charts);
// Inverser l'ordre des éléments si nécessaire
// $charts = array_reverse($charts);
//
// Log::dd($charts);
return $this->render('./page/home.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
@ -152,7 +25,6 @@ class UserController extends BaseController
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'charts' => $charts,
'mails' => [],
'users' => [],
'infoUser' => [],
@ -180,28 +52,10 @@ class UserController extends BaseController
]);
}
#[Route(path: '/profile', name: 'profile', methods: ['GET'])]
public function profile(): Response
{
return $this->render('./page/profile.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/preferences', name: 'preferences', methods: ['POST'])]
public function preferences(string $theme, IRequest $req): Response
{
/*TODO*/
// VALIDER LES DONNEES
$this->preference->majCookie($theme);
@ -221,25 +75,4 @@ class UserController extends BaseController
]);
}
// #[Route(path: '/logout', name: 'logout', methods: ['GET'])]
// public function logout(IRequest $request): IResponse
// {
// $error = [];
//
// try {
//
// if($this->userMgr->deconnecter()){
// return new RedirectResponse('/');
// }
// else{
// $error [] = "Erreur de deconnexion. Essayez encore";
// return new RedirectResponse('/');
// }
//
// } catch (\Throwable $th) {
// $error [] =$th->getMessage();
// return new RedirectResponse('/');
// }
// }
}

@ -1,15 +1,12 @@
<?php
namespace App\Router;
use App\Router\Request\IRequest;
/**
* Router class to manage a collection of routes in the application.
* It provides functionalities to add routes and check if a given URL matches any of the defined routes.
*/
class Router
{
class Router {
/**
* The base path for routing.
@ -37,8 +34,7 @@ class Router
*
* @param string $path The base path for the router.
*/
public function __construct(string $path = "/PHP/project/index.php")
{
public function __construct(string $path = "/PHP/project/index.php") {
$this->path = $path;
$this->routes = new \AltoRouter();
}
@ -50,8 +46,7 @@ class Router
* @param Route $route The route object.
* @throws \InvalidArgumentException If method is not supported.
*/
public function add(string $method, Route $route)
{
public function add(string $method, Route $route) {
if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported");
}
@ -60,27 +55,19 @@ class Router
/**
* Adds a route for a controller action.
* TODO : the problème is that AltoRouter is a map so i can't have mutilple Route just by doing this:(i need to find a logic to resolve this beavior) #[Route('/login', name: 'login',methods: ['POST','GET'])]
* @param string|array $methods HTTP method.
*
* @param string $method The HTTP method.
* @param string $path The path for the route.
* @param mixed $controller The controller object.
* @param string $action The action method in the controller.
* @param string $name (Optional) The name of the route.
* @throws \InvalidArgumentException If method is not supported.
*/
public function addControllerRoute(string|array $methods, string $path, $controller, string $action, string $name = '')
{
if (is_string($methods)) {
$methods = [$methods]; // Convert to an array if it's a string
}
foreach ($methods as $method) {
if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported");
}
$this->routes->map($method, $path, [$controller, $action], $name);
public function addControllerRoute(string $method, string $path, $controller, string $action, string $name = '') {
if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported");
}
$this->routes->map($method, $path, [$controller, $action], $name);
}
// TODO: Implement the extractParams method.
@ -93,8 +80,7 @@ class Router
* @param callable $callable The callback function.
* @param string $name The name of the route.
*/
public function get(string $path, callable $callable, $name)
{
public function get(string $path, callable $callable, $name) {
$this->routes->map('GET', $path, $callable, $name);
}
@ -106,8 +92,7 @@ class Router
* @param IRequest $request The request object.
* @return array|null The matched route or null if no match.
*/
public function match(IRequest $request): ?array
{
public function match(IRequest $request): ?array {
return $this->routes->match($request->getRequestUri(), $request->getMethod()) ?: null;
}
@ -116,15 +101,14 @@ class Router
*
* @return array The array of routes.
*/
public function getRoutes()
{
public function getRoutes() {
return []; // TODO: Implement the actual logic to return routes.
}
public function generate(string $routeName, array $params = array()): string
public function generate (string $routeName, array $params = array()): string
{
return $this->routes->generate($routeName, $params);
return $this->routes->generate($routeName,$params);
}
}

@ -111,7 +111,8 @@ class Session
if ( $this->sessionState == self::SESSION_STARTED )
{
$this->sessionState = !session_destroy();
session_unset(); // Clear all session variables
unset( $_SESSION );
return !$this->sessionState;
}

@ -2,24 +2,26 @@
namespace App\Router\Middleware;
use App\Router\Session;
use Network\IAuthService;
use Shared\Log;
use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse;
class AuthMiddleware extends Middleware {
private IAuthService $auth;
public function __construct(IAuthService $auth) {
$this->auth = $auth;
}
public function handle(IRequest $request, callable $next) {
$excludedUrls = ['/login', '/register','/forgetPassword', '/', '/mock'];
if ($this->auth->getCurrentUser() === null && !in_array($request->getRequestUri(), $excludedUrls)) {
$resp = new RedirectResponse("/login");
$resp->send();
exit;
}
// if (isset($_SESSION['user'])) {
// $resp =new RedirectResponse("/");
// $resp->send();
// exit;
// }
// La page nest pas redirigée correctement
// Firefox a détecté que le serveur redirige la demande pour cette adresse dune manière qui naboutira pas.
// La cause de ce problème peut être la désactivation ou le refus des cookies.
// if (!isset($_SESSION['user'])) {
// $resp =new RedirectResponse("/log");
// $resp->send();
// exit;
// }
return parent::handle($request, $next);
}
}

@ -2,9 +2,6 @@
namespace App\Router\Response;
use App\Router\Session;
use Shared\Log;
class RedirectResponse implements IResponse
{
private $content;
@ -52,7 +49,6 @@ class RedirectResponse implements IResponse
public function send(): void
{
http_response_code($this->statusCode);
foreach ($this->headers as $name => $value) {

@ -1,8 +1,6 @@
<?php
namespace App\Router\Response;
use Shared\Log;
class Response implements IResponse {
private string $content;
private int $statusCode;

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="en">
{#<<<<<<< HEAD#}
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ -35,78 +34,38 @@
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="password.html">Mot de passe oublié ?</a>
<a class="btn btn-primary" href="index.html">Se connecter</a>
</div>
</form>
</div>
{#=======#}
{#<head>#}
{# <meta charset="utf-8" />#}
{# <meta http-equiv="X-UA-Compatible" content="IE=edge" />#}
{# <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />#}
{# <meta name="description" content="" />#}
{# <meta name="author" content="" />#}
{# <title>{% block title %}{% endblock %}</title>#}
{# <link href="/css/{% block css %}base_theme{% endblock %}.css" rel="stylesheet" />#}
{# <script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>#}
{#</head>#}
{#<body class="bg-primary">#}
{#<div id="layoutAuthentication">#}
{# <div id="layoutAuthentication_content">#}
{# <main>#}
{# {% block main %}#}
{# <div class="container">#}
{# <div class="row justify-content-center">#}
{# <div class="col-lg-5">#}
{# <div class="card shadow-lg border-0 rounded-lg mt-5">#}
{# <div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div>#}
{# <div class="card-body">#}
{# <form>#}
{# <div class="form-floating mb-3">#}
{# <input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />#}
{# <label for="inputEmail">Adresse eMail</label>#}
{# </div>#}
{# <div class="form-floating mb-3">#}
{# <input class="form-control" id="inputPassword" type="password" placeholder="Mot de passe" />#}
{# <label for="inputPassword">Mot de passe</label>#}
{# </div>#}
{# <div class="form-check mb-3">#}
{# <input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />#}
{# <label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>#}
{# </div>#}
{# <div class="d-flex align-items-center justify-content-between mt-4 mb-0">#}
{# <a class="small" href="password.html">Mot de passe oublié ?</a>#}
{# <a class="btn btn-primary" href="index.html">Se connecter</a>#}
{# </div>#}
{# </form>#}
{# </div>#}
{# <div class="card-footer text-center py-3">#}
{# <div class="small"><a href="register.html">Besoin d'un compte ? Inscrivez-vous !</a></div>#}
{#>>>>>>> origin/merged_PLE#}
<div class="card-footer text-center py-3">
<div class="small"><a href="register.html">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
</main>
</div>
<div id="layoutAuthentication_footer">
<footer class="py-4 bg-light mt-auto">
<div class="container-fluid px-4">
<div class="d-flex align-items-center justify-content-between small">
<div class="text-muted">Copyright &copy; HeartTrack 2023</div>
<div>
<a href="#">Politique de confidentialité</a>
&middot;
<a href="#">Termes &amp; Conditions d'utilisations</a>
{% endblock %}
</main>
</div>
<div id="layoutAuthentication_footer">
<footer class="py-4 bg-light mt-auto">
<div class="container-fluid px-4">
<div class="d-flex align-items-center justify-content-between small">
<div class="text-muted">Copyright &copy; HeartTrack 2023</div>
<div>
<a href="#">Politique de confidentialité</a>
&middot;
<a href="#">Termes &amp; Conditions d'utilisations</a>
</div>
</div>
</div>
</div>
</footer>
</div>
</footer>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
</body>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
</body>
</html>

@ -7,12 +7,9 @@
<meta name="description" content="Accueil" />
<meta name="author" content="PINAGOT Antoine" />
<title>{% block title %}{% endblock %}</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
<link href="/css/{% block css %}styles{% endblock %}.css" rel="stylesheet" />
<link href="/css/{% block css %}style{% endblock %}.css" rel="stylesheet" />
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
</head>
<body class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
@ -38,7 +35,7 @@
<li><a class="dropdown-item" href="/profile">Profile</a></li>
<li><a class="dropdown-item" href="/settings">Paramètres</a></li>
<li><hr class="dropdown-divider" /></li>
<li><a class="dropdown-item" href="/">Déconnexion</a></li>
<li><a class="dropdown-item" href="/logout">Déconnexion</a></li>
</ul>
</li>
</ul>
@ -49,7 +46,7 @@
<div class="sb-sidenav-menu">
<div class="nav">
<div class="sb-sidenav-menu-heading">Menu</div>
<a class="nav-link" href="/home">
<a class="nav-link" href="/">
<div class="sb-nav-link-icon"><img src="/assets/img/house.png"></div>
Accueil
</a>
@ -58,9 +55,9 @@
<div class="sb-nav-link-icon"><img src="/assets/img/sprinter.png"></div>
Exercices
</a>
<a class="nav-link" href="/activity">
<a class="nav-link" href="/analyses">
<div class="sb-nav-link-icon"><i class="fas fa-chart-area"></i></div>
Activités
Analyses
</a>
<div class="sb-sidenav-menu-heading">Social</div>
<a class="nav-link" href="/friendlist">
@ -71,7 +68,7 @@
<div class="sb-nav-link-icon"><img src="/assets/img/coaching.png"></div>
Coaching
</a>
<a class="nav-link" href="/notification">
<a class="nav-link" href="/mail">
<div class="sb-nav-link-icon"><img src="/assets/img/letter.png"></div>
Messagerie
</a>

@ -21,7 +21,7 @@
<h1 class="display-1">{% block nb %}{% endblock %}</h1>
<p class="lead">{% block name %}{% endblock %}</p>
<p>{% block descr %}{% endblock %}</p>
<a href="/home">
<a href="/">
<i class="fas fa-arrow-left me-1"></i>
Retour à l'accueil
</a>

@ -4,84 +4,30 @@
{% block css %}{{css}}{% endblock %}
{% block title %}Analyses - HearthTrack{% endblock %}
{% block title %}Exercices - HearthTrack{% endblock %}
{% block user %}{{user}} - {{role}}{% endblock %}
{% block body %}
<div class="container-fluid px-4">
<h1 class="mt-4">Analyses</h1>
<div class="container-fluid px-4">
<h1 class="mt-4">Exercices</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item active">Analyses</li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Exercices</li>
</ol>
<div class="card-body">
<div class="datatable-container">
<table id="datatablesSimple" class="datatable-table">
<thead>
<tr>
<th>Date</th>
<th>Heure de début</th>
<th>Heure de fin</th>
<th>Type</th>
<th>effort ressenti</th>
<th>Variabilité</th>
<th>Variance</th>
<th>Ecart type</th>
<th>Moyenne</th>
<th>Maximum</th>
<th>Minimum</th>
<th>Temperature moyenne</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>Date</th>
<th>Heure de début</th>
<th>Heure de fin</th>
<th>Type</th>
<th>effort ressenti</th>
<th>Variabilité</th>
<th>Variance</th>
<th>Ecart type</th>
<th>Moyenne</th>
<th>Maximum</th>
<th>Minimum</th>
<th>Temperature moyenne</th>
</tr><tr></tr>
</tfoot>
<tbody>
{% for analyze in analyzes %}
<tr>
<td>{{analyze.date}}</td>
<td>{{analyze.heureDebut}}</td>
<td>{{analyze.heureFin}}</td>
<td>{{analyze.type}}</td>
<td>{{analyze.effortRessenti}}</td>
<td>{{analyze.variabilite}}</td>
<td>{{analyze.variance}}</td>
<td>{{analyze.ecartType}}</td>
<td>{{analyze.moyenne}} Bpm</td>
<td>{{analyze.max}} Bpm</td>
<td>{{analyze.min}} Bpm</td>
<td>{{analyze.temperature}} °C</td>
<td><a href="/analyze?id={{ analyze.idactivity }}">En savoir plus</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<div class="datatable-container">
<form method="post" action="/exercices">
Type : <input type="text" name="type"/>
Intensité : <input type="text" name="intensite"/>
Date : <input type="text" name="date"/>
<button class="btn btn-primary btn-mrg" id="btnNavbarSearch" type="submit">Ajouter l'exercice</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/umd/simple-datatables.min.js" crossorigin="anonymous"></script>
<script src="js/datatables-simple-demo.js"></script>
<h1>{{responce}}</h1>
{% endblock %}

@ -12,7 +12,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Liste d'ami</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Ami</li>
</ol>

@ -12,7 +12,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Coaching</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Coaching</li>
</ol>

@ -4,151 +4,63 @@
{% block css %}{{css}}{% endblock %}
{% block title %}Exercices - HearthTrack{% endblock %}
{% block title %}Analyses - HearthTrack{% endblock %}
{% block user %}{{user}} - {{role}}{% endblock %}
{% block body %}
<div class="container-fluid px-4">
<h1 class="mt-4">Exercices</h1>
<div class="container-fluid px-4">
<h1 class="mt-4">Analyses</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item active">Exercices</li>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Analyses</li>
</ol>
<div class="card-body">
{# <table id="datatablesSimple" class="datatable-table">#}
{# <thead>#}
{# <tr>#}
{# <th>id FC</th>#}
{# <th>altitude</th>#}
{# <th>temps</th>#}
{# <th>Temperature</th>#}
{# <th>bpm</th>#}
{# <th>longitude</th>#}
{# <th>latitude</th>#}
{# <th>activiteid</th>#}
{# <th></th>#}
{# </tr>#}
{# </thead>#}
{# {% for analyze in analyzes %}#}
{# <tbody>#}
{# <tr>#}
{# <td>{{analyze.idfc}}</td>#}
{# <td>{{analyze.altitude}}</td>#}
{# <td>{{analyze.temps}}</td>#}
{# <td>{{analyze.temperature}}</td>#}
{# <td>{{analyze.bpm}}</td>#}
{# <td>{{analyze.longitude}}</td>#}
{# <td>{{analyze.latitude}}</td>#}
{# <td>{{analyze.activiteid}}</td>#}
{# <td><a href="/home">Home</a></td>#}
{# </tr>#}
{# </tbody>#}
{# {% endfor %}#}
{# </table>#}
{# <div>#}
{# <canvas id="myChart" width="400" height="200">#}
{# <p>Hello Fallback World</p>#}
{# </canvas>#}
{# </div>#}
{# <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>#}
{# <script>#}
{# const ctx = document.getElementById('myChart');#}
<div class="card-body">
<div class="datatable-container">
<table id="datatablesSimple" class="datatable-table">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>BMP</th>
<th>KM/H</th>
<th>Distance</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>Date</th>
<th>Type</th>
<th>BPM</th>
<th>KM/H</th>
<th>Distance</th>
</tr><tr></tr>
{# new Chart(ctx, {#}
{# type: 'line',#}
{# data: {#}
{# labels: [#}
{# {% for analyze in analyzes %}#}
{# {{analyze.temps}}#}
{# {% endfor %}#}
{# ],#}
{# datasets: [{#}
{# label: 'Batement par minute',#}
{# data: [#}
{# {% for analyze in analyzes %}#}
{# {{analyze.bpm}}#}
{# {% endfor %}#}
{# ],#}
{# borderWidth: 1#}
{# }]#}
{# },#}
{# options: {#}
{# scales: {#}
{# y: {#}
{# beginAtZero: true#}
{# }#}
{# }#}
{# }#}
{# });#}
{# </script>#}
<div>
<canvas id="myChart" height="50">
<p>Hello Fallback World</p>
</canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
const labels = [
{% for analyze in analyzes %}
'{{ analyze.temps }}',
{% endfor %}
];
const data = [
{% for analyze in analyzes %}
{{ analyze.bpm }},
{% endfor %}
];
new Chart(ctx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Batement par minute',
data: data,
borderWidth: 1,
tension: 0.2,
fill: false,
borderColor: 'rgb(255, 0, 0)'
}]
},
options: {
scales: {
y: {
beginAtZero: false
}
}
}
});
</script>
<div class="card-body">
<div id="map" style="height: 500px;"></div>
<script>
document.addEventListener("DOMContentLoaded", function () {
{#var lat = {{ analyze.latitude }}#}
var map = L.map('map').setView([45.75771709151474, 3.113484980409329], 14);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
{% for analyze in analyzes %}
var marker = L.marker([{{ analyze.latitude }}, {{ analyze.longitude }}]).addTo(map);
marker.bindPopup(`
<strong>Date:</strong> {{ analyze.temps }}<br>
<strong>FC:</strong> {{ analyze.bpm }}<br>
<strong>Altitude:</strong> {{ analyze.altitude }}<br>
<strong>Temperature:</strong> {{ analyze.temperature }}
`);
{% endfor %}
});
</script>
</div>
</div>
</div>
</tfoot>
<tbody>
{% for analyze in analyzes %}
<tr>
<td>{{analyze.date}}</td>
<td>{{analyze.type}}</td>
<td>{{analyze.bpm}}</td>
<td>{{analyze.kmh}} Km/H</td>
<td>{{analyze.distance}} Km</td>
<td><a href="#about">En savoir plus</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<h1>{{responce}}</h1>
{% endblock %}
{% block script %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/umd/simple-datatables.min.js" crossorigin="anonymous"></script>
<script src="js/datatables-simple-demo.js"></script>
{% endblock %}

@ -13,7 +13,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Coaching</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Coaching</li>
</ol>
<style>.btn-mrg{margin:15px; margin-left:83%}</style>

@ -9,11 +9,10 @@
{% block user %}{{user}} - {{role}}{% endblock %}
{% block body %}
<div class="container-fluid px-4">
<h1 class="mt-4">Exercices</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Exercices</li>
</ol>
<style>.btn-mrg{margin:15px; margin-left:85%}</style>
@ -26,39 +25,18 @@
<thead>
<tr>
<th>Date</th>
<th>Description</th>
<th>Localisation</th>
<th>FeedBack</th>
<th>Type</th>
<th>Intensité prévue</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
{% for exo in exos %}
<tr>
<td>{{ exo.date }}</td>
<td>{{ exo.description }}</td>
<td>
<div id="map-{{ loop.index }}"
data-lat=45.758285982369415
data-lng=3.110223414416445
style="height: 300px; width: 650px;"></div>
<script>
document.addEventListener("DOMContentLoaded", function() {
var map{{ loop.index }} = L.map('map-{{ loop.index }}').setView([45.75771709151474, 3.113484980409329], 14);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map{{ loop.index }});
var marker{{ loop.index }} = L.marker([45.75771709151474, 3.113484980409329]).addTo(map{{ loop.index }});
marker{{ loop.index }}.bindPopup(`
<strong>Date:</strong> {{ exo.date }}<br>
<strong>Description:</strong> {{ exo.description }}<br>
<strong>Feedback:</strong> {{ exo.feedback }}
`);
});
</script>
</td>
<td>{{ exo.feedback }}</td>
<td>{{exo.date}}</td>
<td>{{exo.type}}</td>
<td>{{exo.intensite}}</td>
<td>{{exo.status}}</td>
</tr>
{% endfor %}
</tbody>

@ -12,7 +12,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Liste d'ami</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Ami</li>
</ol>
<style>.btn-mrg{margin:15px; margin-left:87%}</style>
@ -26,7 +26,7 @@
<table id="datatablesSimple" class="datatable-table">
{% if friendship is empty %}
<p>Vous n'avez aucun ami.</p>
{% else %}
{% else %}
<thead>
<tr>
<th></th>

@ -21,85 +21,8 @@
<i class="fas fa-chart-area me-1"></i>
Stastiques globales
</div>
<div>
<canvas id="myChart" height="50" width="100">
<p>Hello Fallback World</p>
</canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
const labels = [
{% for chart in charts %}
{{ chart.mois }},
{% endfor %}
];
const data = [
{% for chart in charts %}
{{ chart.act }},
{% endfor %}
];
new Chart(ctx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Activité du mois',
data: data,
borderWidth: 1,
tension: 0.2,
fill: false,
borderColor: 'rgb(255, 0, 0)'
}]
},
options: {
scales: {
x: {
// type: 'linear', // Utiliser une échelle linéaire pour les mois
position: 'bottom'
},
y: {
beginAtZero: true
}
}
}
});
{#const ctx = document.getElementById('myChart');#}
{#const labels = [#}
{# {% for chart in charts %}#}
{# '{{ chart.mois }}',#}
{# {% endfor %}#}
{#];#}
{#const data = [#}
{# {% for chart in charts %}#}
{# {{ chart.act }},#}
{# {% endfor %}#}
{#];#}
{#new Chart(ctx, {#}
{# type: 'line',#}
{# data: {#}
{# labels: labels,#}
{# datasets: [{#}
{# label: 'Activité du mois',#}
{# data: data,#}
{# borderWidth: 1,#}
{# tension: 0.2,#}
{# fill: false,#}
{# borderColor: 'rgb(255, 0, 0)'#}
{# }]#}
{# },#}
{# options: {#}
{# scales: {#}
{# y: {#}
{# beginAtZero: true#}
{# }#}
{# }#}
{# }#}
{#});#}
</script>
<div class="card-body">
{# <canvas id="myAreaChart" width="100%" height="40"></canvas> #}
</div>
</div>
</div>

@ -9,57 +9,34 @@
{% block user %}{{user}} - {{role}}{% endblock %}
{% block body %}
<div class="container-fluid px-4">
<h1 class="mt-4">Importer</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Importer</li>
</ol>
<div class="flex items-center justify-center">
<div class="sm:max-w-lg w-full p-10 bg-white rounded-xl z-10 ">
<div class="text-center">
<h2 class="mt-5 text-3xl font-bold text-gray-900">
Importer un fichier .fit !
</h2>
<p class="mt-2 text-sm text-gray-400">Let's go</p>
</div>
<form class="mt-8 space-y-3" action="/upload" method="POST" enctype="multipart/form-data">
<div class="grid grid-cols-1 space-y-2">
<label class="text-sm font-bold text-gray-500 tracking-wide">Veuillez renseigner le type d'activité</label>
<input class="text-base p-2 border border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500" type="text" name="activityType" placeholder="Course à pied">
</div>
<div class="grid grid-cols-1 space-y-2">
<label class="text-sm font-bold text-gray-500 tracking-wide">Effort Level (0-5)</label>
<input class="text-base p-2 border border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500" type="number" name="effort" min="0" max="5" placeholder="Enter effort level (0-5)">
</div>
<div class="grid grid-cols-1 space-y-2">
<label class="text-sm font-bold text-gray-500 tracking-wide">Attach Document</label>
<div class="flex items-center justify-center w-full">
<label class="flex flex-col rounded-lg border-4 border-dashed w-full h-60 p-10 group text-center cursor-pointer">
<div class="h-full w-full text-center flex flex-col items-center justify-center items-center ">
<div class="flex flex-auto max-h-48 w-2/5 mx-auto -mt-10">
<img class="has-mask h-36 object-center" src="https://img.freepik.com/free-vector/image-upload-concept-landing-page_52683-27130.jpg?size=338&ext=jpg" alt="freepik image">
<div class="container-fluid px-4">
<h1 class="mt-4">Importer</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="home.html">Accueil</a></li>
<li class="breadcrumb-item active">Importer</li>
</ol>
<div class="row">
<div class="col">
<div class="card mb-4">
<div class="card-header">
<img src="/assets/img/bupload.png"></i>
Importer un fichier .fit
</div>
<div class="card-body">
<div style="text-align:center; margin-bottom: 15px;">
<label for="file-input">
<img src="/assets/img/uploadW.svg"/>
</label>
<form action="/analyses" method="post">
<input id="file-input" type="file" name="fileToUpload" value=""style="visibility: hidden; width:0; height:0;"/>
<input type="submit" value="Soumettre le fichier" name="submit"/>
</form>
</div>
</div>
<p class="pointer-none text-gray-500 "><span class="text-sm">Drag and drop</span> files here <br /> or
<span class="text-blue-600 hover:underline">select a file</span>
from your computer</p>
</div>
<input type="file" class="hidden" id="file-input" name="uploaded_file" accept=".fit">
</label>
<p id="file-name-display" class="text-sm text-gray-500"></p>
</div>
</div>
</div>
</div>
<p class="text-sm text-gray-300">
<span>File type: .fit</span>
</p>
<div class="flex justify-center">
<button type="submit" class="my-5 w-3/4 flex justify-center bg-blue-500 text-gray-100 p-4 rounded-full tracking-wide
font-semibold focus:outline-none focus:shadow-outline hover:bg-blue-600 shadow-lg cursor-pointer transition ease-in duration-300">
Upload
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}

@ -1,296 +1 @@
<!--<<<<<<< HEAD-->
<!--<a href="/log">Se connecter</button>-->
<!--=======-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="index page du site web" />
<meta name="author" content="PINAGOT Antoine" />
<title>HeartTrack - Getting Started</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Google fonts-->
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,600;1,600&amp;display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Mulish:ital,wght@0,300;0,500;0,600;0,700;1,300;1,500;1,600;1,700&amp;display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,400;1,400&amp;display=swap" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles2.css" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-light fixed-top shadow-sm" id="mainNav">
<div class="container px-5">
<a class="navbar-brand fw-bold" href="/">HeartTrack</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="bi-list"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto me-4 my-3 my-lg-0">
<li class="nav-item"><a class="nav-link me-lg-3" href="/login">Se connecter</a></li>
<li class="nav-item"><a class="nav-link me-lg-3" href="/register">S'inscire</a></li>
</ul>
<button class="btn btn-primary rounded-pill px-3 mb-2 mb-lg-0" data-bs-toggle="modal" data-bs-target="#feedbackModal">
<span class="d-flex align-items-center">
<i class="bi-chat-text-fill me-2"></i>
<span class="small">Donnez votre avis</span>
</span>
</button>
</div>
</div>
</nav>
<!-- Mashead header-->
<header class="masthead">
<div class="container px-5">
<div class="row gx-5 align-items-center">
<div class="col-lg-6">
<!-- Mashead text and app badges-->
<div class="mb-5 mb-lg-0 text-center text-lg-start">
<h1 class="display-1 lh-1 mb-3">HeartTrack pour mobile !</h1>
<p class="lead fw-normal text-muted mb-5">Une application pour suivre vos analyses en direct, est en cours de développement.</p>
<!-- <div class="d-flex flex-column flex-lg-row align-items-center">
<a class="me-lg-3 mb-4 mb-lg-0" href="#!"><img class="app-badge" src="assets/img/google-play-badge.svg" alt="..." /></a>
<a href="#!"><img class="app-badge" src="assets/img/app-store-badge.svg" alt="..." /></a>
</div> -->
</div>
</div>
<div class="col-lg-6">
<!-- Masthead device mockup feature-->
<div class="masthead-device-mockup">
<svg class="circle" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="circleGradient" gradientTransform="rotate(45)">
<stop class="gradient-start-color" offset="0%"></stop>
<stop class="gradient-end-color" offset="100%"></stop>
</linearGradient>
</defs>
<circle cx="50" cy="50" r="50"></circle></svg
><svg class="shape-1 d-none d-sm-block" viewBox="0 0 240.83 240.83" xmlns="http://www.w3.org/2000/svg">
<rect x="-32.54" y="78.39" width="305.92" height="84.05" rx="42.03" transform="translate(120.42 -49.88) rotate(45)"></rect>
<rect x="-32.54" y="78.39" width="305.92" height="84.05" rx="42.03" transform="translate(-49.88 120.42) rotate(-45)"></rect></svg
><svg class="shape-2 d-none d-sm-block" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50"></circle></svg>
<div class="device-wrapper">
<div class="device" data-device="iPhoneX" data-orientation="portrait" data-color="black">
<div class="screen bg-black">
<!-- PUT CONTENTS HERE:-->
<!-- * * This can be a video, image, or just about anything else.-->
<!-- * * Set the max width of your media to 100% and the height to-->
<!-- * * 100% like the demo example below.-->
<video muted="muted" autoplay="" loop="" style="max-width: 100%; height: 100%"><source src="assets/img/demo-screen.mp4" type="video/mp4" /></video>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- Quote/testimonial aside-->
<aside class="text-center bg-gradient-primary-to-secondary">
<div class="container px-5">
<div class="row gx-5 justify-content-center">
<div class="col-xl-8">
<div class="h2 fs-1 text-white mb-4">"Une solution gratuite pour analyser vos données de fréquences cardiaques !"</div>
<img src="assets/img/tnw-logo.svg" alt="..." style="height: 3rem" />
</div>
</div>
</div>
</aside>
<!-- App features section-->
<section id="features">
<div class="container px-5">
<div class="row gx-5 align-items-center">
<div class="col-lg-8 order-lg-1 mb-5 mb-lg-0">
<div class="container-fluid px-5">
<div class="row gx-5">
<div class="col-md-6 mb-5">
<!-- Feature item-->
<div class="text-center">
<i class="bi-phone icon-feature text-gradient d-block mb-3"></i>
<h3 class="font-alt">Web/Mobile</h3>
<p class="text-muted mb-0">Gardez les informations tant bien dans l'application que sur le site web avec la synchronisation des données !</p>
</div>
</div>
<div class="col-md-6 mb-5">
<!-- Feature item-->
<div class="text-center">
<i class="bi-cast icon-feature text-gradient d-block mb-3"></i>
<h3 class="font-alt">Importez vos données</h3>
<p class="text-muted mb-0">Importez vos données directement depuis un fichier .FIT !</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-5 mb-md-0">
<!-- Feature item-->
<div class="text-center">
<i class="bi-gift icon-feature text-gradient d-block mb-3"></i>
<h3 class="font-alt">Gratuit</h3>
<p class="text-muted mb-0">Ce site et cette application sont entièrement gratuites !</p>
</div>
</div>
<div class="col-md-6">
<!-- Feature item-->
<div class="text-center">
<i class="bi-patch-check icon-feature text-gradient d-block mb-3"></i>
<h3 class="font-alt">Open Source</h3>
<p class="text-muted mb-0">Ce projet est fait en Open Source, tout le monde peut y accéder !</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 order-lg-0">
<!-- Features section device mockup-->
<div class="features-device-mockup">
<svg class="circle" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="circleGradient" gradientTransform="rotate(45)">
<stop class="gradient-start-color" offset="0%"></stop>
<stop class="gradient-end-color" offset="100%"></stop>
</linearGradient>
</defs>
<circle cx="50" cy="50" r="50"></circle></svg
><svg class="shape-1 d-none d-sm-block" viewBox="0 0 240.83 240.83" xmlns="http://www.w3.org/2000/svg">
<rect x="-32.54" y="78.39" width="305.92" height="84.05" rx="42.03" transform="translate(120.42 -49.88) rotate(45)"></rect>
<rect x="-32.54" y="78.39" width="305.92" height="84.05" rx="42.03" transform="translate(-49.88 120.42) rotate(-45)"></rect></svg
><svg class="shape-2 d-none d-sm-block" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50"></circle></svg>
<div class="device-wrapper">
<div class="device" data-device="iPhoneX" data-orientation="portrait" data-color="black">
<div class="screen bg-black">
<!-- PUT CONTENTS HERE:-->
<!-- * * This can be a video, image, or just about anything else.-->
<!-- * * Set the max width of your media to 100% and the height to-->
<!-- * * 100% like the demo example below.-->
<video muted="muted" autoplay="" loop="" style="max-width: 100%; height: 100%"><source src="assets/img/demo-screen.mp4" type="video/mp4" /></video>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Basic features section-->
<section class="bg-light">
<div class="container px-5">
<div class="row gx-5 align-items-center justify-content-center justify-content-lg-between">
<div class="col-12 col-lg-5">
<h2 class="display-4 lh-1 mb-4">Fonctionnalité supplémentaire de notre application</h2>
<p class="lead fw-normal text-muted mb-5 mb-lg-0">Notre application propose un service de coaching personnalisé en fonction du besoin que vous avez en tant qu'athelète. Vous pouvez aussi fournir un service de coaching aux autres utilisateurs en vous inscrivant en tant que coach sportif.</p>
</div>
<div class="col-sm-8 col-md-6">
<div class="px-5 px-sm-0"><img class="img-fluid rounded-circle" src="./assets/img/bg1.png" alt="..." /></div>
</div>
</div>
</div>
</section>
<!-- Call to action section-->
<section class="cta">
<div class="cta-content">
<div class="container px-5">
<h2 class="text-white display-1 lh-1 mb-4">
Arrêtez d'attendre...
<br />
Inscrivez-vous !
</h2>
<!-- <a class="btn btn-outline-light py-3 px-4 rounded-pill" href="#" target="_blank">Download for free</a> -->
</div>
</div>
</section>
<!-- App badge section-->
<section class="bg-gradient-primary-to-secondary" id="download">
<div class="container px-5">
<h2 class="text-center text-white font-alt mb-4">Application mobile bientôt disponible !</h2>
<!-- <div class="d-flex flex-column flex-lg-row align-items-center justify-content-center">
<a class="me-lg-3 mb-4 mb-lg-0" href="#!"><img class="app-badge" src="assets/img/google-play-badge.svg" alt="..." /></a>
<a href="#!"><img class="app-badge" src="assets/img/app-store-badge.svg" alt="..." /></a>
</div> -->
</div>
</section>
<!-- Footer-->
<footer class="bg-black text-center py-5">
<div class="container px-5">
<div class="text-white-50 small">
<div class="mb-2">&copy; HeartTrack 2023. Tous droits réservé.</div>
<a href="#!">Politique de confidentialité</a>
<span class="mx-1">&middot;</span>
<a href="#!">Termes & Conditions d'utilisation</a>
</div>
</div>
</footer>
<!-- Feedback Modal-->
<div class="modal fade" id="feedbackModal" tabindex="-1" aria-labelledby="feedbackModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-gradient-primary-to-secondary p-4">
<h5 class="modal-title font-alt text-white" id="feedbackModalLabel">Envoyez votre avis</h5>
<button class="btn-close btn-close-white" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body border-0 p-4">
<!-- * * * * * * * * * * * * * * *-->
<!-- * * SB Forms Contact Form * *-->
<!-- * * * * * * * * * * * * * * *-->
<!-- This form is pre-integrated with SB Forms.-->
<!-- To make this form functional, sign up at-->
<!-- https://startbootstrap.com/solution/contact-forms-->
<!-- to get an API token!-->
<form id="contactForm" data-sb-form-api-token="API_TOKEN">
<!-- Name input-->
<div class="form-floating mb-3">
<input class="form-control" id="name" type="text" placeholder="Entrez votre nom complet..." data-sb-validations="required" />
<label for="name">Nom complet</label>
<div class="invalid-feedback" data-sb-feedback="name:required">Un nom est requis.</div>
</div>
<!-- Email address input-->
<div class="form-floating mb-3">
<input class="form-control" id="email" type="email" placeholder="nom@exemple.com" data-sb-validations="required,email" />
<label for="email">Adresse email</label>
<div class="invalid-feedback" data-sb-feedback="email:required">Adresse email requis.</div>
<div class="invalid-feedback" data-sb-feedback="email:email">L'adresse email n'est pas valide.</div>
</div>
<!-- Phone number input-->
<div class="form-floating mb-3">
<input class="form-control" id="phone" type="tel" placeholder="06 12 34 56 78" data-sb-validations="required" />
<label for="phone">Numéro de téléphone</label>
<div class="invalid-feedback" data-sb-feedback="phone:required">Numéro de téléphone requis.</div>
</div>
<!-- Message input-->
<div class="form-floating mb-3">
<textarea class="form-control" id="message" type="text" placeholder="Entrez votre message..." style="height: 10rem" data-sb-validations="required"></textarea>
<label for="message">Message</label>
<div class="invalid-feedback" data-sb-feedback="message:required">Un message est requis.</div>
</div>
<!-- Submit success message-->
<!---->
<!-- This is what your users will see when the form-->
<!-- has successfully submitted-->
<div class="d-none" id="submitSuccessMessage">
<div class="text-center mb-3">
<div class="fw-bolder">Avis envoyé !</div>
</div>
</div>
<!-- Submit error message-->
<!---->
<!-- This is what your users will see when there is-->
<!-- an error submitting the form-->
<div class="d-none" id="submitErrorMessage"><div class="text-center text-danger mb-3">Erreur du formulaire !</div></div>
<!-- Submit Button-->
<div class="d-grid"><button class="btn btn-primary rounded-pill btn-lg disabled" id="submitButton" type="submit">Envoyer</button></div>
</form>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts2.js"></script>
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
</body>
</html>
<!--&gt;>>>>>> origin/merged_PLE-->
<a href="/log">Se connecter</button>

@ -1,79 +1,40 @@
{% extends "authbase.html.twig" %}
{% block css %}{{ css }}{% endblock %}
{% block css %}{{css}}{% endblock %}
{% block title %}Connexion - HearthTrack{% endblock %}
{% block main %}
{#<<<<<<< HEAD#}
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div>
<div class="card-body">
{% if login_error %}
{% for value in login_error %}
<div class="alert alert-danger" role="alert">
{{ value }}
{#=======#}
{# <div class="container">#}
{# <div class="row justify-content-center">#}
{# <div class="col-lg-5">#}
{# <div class="card shadow-lg border-0 rounded-lg mt-5">#}
{# <div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div>#}
{# <div class="card-body">#}
{# <form>#}
{# <div class="form-floating mb-3">#}
{# <input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />#}
{# <label for="inputEmail">Adresse eMail</label>#}
{# </div>#}
{# <div class="form-floating mb-3">#}
{# <input class="form-control" id="inputPassword" type="password" placeholder="Mot de passe" />#}
{# <label for="inputPassword">Mot de passe</label>#}
{# </div>#}
{# <div class="form-check mb-3">#}
{# <input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />#}
{# <label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>#}
{# </div>#}
{# <div class="d-flex align-items-center justify-content-between mt-4 mb-0">#}
{# <a class="small" href="/pass">Mot de passe oublié ?</a>#}
{# <a class="btn btn-primary" href="/home">Se connecter</a>#}
{# </div>#}
{# </form>#}
{# </div>#}
{# <div class="card-footer text-center py-3">#}
{# <div class="small"><a href="/regist">Besoin d'un compte ? Inscrivez-vous !</a></div>#}
{# </div>#}
{#>>>>>>> origin/merged_PLE#}
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div>
<div class="card-body">
<form>
<div class="form-floating mb-3">
<input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />
<label for="inputEmail">Adresse eMail</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="inputPassword" type="password" placeholder="Mot de passe" />
<label for="inputPassword">Mot de passe</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="password.html">Mot de passe oublié ?</a>
<a class="btn btn-primary" href="index.html">Se connecter</a>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
<div class="small"><a href="register.html">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div>
{% endfor %}
{% endif %}
<form method="post" action="/login">
<div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="text" placeholder="Nom d'utilisateur" />
<label for="email">Nom d'utilisateur</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="password" name="password" type="password" placeholder="Mot de passe" />
<label for="password">Mot de passe</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="/forgetPassword">Mot de passe oublié ?</a>
<button class="btn btn-primary" type="submit">Se connecter</button>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
<div class="small"><a href="/register">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

@ -23,16 +23,14 @@
<th>Lu</th>
<th>De:</th>
<th>Description</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{% for mail in mails %}
<tr>
<td><img src="/assets/img/verif/{{mail.idnotif}}.png" width="25px" height="25px"></td>
<td>{{mail.idathlete}}</td>
<td><img src="/assets/img/verif/{{mail.lu}}.png" width="25px" height="25px"></td>
<td>{{mail.nom}} {{mail.prenom}}</td>
<td><a href="#">{{mail.message}}</a></td>
<td>{{ mail.date }}</td>
</tr>
{% endfor %}
</tbody>

@ -12,31 +12,19 @@
<div class="card-header"><h3 class="text-center font-weight-light my-4">Récupération du mot de passe</h3></div>
<div class="card-body">
<div class="small mb-3 text-muted">Entrez votre adresse eMail pour recevoir un lien pour changer de mot de passe</div>
{#<<<<<<< HEAD#}
<form method="post" action="/">
{#=======#}
{# <form method="post" action="/password">#}
{#>>>>>>> origin/merged_PLE#}
<form method="post" action="/password">
<div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="email" placeholder="name@example.com" />
<label for="email">Adresse eMail</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
{#<<<<<<< HEAD#}
<a class="small" href="/login">Retour à la connexion</a>
{#=======#}
{# <a class="small" href="/log">Retour à la connexion</a>#}
{#>>>>>>> origin/merged_PLE#}
<button class="btn btn-primary" type="submit">Réinitialiser votre mot de passe</button>
<a class="small" href="/log">Retour à la connexion</a>
<button class="btn btn-primary" type="submit">Réinitialiser votre mot de passe</a>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
{#<<<<<<< HEAD#}
<div class="small"><a href="/register">Besoin d'un compte ? Inscrivez-vous !</a></div>
{#=======#}
{# <div class="small"><a href="/regist">Besoin d'un compte ? Inscrivez-vous !</a></div>#}
{#>>>>>>> origin/merged_PLE#}
<div class="small"><a href="/regist">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div>
</div>

@ -12,7 +12,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Profile</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Profile</li>
</ol>
<div class="row">

@ -11,131 +11,82 @@
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Créer un compte</h3></div>
<div class="card-body">
{# Display error message if register_error is set #}
{% if register_error %}
{% for value in register_error %}
<div class="alert alert-danger" role="alert">
{{ value }}
</div>
{% endfor %}
{% endif %}
<form method="post" action="/register">
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="nom" name="nom" type="text" placeholder="Entrez votre nom" />
<label for="nom">Nom de famille</label>
<input class="form-control" id="inputFirstName" type="text" placeholder="Entrez votre nom" />
<label for="inputFirstName">Nom de famille</label>
</div>
</div>
<div class="col-md-6">
<div class="form-floating">
<input class="form-control" id="prenom" name="prenom" type="text" placeholder="Entrez votre prénom" />
<label for="prenom">Prénom</label>
<input class="form-control" id="inputLastName" type="text" placeholder="Entrez votre prénom" />
<label for="inputLastName">Prénom</label>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
{#<<<<<<< HEAD#}
<input class="form-control" id="username" name="username" type="text" placeholder="Entrez votre pseudonyme" />
<label for="username">Nom d'utilisateur</label>
{#=======#}
{# <label for="inputUsername"></label><input class="form-control" id="inputUsername" type="text" placeholder="Entrez votre pseudonyme" />#}
{# <label for="inputFirstName">Nom d'utilisateur</label>#}
{#>>>>>>> origin/merged_PLE#}
<label for="inputUsername"></label><input class="form-control" id="inputUsername" type="text" placeholder="Entrez votre pseudonyme" />
<label for="inputFirstName">Nom d'utilisateur</label>
</div>
</div>
<div class="col-md-6">
<label for="sexe" >Sexe:</label>
<div class="form-floating">
{#<<<<<<< HEAD#}
<select id="sexe" name="sexe">
<option value="M">Homme</option>
<option value="H">Femme</option>
<option value="M">Ne se prononce pas</option>
{#=======#}
{# <label for="inputLastName">Sexe</label>#}
{# <label for="gender"></label><select id="gender" name="gender">#}
{# <option value="male">Homme</option>#}
{# <option value="female">Femme</option>#}
{# <option value="unknown">Ne se prononce pas</option>#}
{#>>>>>>> origin/merged_PLE#}
<label for="inputLastName">Sexe</label>
<label for="gender"></label><select id="gender" name="gender">
<option value="male">Homme</option>
<option value="female">Femme</option>
<option value="unknown">Ne se prononce pas</option>
</select>
</div>
</div>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="mail" name="mail" type="mail" placeholder="nom@exemple.com" />
<label for="mail">Adresse eMail</label>
<input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />
<label for="inputEmail">Adresse eMail</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="dateNaissance" name="dateNaissance" type="date" placeholder="" />
<label for="dateNaissance">Date de naissance</label>
<input class="form-control" id="inputDateNaissance" type="date" placeholder="" />
<label for="inputEmail">Date de naissance</label>
</div>
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="taille" name="taille" type="text" placeholder="Entrez votre taille" />
<label for="taille">Taille</label>
<input class="form-control" id="inputTaille" type="text" placeholder="Entrez votre taille" />
<label for="inputPassword">Taille</label>
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
{#<<<<<<< HEAD#}
<input class="form-control" id="poids" name="poids" type="text" placeholder="Entrez votre poids" />
<label for="poids">Poids</label>
{#=======#}
{# <label for="inputPoids"></label><input class="form-control" id="inputPoids" type="text" placeholder="Entrez votre poids" />#}
{# <label for="inputPasswordConfirm">Poids</label>#}
{#>>>>>>> origin/merged_PLE#}
<label for="inputPoids"></label><input class="form-control" id="inputPoids" type="text" placeholder="Entrez votre poids" />
<label for="inputPasswordConfirm">Poids</label>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="motDePasse" name="motDePasse" type="password" placeholder="Créez un mot de passe" />
<label for="motDePasse">Mot de passe</label>
<input class="form-control" id="inputPassword" type="password" placeholder="Créez un mot de passe" />
<label for="inputPassword">Mot de passe</label>
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="confirmMdp" name="confirmMdp" type="password" placeholder="Confirmez votre mot de passe" />
<label for="confirmMdp">Confirmer le mot de passe</label>
<input class="form-control" id="inputPasswordConfirm" type="password" placeholder="Confirmez votre mot de passe" />
<label for="inputPasswordConfirm">Confirmer le mot de passe</label>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="roleName" >Role:</label>
<div class="form-floating">
<select id="roleName" name="roleName">
<option value="Athlete">Athlete</option>
<option value="Coach">Coach</option>
</select>
</div>
</div>
</div>
<div class="mt-4 mb-0">
{#<<<<<<< HEAD#}
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-block">Créer un compte</button>
</div>
{#=======#}
{# <div class="d-grid"><a class="btn btn-primary btn-block" href="/log">Créer un compte</a></div>#}
{#>>>>>>> origin/merged_PLE#}
<div class="d-grid"><a class="btn btn-primary btn-block" href="login.html.twig">Créer un compte</a></div>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
{#<<<<<<< HEAD#}
<div class="small"><a href="/login">Avez-vous déjà un compte ? Connectez-vous ?</a></div>
{#=======#}
{# <div class="small"><a href="/log">Avez-vous déjà un compte ? Connectez-vous ?</a></div>#}
{#>>>>>>> origin/merged_PLE#}
<div class="small"><a href="login.html.twig">Avez-vous déjà un compte ? Connectez-vous ?</a></div>
</div>
</div>
</div>

@ -12,7 +12,7 @@
<div class="container-fluid px-4">
<h1 class="mt-4">Paramètres</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/home">Accueil</a></li>
<li class="breadcrumb-item"><a href="/">Accueil</a></li>
<li class="breadcrumb-item active">Paramètres</li>
</ol>
<div class="row">

@ -763,13 +763,7 @@ function profileMenu(Model $model)
do {
$effort = trim(fgets(STDIN));
} while ($effort < 0 || $effort > 5);
try {
$isAddActivity = $model->activityMgr->uploadFile($typeActivity, $effort, $passFile);
}catch (\Throwable $exception){
echo $exception;
}
$isAddActivity = $model->activityMgr->uploadFile($typeActivity, $effort, $passFile);
echo $isAddActivity ? "Activité ajoutée avec succès" : "Erreur lors de l'ajout de l'activité";
case '0':
return;
@ -799,7 +793,7 @@ while (true) {
}*/
break;
case '2': // S'inscrire
if($model->userMgr->login("bruce.lee@example.com", "password123"))
if($model->userMgr->login("bruce.lee@example.com", "hello321"))
$loggedIn = true;
// if (registerUser($model)) {
// $loggedIn = true;

@ -1,44 +1,34 @@
<?php
namespace Network;
namespace Data\Core;
use App\Router\Session;
use Model\User;
use Model\Athlete;
use Model\CoachAthlete;
use Repository\IUserRepository;
use Shared\IHashPassword;
use Shared\Log;
const USER = 'USER';
class AuthService implements IAuthService
{
class AuthService implements IAuthService {
private IUserRepository $userRepository;
private IHashPassword $passwordHacher;
private ?User $currentUser = null;
public function __construct(IUserRepository $userRepository, IHashPassword $passwordHacher)
{
public function __construct(IUserRepository $userRepository, IHashPassword $passwordHacher) {
$this->userRepository = $userRepository;
$this->passwordHacher = $passwordHacher;
}
public function login(string $email, string $password): bool
{
public function login(string $email, string $password): bool {
$user = $this->userRepository->getItemByEmail($email);
if ($user === null || !$this->passwordHacher->isPasswordValid( $user->getMotDePasse(),$password)) {
if ($user === null || !$this->validatePassword($password, $user->getPasswordHash())) {
return false;
}
$this->currentUser = $user;
$id = $this->currentUser->getId();
Session::getInstance()->__set(USER, $id);
Session::getInstance()->__get(USER);
// Add session handling logic here
return true;
}
public function register(string $email, string $password, $data): bool
{
public function register(string $email, string $password, array $data): bool {
if ($this->userRepository->getItemByEmail($email)) {
throw new \Exception('User already exists');
}
@ -47,54 +37,50 @@ class AuthService implements IAuthService
$prenom = $data['prenom'];
$username = $data['username'];
$nom = $data['nom'];
$email = $data['email'];
$sexe = $data['sexe'];
$taille = $data['taille'];
$poids = $data['poids'];
$dateNaissance = $data['dateNaissance'];
$dateNaissance = $data['dateNaissance'] ;
$roleName = $data['roleName'];
$role = null;
if ($roleName == "Coach") {
if($roleName == "Coach"){
$role = new CoachAthlete();
} else if ($roleName == "Athlete") {
}
else if($roleName == "Athlete"){
$role = new Athlete();
}
$user = new User(
random_int(0, 100),
$nom,
$prenom,
$username,
$email,
$hashedPassword,
$sexe,
$taille,
$poids,
$dateNaissance,
//should use reflexion
$role
);
// Create a new user instance (you should expand on this with more data as needed)
$user = new User(
random_int(0, 100),
$nom,
$prenom,
$username,
$email,
$hashedPassword,
$sexe,
$taille,
$poids,
$dateNaissance,
//should use reflexion
$role
);
$this->userRepository->addItem($user);
$this->currentUser = $user;
Session::getInstance()->__set(USER,$this->currentUser->getId());
// Add session handling logic here
return true;
}
public function logoutUser(): bool
{
public function logout(): void {
$this->currentUser = null;
Session::getInstance()->destroy();
return true;
// Add session handling logic here
}
public function getCurrentUser(): ?User
{
if (!empty(Session::getInstance()->__get(USER)) && $this->currentUser === null) {
$this->currentUser = $this->userRepository->getItemById(Session::getInstance()->__get(USER));
}
public function getCurrentUser(): ?User {
return $this->currentUser;
}
private function validatePassword(string $password, string $hash): bool {
// Implement password validation logic (e.g., using password_verify if using bcrypt)
}
}

@ -2,19 +2,15 @@
namespace Data\Core;
use Shared\Log;
class Preferences {
private string $cookie;
private array $theme;
private String $cookie;
private Array $theme;
public function __construct(){
if (isset($_COOKIE['preferences'])){
$this->cookie = $_COOKIE['preferences'];
} else {
if(setcookie('preferences', 'base_theme', time()+(3600*24)*7)){
$this->cookie = 'base_theme';
}
$this->cookie = setcookie('preferences', 'base_theme', time()+(3600*24)*7);
}
$this->theme = array(
'base_theme',
@ -23,7 +19,7 @@
);
}
public function majCookie(string $maj){
public function majCookie(String $maj){
try{
foreach($this->theme as $t){
$this->cookie = $maj;
@ -34,8 +30,8 @@
}
}
public function getCookie():string{
return $this->cookie ?? "base_theme";
public function getCookie():String{
return $this->cookie;
}
}

@ -2,14 +2,12 @@
namespace Database;
use DateTime;
class ActivityEntity {
private $idActivity;
class ActiviteEntity {
private $idActivite;
private $type;
private DateTime $date;
private DateTime $heureDebut;
private DateTime $heureFin;
private $date;
private $heureDebut;
private $heureFin;
private $effortRessenti;
private $variabilite;
private $variance;
@ -20,7 +18,7 @@ class ActivityEntity {
private $temperatureMoyenne;
// Getters
public function getIdActivity() {
public function getIdActivite() {
return $this->idActivity;
}
@ -44,7 +42,7 @@ class ActivityEntity {
return $this->effortRessenti;
}
public function getVariability() {
public function getVariabilite() {
return $this->variabilite;
}
@ -73,7 +71,7 @@ class ActivityEntity {
}
// Setters
public function setIdActivity($idActivity) {
public function setIdActivite($idActivite) {
$this->idActivity = $idActivity;
}

@ -0,0 +1,120 @@
<?php
namespace Database;
class ActiviteGateway {
private $connection;
public function __construct(Connection $connection) {
$this->connection = $connection;
}
public function getActivite() {
$query = "SELECT * FROM Activite";
return $this->connection->executeWithErrorHandling($query);
}
public function getActiviteById(int $activiteId) {
$query = "SELECT * FROM Activite WHERE idActivite = :id";
$params = [':id' => [$activiteId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByType(string $type) {
$query = "SELECT * FROM Activite WHERE type = :type";
$params = [':type' => [$type, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByDate(string $date) {
$query = "SELECT * FROM Activite WHERE date = :date";
$params = [':date' => [$date, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByTimeRange(string $startTime, string $endTime) {
$query = "SELECT * FROM Activite WHERE heureDebut >= :startTime AND heureFin <= :endTime";
$params = [
':startTime' => [$startTime, PDO::PARAM_STR],
':endTime' => [$endTime, PDO::PARAM_STR]
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByEffort(int $effortRessenti) {
$query = "SELECT * FROM Activite WHERE effortRessenti = :effort";
$params = [':effort' => [$effortRessenti, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByVariability(int $variabilite) {
$query = "SELECT * FROM Activite WHERE variabilite = :variability";
$params = [':variability' => [$variabilite, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActiviteByTemperature(int $temperatureMoyenne) {
$query = "SELECT * FROM Activite WHERE temperatureMoyenne = :temperature";
$params = [':temperature' => [$temperatureMoyenne, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function addActivite(ActiviteEntity $activite) {
$query = "INSERT INTO Activite (type, date, heureDebut, heureDeFin, effortRessenti, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne)
VALUES (:type, :date, :heureDebut, :heureDeFin, :effortRessenti, :variabilite, :variance, :ecartType, :moyenne, :maximum, :minimum, :temperatureMoyenne)";
$params = [
':type' => $activite->getType(),
':date' => $activite->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $activite->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $activite->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $activite->getEffortRessenti(),
':variabilite' => $activite->getVariabilite(),
':variance' => $activite->getVariance(),
':ecartType' => $activite->getEcartType(),
':moyenne' => $activite->getMoyenne(),
':maximum' => $activite->getMaximum(),
':minimum' => $activite->getMinimum(),
':temperatureMoyenne' => $activite->getTemperatureMoyenne(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function updateActivite(ActiviteEntity $oldActivite, ActiviteEntity $newActivite) {
$query = "UPDATE Activite
SET type = :type, date = :date, heureDebut = :heureDebut, heureDeFin = :heureDeFin,
effortRessenti = :effortRessenti, variabilite = :variabilite, variance = :variance, ecartType = :ecartType, moyenne = :moyenne, maximum = :maximum, minimum = :minimum, temperatureMoyenne = :temperatureMoyenne
WHERE idActivite = :idActivite";
$params = [
':idActivite' => $oldActivite->getIdActivite(),
':type' => $newActivite->getType(),
':date' => $newActivite->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $newActivite->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $newActivite->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $newActivite->getEffortRessenti(),
':variabilite' => $newActivite->getVariabilite(),
':variance' => $newActivite->getVariance(),
':ecartType' => $newActivite->getEcartType(),
':moyenne' => $newActivite->getMoyenne(),
':maximum' => $newActivite->getMaximum(),
':minimum' => $newActivite->getMinimum(),
':temperatureMoyenne' => $newActivite->getTemperatureMoyenne(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteActivite(int $idActivite) {
$query = "DELETE FROM Activite WHERE idActivite = :idActivite";
$params = [
':idActivite' => $idActivite,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
}
?>

@ -0,0 +1,51 @@
<?php
namespace Database;
use Model\Activite;
class ActiviteMapper {
public function map(array $data):ActiviteEntity {
$activite = new ActiviteEntity();
$activite->setIdActivite($data['idActivite']);
$activite->setType($data['type']);
$activite->setDate($data['date']);
$activite->setHeureDebut($data['heureDebut']);
$activite->setHeureFin($data['heureFin']);
$activite->setEffortRessenti($data['effortRessenti']);
$activite->setVariabilite($data['variabilite']);
$activite->setVariance($data['variance']);
$activite->setEcartType($data['ecartType']);
$activite->setMoyenne($data['moyenne']);
$activite->setMaximum($data['maximum']);
$activite->setMinimum($data['minimum']);
$activite->setTemperatureMoyenne($data['temperatureMoyenne']);
return $activite;
}
//public function ActiviteEntityToModel(ActiviteEntity entity): Activite;
public function ActiviteEntityToModel(ActiviteEntity $activiteEntity):Activite{
$act = new Activite(
$activiteEntity->getIdActivite(),
$activiteEntity->getType(),
$activiteEntity->getDate(),
$activiteEntity->getHeureDebut(),
$activiteEntity->getHeureFin(),
$activiteEntity->getEffortRessenti(),
$activiteEntity->getVariabilite(),
$activiteEntity->getVariance(),
$activiteEntity->getEcartType(),
$activiteEntity->getMoyenne(),
$activiteEntity->getMaximum(),
$activiteEntity->getMinimum(),
$activiteEntity->getTemperatureMoyenne()
);
return $act;
}
//public function ActiviteToEntity(Activite model): ActiviteEntity;
}
?>

@ -1,124 +0,0 @@
<?php
namespace Database;
use \PDO;
use Shared\Log;
class ActivityGateway {
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getActivity() {
$query = "SELECT * FROM Activite";
return $this->connection->executeWithErrorHandling($query);
}
public function getActivityById(int $activityId) {
$query = "SELECT * FROM Activite WHERE idActivite = :id";
$params = [':id' => $activityId];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByType(string $type) {
$query = "SELECT * FROM Activite WHERE type = :type";
$params = [':type' => [$type, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByDate(string $date) {
$query = "SELECT * FROM Activite WHERE date = :date";
$params = [':date' => [$date, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByTimeRange(string $startTime, string $endTime) {
$query = "SELECT * FROM Activite WHERE heureDebut >= :startTime AND heureFin <= :endTime";
$params = [
':startTime' => [$startTime, PDO::PARAM_STR],
':endTime' => [$endTime, PDO::PARAM_STR]
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByEffort(int $effortRessenti) {
$query = "SELECT * FROM Activite WHERE effortRessenti = :effort";
$params = [':effort' => [$effortRessenti, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByVariability(int $variabilite) {
$query = "SELECT * FROM Activite WHERE variabilite = :variability";
$params = [':variability' => [$variabilite, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getActivityByTemperature(int $temperatureMoyenne) {
$query = "SELECT * FROM Activite WHERE temperatureMoyenne = :temperature";
$params = [':temperature' => [$temperatureMoyenne, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function addActivity(ActivityEntity $activity) {
$query = "INSERT INTO Activite (idactivite, type, date, heurededebut, heuredefin, effortressent, variabilite, variance, ecarttype, moyenne, maximum, minimum, temperaturemoyenne, athleteid, sourceid)
VALUES (:idactivite, :type, :date, :heureDebut, :heureDeFin, :effortRessenti, :variabilite, :variance, :ecartType, :moyenne, :maximum, :minimum, :temperatureMoyenne, :athleteid, :sourceid)";
$params = [
':idactivite' => $activity->getIdActivity(),
':type' => $activity->getType(),
':date' => $activity->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $activity->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $activity->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $activity->getEffortRessenti(),
':variabilite' => $activity->getVariability(),
':variance' => $activity->getVariance(),
':ecartType' => $activity->getEcartType(),
':moyenne' => $activity->getMoyenne(),
':maximum' => $activity->getMaximum(),
':minimum' => $activity->getMinimum(),
':temperatureMoyenne' => $activity->getTemperatureMoyenne(),
':athleteid' => 1,
':sourceid' => 1,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function updateActivity(ActivityEntity $oldActivity, ActivityEntity $newActivity) {
$query = "UPDATE Activite
SET type = :type, date = :date, heureDebut = :heureDebut, heureDeFin = :heureDeFin,
effortRessenti = :effortRessenti, variabilite = :variabilite, variance = :variance, ecartType = :ecartType, moyenne = :moyenne, maximum = :maximum, minimum = :minimum, temperatureMoyenne = :temperatureMoyenne
WHERE idActivite = :idActivite";
$params = [
':idActivite' => $oldActivity->getIdActivity(),
':type' => $newActivity->getType(),
':date' => $newActivity->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $newActivity->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $newActivity->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $newActivity->getEffortRessenti(),
':variabilite' => $newActivity->getVariabilite(),
':variance' => $newActivity->getVariance(),
':ecartType' => $newActivity->getEcartType(),
':moyenne' => $newActivity->getMoyenne(),
':maximum' => $newActivity->getMaximum(),
':minimum' => $newActivity->getMinimum(),
':temperatureMoyenne' => $newActivity->getTemperatureMoyenne(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteActivity(int $idActivity) {
$query = "DELETE FROM Activite WHERE idActivite = :idActivity";
$params = [
':idActivity' => $idActivity,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
}
?>

@ -1,126 +0,0 @@
<?php
namespace Database;
use DateTime;
use Model\Activity;
use Shared\Log;
class ActivityMapper {
public function activitySqlToEntity(array $data):array
{
$activityEntities = [];
foreach ($data as $activityData) {
$activity = new ActivityEntity();
if (isset($activityData['idActivite'])) {
$activity->setIdActivity($activityData['idActivite']);
}
if (isset($activityData['type'])) {
$activity->setType($activityData['type']);
}
if (isset($activityData['date'])) {
$activity->setDate(new DateTime($activityData['date']));
}
if (isset($activityData['heureDeDebut'])) {
$activity->setHeureDebut(new DateTime($activityData['heureDeDebut']));
}
if (isset($activityData['heureDeFin'])) {
$activity->setHeureFin(new DateTime($activityData['heureDeFin']));
}
if (isset($activityData['effortRessent'])) {
$activity->setEffortRessenti($activityData['effortRessent']);
}
if (isset($activityData['variabilite'])) {
$activity->setVariabilite($activityData['variabilite']);
}
if (isset($activityData['variance'])) {
$activity->setVariance($activityData['variance']);
}
if (isset($activityData['ecartType'])) {
$activity->setEcartType($activityData['ecartType']);
}
if (isset($activityData['moyenne'])) {
$activity->setMoyenne($activityData['moyenne']);
}
if (isset($activityData['maximum'])) {
$activity->setMaximum($activityData['maximum']);
}
if (isset($activityData['minimum'])) {
$activity->setMinimum($activityData['minimum']);
}
if (isset($activityData['temperatureMoyenne'])) {
$activity->setTemperatureMoyenne($activityData['temperatureMoyenne']);
}
$activityEntities[] = $activity;
}
return $activityEntities;
}
/**
* @throws \Exception
*/
public function ActivityEntityToModel(ActivityEntity $activiteEntity):Activity {
$date = new DateTime($activiteEntity->getDate()->format('Y-m-d'));
$heureDebut = new \DateTime($activiteEntity->getHeureDebut()->format('H:i:s'));
$heureFin = new \DateTime($activiteEntity->getHeureFin()->format('H:i:s'));
$effortRessenti = intval($activiteEntity->getEffortRessenti());
$variability = floatval($activiteEntity->getVariability());
$variance = floatval($activiteEntity->getVariance());
$ecartType = floatval($activiteEntity->getEcartType());
$act = new Activity(
$activiteEntity->getType(),
$date,
$heureDebut,
$heureFin,
$effortRessenti,
$variability,
$variance,
$ecartType,
$activiteEntity->getMoyenne(),
$activiteEntity->getMaximum(),
$activiteEntity->getMinimum(),
$activiteEntity->getTemperatureMoyenne(),
'false'
);
return $act;
}
//public function ActivityToEntity(Activity model): ActivityEntity;
public function activityToEntity(Activity $act):ActivityEntity{
$actEntity = new ActivityEntity();
$actEntity->setIdActivity($act->getIdActivity());
$actEntity->setType($act->getType());
$actEntity->setDate($act->getDate());
$actEntity->setHeureDebut($act->getHeureDebut());
$actEntity->setHeureFin($act->getHeureFin());
$actEntity->setEffortRessenti($act->getEffortRessenti());
$actEntity->setVariabilite($act->getVariability());
$actEntity->setVariance($act->getVariance());
$actEntity->setEcartType($act->getStandardDeviation());
$actEntity->setMoyenne($act->getAverage());
$actEntity->setMaximum($act->getMaximum());
$actEntity->setMinimum($act->getMinimum());
$actEntity->setTemperatureMoyenne($act->getAvrTemperature());
return $actEntity;
}
}
?>

@ -1,79 +0,0 @@
<?php
namespace Database;
class AnalyzeEntity
{
private $idFc;
private $altitude;
private $time;
private $temperature;
private $bpm;
private $longitude;
private $latitude;
private $idactivity;
public function getIdFC()
{
return $this->idFc;
}
public function getAltitude()
{
return $this->altitude;
}
public function getTime()
{
return $this->temps;
}
public function getTemperature()
{
return $this->temperature;
}
public function getBpm()
{
return $this->bpm;
}
public function getLongitude()
{
return $this->longitude;
}
public function getLatitude()
{
return $this->latitude;
}
public function getIdActivity()
{
return $this->idactivity;
}
public function setIdFC($idFc)
{
$this->idFc = $idFc;
}
public function setAltitude($altitude)
{
$this->altitude = $altitude;
}
public function setTime($time)
{
$this->time = $time;
}
public function setTemperature($temperature)
{
$this->temperature = $temperature;
}
public function setBpm($bpm)
{
$this->bpm = $bpm;
}
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
public function setIdActivity($idactivity)
{
$this->idactivity = $idactivity;
}
}

@ -1,24 +0,0 @@
<?php
namespace Database;
class AnalyzeGateway
{
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getFrequenceCardiaque() {
$query = "SELECT * FROM FrequenceCardiaque";
return $this->connection->executeWithErrorHandling($query);
}
public function getFrequenceCardiaqueByIdActivity(int $activityId)
{
$query = "SELECT * FROM FrequenceCardiaque WHERE activiteid = :id";
$params = [':id' => $activityId];
return $this->connection->executeWithErrorHandling($query, $params);
}
}

@ -1,125 +0,0 @@
<?php
namespace Database;
use Shared\Log;
class AnalyzeMapper
{
public function analyzeSqlToEntity(array $data):array
{
$analyzeEntities = [];
foreach ($data as $analyzeData) {
$analyze = new ActivityEntity();
if (isset($analyzeData['idactivite'])) {
$analyze->setIdActivity($analyzeData['idactivite']);
}
if (isset($analyzeData['type'])) {
$analyze->setType($analyzeData['type']);
}
if (isset($analyzeData['date'])) {
$analyze->setDate($analyzeData['date']);
}
if (isset($analyzeData['heurededebut'])) {
$analyze->setHeureDebut($analyzeData['heurededebut']);
}
if (isset($analyzeData['heuredefin'])) {
$analyze->setHeureFin($analyzeData['heuredefin']);
}
if (isset($analyzeData['effortressent'])) {
$analyze->setEffortRessenti($analyzeData['effortressent']);
}
if (isset($analyzeData['variabilite'])) {
$analyze->setVariabilite($analyzeData['variabilite']);
}
if (isset($analyzeData['variance'])) {
$analyze->setVariance($analyzeData['variance']);
}
if (isset($analyzeData['ecarttype'])) {
$analyze->setEcartType($analyzeData['ecarttype']);
}
if (isset($analyzeData['moyenne'])) {
$analyze->setMoyenne($analyzeData['moyenne']);
}
if (isset($analyzeData['maximum'])) {
$analyze->setMaximum($analyzeData['maximum']);
}
if (isset($analyzeData['minimum'])) {
$analyze->setMinimum($analyzeData['minimum']);
}
if (isset($analyzeData['temperaturemoyenne'])) {
$analyze->setTemperatureMoyenne($analyzeData['temperaturemoyenne']);
}
$analyzeEntities[] = $analyze;
}
return $analyzeEntities;
}
/**
* @throws \Exception
*/
// public function ActivityEntityToModel(ActivityEntity $activiteEntity):Activity {
// $date = new DateTime($activiteEntity->getDate());
// $heureDebut = new \DateTime($activiteEntity->getHeureDebut());
// $heureFin = new \DateTime($activiteEntity->getHeureFin());
// $effortRessenti = intval($activiteEntity->getEffortRessenti());
// $variability = floatval($activiteEntity->getVariability());
// $variance = floatval($activiteEntity->getVariance());
// $ecartType = floatval($activiteEntity->getEcartType());
//
// $act = new Activity(
// $activiteEntity->getIdActivity(),
// $activiteEntity->getType(),
// $date,
// $heureDebut,
// $heureFin,
// $effortRessenti,
// $variability,
// $variance,
// $ecartType,
// $activiteEntity->getMoyenne(),
// $activiteEntity->getMaximum(),
// $activiteEntity->getMinimum(),
// $activiteEntity->getTemperatureMoyenne(),
// 'false'
// );
//
// return $act;
// }
//public function ActivityToEntity(Activity model): ActivityEntity;
// public function activityToEntity( $act):ActivityEntity{
//
// $act = new ActivityEntity();
// $act->setIdActivity($act->getIdActivity()());
// $act->setType($act->getType());
// $act->setDate($act->getDate());
// $act->setHeureDebut($act->getHeureDebut());
// $act->setHeureFin($act->getHeureFin());
// $act->setEffortRessenti($act->getEffortRessenti());
// $act->setVariabilite($act->getVariability());
// $act->setVariance($act->getVariance());
// $act->setEcartType($act->getEcartType());
// $act->setMoyenne($act->getMoyenne());
// $act->setMaximum($act->getMaximum());
// $act->setMinimum($act->getMinimum());
// $act->setTemperatureMoyenne($act->getTemperatureMoyenne());
//
// return $act;
// }
}

@ -6,14 +6,12 @@ class AthleteEntity {
private $idAthlete;
private $nom;
private $prenom;
private $username;
private $email;
private $sexe;
private $taille;
private $poids;
private $motDePasse;
private $dateNaissance;
private $isCoach;
// Getters
public function getIdAthlete() {
@ -28,10 +26,6 @@ class AthleteEntity {
return $this->prenom;
}
public function getUsername(){
return $this->username;
}
public function getEmail() {
return $this->email;
}
@ -56,11 +50,6 @@ class AthleteEntity {
return $this->dateNaissance;
}
public function getIsCoach(){
return $this->isCoach;
}
// Setters
public function setIdAthlete($idAthlete) {
$this->idAthlete = $idAthlete;
@ -74,10 +63,6 @@ class AthleteEntity {
$this->prenom = $prenom;
}
public function setUsername($username){
$this->username = $username;
}
public function setEmail($email) {
$this->email = $email;
}
@ -101,10 +86,6 @@ class AthleteEntity {
public function setDateNaissance($dateNaissance) {
$this->dateNaissance = $dateNaissance;
}
public function setIsCoach($isCoach){
$this->isCoach = $isCoach;
}
}
?>

@ -2,131 +2,70 @@
namespace Database;
use \PDO;
use Shared\Log;
class AthleteGateway {
private Connexion $connection;
private $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getAthlete(): array
{
$query = "SELECT * FROM Athlete WHERE isCoach=FALSE";
$res = $this->connection->executeWithErrorHandling($query);
return $res;
public function getAthlete() {
$query = "SELECT * FROM Athlete";
return $this->connection->executeWithErrorHandling($query);
}
public function getAthleteById(int $userId): array
{
$query = "SELECT * FROM Athlete WHERE idAthlete = :id AND isCoach=FALSE";
$params = [':id' => $userId];
// log::dd($params);
$res = $this->connection->executeWithErrorHandling($query, $params);
return $res;
}
public function getAthleteByName(string $name): array
{
$query = "SELECT * FROM Athlete WHERE nom = :name AND isCoach=FALSE";
$params = [':name' => $name];
public function getAthleteById(int $userId) {
$query = "SELECT * FROM Athlete WHERE idAthlete = :id";
$params = [':id' => [$userId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByFirstName(string $firstName): array
{
$query = "SELECT * FROM Athlete WHERE prenom = :firstName AND isCoach=FALSE";
$params = [':firstName' => $firstName];
public function getAthleteByName(string $name) {
$query = "SELECT * FROM Athlete WHERE nom = :name";
$params = [':name' => [$name, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByEmail(string $email): array
{
$query = "SELECT * FROM Athlete WHERE email = :email AND isCoach=FALSE";
$params = [':email' => $email];
public function getAthleteByFirstName(string $firstName) {
$query = "SELECT * FROM Athlete WHERE prenom = :firstName";
$params = [':firstName' => [$firstName, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByEmail(string $email): array
{
public function getAthleteByEmail(string $email) {
$query = "SELECT * FROM Athlete WHERE email = :email";
$params = [':email' => $email];
$params = [':email' => [$email, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByGender(string $gender): array
{
$query = "SELECT * FROM Athlete WHERE sexe = :gender AND isCoach=FALSE";
$params = [':gender' => $gender];
public function getAthleteByGender(string $gender) {
$query = "SELECT * FROM Athlete WHERE sexe = :gender";
$params = [':gender' => [$gender, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByHeight(int $height): array
{
$query = "SELECT * FROM Athlete WHERE taille = :height AND isCoach=FALSE";
public function getAthleteByHeight(int $height) {
$query = "SELECT * FROM Athlete WHERE taille = :height";
$params = [':height' => [$height, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByWeight(int $weight): array
{
$query = "SELECT * FROM Athlete WHERE poids = :weight AND isCoach=FALSE";
public function getAthleteByWeight(int $weight) {
$query = "SELECT * FROM Athlete WHERE poids = :weight";
$params = [':weight' => [$weight, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByBirthDate(string $birthdate): array
{
$query = "SELECT * FROM Athlete WHERE dateNaissance = :birthdate AND isCoach=FALSE";
public function getAthleteByBirthDate(string $birthdate) {
$query = "SELECT * FROM Athlete WHERE dateNaissance = :birthdate";
$params = [':birthdate' => [$birthdate, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getListIdFriends(int $idAthlete): array
{
$query = "SELECT idAthlete1, idAthlete2 FROM Friendship WHERE idAthlete1 = :idAthlete OR idAthlete2= :idAthlete";
$params = [
':idAthlete' => $idAthlete,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getListActivity(int $idAthlete): array
{
/*$query = "SELECT count(ac.idActivite) AS nbActivite, EXTRACT(MONTH FROM ac.date) AS mois
FROM Athlete at, Activite ac
WHERE at.idAthlete = :idAthlete
AND ac.date > CURRENT_DATE - INTERVAL '1 YEAR'
AND ac.athleteId = at.idAthlete
GROUP BY mois";*/
$query = "SELECT COUNT(ac.idActivite) AS nbActivite, EXTRACT(MONTH FROM ac.date) AS mois
FROM Athlete at
JOIN Activite ac ON ac.athleteId = at.idAthlete
WHERE at.idAthlete = :idAthlete
AND ac.date > CURRENT_DATE - INTERVAL 1 YEAR
GROUP BY mois";
// $query = "SELECT count(ac.idActivite) AS nbActivite, EXTRACT(MONTH FROM ac.date) AS mois
// FROM Athlete at, Activite ac
// WHERE at.idAthlete = :idAthlete
// AND ac.date > CURRENT_DATE - INTERVAL '1 YEAR'
// AND ac.athleteId = at.idAthlete
// GROUP BY mois";
$params = [
':idAthlete' => $idAthlete,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function addAthlete(AthleteEntity $athlete): array
{
$query = "INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach)
VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance, :isCoach)";
public function addAthlete(AthleteEntity $athlete) {
$query = "INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance)
VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance)";
$params = [
':nom' => $athlete->getNom(),
@ -137,22 +76,19 @@ class AthleteGateway {
':poids' => $athlete->getPoids(),
':motDePasse' => $athlete->getMotDePasse(),
':dateNaissance' => $athlete->getDateNaissance(),
':isCoach' => $athlete->getIsCoach(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function updateAthlete(AthleteEntity $oldAthlete, AthleteEntity $newAthlete): array
{
public function updateAthlete(AthleteEntity $oldAthlete, AthleteEntity $newAthlete) {
$query = "UPDATE Athlete
SET username = :username, nom = :nom, prenom = :prenom, email = :email, sexe = :sexe,
taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance, isCoach = :isCoach
SET nom = :nom, prenom = :prenom, email = :email, sexe = :sexe,
taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance
WHERE idAthlete = :idAthlete";
$params = [
':idAthlete' => $oldAthlete->getIdAthlete(),
':username' => $newAthlete->getUsername(),
':nom' => $newAthlete->getNom(),
':prenom' => $newAthlete->getPrenom(),
':email' => $newAthlete->getEmail(),
@ -161,14 +97,12 @@ class AthleteGateway {
':poids' => $newAthlete->getPoids(),
':motDePasse' => $newAthlete->getMotDePasse(),
':dateNaissance' => $newAthlete->getDateNaissance(),
':isCoach' => $newAthlete->getIsCoach(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteAthlete(int $idAthlete): array
{
public function deleteAthlete(int $idAthlete) {
$query = "DELETE FROM Athlete WHERE idAthlete = :idAthlete";
$params = [

@ -6,14 +6,14 @@ use \PDO;
use \DateTime;
use Model\Role;
use Model\Athlete;
use Shared\Log;
class AthleteMapper {
public function athleteSqlToEntity(array $data): array {
public function fromSqlToEntity(array $data): array {
$athleteEntities = [];
foreach ($data as $athleteData) {
$athlete = new AthleteEntity();
if (isset($athleteData['idAthlete'])) {
$athlete->setIdAthlete($athleteData['idAthlete']);
}
@ -26,10 +26,6 @@ class AthleteMapper {
$athlete->setPrenom($athleteData['prenom']);
}
if (isset($athleteData['username'])) {
$athlete->setUsername($athleteData['username']);
}
if (isset($athleteData['email'])) {
$athlete->setEmail($athleteData['email']);
}
@ -54,10 +50,6 @@ class AthleteMapper {
$athlete->setDateNaissance($athleteData['dateNaissance']);
}
if (isset($athleteData['isCoach'])) {
$athlete->setIsCoach($athleteData['isCoach']);
}
$athleteEntities[] = $athlete;
}
@ -66,19 +58,19 @@ class AthleteMapper {
public function athleteEntityToModel(AthleteEntity $athleteEntity): User {
$role = new Athlete(); // Utilisez la classe Athlete
$date = new DateTime($athleteEntity->getDateNaissance());
$poids = floatval($athleteEntity->getPoids());
$taille = floatval($athleteEntity->getTaille());
$dateSpecifique = $athleteEntity->getDateNaissance();
$date = new DateTime($dateSpecifique);
$user = new User(
$athleteEntity->getIdAthlete(),
$athleteEntity->getNom(),
$athleteEntity->getPrenom(),
$athleteEntity->getUsername(),
$athleteEntity->getEmail(),
$athleteEntity->getMotDePasse(),
$athleteEntity->getSexe(),
$taille,
$poids,
$athleteEntity->getTaille(),
$athleteEntity->getPoids(),
$date,
$role
);
@ -92,15 +84,12 @@ class AthleteMapper {
$ath->setIdAthlete($user->getId());
$ath->setNom($user->getNom());
$ath->setPrenom($user->getPrenom());
$ath->setUsername($user->getUsername());
$ath->setEmail($user->getEmail());
$ath->setSexe($user->getSexe());
$ath->setTaille($user->getTaille());
$ath->setPoids($user->getPoids());
$ath->setMotDePasse($user->getMotDePasse());
$ath->setDateNaissance($user->getDateNaissance());
$ath->setIsCoach(FALSE);
$ath->setCoachId(NULL);
return $ath;
}

@ -6,14 +6,12 @@ class CoachEntity {
private $idCoach;
private $nom;
private $prenom;
private $username;
private $email;
private $sexe;
private $taille;
private $poids;
private $motDePasse;
private $dateNaissance;
private $isCoach;
// Getters
public function getIdCoach() {
@ -28,10 +26,6 @@ class CoachEntity {
return $this->prenom;
}
public function getUsername(){
return $this->username;
}
public function getEmail() {
return $this->email;
}
@ -56,11 +50,6 @@ class CoachEntity {
return $this->dateNaissance;
}
public function getIsCoach(){
return $this->isCoach;
}
// Setters
public function setIdCoach($idCoach) {
$this->idCoach = $idCoach;
@ -74,10 +63,6 @@ class CoachEntity {
$this->prenom = $prenom;
}
public function setUsername($username){
$this->username = $username;
}
public function setEmail($email) {
$this->email = $email;
}
@ -101,11 +86,6 @@ class CoachEntity {
public function setDateNaissance($dateNaissance) {
$this->dateNaissance = $dateNaissance;
}
public function setIsCoach($isCoach){
$this->isCoach = $isCoach;
}
}
?>

@ -10,96 +10,93 @@ class CoachGateway {
$this->connection = $connection;
}
public function getCoach(): array
{
public function getCoach() {
$query = "SELECT * FROM Coach";
return $this->connection->executeWithErrorHandling($query);
}
public function getCoachById(int $userId): array
{
public function getCoachById(int $userId) {
$query = "SELECT * FROM Coach WHERE idCoach = :id";
$params = [':id' => [$userId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getAthleteByCoachId(int $coachId): array
{
$query = "SELECT * FROM Athlete a, Coach c WHERE a.coachId = :id AND a.isCoach = TRUE";
$params = [':id' => [$coachId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByName(string $name): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.nom = :name";
public function getCoachByName(string $name) {
$query = "SELECT * FROM Coach WHERE nom = :name";
$params = [':name' => [$name, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByFirstName(string $firstName): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.prenom = :firstName";
public function getCoachByFirstName(string $firstName) {
$query = "SELECT * FROM Coach WHERE prenom = :firstName";
$params = [':firstName' => [$firstName, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByEmail(string $email): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.email = :email";
public function getCoachByEmail(string $email) {
$query = "SELECT * FROM Coach WHERE email = :email";
$params = [':email' => [$email, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByGender(string $gender): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.sexe = :gender";
public function getCoachByGender(string $gender) {
$query = "SELECT * FROM Coach WHERE sexe = :gender";
$params = [':gender' => [$gender, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByHeight(int $height): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.taille = :height";
public function getCoachByHeight(int $height) {
$query = "SELECT * FROM Coach WHERE taille = :height";
$params = [':height' => [$height, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByBirthDate(string $birthdate): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.dateNaissance = :birthdate";
public function getCoachByBirthDate(string $birthdate) {
$query = "SELECT * FROM Coach WHERE dateNaissance = :birthdate";
$params = [':birthdate' => [$birthdate, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function addCoach(CoachEntity $coach): array
{
$query = "INSERT INTO Coach (athleteId)
VALUES (:athleteId)";
public function addCoach(CoachEntity $coach) {
$query = "INSERT INTO Coach (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance)
VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance)";
$params = [
':athleteId' => $coach->getAthleteId(),
':nom' => $coach->getNom(),
':prenom' => $coach->getPrenom(),
':email' => $coach->getEmail(),
':sexe' => $coach->getSexe(),
':taille' => $coach->getTaille(),
':poids' => $coach->getPoids(),
':motDePasse' => $coach->getMotDePasse(),
':dateNaissance' => $coach->getDateNaissance(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function updateCoach(CoachEntity $oldCoach, CoachEntity $newCoach): array
{
public function updateCoach(CoachEntity $oldCoach, CoachEntity $newCoach) {
$query = "UPDATE Coach
SET athleteId = :athleteId
SET nom = :nom, prenom = :prenom, email = :email, sexe = :sexe,
taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance
WHERE idCoach = :idCoach";
$params = [
':idCoach' => $oldCoach->getIdCoach(),
':athleteId' => $newCoach->getAthleteId(),
':nom' => $newCoach->getNom(),
':prenom' => $newCoach->getPrenom(),
':email' => $newCoach->getEmail(),
':sexe' => $newCoach->getSexe(),
':taille' => $newCoach->getTaille(),
':poids' => $newCoach->getPoids(),
':motDePasse' => $newCoach->getMotDePasse(),
':dateNaissance' => $newCoach->getDateNaissance(),
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteCoach(int $idCoach): array
{
public function deleteCoach(int $idCoach) {
$query = "DELETE FROM Coach WHERE idCoach = :idCoach";
$params = [

@ -1,85 +1,41 @@
<?php
namespace Database;
use Model\CoachAthlete;
use Model\User;
use \PDO;
use \DateTime;
use Model\Role;
use Model\Coach;
use Shared\Log;
class CoachMapper {
public function coachSqlToEntity(array $data): array {
$coachEntities = [];
foreach ($data as $coachData) {
$coach = new CoachEntity();
if (isset($coachData['idAthlete'])) {
$coach->setIdCoach($coachData['idAthlete']);
}
if (isset($coachData['nom'])) {
$coach->setNom($coachData['nom']);
}
if (isset($coachData['prenom'])) {
$coach->setPrenom($coachData['prenom']);
}
if (isset($coachData['username'])) {
$coach->setUsername($coachData['username']);
}
if (isset($coachData['email'])) {
$coach->setEmail($coachData['email']);
}
if (isset($coachData['sexe'])) {
$coach->setSexe($coachData['sexe']);
}
if (isset($coachData['taille'])) {
$coach->setTaille($coachData['taille']);
}
if (isset($coachData['poids'])) {
$coach->setPoids($coachData['poids']);
}
if (isset($coachData['motDePasse'])) {
$coach->setMotDePasse($coachData['motDePasse']);
}
if (isset($coachData['dateNaissance'])) {
$coach->setDateNaissance($coachData['dateNaissance']);
}
if (isset($coachData['isCoach'])) {
$coach->setIsCoach($coachData['isCoach']);
}
$coachEntities[] = $coach;
}
public function map(array $data) {
$coach = new CoachEntity();
$coach->setIdCoach($data['idCoach']);
$coach->setNom($data['nom']);
$coach->setPrenom($data['prenom']);
$coach->setEmail($data['email']);
$coach->setSexe($data['sexe']);
$coach->setTaille($data['taille']);
$coach->setPoids($data['poids']);
$coach->setMotDePasse($data['motDePasse']);
$coach->setDateNaissance($data['dateNaissance']);
return $coachEntities;
return $coach;
}
public function CoachEntityToModel(CoachEntity $coachEntity):User{
$role = new CoachAthlete();
$date = new DateTime($coachEntity->getDateNaissance());
$role = "Coach";
$user = new User(
$coachEntity->getIdCoach(),
$coachEntity->getNom(),
$coachEntity->getPrenom(),
$coachEntity->getUsername(),
$coachEntity->getEmail(),
$coachEntity->getMotDePasse(),
$coachEntity->getSexe(),
$coachEntity->getTaille(),
$coachEntity->getPoids(),
$date,
$coachEntity->getDateNaissance(),
$role
);
@ -90,10 +46,17 @@ class CoachMapper {
$coach = new CoachEntity();
$coach->setIdCoach($user->getId());
$coach->setAthleteId($user->getId());
$coach->setNom($user->getNom());
$coach->setPrenom($user->getPrenom());
$coach->setEmail($user->getEmail());
$coach->setSexe($user->getSexe());
$coach->setTaille($user->getTaille());
$coach->setPoids($user->getPoids());
$coach->setMotDePasse($user->getMotDePasse());
$coach->setDateNaissance($user->getDateNaissance());
return $coach;
}
}
?>
?>

@ -2,9 +2,6 @@
namespace Database;
use DateTime;
use Shared\Log;
class Connexion extends \PDO {
private $stmt;
@ -18,11 +15,13 @@ class Connexion extends \PDO {
}
}
public function executeQuery(string $query, array $parameters = []) {
public function executeQuery(string $query, array $parameters = []): bool {
$this->stmt = $this->prepare($query);
//foreach ($parameters as $name => $value) {
// $this->stmt->bindValue($name, $value[0], $value[1]);
//}
foreach ($parameters as $name => $value) {
$dataType = is_numeric($value) ? \PDO::PARAM_INT : \PDO::PARAM_STR;
$bindValueResult = $this->stmt->bindValue($name, $value, $dataType);
$bindValueResult = $this->stmt->bindValue($name, $value, \PDO::PARAM_STR);
if (!$bindValueResult) {
// Gérez l'erreur, par exemple, en lançant une exception.
throw new \PDOException('Failed to bind value for parameter ' . $name);

@ -1,71 +0,0 @@
<?php
namespace Database;
class EntrainementEntity
{
private $idEntrainement;
private $date;
private $description;
private $latitude;
private $longitude;
private $feedback;
private $coachId;
public function getIdEntrainement()
{
return $this->idEntrainement;
}
public function getDate()
{
return $this->date;
}
public function getDescription()
{
return $this->description;
}
public function getLatitude()
{
return $this->latitude;
}
public function getLongitude()
{
return $this->longitude;
}
public function getFeedback()
{
return $this->feedback;
}
public function getCoachId()
{
return $this->coachId;
}
public function setIdEntrainement($idEntrainement)
{
$this->idEntrainement = $idEntrainement;
}
public function setDate($date)
{
$this->date = $date;
}
public function setDescription($description)
{
$this->description = $description;
}
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
public function setFeedback($feedback)
{
$this->feedback = $feedback;
}
public function setCoachId($coachId)
{
$this->coachId = $coachId;
}
}

@ -1,21 +0,0 @@
<?php
namespace Database;
use Shared\Log;
class EntrainementGateway
{
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getEntrainements(): array
{
$query = "SELECT * FROM Entrainement";
$res = $this->connection->executeWithErrorHandling($query);
return $res;
}
}

@ -1,82 +0,0 @@
<?php
namespace Database;
use DateTime;
use Model\Athlete;
use Model\Training;
use Model\User;
use Shared\Log;
class EntrainementMapper
{
public function entrainementSqlToEntity(array $data): array {
$entrainementEntities = [];
foreach ($data as $entrainementData) {
$entrainement = new EntrainementEntity();
if (isset($entrainementData['identrainement'])) {
$entrainement->setIdEntrainement($entrainementData['identrainement']);
}
if (isset($entrainementData['date'])) {
$entrainement->setDate($entrainementData['date']);
}
if (isset($entrainementData['description'])) {
$entrainement->setDescription($entrainementData['description']);
}
if (isset($entrainementData['latitude'])) {
$entrainement->setLatitude($entrainementData['latitude']);
}
if (isset($entrainementData['longitude'])) {
$entrainement->setLongitude($entrainementData['longitude']);
}
if (isset($entrainementData['feedback'])) {
$entrainement->setFeedback($entrainementData['feedback']);
}
if (isset($entrainementData['athleteid'])) {
$entrainement->setCoachId($entrainementData['athleteid']);
}
$entrainementEntities[] = $entrainement;
}
return $entrainementEntities;
}
public function entrainementEntityToModel(EntrainementEntity $entrainementEntity): Training {
$date = new DateTime($entrainementEntity->getDate());
$idTraining = intval($entrainementEntity->getIdEntrainement());
$latitude = floatval($entrainementEntity->getLatitude());
$longitude = floatval($entrainementEntity->getLongitude());
return new Training(
$idTraining,
$date,
$latitude,
$longitude,
$entrainementEntity->getDescription(),
$entrainementEntity->getFeedback()
);
}
public function entrainementToEntity(Training $training):EntrainementEntity{
$train = new EntrainementEntity();
$train->setIdEntrainement($training->getId());
$train->setDate($training->getDate());
$train->setDescription($training->getDescription());
$train->setLatitude($training->getLatitude());
$train->setLongitude($training->getLongitude());
$train->setFeedback($training->getFeedback());
$train->setCoachId(1);
return $train;
}
}

@ -1,64 +0,0 @@
<?php
namespace Database;
use Shared\Log;
class NotificationEntity
{
private $idNotif;
private $message;
private $date;
private $statut;
private $urgence;
private $idAthlete;
public function getIdNotif(): int
{
return $this->idNotif;
}
public function getMessage()
{
return $this->message;
}
public function getDate()
{
return $this->date;
}
public function getStatut()
{
return $this->statut;
}
public function getUrgence()
{
return $this->urgence;
}
public function getIdAthlete()
{
return $this->idAthlete;
}
public function setIdNotif($idNotif)
{
$this->idNotif = $idNotif;
}
public function setMessage($message)
{
$this->message = $message;
}
public function setDate($date)
{
$this->date = $date;
}
public function setStatut($statut)
{
$this->statut = $statut;
}
public function setUrgence($urgence)
{
$this->urgence = $urgence;
}
public function setIdAthlete($idAthlete)
{
$this->idAthlete = $idAthlete;
}
}

@ -1,27 +0,0 @@
<?php
namespace Database;
use Shared\Log;
class NotificationGateway
{
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getNotifications(): array
{
$query = "SELECT * FROM Notification";
$res = $this->connection->executeWithErrorHandling($query);
return $res;
}
public function addNotification(NotificationEntity $notif){
$query = "INSERT INTO Notification (message, date, statut, urgence, athleteid) VALUES (:message, :date, :statut, :urgence, :idAthlete)";
$params = [':message'=>$notif->getMessage(), ':date'=>$notif->getDate(), ':statut'=>$notif->getStatut(), ':urgence'=>$notif->getUrgence(), ':idAthlete'=>$notif->getIdAthlete()];
return $this->connection->executeWithErrorHandling($query, $params);
}
}

@ -1,74 +0,0 @@
<?php
namespace Database;
use DateTime;
use Model\Notification;
use Model\Training;
use Shared\Log;
class NotificationMapper
{
public function notificationSqlToEntity(array $data): array
{
$notificationEntities = [];
foreach ($data as $notificationData) {
$notification = new NotificationEntity();
if (isset($notificationData['idnotif'])) {
$notification->setIdNotif($notificationData['idnotif']);
}
if (isset($notificationData['message'])) {
$notification->setMessage($notificationData['message']);
}
if (isset($notificationData['date'])) {
$notification->setDate($notificationData['date']);
}
if (isset($notificationData['statut'])) {
$notification->setStatut($notificationData['statut']);
}
if (isset($notificationData['urgence'])) {
$notification->setUrgence($notificationData['urgence']);
}
if (isset($notificationData['athleteid'])) {
$notification->setIdAthlete($notificationData['athleteid']);
}
$notificationEntities[] = $notification;
}
return $notificationEntities;
}
public function notificationEntityToModel(NotificationEntity $notificationEntity): Notification
{
$date = new DateTime($notificationEntity->getDate());
return new Notification(
$notificationEntity->getIdNotif(),
$notificationEntity->getMessage(),
$date,
$notificationEntity->getStatut(),
$notificationEntity->getUrgence(),
$notificationEntity->getIdAthlete()
);
}
public function notificationToEntity(Notification $notification): NotificationEntity
{
$notif = new NotificationEntity();
$notif->setIdNotif($notification->getId());
$notif->setMessage($notification->getMessage());
$notif->setDate($notification->getDate()->format('Y-m-d H:i:s'));
$notif->setStatut($notification->getStatut());
$notif->setUrgence($notification->getUrgence());
$notif->setIdAthlete($notification->getToUserId());
return $notif;
}
}

@ -1,97 +0,0 @@
<?php
namespace Database;
class UserGateway
{
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getUsers(): array
{
$query = "SELECT * FROM Athlete";
$res = $this->connection->executeWithErrorHandling($query);
return $res;
}
public function getUserById(int $userId): array
{
$query = "SELECT * FROM Athlete WHERE idAthlete = :id";
$params = [':id' => $userId];
$res = $this->connection->executeWithErrorHandling($query, $params);
return $res;
}
public function getUserByName(string $name): array
{
$query = "SELECT * FROM Athlete WHERE nom = :name";
$params = [':name' => $name];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByFirstName(string $firstName): array
{
$query = "SELECT * FROM Athlete WHERE prenom = :firstName";
$params = [':firstName' => $firstName];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByEmail(string $email): array
{
$query = "SELECT * FROM Athlete WHERE email = :email";
$params = [':email' => $email];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByGender(string $gender): array
{
$query = "SELECT * FROM Athlete WHERE sexe = :gender";
$params = [':gender' => $gender];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByHeight(int $height): array
{
$query = "SELECT * FROM Athlete WHERE taille = :height";
$params = [':height' => [$height, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByWeight(int $weight): array
{
$query = "SELECT * FROM Athlete WHERE poids = :weight";
$params = [':weight' => [$weight, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getUserByBirthDate(string $birthdate): array
{
$query = "SELECT * FROM Athlete WHERE dateNaissance = :birthdate";
$params = [':birthdate' => [$birthdate, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteUserById(int $idAthlete): array
{
$query = "DELETE FROM Athlete WHERE idAthlete = :idAthlete";
$params = [
':idAthlete' => $idAthlete,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function deleteUserByEmail(string $email): array
{
$query = "DELETE FROM Athlete WHERE email = :email";
$params = [
':email' => $email,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
}

@ -1,6 +0,0 @@
INSERT INTO Athlete (username, nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES
('johnD63', 'Doe', 'John', 'john.doe@example.com', 'M', 1.80, 75, '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', '1985-05-15', TRUE),
('janeS03', 'Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', '1990-03-10', FALSE),
('bryanO', 'Martin', 'Paul', 'paul.martin@example.com', 'M', 1.75, 68, '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', '1988-08-20', TRUE),
('dominicT', 'Brown', 'Anna', 'anna.brown@example.com', 'F', 1.70, 58, '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', '1992-11-25', FALSE),
('miaT', 'Lee', 'Bruce', 'bruce.lee@example.com', 'M', 1.72, 70, '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', '1970-02-05', FALSE);

@ -1,22 +0,0 @@
INSERT INTO FrequenceCardiaque
VALUES
(1, 100, '08:15:00', 15, 130, 45.75771709151474, 3.113484980409329, 1),
(2, ROUND(RAND() * 10 + 90), '08:16:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75772709151474, 3.113494980409329, 1),
(3, ROUND(RAND() * 10 + 90), '08:17:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75773709151474, 3.113504980409329, 1),
(4, ROUND(RAND() * 10 + 90), '08:18:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75774709151474, 3.113514980409329, 1),
(5, ROUND(RAND() * 10 + 90), '08:19:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75775709151474, 3.113524980409329, 1),
(6, ROUND(RAND() * 10 + 90), '08:20:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75776709151474, 3.113534980409329, 1),
(7, ROUND(RAND() * 10 + 90), '08:21:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75777709151474, 3.113544980409329, 1),
(8, ROUND(RAND() * 10 + 90), '08:22:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75778709151474, 3.113554980409329, 1),
(9, ROUND(RAND() * 10 + 90), '08:23:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75779709151474, 3.113564980409329, 1),
(10, ROUND(RAND() * 10 + 90), '08:24:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75780709151474, 3.113574980409329, 1),
(11, ROUND(RAND() * 10 + 90), '08:25:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75781709151474, 3.113584980409329, 1),
(12, ROUND(RAND() * 10 + 90), '08:26:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75782709151474, 3.113594980409329, 1),
(13, ROUND(RAND() * 10 + 90), '08:27:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75783709151474, 3.113604980409329, 1),
(14, ROUND(RAND() * 10 + 90), '08:28:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75784709151474, 3.113614980409329, 1),
(15, ROUND(RAND() * 10 + 90), '08:29:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75785709151474, 3.113624980409329, 1),
(16, ROUND(RAND() * 10 + 90), '08:30:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75786709151474, 3.113634980409329, 1),
(17, ROUND(RAND() * 10 + 90), '08:31:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75787709151474, 3.113644980409329, 1),
(18, ROUND(RAND() * 10 + 90), '08:32:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75788709151474, 3.113654980409329, 1),
(19, ROUND(RAND() * 10 + 90), '08:33:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75789709151474, 3.113664980409329, 1),
(20, ROUND(RAND() * 10 + 90), '08:34:00', ROUND(RAND() * 5 + 10), ROUND(RAND() * 20 + 110), 45.75790709151474, 3.113674980409329, 1);

@ -1,26 +0,0 @@
INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
(3, 4, '2023-01-01'),
(3, 5, '2023-01-12');
INSERT INTO Notification (idNotif, message, date, statut, urgence, athleteId) VALUES
(1, 'Training session at 10 AM', '2023-03-10', TRUE, 1, 1),
(2, 'Training session at 3 PM', '2023-05-10', TRUE, 1, 2);
INSERT INTO Statistique (idStatistique, poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
(1, 70, 80, 150, 500, '2023-03-10', 1),
(2, 86, 95, 170, 896, '2023-04-13', 3);
INSERT INTO Entrainement (idEntrainement, date, description, latitude, longitude, feedback, athleteId) VALUES
(1, '2023-03-10', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1),
(2, '2023-04-13', 'Long run in the forest', 44.7128, -70.0060, 'Pretty good effort', 3);
INSERT INTO Participe (athleteId, entrainementId) VALUES
(1, 1),
(3, 2);
INSERT INTO SourceDonnee (idSource, type, modele, precision2, athleteId) VALUES
(1, 'Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
INSERT INTO Activite (idActivite, type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
(1, 'Running', '2023-03-10', '08:00:00', '09:00:00', 3, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1),
(2, 'Running Forest', '2023-04-13', '10:00:00', '12:00:00', 5, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);

@ -1,107 +0,0 @@
DROP TABLE IF EXISTS Athlete, Friendship, Notification, Statistique, Entrainement, Participe, SourceDonnee, Activite, FrequenceCardiaque CASCADE;
CREATE TABLE Athlete (
idAthlete INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255),
nom VARCHAR(255),
prenom VARCHAR(255),
email VARCHAR(255) UNIQUE,
sexe CHAR(1),
taille DECIMAL,
poids DECIMAL,
motDePasse VARCHAR(255),
dateNaissance DATE,
isCoach BOOLEAN
);
CREATE TABLE Friendship (
idAthlete1 INT,
idAthlete2 INT,
debut DATE,
PRIMARY KEY (idAthlete1, idAthlete2),
FOREIGN KEY (idAthlete1) REFERENCES Athlete(idAthlete),
FOREIGN KEY (idAthlete2) REFERENCES Athlete(idAthlete)
);
CREATE TABLE Notification (
idNotif INT AUTO_INCREMENT PRIMARY KEY,
message TEXT,
date DATE,
statut BOOLEAN,
urgence INT,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
);
CREATE TABLE Statistique (
idStatistique INT AUTO_INCREMENT PRIMARY KEY,
poids DECIMAL,
fcMoyenne DECIMAL,
fcMax DECIMAL,
caloriesBruleesMoy DECIMAL,
date DATE,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
);
CREATE TABLE Entrainement (
idEntrainement INT AUTO_INCREMENT PRIMARY KEY,
date DATE,
description TEXT,
latitude DECIMAL,
longitude DECIMAL,
feedback TEXT,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
);
CREATE TABLE Participe (
athleteId INT,
entrainementId INT,
PRIMARY KEY (athleteId, entrainementId),
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete),
FOREIGN KEY (entrainementId) REFERENCES Entrainement(idEntrainement)
);
CREATE TABLE SourceDonnee (
idSource INT AUTO_INCREMENT PRIMARY KEY,
type VARCHAR(255),
modele VARCHAR(255),
precision DECIMAL,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
);
CREATE TABLE Activite (
idActivite INT AUTO_INCREMENT PRIMARY KEY,
type VARCHAR(255),
date DATE,
heureDeDebut TIME,
heureDeFin TIME,
effortRessent DECIMAL,
variabilite DECIMAL,
variance DECIMAL,
ecartType DECIMAL,
moyenne DECIMAL,
maximum DECIMAL,
minimum DECIMAL,
temperatureMoyenne DECIMAL,
athleteId INT,
sourceId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete),
FOREIGN KEY (sourceId) REFERENCES SourceDonnee(idSource)
);
CREATE TABLE FrequenceCardiaque (
idFc INT AUTO_INCREMENT PRIMARY KEY,
altitude DECIMAL,
temps TIME,
temperature DECIMAL,
bpm INT,
longitude DECIMAL,
latitude DECIMAL,
activiteId INT,
FOREIGN KEY (activiteId) REFERENCES Activite(idActivite)
);
-- \i athlete.sql
-- \i friendship.sql

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save