Merge dev vers main
Ajout des changements à la branche principale
This commit is contained in:
commit
0aa1ecc9e0
36 changed files with 1468 additions and 106 deletions
|
|
@ -4,3 +4,4 @@ APP_SECRET='$ecretf0rt3st'
|
|||
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||
PANTHER_APP_ENV=panther
|
||||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
||||
DATABASE_URL="mysql://root:@127.0.0.1:3306/mediatekformation_test?serverVersion=8.0"
|
||||
|
|
|
|||
31
.github/workflows/main.yml
vendored
Normal file
31
.github/workflows/main.yml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
name: Generate Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
phpdoc:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
tools: phpdoc # Installe automatiquement phpDocumentor
|
||||
|
||||
- name: Run phpDocumentor
|
||||
run: phpdoc -d ./src -t ./docs/api
|
||||
# -d : dossier source
|
||||
# -t : dossier de destination pour la doc générée
|
||||
|
||||
- name: Upload Documentation
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-doc-api
|
||||
path: ./docs/api # Le dossier où phpDoc a généré l'HTML
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -23,3 +23,5 @@
|
|||
/public/assets/
|
||||
/assets/vendor/
|
||||
###< symfony/asset-mapper ###
|
||||
|
||||
/tests/
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
"doctrine/doctrine-migrations-bundle": "^3.3",
|
||||
"doctrine/orm": "^3.1",
|
||||
"phpdocumentor/reflection-docblock": "^5.4",
|
||||
"phpdocumentor/shim": "*",
|
||||
"phpstan/phpdoc-parser": "^1.29",
|
||||
"symfony/apache-pack": "^1.0",
|
||||
"symfony/asset": "6.4.*",
|
||||
|
|
@ -49,6 +50,7 @@
|
|||
"config": {
|
||||
"allow-plugins": {
|
||||
"php-http/discovery": true,
|
||||
"phpdocumentor/shim": true,
|
||||
"symfony/flex": true,
|
||||
"symfony/runtime": true
|
||||
},
|
||||
|
|
@ -100,7 +102,7 @@
|
|||
"symfony/browser-kit": "6.4.*",
|
||||
"symfony/css-selector": "6.4.*",
|
||||
"symfony/debug-bundle": "6.4.*",
|
||||
"symfony/maker-bundle": "^1.0",
|
||||
"symfony/maker-bundle": "^1.65",
|
||||
"symfony/phpunit-bridge": "^7.0",
|
||||
"symfony/stopwatch": "6.4.*",
|
||||
"symfony/web-profiler-bundle": "6.4.*"
|
||||
|
|
|
|||
310
composer.lock
generated
310
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "449a04e5b2ca2b8ce88b30d4b38fa5c0",
|
||||
"content-hash": "5c2a0f302f462514c4808d0320c81cef",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/semver",
|
||||
|
|
@ -1477,6 +1477,220 @@
|
|||
],
|
||||
"time": "2024-04-12T21:02:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/composer-distributor",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/composer-distributor.git",
|
||||
"reference": "dd7d936290b2a42b0c64bfe08090b5c597c280c9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/composer-distributor/zipball/dd7d936290b2a42b0c64bfe08090b5c597c280c9",
|
||||
"reference": "dd7d936290b2a42b0c64bfe08090b5c597c280c9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.1 || ^2.0",
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"phar-io/filesystem": "^2.0",
|
||||
"phar-io/gnupg": "^1.0",
|
||||
"php": "^7.3 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^2.0",
|
||||
"phpunit/phpunit": "^9.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PharIo\\ComposerDistributor\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Andreas Heigl",
|
||||
"email": "andreas@heigl.org",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Arne Blankerts",
|
||||
"email": "arne@blankerts.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Feldmann",
|
||||
"email": "sf@sebastian-feldmann.info",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Base Code for a composer plugin that installs PHAR-files",
|
||||
"homepage": "https://phar.io",
|
||||
"keywords": [
|
||||
"bin",
|
||||
"binary",
|
||||
"composer",
|
||||
"distribute",
|
||||
"phar",
|
||||
"phive"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/composer-distributor/issues",
|
||||
"source": "https://github.com/phar-io/composer-distributor/tree/1.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://phar.io",
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-31T17:05:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/executor",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/executor.git",
|
||||
"reference": "5bfb7400224a0c1cf83343660af85c7f5a073473"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/executor/zipball/5bfb7400224a0c1cf83343660af85c7f5a073473",
|
||||
"reference": "5bfb7400224a0c1cf83343660af85c7f5a073473",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phar-io/filesystem": "^2.0",
|
||||
"php": "^7.2||^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arne Blankerts",
|
||||
"email": "arne@blankerts.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Heuer",
|
||||
"email": "sebastian@phpeople.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/executor/issues",
|
||||
"source": "https://github.com/phar-io/executor/tree/1.0.1"
|
||||
},
|
||||
"time": "2020-11-30T10:53:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/filesystem",
|
||||
"version": "2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/filesystem.git",
|
||||
"reference": "222e3ea432262a05706b7066697c21257664d9d1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/filesystem/zipball/222e3ea432262a05706b7066697c21257664d9d1",
|
||||
"reference": "222e3ea432262a05706b7066697c21257664d9d1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arne Blankerts",
|
||||
"email": "arne@blankerts.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Heuer",
|
||||
"email": "sebastian@phpeople.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/filesystem/issues",
|
||||
"source": "https://github.com/phar-io/filesystem/tree/2.0.1"
|
||||
},
|
||||
"time": "2020-11-30T10:16:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/gnupg",
|
||||
"version": "1.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/gnupg.git",
|
||||
"reference": "ed8ab1740ac4e9db99500e7252911f2821357093"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/gnupg/zipball/ed8ab1740ac4e9db99500e7252911f2821357093",
|
||||
"reference": "ed8ab1740ac4e9db99500e7252911f2821357093",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phar-io/executor": "^1.0",
|
||||
"phar-io/filesystem": "^2.0",
|
||||
"php": "^7.2||^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arne Blankerts",
|
||||
"email": "arne@blankerts.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Heuer",
|
||||
"email": "sebastian@phpeople.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Thin GnuPG wrapper class around the gnupg binary, mimicking the pecl/gnupg api",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/gnupg/issues",
|
||||
"source": "https://github.com/phar-io/gnupg/tree/1.0.3"
|
||||
},
|
||||
"time": "2024-08-22T20:45:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
"version": "2.2.0",
|
||||
|
|
@ -1594,6 +1808,42 @@
|
|||
},
|
||||
"time": "2024-04-09T21:13:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/shim",
|
||||
"version": "v3.9.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/shim.git",
|
||||
"reference": "f34a43193996194a2b22d243b650f1fbf5746257"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/shim/zipball/f34a43193996194a2b22d243b650f1fbf5746257",
|
||||
"reference": "f34a43193996194a2b22d243b650f1fbf5746257",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^2.0",
|
||||
"phar-io/composer-distributor": "^1.0"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "phpDocumentor\\Plugin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"phpDocumentor\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/phpDocumentor/shim/tree/v3.9.1"
|
||||
},
|
||||
"time": "2025-11-25T21:55:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "1.8.2",
|
||||
|
|
@ -5672,16 +5922,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/security-bundle",
|
||||
"version": "v6.4.7",
|
||||
"version": "v6.4.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/security-bundle.git",
|
||||
"reference": "c9112933215b9b3c48851eb6644263d5c9d93245"
|
||||
"reference": "50007f4f76632741b62fa9604c5f65807f268b72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/security-bundle/zipball/c9112933215b9b3c48851eb6644263d5c9d93245",
|
||||
"reference": "c9112933215b9b3c48851eb6644263d5c9d93245",
|
||||
"url": "https://api.github.com/repos/symfony/security-bundle/zipball/50007f4f76632741b62fa9604c5f65807f268b72",
|
||||
"reference": "50007f4f76632741b62fa9604c5f65807f268b72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -5764,7 +6014,7 @@
|
|||
"description": "Provides a tight integration of the Security component into the Symfony full-stack framework",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/security-bundle/tree/v6.4.7"
|
||||
"source": "https://github.com/symfony/security-bundle/tree/v6.4.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -5780,7 +6030,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-18T09:22:46+00:00"
|
||||
"time": "2024-07-17T10:49:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/security-core",
|
||||
|
|
@ -9473,31 +9723,31 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/maker-bundle",
|
||||
"version": "v1.59.1",
|
||||
"version": "v1.65.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/maker-bundle.git",
|
||||
"reference": "b87b1b25c607a8a50832395bc751c784946a0350"
|
||||
"reference": "eba30452d212769c9a5bcf0716959fd8ba1e54e3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/maker-bundle/zipball/b87b1b25c607a8a50832395bc751c784946a0350",
|
||||
"reference": "b87b1b25c607a8a50832395bc751c784946a0350",
|
||||
"url": "https://api.github.com/repos/symfony/maker-bundle/zipball/eba30452d212769c9a5bcf0716959fd8ba1e54e3",
|
||||
"reference": "eba30452d212769c9a5bcf0716959fd8ba1e54e3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/inflector": "^2.0",
|
||||
"nikic/php-parser": "^4.18|^5.0",
|
||||
"nikic/php-parser": "^5.0",
|
||||
"php": ">=8.1",
|
||||
"symfony/config": "^6.4|^7.0",
|
||||
"symfony/console": "^6.4|^7.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0",
|
||||
"symfony/config": "^6.4|^7.0|^8.0",
|
||||
"symfony/console": "^6.4|^7.0|^8.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
|
||||
"symfony/deprecation-contracts": "^2.2|^3",
|
||||
"symfony/filesystem": "^6.4|^7.0",
|
||||
"symfony/finder": "^6.4|^7.0",
|
||||
"symfony/framework-bundle": "^6.4|^7.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0",
|
||||
"symfony/process": "^6.4|^7.0"
|
||||
"symfony/filesystem": "^6.4|^7.0|^8.0",
|
||||
"symfony/finder": "^6.4|^7.0|^8.0",
|
||||
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0|^8.0",
|
||||
"symfony/process": "^6.4|^7.0|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/doctrine-bundle": "<2.10",
|
||||
|
|
@ -9505,12 +9755,14 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"composer/semver": "^3.0",
|
||||
"doctrine/doctrine-bundle": "^2.5.0",
|
||||
"doctrine/doctrine-bundle": "^2.5.0|^3.0.0",
|
||||
"doctrine/orm": "^2.15|^3",
|
||||
"symfony/http-client": "^6.4|^7.0",
|
||||
"symfony/phpunit-bridge": "^6.4.1|^7.0",
|
||||
"symfony/security-core": "^6.4|^7.0",
|
||||
"symfony/yaml": "^6.4|^7.0",
|
||||
"doctrine/persistence": "^3.1|^4.0",
|
||||
"symfony/http-client": "^6.4|^7.0|^8.0",
|
||||
"symfony/phpunit-bridge": "^6.4.1|^7.0|^8.0",
|
||||
"symfony/security-core": "^6.4|^7.0|^8.0",
|
||||
"symfony/security-http": "^6.4|^7.0|^8.0",
|
||||
"symfony/yaml": "^6.4|^7.0|^8.0",
|
||||
"twig/twig": "^3.0|^4.x-dev"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
|
|
@ -9545,7 +9797,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/symfony/maker-bundle/issues",
|
||||
"source": "https://github.com/symfony/maker-bundle/tree/v1.59.1"
|
||||
"source": "https://github.com/symfony/maker-bundle/tree/v1.65.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -9556,12 +9808,16 @@
|
|||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-05-06T03:59:59+00:00"
|
||||
"time": "2025-12-02T07:14:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/phpunit-bridge",
|
||||
|
|
|
|||
|
|
@ -4,14 +4,23 @@ security:
|
|||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
||||
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
|
||||
providers:
|
||||
users_in_memory: { memory: null }
|
||||
# used to reload user from session & other features (e.g. switch_user)
|
||||
app_user_provider:
|
||||
entity:
|
||||
class: App\Entity\User
|
||||
property: username
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
main:
|
||||
lazy: true
|
||||
provider: users_in_memory
|
||||
provider: app_user_provider
|
||||
custom_authenticator: App\Security\AppCustomAuthenticator
|
||||
logout:
|
||||
path: app_logout
|
||||
# where to redirect after logout
|
||||
# target: app_any_route
|
||||
|
||||
# activate different ways to authenticate
|
||||
# https://symfony.com/doc/current/security.html#the-firewall
|
||||
|
|
@ -22,7 +31,7 @@ security:
|
|||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
access_control:
|
||||
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
||||
# - { path: ^/profile, roles: ROLE_USER }
|
||||
|
||||
when@test:
|
||||
|
|
@ -33,7 +42,7 @@ when@test:
|
|||
# are not important, waste resources and increase test times. The following
|
||||
# reduces the work factor to the lowest possible values.
|
||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
|
||||
algorithm: auto
|
||||
algorithm: bcrypt
|
||||
cost: 4 # Lowest possible value for bcrypt
|
||||
time_cost: 3 # Lowest possible value for argon
|
||||
memory_cost: 10 # Lowest possible value for argon
|
||||
|
|
|
|||
31
migrations/Version20260123101220.php
Normal file
31
migrations/Version20260123101220.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260123101220 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE user');
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
|
||||
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled=1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
|
|
|
|||
|
|
@ -19,23 +19,23 @@ class AccueilController extends AbstractController{
|
|||
private $repository;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param FormationRepository $repository
|
||||
*/
|
||||
public function __construct(FormationRepository $repository) {
|
||||
$this->repository = $repository;
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/', name: 'accueil')]
|
||||
public function index(): Response{
|
||||
$formations = $this->repository->findAllLasted(2);
|
||||
return $this->render("pages/accueil.html.twig", [
|
||||
'formations' => $formations
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/cgu', name: 'cgu')]
|
||||
public function cgu(): Response{
|
||||
return $this->render("pages/cgu.html.twig");
|
||||
return $this->render("pages/cgu.html.twig");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,18 +16,19 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||
class FormationsController extends AbstractController {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var FormationRepository
|
||||
*/
|
||||
private $formationRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var CategorieRepository
|
||||
*/
|
||||
private $categorieRepository;
|
||||
private $formationPage = "/pages/formations.html.twig";
|
||||
|
||||
function __construct(FormationRepository $formationRepository, CategorieRepository $categorieRepository) {
|
||||
public function __construct(FormationRepository $formationRepository, CategorieRepository $categorieRepository) {
|
||||
$this->formationRepository = $formationRepository;
|
||||
$this->categorieRepository= $categorieRepository;
|
||||
}
|
||||
|
|
@ -36,7 +37,7 @@ class FormationsController extends AbstractController {
|
|||
public function index(): Response{
|
||||
$formations = $this->formationRepository->findAll();
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/formations.html.twig", [
|
||||
return $this->render($this->formationPage, [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories
|
||||
]);
|
||||
|
|
@ -46,31 +47,31 @@ class FormationsController extends AbstractController {
|
|||
public function sort($champ, $ordre, $table=""): Response{
|
||||
$formations = $this->formationRepository->findAllOrderBy($champ, $ordre, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/formations.html.twig", [
|
||||
return $this->render($this->formationPage, [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/formations/recherche/{champ}/{table}', name: 'formations.findallcontain')]
|
||||
public function findAllContain($champ, Request $request, $table=""): Response{
|
||||
$valeur = $request->get("recherche");
|
||||
$formations = $this->formationRepository->findByContainValue($champ, $valeur, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/formations.html.twig", [
|
||||
return $this->render($this->formationPage, [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories,
|
||||
'valeur' => $valeur,
|
||||
'table' => $table
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/formations/formation/{id}', name: 'formations.showone')]
|
||||
public function showOne($id): Response{
|
||||
$formation = $this->formationRepository->find($id);
|
||||
return $this->render("pages/formation.html.twig", [
|
||||
'formation' => $formation
|
||||
]);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,24 +17,25 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||
class PlaylistsController extends AbstractController {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var PlaylistRepository
|
||||
*/
|
||||
private $playlistRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var FormationRepository
|
||||
*/
|
||||
private $formationRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var CategorieRepository
|
||||
*/
|
||||
private $categorieRepository;
|
||||
private $categorieRepository;
|
||||
private $playlistPage = "/pages/playlists.html.twig";
|
||||
|
||||
function __construct(PlaylistRepository $playlistRepository,
|
||||
public function __construct(PlaylistRepository $playlistRepository,
|
||||
CategorieRepository $categorieRepository,
|
||||
FormationRepository $formationRespository) {
|
||||
$this->playlistRepository = $playlistRepository;
|
||||
|
|
@ -50,9 +51,16 @@ class PlaylistsController extends AbstractController {
|
|||
public function index(): Response{
|
||||
$playlists = $this->playlistRepository->findAllOrderByName('ASC');
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
|
||||
$nombreFormations = [];
|
||||
foreach ($playlists as $p) {
|
||||
$nombreFormations[$p->getId()] = $this->playlistRepository->countFormationsByPlaylist($p);
|
||||
}
|
||||
|
||||
return $this->render("pages/playlists.html.twig", [
|
||||
'playlists' => $playlists,
|
||||
'categories' => $categories
|
||||
'categories' => $categories,
|
||||
'nombreFormations' => $nombreFormations
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -62,37 +70,57 @@ class PlaylistsController extends AbstractController {
|
|||
case "name":
|
||||
$playlists = $this->playlistRepository->findAllOrderByName($ordre);
|
||||
break;
|
||||
case "nbResult":
|
||||
$playlists = $this->playlistRepository->findAllOrderByResultNb($ordre);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/playlists.html.twig", [
|
||||
|
||||
$nombreFormations = [];
|
||||
foreach ($playlists as $p) {
|
||||
$nombreFormations[$p->getId()] = $this->playlistRepository->countFormationsByPlaylist($p);
|
||||
}
|
||||
|
||||
return $this->render($this->playlistPage, [
|
||||
'playlists' => $playlists,
|
||||
'categories' => $categories
|
||||
'categories' => $categories,
|
||||
'nombreFormations' => $nombreFormations
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/playlists/recherche/{champ}/{table}', name: 'playlists.findallcontain')]
|
||||
public function findAllContain($champ, Request $request, $table=""): Response{
|
||||
$valeur = $request->get("recherche");
|
||||
$playlists = $this->playlistRepository->findByContainValue($champ, $valeur, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/playlists.html.twig", [
|
||||
|
||||
$nombreFormations = [];
|
||||
foreach ($playlists as $p) {
|
||||
$nombreFormations[$p->getId()] = $this->playlistRepository->countFormationsByPlaylist($p);
|
||||
}
|
||||
|
||||
return $this->render($this->playlistPage, [
|
||||
'playlists' => $playlists,
|
||||
'categories' => $categories,
|
||||
'categories' => $categories,
|
||||
'valeur' => $valeur,
|
||||
'table' => $table
|
||||
'table' => $table,
|
||||
'nombreFormations' => $nombreFormations
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/playlists/playlist/{id}', name: 'playlists.showone')]
|
||||
public function showOne($id): Response{
|
||||
$playlist = $this->playlistRepository->find($id);
|
||||
$playlistCategories = $this->categorieRepository->findAllForOnePlaylist($id);
|
||||
$playlistFormations = $this->formationRepository->findAllForOnePlaylist($id);
|
||||
$nbFormations = $this->playlistRepository->countFormationsByPlaylist($playlist);
|
||||
return $this->render("pages/playlist.html.twig", [
|
||||
'playlist' => $playlist,
|
||||
'playlistcategories' => $playlistCategories,
|
||||
'playlistformations' => $playlistFormations
|
||||
]);
|
||||
}
|
||||
|
||||
'playlistformations' => $playlistFormations,
|
||||
'nombreFormations' => $nbFormations
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
32
src/Controller/SecurityController.php
Normal file
32
src/Controller/SecurityController.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
class SecurityController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/login', name: 'app_login')]
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
// if ($this->getUser()) {
|
||||
// return $this->redirectToRoute('target_path');
|
||||
// }
|
||||
|
||||
// get the login error if there is one
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
// last username entered by the user
|
||||
$lastUsername = $authenticationUtils->getLastUsername();
|
||||
|
||||
return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
|
||||
}
|
||||
|
||||
#[Route(path: '/logout', name: 'app_logout')]
|
||||
public function logout(): void
|
||||
{
|
||||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||
}
|
||||
}
|
||||
67
src/Controller/admin/AdminCategoriesController.php
Normal file
67
src/Controller/admin/AdminCategoriesController.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
namespace App\Controller\admin;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use App\Repository\CategorieRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdminCategoriesController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var CategorieRepository
|
||||
*/
|
||||
private $categorieRepository;
|
||||
|
||||
public function __construct(CategorieRepository $categorieRepository)
|
||||
{
|
||||
$this->categorieRepository = $categorieRepository;
|
||||
}
|
||||
|
||||
#[Route('/admin/categories', name:'admin.categories')]
|
||||
public function index(){
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
$count = [];
|
||||
foreach ($categories as $categorie) {
|
||||
$count[$categorie->getId()] = $this->categorieRepository->countFormationsByCategorie($categorie);
|
||||
}
|
||||
|
||||
return $this->render('pages/admin/admin.categories.html.twig', [
|
||||
'categories'=> $categories,
|
||||
'usageCounts' => $count,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/categories/remove/{id}', name:'admin.categories.remove')]
|
||||
public function remove(int $id){
|
||||
$categorie = $this->categorieRepository->find($id);
|
||||
$count = $this->categorieRepository->countFormationsByCategorie($categorie);
|
||||
|
||||
if($count == 0){
|
||||
$this->categorieRepository->remove($categorie);
|
||||
return $this->redirectToRoute('admin.categories');
|
||||
}
|
||||
return $this->redirectToRoute('admin.categories');
|
||||
}
|
||||
|
||||
#[Route('admin/categories/add', name:'admin.categories.add')]
|
||||
public function add(Request $request){
|
||||
$name = $request->request->get('name');
|
||||
$token = $request->request->get('_token');
|
||||
|
||||
if (!$this->isCsrfTokenValid('filtre_title', $token)) {
|
||||
throw $this->createAccessDeniedException('Token CSRF invalide.');
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
$category = new Categorie();
|
||||
$category->setName($name);
|
||||
|
||||
$this->categorieRepository->add($category);
|
||||
|
||||
$this->addFlash('success', 'Catégorie ajoutée !');
|
||||
}
|
||||
return $this->redirectToRoute('admin.categories');
|
||||
}
|
||||
}
|
||||
105
src/Controller/admin/AdminFormationsController.php
Normal file
105
src/Controller/admin/AdminFormationsController.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
namespace App\Controller\admin;
|
||||
|
||||
use App\Entity\Formation;
|
||||
use App\Form\FormationType;
|
||||
use App\Repository\CategorieRepository;
|
||||
use App\Repository\FormationRepository;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdminFormationsController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var FormationRepository
|
||||
*/
|
||||
private $formationRepository;
|
||||
private $categorieRepository;
|
||||
|
||||
private $adminPage = "pages/admin/admin.formations.html.twig";
|
||||
|
||||
public function __construct(FormationRepository $formationRepository, CategorieRepository $categorieRepository)
|
||||
{
|
||||
$this->formationRepository = $formationRepository;
|
||||
$this->categorieRepository = $categorieRepository;
|
||||
}
|
||||
|
||||
#[Route('/admin', name: 'admin.formations')]
|
||||
public function index() : Response
|
||||
{
|
||||
$formations = $this->formationRepository->findAllOrderBy('publishedAt', 'DESC');
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render("pages/admin/admin.formations.html.twig", [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/formations/tri/{champ}/{ordre}/{table}', name: 'admin.formations.sort')]
|
||||
public function sort($champ, $ordre, $table=""): Response{
|
||||
$formations = $this->formationRepository->findAllOrderBy($champ, $ordre, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render($this->adminPage, [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/recherche/{champ}/{table}', name: 'admin.formations.findallcontain')]
|
||||
public function findAllContain($champ, Request $request, $table=""): Response{
|
||||
$valeur = $request->get("recherche");
|
||||
$formations = $this->formationRepository->findByContainValue($champ, $valeur, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
return $this->render($this->adminPage, [
|
||||
'formations' => $formations,
|
||||
'categories' => $categories,
|
||||
'valeur' => $valeur,
|
||||
'table' => $table
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/creerFormation', name: 'admin.creerFormation')]
|
||||
public function afficherCreerFormation(Request $request) : Response{
|
||||
$formation = new Formation();
|
||||
$formCreateFormation = $this->createForm(FormationType::class, $formation);
|
||||
$formCreateFormation->handleRequest($request);
|
||||
|
||||
if($formCreateFormation->isSubmitted() && $formCreateFormation->isValid()){
|
||||
$this->formationRepository->add($formation);
|
||||
$this->addFlash('success', 'La formation a bien été créée !');
|
||||
return $this->redirectToRoute('admin.formations');
|
||||
}
|
||||
|
||||
return $this->render('pages/admin/admin.addFormation.html.twig', [
|
||||
'formCreateFormation'=> $formCreateFormation->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('admin/formations/modifier/{id}', name: 'admin.formations.modifier')]
|
||||
public function modifier(Request $request, int $id){
|
||||
$formation = $this->formationRepository->find($id);
|
||||
|
||||
$formModifierFormation = $this->createForm(FormationType::class, $formation);
|
||||
$formModifierFormation->handleRequest($request);
|
||||
|
||||
if($formModifierFormation->isSubmitted() && $formModifierFormation->isValid()){
|
||||
$this->formationRepository->add($formation);
|
||||
$this->addFlash('success', 'La formation a bien été créée !');
|
||||
return $this->redirectToRoute('admin.formations');
|
||||
}
|
||||
|
||||
return $this->render('pages/admin/admin.addFormation.html.twig', [
|
||||
'formCreateFormation'=> $formModifierFormation->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/remove/{id}', name: 'admin.formations.remove')]
|
||||
public function remove(int $id)
|
||||
{
|
||||
$formation = $this->formationRepository->find($id);
|
||||
$this->formationRepository->remove($formation);
|
||||
return $this->redirectToRoute('admin.formations');
|
||||
}
|
||||
}
|
||||
120
src/Controller/admin/AdminPlaylistsController.php
Normal file
120
src/Controller/admin/AdminPlaylistsController.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
namespace App\Controller\admin;
|
||||
|
||||
use App\Entity\Playlist;
|
||||
use App\Form\PlaylistType;
|
||||
use App\Repository\CategorieRepository;
|
||||
use App\Repository\FormationRepository;
|
||||
use App\Repository\PlaylistRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AdminPlaylistsController extends AbstractController
|
||||
{
|
||||
private $playlistPage = "pages/admin/admin.playlists.html.twig";
|
||||
|
||||
/**
|
||||
* @var PlaylistRepository
|
||||
*/
|
||||
private $playlistRepository;
|
||||
private $formationRepository;
|
||||
private $categorieRepository;
|
||||
|
||||
public function __construct(PlaylistRepository $playlistRepository, FormationRepository $formationRepository, CategorieRepository $categorieRepository)
|
||||
{
|
||||
$this->playlistRepository = $playlistRepository;
|
||||
$this->formationRepository = $formationRepository;
|
||||
$this->categorieRepository = $categorieRepository;
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists', name: 'admin.playlists')]
|
||||
public function index() : Response
|
||||
{
|
||||
$playlists = $this->playlistRepository->findAllOrderByName('ASC');
|
||||
return $this->render($this->playlistPage, [
|
||||
"playlists" => $playlists,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists/delete/{id}', name:'admin.playlists.remove')]
|
||||
public function remove($id){
|
||||
$playlist = $this->playlistRepository->find($id);
|
||||
if($this->playlistRepository->countFormationsByPlaylist($playlist) > 0){
|
||||
return $this->redirectToRoute('admin.playlists');
|
||||
}
|
||||
|
||||
$this->playlistRepository->remove($playlist);
|
||||
return $this->redirectToRoute('admin.playlists');
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists/modifier/{id}', name:'admin.playlists.modifier')]
|
||||
public function modifier(Request $request, int $id){
|
||||
$playlist = $this->playlistRepository->find($id);
|
||||
$formModifierPlaylist = $this->createForm(PlaylistType::class, $playlist);
|
||||
$formModifierPlaylist->handleRequest($request);
|
||||
|
||||
$formations = $this->formationRepository->findAllForOnePlaylist($id);
|
||||
|
||||
if($formModifierPlaylist->isSubmitted() && $formModifierPlaylist->isValid()){
|
||||
$this->playlistRepository->add($playlist);
|
||||
$this->addFlash('success', 'La playlist a bien été modifiée !');
|
||||
return $this->redirectToRoute('admin.playlists');
|
||||
}
|
||||
|
||||
return $this->render('pages/admin/admin.addPlaylist.html.twig', [
|
||||
'formModifierPlaylist'=> $formModifierPlaylist->createView(),
|
||||
'formations'=> $formations,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists/create', name:'admin.playlists.create')]
|
||||
public function create(Request $request){
|
||||
$playlist = new Playlist;
|
||||
$formCreerPlaylist = $this->createForm(PlaylistType::class, $playlist);
|
||||
$formCreerPlaylist->handleRequest($request);
|
||||
|
||||
$formations = [];
|
||||
|
||||
if($formCreerPlaylist->isSubmitted() && $formCreerPlaylist->isValid()){
|
||||
$this->playlistRepository->add($playlist);
|
||||
$this->addFlash('success', 'La playlist a bien été créée !');
|
||||
return $this->redirectToRoute('admin.playlists');
|
||||
}
|
||||
|
||||
return $this->render('pages/admin/admin.addPlaylist.html.twig', [
|
||||
'formModifierPlaylist'=> $formCreerPlaylist->createView(),
|
||||
'formations'=> $formations,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists/sort/{champ}/{ordre}', name:'admin.playlists.sort')]
|
||||
public function sort(string $champ, string $ordre){
|
||||
//
|
||||
$playlists = $this->playlistRepository->findAllOrderByName($ordre);
|
||||
return $this->render($this->playlistPage, [
|
||||
"playlists" => $playlists,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/playlists/recherche/{champ}/{table}', name: 'adminplaylists.findallcontain')]
|
||||
public function findAllContain($champ, Request $request, $table=""): Response{
|
||||
$valeur = $request->get("recherche");
|
||||
$playlists = $this->playlistRepository->findByContainValue($champ, $valeur, $table);
|
||||
$categories = $this->categorieRepository->findAll();
|
||||
|
||||
$nombreFormations = [];
|
||||
foreach ($playlists as $p) {
|
||||
$nombreFormations[$p->getId()] = $this->playlistRepository->countFormationsByPlaylist($p);
|
||||
}
|
||||
|
||||
return $this->render($this->playlistPage, [
|
||||
'playlists' => $playlists,
|
||||
'categories' => $categories,
|
||||
'valeur' => $valeur,
|
||||
'table' => $table,
|
||||
'nombreFormations' => $nombreFormations
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FormationRepository::class)]
|
||||
class Formation
|
||||
|
|
@ -15,7 +16,7 @@ class Formation
|
|||
/**
|
||||
* Début de chemin vers les images
|
||||
*/
|
||||
private const cheminImage = "https://i.ytimg.com/vi/";
|
||||
private const CHEMINIMAGE = "https://i.ytimg.com/vi/";
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
|
|
@ -23,6 +24,7 @@ class Formation
|
|||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
#[Assert\LessThanOrEqual('now', message:"La date ne peut pas être postétrieure à aujourd'hui.")]
|
||||
private ?\DateTimeInterface $publishedAt = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true)]
|
||||
|
|
@ -69,8 +71,8 @@ class Formation
|
|||
if($this->publishedAt == null){
|
||||
return "";
|
||||
}
|
||||
return $this->publishedAt->format('d/m/Y');
|
||||
}
|
||||
return $this->publishedAt->format('d/m/Y');
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
|
|
@ -110,12 +112,12 @@ class Formation
|
|||
|
||||
public function getMiniature(): ?string
|
||||
{
|
||||
return self::cheminImage.$this->videoId."/default.jpg";
|
||||
return self::CHEMINIMAGE.$this->videoId."/default.jpg";
|
||||
}
|
||||
|
||||
public function getPicture(): ?string
|
||||
{
|
||||
return self::cheminImage.$this->videoId."/hqdefault.jpg";
|
||||
return self::CHEMINIMAGE.$this->videoId."/hqdefault.jpg";
|
||||
}
|
||||
|
||||
public function getPlaylist(): ?playlist
|
||||
|
|
|
|||
|
|
@ -107,5 +107,13 @@ class Playlist
|
|||
}
|
||||
return $categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountFormation() : int
|
||||
{
|
||||
return $this->formations->count();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
103
src/Entity/User.php
Normal file
103
src/Entity/User.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
private ?string $username = null;
|
||||
|
||||
/**
|
||||
* @var list<string> The user roles
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private array $roles = [];
|
||||
|
||||
/**
|
||||
* @var string The hashed password
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $password = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function setUsername(string $username): static
|
||||
{
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A visual identifier that represents this user.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return (string) $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
$roles = $this->roles;
|
||||
// guarantee every user at least has ROLE_USER
|
||||
$roles[] = 'ROLE_USER';
|
||||
|
||||
return array_unique($roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $roles
|
||||
*/
|
||||
public function setRoles(array $roles): static
|
||||
{
|
||||
$this->roles = $roles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordAuthenticatedUserInterface
|
||||
*/
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): static
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[\Deprecated]
|
||||
public function eraseCredentials(): void
|
||||
{
|
||||
// @deprecated, to be removed when upgrading to Symfony 8
|
||||
}
|
||||
}
|
||||
55
src/Form/FormationType.php
Normal file
55
src/Form/FormationType.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use App\Entity\Formation;
|
||||
use App\Entity\Playlist;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
class FormationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('publishedAt', null, [
|
||||
'widget' => 'single_text',
|
||||
'required' => 'true'
|
||||
])
|
||||
->add('title', null, [
|
||||
'required' => 'true'
|
||||
])
|
||||
->add('description', null, [
|
||||
'required' => 'false'
|
||||
])
|
||||
->add('videoId', null, [
|
||||
'required' => 'true'
|
||||
])
|
||||
->add('playlist', EntityType::class, [
|
||||
'class' => Playlist::class,
|
||||
'choice_label' => 'name',
|
||||
'required' => 'true'
|
||||
])
|
||||
->add('categories', EntityType::class, [
|
||||
'class' => Categorie::class,
|
||||
'choice_label' => 'name',
|
||||
'multiple' => true,
|
||||
'required' => false,
|
||||
])
|
||||
->add('submit', SubmitType::class, [
|
||||
'label' => 'Enregistrer'
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Formation::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
32
src/Form/PlaylistType.php
Normal file
32
src/Form/PlaylistType.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Playlist;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PlaylistType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name', null, [
|
||||
'required' => true
|
||||
])
|
||||
->add('description')
|
||||
->add('submit', SubmitType::class, [
|
||||
'label' => 'Enregistrer'
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Playlist::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,9 +39,25 @@ class CategorieRepository extends ServiceEntityRepository
|
|||
->join('f.playlist', 'p')
|
||||
->where('p.id=:id')
|
||||
->setParameter('id', $idPlaylist)
|
||||
->orderBy('c.name', 'ASC')
|
||||
->orderBy('c.name', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compte le nombre de formations pour une catégorie donnée
|
||||
* @param Categorie $categorie
|
||||
* @return int
|
||||
*/
|
||||
public function countFormationsByCategorie(Categorie $categorie): int
|
||||
{
|
||||
return (int) $this->createQueryBuilder('c')
|
||||
->select('COUNT(f.id)')
|
||||
->join('c.formations', 'f')
|
||||
->where('c.id = :id')
|
||||
->setParameter('id', $categorie->getId())
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ class FormationRepository extends ServiceEntityRepository
|
|||
/**
|
||||
* Retourne toutes les formations triées sur un champ
|
||||
* @param type $champ
|
||||
* @param type $ordre
|
||||
* @param string $ordre
|
||||
* @param type $table si $champ dans une autre table
|
||||
* @return Formation[]
|
||||
*/
|
||||
public function findAllOrderBy($champ, $ordre, $table=""): array{
|
||||
public function findAllOrderBy($champ, string $ordre, $table=""): array{
|
||||
if($table==""){
|
||||
return $this->createQueryBuilder('f')
|
||||
->orderBy('f.'.$champ, $ordre)
|
||||
|
|
@ -46,7 +46,7 @@ class FormationRepository extends ServiceEntityRepository
|
|||
->join('f.'.$table, 't')
|
||||
->orderBy('t.'.$champ, $ordre)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,30 +68,30 @@ class FormationRepository extends ServiceEntityRepository
|
|||
->orderBy('f.publishedAt', 'DESC')
|
||||
->setParameter('valeur', '%'.$valeur.'%')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
->getResult();
|
||||
}else{
|
||||
return $this->createQueryBuilder('f')
|
||||
->join('f.'.$table, 't')
|
||||
->join('f.'.$table, 't')
|
||||
->where('t.'.$champ.' LIKE :valeur')
|
||||
->orderBy('f.publishedAt', 'DESC')
|
||||
->setParameter('valeur', '%'.$valeur.'%')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les n formations les plus récentes
|
||||
* @param type $nb
|
||||
* @param int $nb
|
||||
* @return Formation[]
|
||||
*/
|
||||
public function findAllLasted($nb) : array {
|
||||
public function findAllLasted(int $nb) : array {
|
||||
return $this->createQueryBuilder('f')
|
||||
->orderBy('f.publishedAt', 'DESC')
|
||||
->setMaxResults($nb)
|
||||
->setMaxResults($nb)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la liste des formations d'une playlist
|
||||
|
|
@ -103,9 +103,9 @@ class FormationRepository extends ServiceEntityRepository
|
|||
->join('f.playlist', 'p')
|
||||
->where('p.id=:id')
|
||||
->setParameter('id', $idPlaylist)
|
||||
->orderBy('f.publishedAt', 'ASC')
|
||||
->orderBy('f.publishedAt', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
->getResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ class PlaylistRepository extends ServiceEntityRepository
|
|||
|
||||
/**
|
||||
* Retourne toutes les playlists triées sur le nom de la playlist
|
||||
* @param type $champ
|
||||
* @param type $ordre
|
||||
* @param string $ordre
|
||||
* @return Playlist[]
|
||||
*/
|
||||
public function findAllOrderByName($ordre): array{
|
||||
|
|
@ -40,22 +39,22 @@ class PlaylistRepository extends ServiceEntityRepository
|
|||
->groupBy('p.id')
|
||||
->orderBy('p.name', $ordre)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistrements dont un champ contient une valeur
|
||||
* ou tous les enregistrements si la valeur est vide
|
||||
* @param type $champ
|
||||
* @param type $valeur
|
||||
* @param type $table si $champ dans une autre table
|
||||
* @param string $champ
|
||||
* @param string $valeur
|
||||
* @param string $table si $champ dans une autre table
|
||||
* @return Playlist[]
|
||||
*/
|
||||
public function findByContainValue($champ, $valeur, $table=""): array{
|
||||
if($valeur==""){
|
||||
return $this->findAllOrderByName('ASC');
|
||||
}
|
||||
if($table==""){
|
||||
}
|
||||
if($table==""){
|
||||
return $this->createQueryBuilder('p')
|
||||
->leftjoin('p.formations', 'f')
|
||||
->where('p.'.$champ.' LIKE :valeur')
|
||||
|
|
@ -63,8 +62,8 @@ class PlaylistRepository extends ServiceEntityRepository
|
|||
->groupBy('p.id')
|
||||
->orderBy('p.name', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}else{
|
||||
->getResult();
|
||||
}else{
|
||||
return $this->createQueryBuilder('p')
|
||||
->leftjoin('p.formations', 'f')
|
||||
->leftjoin('f.categories', 'c')
|
||||
|
|
@ -73,8 +72,40 @@ class PlaylistRepository extends ServiceEntityRepository
|
|||
->groupBy('p.id')
|
||||
->orderBy('p.name', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne toutes les playlists triées sur le nombre de résultats par playlist
|
||||
* @param string $ordre
|
||||
* @return Playlist[]
|
||||
*/
|
||||
public function findAllOrderByResultNb($ordre){
|
||||
return $this->createQueryBuilder('p')
|
||||
->select('p', 'COUNT(f.id) AS HIDDEN nbrFormations')
|
||||
->leftJoin('p.formations', 'f')
|
||||
->groupBy('p.id')
|
||||
->orderBy('nbrFormations', $ordre)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de formations pour une playlist donnée
|
||||
* @param Playlist $playlist
|
||||
* @return int
|
||||
*/
|
||||
public function countFormationsByPlaylist(Playlist $playlist): int
|
||||
{
|
||||
$nb = $this->createQueryBuilder('p')
|
||||
->select('COUNT(f.id)')
|
||||
->leftJoin('p.formations', 'f')
|
||||
->where('p = :playlist')
|
||||
->setParameter('playlist', $playlist)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
|
||||
return (int) $nb;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
60
src/Repository/UserRepository.php
Normal file
60
src/Repository/UserRepository.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<User>
|
||||
*/
|
||||
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to upgrade (rehash) the user's password automatically over time.
|
||||
*/
|
||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
$this->getEntityManager()->persist($user);
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return User[] Returns an array of User objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('u.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?User
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
54
src/Security/AppCustomAuthenticator.php
Normal file
54
src/Security/AppCustomAuthenticator.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||
use Symfony\Component\Security\Http\SecurityRequestAttributes;
|
||||
use Symfony\Component\Security\Http\Util\TargetPathTrait;
|
||||
|
||||
class AppCustomAuthenticator extends AbstractLoginFormAuthenticator
|
||||
{
|
||||
use TargetPathTrait;
|
||||
|
||||
public const LOGIN_ROUTE = 'app_login';
|
||||
|
||||
public function __construct(private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
$username = $request->getPayload()->getString('username');
|
||||
|
||||
$request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $username);
|
||||
|
||||
return new Passport(
|
||||
new UserBadge($username),
|
||||
new PasswordCredentials($request->getPayload()->getString('password')),
|
||||
[
|
||||
new CsrfTokenBadge('authenticate', $request->getPayload()->getString('_csrf_token')), ]
|
||||
);
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
|
||||
return new RedirectResponse($targetPath);
|
||||
}
|
||||
return new RedirectResponse($this->urlGenerator->generate('app_home'));
|
||||
}
|
||||
|
||||
protected function getLoginUrl(Request $request): string
|
||||
{
|
||||
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
|
||||
}
|
||||
}
|
||||
43
templates/baseadmin.html.twig
Normal file
43
templates/baseadmin.html.twig
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block title %}{% endblock %}
|
||||
{% block stylesheets %}{% endblock %}
|
||||
{% block top %}
|
||||
<div class="container">
|
||||
<!-- titre -->
|
||||
<div class="text-left">
|
||||
<img src="{{ app.request.getBasePath()~'/banniere.jpg' }}" alt="Bannière Mediatek Formation">
|
||||
</div>
|
||||
<!-- menu -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('admin.formations') }}">Formations</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('admin.playlists') }}">Playlists</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('admin.categories') }}">Catégories</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block body %}{% endblock %}
|
||||
{% block footer %}
|
||||
<div class="container text-center">
|
||||
<footer>
|
||||
<hr>
|
||||
<a href="{{ path('app_logout') }}">Se déconnecter</a>
|
||||
<hr>
|
||||
<p><small><i>
|
||||
Consultez nos <a class="link-secondary" href="{{ path('cgu') }}">Conditions Générales d'Utilisation</a>
|
||||
</i></small></p>
|
||||
|
||||
</footer>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block javascripts %}{% endblock %}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<div class="container">
|
||||
<!-- titre -->
|
||||
<div class="text-left">
|
||||
<img src="{{ app.request.getBasePath()~'/banniere.jpg' }}" >
|
||||
<img src="{{ app.request.getBasePath()~'/banniere.jpg' }}" alt="Bannière Mediatek Formation">
|
||||
</div>
|
||||
<!-- menu -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
|
|
|
|||
25
templates/pages/admin/admin.addFormation.html.twig
Normal file
25
templates/pages/admin/admin.addFormation.html.twig
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% extends "baseadmin.html.twig" %}
|
||||
{% block body %}
|
||||
{{ form_start(formCreateFormation) }}
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.title) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.description) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.playlist) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.categories) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.videoId) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formCreateFormation.publishedAt) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(formCreateFormation) }}
|
||||
{% endblock %}
|
||||
22
templates/pages/admin/admin.addPlaylist.html.twig
Normal file
22
templates/pages/admin/admin.addPlaylist.html.twig
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{% extends "baseadmin.html.twig" %}
|
||||
{% block body %}
|
||||
{{ form_start(formModifierPlaylist) }}
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
{{ form_row(formModifierPlaylist.name) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ form_row(formModifierPlaylist.description) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(formModifierPlaylist) }}
|
||||
{% if formations %}
|
||||
<br>
|
||||
<h3>Liste des formations dans la playlist :</h3>
|
||||
<ul>
|
||||
{% for formation in formations %}
|
||||
<li>{{ formation.title }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
43
templates/pages/admin/admin.categories.html.twig
Normal file
43
templates/pages/admin/admin.categories.html.twig
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{% extends "baseadmin.html.twig" %}
|
||||
{% block body %}
|
||||
<h3>Liste des catégories présentes</h3>
|
||||
<table class="table table-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Nom
|
||||
</th>
|
||||
<th>
|
||||
Nombre d'utilisation
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for categorie in categories %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ categorie.name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ usageCounts[categorie.id] | default(0) }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ path('admin.categories.remove', {'id': categorie.id}) }}" class="btn btn-danger" onclick="return confirm('Êtes vous sûr de vouloir supprimer {{ categorie.name }} ?')">Supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<h3>Ajouter une formation</h3>
|
||||
<form class="form-inline mt-1" method="POST" action="{{ path('admin.categories.add') }}">
|
||||
<div class="form-group mr-1 mb-2">
|
||||
<input type="text" name="name" id="name">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('filtre_title') }}">
|
||||
<button type="submit" class="btn btn-info mb-2 btn-sm">Ajouter</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
85
templates/pages/admin/admin.formations.html.twig
Normal file
85
templates/pages/admin/admin.formations.html.twig
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{% extends "baseadmin.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<table class="table table-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Nom
|
||||
<a href="{{ path('admin.formations.sort', {champ:'title', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
|
||||
<a href="{{ path('admin.formations.sort', {champ:'title', ordre:'DESC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
|
||||
<form class="form-inline mt-1" method="POST" action="{{ path('admin.formations.findallcontain', {champ:'title'}) }}">
|
||||
<div class="form-group mr-1 mb-2">
|
||||
<input type="text" class="sm" name="recherche"
|
||||
value="{% if valeur|default and not table|default %}{{ valeur }}{% endif %}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('filtre_title') }}">
|
||||
<button type="submit" class="btn btn-info mb-2 btn-sm">filtrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</th>
|
||||
<th>
|
||||
Playlist
|
||||
<a href="{{ path('admin.formations.sort', {table:'playlist', champ:'name', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
|
||||
<a href="{{ path('admin.formations.sort', {table:'playlist', champ:'name', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
|
||||
<form class="form-inline mt-1" method="POST" action="{{ path('admin.formations.findallcontain', {champ:'name', table:'playlist'}) }}">
|
||||
<div class="form-group mr-1 mb-2">
|
||||
<input type="text" class="sm" name="recherche"
|
||||
value="{% if valeur|default and table|default and table=='playlist' %}{{ valeur }}{% endif %}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('filtre_name') }}">
|
||||
<button type="submit" class="btn btn-info mb-2 btn-sm">filtrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</th>
|
||||
<th>
|
||||
Catégories
|
||||
<form class="form-inline mt-1" method="POST" action="{{ path('admin.formations.findallcontain', {champ:'id', table:'categories'}) }}">
|
||||
<select class="form-select form-select-sm" name="recherche" id="recherche" onchange="this.form.submit()">
|
||||
<option value=""></option>
|
||||
{% for categorie in categories %}
|
||||
<option
|
||||
{% if valeur|default and valeur==categorie.id %}
|
||||
selected
|
||||
{% endif %}
|
||||
value="{{ categorie.id }}">{{ categorie.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
</th>
|
||||
<th>
|
||||
Date
|
||||
<a href="{{ path('admin.formations.sort', {champ:'publishedAt', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
|
||||
<a href="{{ path('admin.formations.sort', {champ:'publishedAt', ordre:'DESC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formation in formations %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ formation.title }}
|
||||
</td>
|
||||
<td>
|
||||
{{ formation.playlist.name }}
|
||||
</td>
|
||||
<td>
|
||||
{% for categorie in formation.categories %}
|
||||
{{ categorie.name }}<br />
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
{{ formation.publishedatstring }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ path('admin.formations.remove', {'id': formation.id}) }}" class="btn btn-danger" onclick="return confirm('Êtes vous sûr de vouloir supprimer {{ formation.title }} ?')">Supprimer</a>
|
||||
<a href="{{ path('admin.formations.modifier', {'id': formation.id}) }}" class="btn btn-danger">Modifier</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ path('admin.creerFormation')}}" class="btn btn-primary">Ajouter une formation</a>
|
||||
{% endblock %}
|
||||
63
templates/pages/admin/admin.playlists.html.twig
Normal file
63
templates/pages/admin/admin.playlists.html.twig
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{% extends 'baseadmin.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<table class="table table-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Nom
|
||||
<a href="{{ path('admin.playlists.sort', {champ:'name', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
|
||||
<a href="{{ path('admin.playlists.sort', {champ:'name', ordre:'DESC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
|
||||
<form class="form-inline mt-1" method="POST" action="{{ path('adminplaylists.findallcontain', {champ:'name'}) }}">
|
||||
<div class="form-group mr-1 mb-2">
|
||||
<input type="text" class="sm" name="recherche"
|
||||
value="{% if valeur|default and not table|default %}{{ valeur }}{% endif %}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('filtre_name') }}">
|
||||
<button type="submit" class="btn btn-info mb-2 btn-sm">filtrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</th>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>
|
||||
Catégories
|
||||
</th>
|
||||
<th>
|
||||
Nombre de formations
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for playlist in playlists %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ playlist.name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ playlist.description }}
|
||||
</td>
|
||||
<td>
|
||||
{% set categories = playlist.categoriesplaylist %}
|
||||
{% if categories|length > 0 %}
|
||||
{% for c in 0..categories|length-1 %}
|
||||
{{ categories[c] }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ playlist.getCountFormation() }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ path('admin.playlists.remove', {'id': playlist.id}) }}" class="btn btn-danger" onclick="return confirm('Êtes vous sûr de vouloir supprimer {{ playlist.name }} ?')">Supprimer</a>
|
||||
<a href="{{ path('admin.playlists.modifier', {'id': playlist.id}) }}" class="btn btn-danger">Modifier</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ path('admin.playlists.create') }}" class="btn btn-primary">Ajouter une playlist</a>
|
||||
{% endblock %}
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
<input type="hidden" name="_token" value="{{ csrf_token('filtre_name') }}">
|
||||
<button type="submit" class="btn btn-info mb-2 btn-sm">filtrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</th>
|
||||
<th class="text-left align-top" scope="col">
|
||||
catégories
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
{% endfor %}
|
||||
<br /><br />
|
||||
<strong>description :</strong><br />
|
||||
{{ playlist.description|nl2br }}
|
||||
{{ playlist.description|nl2br }}<br>
|
||||
Nombre de formations : {{ nombreFormations }}
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- boucle sur l'affichage des formations -->
|
||||
|
|
@ -20,7 +21,7 @@
|
|||
<div class="col-md-auto">
|
||||
{% if formation.miniature %}
|
||||
<a href="{{ path('formations.showone', {id:formation.id}) }}">
|
||||
<img src="{{ formation.miniature }}">
|
||||
<img src="{{ formation.miniature }}" alt="Miniature de la formation">
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@
|
|||
</form>
|
||||
</th>
|
||||
<th class="text-center align-top" scope="col">
|
||||
|
||||
Nb résultats
|
||||
<a href="{{ path('playlists.sort', {champ:'nbResult', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
|
||||
<a href="{{ path('playlists.sort', {champ:'nbResult', ordre:'DESC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -57,7 +59,10 @@
|
|||
</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ path('playlists.showone', {id:playlists[k].id}) }}" class="btn btn-secondary">Voir détail</a>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
{{ nombreFormations[playlists[k].id] ?? 0 }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
|
|||
28
templates/security/login.html.twig
Normal file
28
templates/security/login.html.twig
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Log in!{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ logout_path() }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
||||
<label for="inputUsername">Username</label>
|
||||
<input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" autocomplete="username" required autofocus>
|
||||
<label for="inputPassword">Password</label>
|
||||
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
|
||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Loading…
Reference in a new issue