Compare commits
89 Commits
merged_PLE
...
master
@ -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 ]
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
@ -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"]
|
@ -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>
|
Before Width: | Height: | Size: 136 KiB |
Binary file not shown.
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 586 B |
File diff suppressed because it is too large
Load Diff
@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@ -1,716 +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
|
||||
// {
|
||||
// private Environment $twig;
|
||||
// private Preferences $preference;
|
||||
|
||||
// public function __construct()
|
||||
// {
|
||||
// session_start();
|
||||
// $this->preference = new Preferences();
|
||||
// }
|
||||
|
||||
// #[Route(path: '/', name: 'index', 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
|
||||
// {
|
||||
// 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(path: '/analyses', name: 'analyses', methods: ['GET'])]
|
||||
// public function analyses(): 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: '/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: '/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: '/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: '/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 {
|
||||
// //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: '/friend', name: 'friend', methods: ['GET'])]
|
||||
// public function friend(): Response
|
||||
// {
|
||||
// $utiliArray = [
|
||||
// [
|
||||
// 'nom' => 'John',
|
||||
// 'prenom' => 'Doe',
|
||||
// 'img' => 'john_doe',
|
||||
// 'username' => 'johndoe',
|
||||
// ],
|
||||
// [
|
||||
// 'nom' => 'Alice',
|
||||
// 'prenom' => 'Smith',
|
||||
// 'img' => 'alice_smith',
|
||||
// 'username' => 'alicesmith',
|
||||
// ],
|
||||
// ];
|
||||
// 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' => [],
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// #[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: '/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: '/settings', name: 'settings', methods: ['GET'])]
|
||||
// public function settings(IRequest $req): Response
|
||||
// {
|
||||
// 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: '/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);
|
||||
|
||||
// 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: '/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: '/mdp', name: 'mdp', methods: ['POST'])]
|
||||
// public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response
|
||||
// {
|
||||
|
||||
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
|
||||
|
||||
// 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: '/login', name: 'login', methods: ['POST'])]
|
||||
// public function login(string $username,string $mdp, IRequest $req): Response
|
||||
// {
|
||||
|
||||
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
|
||||
|
||||
// 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(path: '/log', name: 'log', methods: ['GET'])]
|
||||
// public function login2(): 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' => []
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// #[Route(path: '/register', name: 'register', methods: ['POST'])]
|
||||
// public function register(string $username,string $mdp,string $confirmMdp,string $nom,string $prenom,string $dateNaissance,string $sexe,string $taille,string $poids, IRequest $req): Response
|
||||
// {
|
||||
|
||||
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
|
||||
|
||||
// return $this->render('./page/home.html.twig',[
|
||||
// 'css' => $this->preference->getCookie()
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// #[Route(path: '/regist', name: 'regist', methods: ['GET'])]
|
||||
// public function register2(): Response
|
||||
// {
|
||||
|
||||
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
|
||||
|
||||
// return $this->render('./page/register.html.twig',[
|
||||
// 'css' => $this->preference->getCookie()
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// #[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' => []
|
||||
// ]);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
@ -1,44 +1,36 @@
|
||||
<?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;
|
||||
|
||||
class HeartRateController extends BaseController
|
||||
{
|
||||
|
||||
private Environment $twig;
|
||||
protected Preferences $preference;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->preference = new Preferences();
|
||||
}
|
||||
|
||||
|
||||
#[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' => []
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 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,67 +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 = [];
|
||||
//log::dd($notificationEntity);
|
||||
|
||||
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(),
|
||||
'athleteId' => $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
|
||||
// {
|
@ -1,71 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<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>
|
||||
<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>
|
||||
</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 © HeartTrack 2023</div>
|
||||
<div>
|
||||
<a href="#">Politique de confidentialité</a>
|
||||
·
|
||||
<a href="#">Termes & 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 © HeartTrack 2023</div>
|
||||
<div>
|
||||
<a href="#">Politique de confidentialité</a>
|
||||
·
|
||||
<a href="#">Termes & 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>
|
||||
|
@ -1,292 +1 @@
|
||||
<!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&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&display=swap" rel="stylesheet" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,400;1,400&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="/log">Se connecter</a></li>
|
||||
<li class="nav-item"><a class="nav-link me-lg-3" href="/regist">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 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">© HeartTrack 2023. Tous droits réservé.</div>
|
||||
<a href="#!">Politique de confidentialité</a>
|
||||
<span class="mx-1">·</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>
|
||||
<a href="/log">Se connecter</button>
|
@ -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,127 +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($activityData['date']);
|
||||
}
|
||||
|
||||
if (isset($activityData['heureDeDebut'])) {
|
||||
$activity->setHeureDebut($activityData['heureDeDebut']);
|
||||
}
|
||||
|
||||
if (isset($activityData['heureDeFin'])) {
|
||||
$activity->setHeureFin($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());
|
||||
$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(Activity $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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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,31 +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);
|
||||
}
|
||||
|
||||
public function getFrequenceCardiaqueByIdActivityAndCurrentAthlete(int $activityId, int $athleteId)
|
||||
{
|
||||
$query = "SELECT * FROM FrequenceCardiaque WHERE activiteId = :id AND athleteId = :athleteId";
|
||||
$params = [':id' => $activityId, ':athleteId' => $athleteId];
|
||||
return $this->connection->executeWithErrorHandling($query, $params);
|
||||
}
|
||||
|
||||
}
|
@ -1,126 +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 analyzeEntityToModel(ActivityEntity $activiteEntity) {
|
||||
$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;
|
||||
// }
|
||||
}
|
@ -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,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database;
|
||||
|
||||
class EnvoiEntity {
|
||||
private $idAthlete;
|
||||
private $idNotif;
|
||||
|
||||
// Getters
|
||||
public function getIdAthlete() :int {
|
||||
return $this->idActivity;
|
||||
}
|
||||
|
||||
public function getIdNotif() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public function setIdAthlete($idAthlete) {
|
||||
$this->idAthlete = $idAthlete;
|
||||
}
|
||||
|
||||
public function setIdNotif($idNotif) {
|
||||
$this->idNotif = $idNotif;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database;
|
||||
|
||||
class EnvoiGateway
|
||||
{
|
||||
private Connexion $connection;
|
||||
|
||||
public function __construct(Connexion $connection) {
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
public function getEnvois(): array
|
||||
{
|
||||
$query = "SELECT * FROM Envoi";
|
||||
$res = $this->connection->executeWithErrorHandling($query);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function addEnvoi(EnvoiEntity $envoi){
|
||||
$query = "INSERT INTO Envoi (idAthlete, idEnvoi) VALUES (:idAthlete, :idEnvoi)";
|
||||
$params = [':idAthlete'=>$envoi->getIdAthlete(), ':date'=>$idNotif->getIdNotif()];
|
||||
return $this->connection->executeWithErrorHandling($query, $params);
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database;
|
||||
|
||||
class EnvoiMapper
|
||||
{
|
||||
public function envoiSqlToEntity(array $data): array
|
||||
{
|
||||
$envoiEntities = [];
|
||||
|
||||
foreach ($data as $envoiData) {
|
||||
$envoi = new EnvoiEntity();
|
||||
|
||||
if (isset($envoiData['idNotif'])) {
|
||||
$envoi->setIdNotif($envoiData['idNotif']);
|
||||
}
|
||||
|
||||
if (isset($envoiData['idAthlete'])) {
|
||||
$envoi->setMessage($envoiData['idAthlete']);
|
||||
}
|
||||
|
||||
$envoiEntities[] = $envoi;
|
||||
}
|
||||
|
||||
return $envoiEntities;
|
||||
}
|
||||
|
||||
public function envoiEntityToModel(EnvoiEntity $envoiEntity): Envoi
|
||||
{
|
||||
$date = new DateTime($envoiEntity->getDate());
|
||||
return new envoi(
|
||||
$envoiEntity->getIdAthlete(),
|
||||
$envoiEntity->getIdNotif(),
|
||||
);
|
||||
}
|
||||
|
||||
public function envoiToEntity(Envoi $envoi): EnvoiEntity
|
||||
{
|
||||
$notif = new envoiEntity();
|
||||
$notif->setIdAthlete($envoi->getIdAthlete());
|
||||
$notif->setIdNotif($envoi->getIdNotif());
|
||||
return $notif;
|
||||
}
|
||||
}
|
@ -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()
|
||||
{
|
||||
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,6 +0,0 @@
|
||||
INSERT INTO Athlete (idAthlete, username, nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES
|
||||
(1, 'johnD63', 'Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01', FALSE),
|
||||
(2, 'janeS03', 'Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02', TRUE),
|
||||
(3, 'bryanO', 'OConner', 'Bryan', 'bryan.oconner@example.com', 'M', 1.88, 86, 'password789', '1973-09-12', FALSE),
|
||||
(4, 'dominicT', 'Toretto', 'Dominic', 'dominic.toretto@example.com', 'M', 1.83, 94, 'password987', '1967-07-18', TRUE),
|
||||
(5, 'miaT', 'Toretto', 'Mia', 'mia.toretto@example.com', 'F', 1.70, 56, 'password654', '1980-04-26', FALSE);
|
@ -1,21 +0,0 @@
|
||||
INSERT INTO FrequenceCardiaque VALUES(1, 100, '08:15:00', 15, 130, 45.75771709151474, 3.113484980409329, 1);
|
||||
INSERT INTO FrequenceCardiaque VALUES
|
||||
(2, ROUND(RANDOM() * 10 + 90), '08:16:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75772709151474, 3.113494980409329, 1),
|
||||
(3, ROUND(RANDOM() * 10 + 90), '08:17:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75773709151474, 3.113504980409329, 1),
|
||||
(4, ROUND(RANDOM() * 10 + 90), '08:18:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75774709151474, 3.113514980409329, 1),
|
||||
(5, ROUND(RANDOM() * 10 + 90), '08:19:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75775709151474, 3.113524980409329, 1),
|
||||
(6, ROUND(RANDOM() * 10 + 90), '08:20:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75776709151474, 3.113534980409329, 1),
|
||||
(7, ROUND(RANDOM() * 10 + 90), '08:21:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75777709151474, 3.113544980409329, 1),
|
||||
(8, ROUND(RANDOM() * 10 + 90), '08:22:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75778709151474, 3.113554980409329, 1),
|
||||
(9, ROUND(RANDOM() * 10 + 90), '08:23:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75779709151474, 3.113564980409329, 1),
|
||||
(10, ROUND(RANDOM() * 10 + 90), '08:24:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75780709151474, 3.113574980409329, 1),
|
||||
(11, ROUND(RANDOM() * 10 + 90), '08:25:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75781709151474, 3.113584980409329, 1),
|
||||
(12, ROUND(RANDOM() * 10 + 90), '08:26:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75782709151474, 3.113594980409329, 1),
|
||||
(13, ROUND(RANDOM() * 10 + 90), '08:27:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75783709151474, 3.113604980409329, 1),
|
||||
(14, ROUND(RANDOM() * 10 + 90), '08:28:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75784709151474, 3.113614980409329, 1),
|
||||
(15, ROUND(RANDOM() * 10 + 90), '08:29:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75785709151474, 3.113624980409329, 1),
|
||||
(16, ROUND(RANDOM() * 10 + 90), '08:30:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75786709151474, 3.113634980409329, 1),
|
||||
(17, ROUND(RANDOM() * 10 + 90), '08:31:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75787709151474, 3.113644980409329, 1),
|
||||
(18, ROUND(RANDOM() * 10 + 90), '08:32:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75788709151474, 3.113654980409329, 1),
|
||||
(19, ROUND(RANDOM() * 10 + 90), '08:33:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75789709151474, 3.113664980409329, 1),
|
||||
(20, ROUND(RANDOM() * 10 + 90), '08:34:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75790709151474, 3.113674980409329, 1);
|
@ -1,29 +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);
|
||||
|
||||
INSERT INTO FrequenceCardiaque (idFc, altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
|
||||
(1, 100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);
|
@ -1,107 +0,0 @@
|
||||
DROP TABLE IF EXISTS Athlete, Friendship, Notification, Statistique, Entrainement, Participe, SourceDonnee, Activite, FrequenceCardiaque CASCADE;
|
||||
|
||||
CREATE TABLE Athlete (
|
||||
idAthlete SERIAL PRIMARY KEY,
|
||||
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 PRIMARY KEY,
|
||||
message TEXT,
|
||||
date DATE,
|
||||
statut BOOLEAN,
|
||||
urgence INT,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
|
||||
);
|
||||
|
||||
CREATE TABLE Statistique (
|
||||
idStatistique INT 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 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 PRIMARY KEY,
|
||||
type VARCHAR(255),
|
||||
modele VARCHAR(255),
|
||||
precision2 DECIMAL,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
|
||||
);
|
||||
|
||||
CREATE TABLE Activite (
|
||||
idActivite INT 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 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
|
@ -0,0 +1,158 @@
|
||||
-- Athlete Table
|
||||
CREATE TABLE Athlete (
|
||||
idAthlete SERIAL PRIMARY KEY,
|
||||
nom VARCHAR(255),
|
||||
prenom VARCHAR(255),
|
||||
email VARCHAR(255) UNIQUE,
|
||||
sexe CHAR(1),
|
||||
taille DECIMAL,
|
||||
poids DECIMAL,
|
||||
motDePasse VARCHAR(255),
|
||||
dateNaissance DATE
|
||||
);
|
||||
|
||||
-- Friendship Table
|
||||
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)
|
||||
);
|
||||
|
||||
-- Notification Table
|
||||
CREATE TABLE Notification (
|
||||
idNotif SERIAL PRIMARY KEY,
|
||||
message TEXT,
|
||||
date DATE,
|
||||
statut BOOLEAN,
|
||||
urgence INT,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
|
||||
);
|
||||
|
||||
-- Coach Table
|
||||
CREATE TABLE Coach (
|
||||
idCoach SERIAL PRIMARY KEY,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
|
||||
);
|
||||
|
||||
-- Statistique Table
|
||||
CREATE TABLE Statistique (
|
||||
idStatistique SERIAL PRIMARY KEY,
|
||||
poids DECIMAL,
|
||||
fcMoyenne DECIMAL,
|
||||
fcMax DECIMAL,
|
||||
caloriesBruleesMoy DECIMAL,
|
||||
date DATE,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
|
||||
);
|
||||
|
||||
-- Entrainement Table
|
||||
CREATE TABLE Entrainement (
|
||||
idEntrainement SERIAL PRIMARY KEY,
|
||||
date DATE,
|
||||
description TEXT,
|
||||
latitude DECIMAL,
|
||||
longitude DECIMAL,
|
||||
feedback TEXT,
|
||||
coachId INT,
|
||||
FOREIGN KEY (coachId) REFERENCES Coach (idCoach)
|
||||
);
|
||||
|
||||
-- Participe Table
|
||||
CREATE TABLE Participe (
|
||||
athleteId INT,
|
||||
entrainementId INT,
|
||||
PRIMARY KEY (athleteId, entrainementId),
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete),
|
||||
FOREIGN KEY (entrainementId) REFERENCES Entrainement (idEntrainement)
|
||||
);
|
||||
|
||||
-- SourceDonnee Table
|
||||
CREATE TABLE SourceDonnee (
|
||||
idSource SERIAL PRIMARY KEY,
|
||||
type VARCHAR(255),
|
||||
modele VARCHAR(255),
|
||||
precision DECIMAL,
|
||||
athleteId INT,
|
||||
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
|
||||
);
|
||||
|
||||
-- Activite Table
|
||||
CREATE TABLE Activite (
|
||||
idActivite SERIAL 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)
|
||||
);
|
||||
|
||||
-- FrequenceCardiaque Table
|
||||
CREATE TABLE FrequenceCardiaque (
|
||||
idFc SERIAL PRIMARY KEY,
|
||||
altitude DECIMAL,
|
||||
temps TIME,
|
||||
temperature DECIMAL,
|
||||
bpm INT,
|
||||
longitude DECIMAL,
|
||||
latitude DECIMAL,
|
||||
activiteId INT,
|
||||
FOREIGN KEY (activiteId) REFERENCES Activite (idActivite)
|
||||
);
|
||||
|
||||
-- Insertion de données dans la table Athlete
|
||||
INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance) VALUES
|
||||
('Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01'),
|
||||
('Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02');
|
||||
|
||||
-- Insertion de données dans la table Friendship
|
||||
INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
|
||||
(1, 2, '2023-01-01');
|
||||
|
||||
-- Insertion de données dans la table Notification
|
||||
INSERT INTO Notification (message, date, statut, urgence, athleteId) VALUES
|
||||
('Training session at 10 AM', '2023-03-10', TRUE, 1, 1);
|
||||
|
||||
-- Insertion de données dans la table Coach
|
||||
INSERT INTO Coach (athleteId) VALUES
|
||||
(1);
|
||||
|
||||
-- Insertion de données dans la table Statistique
|
||||
INSERT INTO Statistique (poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
|
||||
(70, 80, 150, 500, '2023-03-10', 1);
|
||||
|
||||
-- Insertion de données dans la table Entrainement
|
||||
INSERT INTO Entrainement (date, description, latitude, longitude, feedback, coachId) VALUES
|
||||
('2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1);
|
||||
|
||||
-- Insertion de données dans la table Participe
|
||||
INSERT INTO Participe (athleteId, entrainementId) VALUES
|
||||
(1, 1);
|
||||
|
||||
-- Insertion de données dans la table SourceDonnee
|
||||
INSERT INTO SourceDonnee (type, modele, precision, athleteId) VALUES
|
||||
('Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
|
||||
|
||||
-- Insertion de données dans la table Activite
|
||||
INSERT INTO Activite (type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
|
||||
('Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);
|
||||
|
||||
-- Insertion de données dans la table FrequenceCardiaque
|
||||
INSERT INTO FrequenceCardiaque (altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
|
||||
(100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);
|
@ -1,10 +1,9 @@
|
||||
<?php
|
||||
namespace Repository;
|
||||
use Model\User;
|
||||
|
||||
interface IUserRepository extends IGenericRepository {
|
||||
public function addFriend(User $user1,user $user2);
|
||||
public function deleteFriend(User $user1,User $user2);
|
||||
public function addFriend(int $user1,int $user2);
|
||||
public function deleteFriend(int $user1,int $user2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,215 +0,0 @@
|
||||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
//use Database\{Connexion, AthleteGateway,AthleteEntity};
|
||||
use Database\AthleteEntity;
|
||||
use Database\AthleteGateway;
|
||||
use Database\Connexion;
|
||||
use Database\AthleteMapper;
|
||||
use Database\CoachGateway;
|
||||
use Database\CoachEntity;
|
||||
use Database\CoachMapper;
|
||||
|
||||
class GatewayTest extends TestCase {
|
||||
|
||||
//Partie concernant les Athlètes
|
||||
|
||||
public function testGetAthlete() {
|
||||
|
||||
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
|
||||
|
||||
require "loginDatabase.php";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
$result = $athleteGateway->getAthlete();
|
||||
//var_dump($result);
|
||||
}
|
||||
|
||||
/* Fonctionne mais en commentaire pour pas add et del a chaque fois
|
||||
public function testAddAthlete(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
|
||||
$dateSpecifique = "2023-11-26";
|
||||
$timestamp = strtotime($dateSpecifique);
|
||||
$dateSQL = date("Y-m-d", $timestamp);
|
||||
|
||||
$athleteEntity = new AthleteEntity();
|
||||
$athleteEntity->setNom('John');
|
||||
$athleteEntity->setPrenom('Doe');
|
||||
$athleteEntity->setIdAthlete(1234);
|
||||
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
|
||||
$athleteEntity->setSexe('H');
|
||||
$athleteEntity->setTaille(169);
|
||||
$athleteEntity->setPoids(69);
|
||||
$athleteEntity->setMotDePasse('motdepasse');
|
||||
$athleteEntity->setDateNaissance($dateSQL);
|
||||
|
||||
$result2 = $athleteGateway->addAthlete($athleteEntity);
|
||||
}
|
||||
|
||||
|
||||
public function testDeleteAthlete(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
$result = $athleteGateway->deleteAthlete( //idAthlete );
|
||||
var_dump($result);
|
||||
|
||||
}*/
|
||||
|
||||
public function testUpdateAthlete(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
|
||||
$dateSpecifique = "2004-08-26";
|
||||
$timestamp = strtotime($dateSpecifique);
|
||||
$dateSQL = date("Y-m-d", $timestamp);
|
||||
|
||||
$athleteEntity = new AthleteEntity();
|
||||
$athleteEntity->setNom('John');
|
||||
$athleteEntity->setPrenom('Doe');
|
||||
$athleteEntity->setIdAthlete(13);
|
||||
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
|
||||
$athleteEntity->setSexe('H');
|
||||
$athleteEntity->setTaille(169);
|
||||
$athleteEntity->setPoids(69);
|
||||
$athleteEntity->setMotDePasse('motdepasse');
|
||||
$athleteEntity->setDateNaissance($dateSQL);
|
||||
$athleteEntity->setIsCoach(FALSE);
|
||||
$athleteEntity->setCoachId(NULL);
|
||||
|
||||
$athleteEntity2 = new AthleteEntity();
|
||||
$athleteEntity2->setNom('Monteiro');
|
||||
$athleteEntity2->setPrenom('Kevin');
|
||||
$athleteEntity2->setIdAthlete(13);
|
||||
$athleteEntity2->setEmail('kevin.monteiro@gmail.fr');
|
||||
$athleteEntity2->setSexe('H');
|
||||
$athleteEntity2->setTaille(169);
|
||||
$athleteEntity2->setPoids(69);
|
||||
$athleteEntity2->setMotDePasse('motdepasse');
|
||||
$athleteEntity2->setDateNaissance($dateSQL);
|
||||
$athleteEntity2->setIsCoach(TRUE);
|
||||
$athleteEntity2->setCoachId(1);
|
||||
|
||||
$result = $athleteGateway->updateAthlete($athleteEntity, $athleteEntity2);
|
||||
}
|
||||
|
||||
//Partie concernant les Coachs
|
||||
|
||||
public function testGetCoach() {
|
||||
|
||||
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
|
||||
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
|
||||
$coachGateway = new CoachGateway($connexion);
|
||||
$result = $coachGateway->getCoach();
|
||||
var_dump($result);
|
||||
}
|
||||
/*
|
||||
//Fonctionne PAS A PARTIR DE LA
|
||||
public function testAddCoach(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
|
||||
$coachGateway = new CoachGateway($connexion);
|
||||
|
||||
$dateSpecifique = "2023-11-26";
|
||||
$timestamp = strtotime($dateSpecifique);
|
||||
$dateSQL = date("Y-m-d", $timestamp);
|
||||
|
||||
$coachEntity = new CoachEntity();
|
||||
$coachEntity->setNom('John');
|
||||
$coachEntity->setPrenom('Doe');
|
||||
$coachEntity->setIdCoach(1234);
|
||||
$coachEntity->setEmail('kevin.monteiro@gmail.fr');
|
||||
$coachEntity->setSexe('H');
|
||||
$coachEntity->setTaille(169);
|
||||
$coachEntity->setPoids(69);
|
||||
$coachEntity->setMotDePasse('motdepasse');
|
||||
$coachEntity->setDateNaissance($dateSQL);
|
||||
|
||||
$result2 = $coachGateway->addCoach($coachEntity);
|
||||
}
|
||||
|
||||
|
||||
public function testDeleteAthlete(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
$result = $athleteGateway->deleteAthlete( //idAthlete );
|
||||
var_dump($result);
|
||||
|
||||
}*/
|
||||
/*
|
||||
public function testUpdateAthlete(){
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
|
||||
$dateSpecifique = "2004-08-26";
|
||||
$timestamp = strtotime($dateSpecifique);
|
||||
$dateSQL = date("Y-m-d", $timestamp);
|
||||
|
||||
$athleteEntity = new AthleteEntity();
|
||||
$athleteEntity->setNom('John');
|
||||
$athleteEntity->setPrenom('Doe');
|
||||
$athleteEntity->setIdAthlete(13);
|
||||
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
|
||||
$athleteEntity->setSexe('H');
|
||||
$athleteEntity->setTaille(169);
|
||||
$athleteEntity->setPoids(69);
|
||||
$athleteEntity->setMotDePasse('motdepasse');
|
||||
$athleteEntity->setDateNaissance($dateSQL);
|
||||
|
||||
$athleteEntity2 = new AthleteEntity();
|
||||
$athleteEntity2->setNom('Monteiro');
|
||||
$athleteEntity2->setPrenom('Kevin');
|
||||
$athleteEntity2->setIdAthlete(13);
|
||||
$athleteEntity2->setEmail('kevin.monteiro@gmail.fr');
|
||||
$athleteEntity2->setSexe('H');
|
||||
$athleteEntity2->setTaille(169);
|
||||
$athleteEntity2->setPoids(69);
|
||||
$athleteEntity2->setMotDePasse('motdepasse');
|
||||
$athleteEntity2->setDateNaissance($dateSQL);
|
||||
|
||||
$result = $athleteGateway->updateAthlete($athleteEntity, $athleteEntity2);
|
||||
}*/
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use Model\User;
|
||||
use Database\AthleteEntity;
|
||||
use Database\AthleteGateway;
|
||||
use Database\Connexion;
|
||||
use Database\AthleteMapper;
|
||||
|
||||
class MapperTest extends TestCase {
|
||||
|
||||
public function testMapperAthlete() {
|
||||
|
||||
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
|
||||
|
||||
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
|
||||
$username = "kemonteiro2";
|
||||
$password = "#Phpmyadmin63";
|
||||
|
||||
$connexion = new Connexion($dsn,$username,$password);
|
||||
|
||||
|
||||
$athleteGateway = new AthleteGateway($connexion);
|
||||
$result = $athleteGateway->getAthlete();
|
||||
|
||||
$map = new AthleteMapper ();
|
||||
//SQL To AthleteEntity
|
||||
$athleteEntity = $map->athleteSqlToEntity($result);
|
||||
|
||||
|
||||
foreach($athleteEntity as $ath){
|
||||
|
||||
$result = $ath->getNom();
|
||||
var_dump($result);
|
||||
//Pour chaque AthleteEntity : Athlete Entity To User avec Role Athlete(Model)
|
||||
$user = $map->athleteEntityToModel($ath);
|
||||
var_dump($user->getId());
|
||||
//Pour chaque Athlete du Model -> Athlete Entity
|
||||
$res = $map->athleteToEntity($user);
|
||||
var_dump($res->getIdAthlete());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
$dsn = "psql:host=localhost;dbname=sae_3;";
|
||||
$username = "Perederii";
|
||||
$password = "";
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue