Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • e0329u/sae4-developpement-d-une-application-complexe
1 result
Select Git revision
Show changes
Commits on Source (29)
Showing
with 84 additions and 8374 deletions
.idea
\ No newline at end of file
# SAE4-Développement d’une application complexe
## HorseBand
## Getting started
**HorseBand** est une application web de gestion pour un club équestre. Elle permet l'administration de membres, de chevaux, de documents, d'entraînements et de matchs (locaux et nationaux), avec une interface dédiée aux administrateurs et aux adhérents.
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
---
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
### Structure du projet
```
cd existing_repo
git remote add origin https://gitlab.univ-lorraine.fr/e0329u/sae4-developpement-d-une-application-complexe.git
git branch -M main
git push -uf origin main
php-app/
├── docker/ # Configuration Docker (PHP, MySQL)
│ ├── php/
│ │ ├── Dockerfile
│ │ └── vhost.conf
│ └── sql/
│ └── init.sql # Script de création des tables et données initiales
├── Files/
│ ├── assets/ # Images, CSS, JS
│ ├── includes/ # Fichiers partagés (config, header, footer)
│ ├── logs/ # Repertoire avec les logs
│ ├── pages/
│ │ ├── admin/ # Espace administrateur
│ │ ├── adherent/ # Espace utilisateur adhérent
│ │ ├── public/ # Espace utilisateur sans connexion
│ │ └── storage/
│ │ └── documents/ # Dossier pour les documents uploadés des adhérents
│ └── .env # Fichier d'environnement
└── docker-compose.yml
```
## Integrate with your tools
---
### Fonctionnalités
#### Adhérents
* Accès à leur profil
* Téléversement et suppression de documents
* Consultation des entraînements et des matchs à venir
- [ ] [Set up project integrations](https://gitlab.univ-lorraine.fr/e0329u/sae4-developpement-d-une-application-complexe/-/settings/integrations)
#### Administrateurs
## Collaborate with your team
* Dashboard centralisé
* Gestion des chevaux, documents, entraînements et matchs
* Insertion, mise à jour et suppression des données
* Système de rôle basé sur les sessions PHP
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
---
## Test and Deploy
### Démarrage rapide
Use the built-in continuous integration in GitLab.
#### Prérequis
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
* Docker & Docker Compose installés
***
#### ▶ Lancer l'application
# Editing this README
```bash
cd php-app
docker-compose up --build
```
L'application sera disponible sur `http://localhost:8080`.
---
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
### Variables d'environnement
## Suggestions for a good README
Le fichier `.env` contient les informations de connexion à la base de données, modifiables selon ton environnement :
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
```
DB_HOST=db
DB_NAME=horseband
DB_USER=root
DB_PASS=root
```
## Name
Choose a self-explaining name for your project.
---
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
### Base de données
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
Le fichier `docker/sql/init.sql` contient :
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
* La création des tables `users`, `matches`, `chevaux`, `documents`, `entrainements`, etc.
* Des données de test insérées automatiquement au lancement
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
---
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
### Authentification
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
* Utilise les sessions PHP
* Redirige vers la page de connexion si l'utilisateur n'est pas authentifié
* Vérifie le rôle (admin ou adherent) pour restreindre l'accès
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
---
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
### Interface
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
* CSS personnalisée dans `assets/css/style.css`
* Images thématiques : chevaux, cavaliers, événements
* Interfaces séparées pour les rôles
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
---
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
### Fonctionnalités techniques
## License
For open source projects, say how it is licensed.
* Upload de fichiers
* Formulaires sécurisés (vérification de champs requis et types)
* Traitement conditionnel (match local/national, statuts à venir/terminés)
* Gestion des erreurs et messages de confirmation
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
---
### Auteur
* **Thomas KANY** et **Romain DESERT** : Securisation du projet
* **Ayat MERIMI** et **Zaynab RIFI** : Creation du projet
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/java.iml" filepath="$PROJECT_DIR$/.idea/java.iml" />
</modules>
</component>
</project>
\ No newline at end of file
import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class AuthInterface extends JFrame {
public AuthInterface() {
setTitle("Se connecter");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400, 300);
setLocationRelativeTo(null);
getContentPane().setBackground(Color.GRAY); // Fond noir
getContentPane().setLayout(null);
RoundedLogo logoLabel = createRoundedLogo();
if (logoLabel != null) {
logoLabel.setBounds(0, -25, 90, 100);
getContentPane().add(logoLabel); }
addTitle();
addButtons();
setVisible(true);
}
private void addTitle() {
JLabel titleLabel = new JLabel("Content de vous revoir !", JLabel.CENTER);
titleLabel.setFont(new Font("Georgia", Font.BOLD, 18));
titleLabel.setForeground(Color.ORANGE); // Texte
titleLabel.setBounds(0, 20, getWidth(), 30);
getContentPane().add(titleLabel);
}
private void addButtons() {
JButton loginButton = createWhiteButton("Connexion");
loginButton.setBounds(130, 100, 120, 50);
loginButton.addActionListener(e -> openLoginWindow());
getContentPane().add(loginButton);
}
private JButton createWhiteButton(String text) {
JButton button = new JButton(text);
button.setFont(new Font("Georgia", Font.BOLD, 14));
button.setForeground(Color.WHITE);
button.setBackground(Color.BLACK); // Fond noir
button.setFocusPainted(false);
button.setBorderPainted(false);
button.setOpaque(true);
// Effet au survol
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
button.setBackground(Color.LIGHT_GRAY);
}
@Override
public void mouseExited(MouseEvent e) {
button.setBackground(Color.BLACK);
}
});
return button;
}
private RoundedLogo createRoundedLogo() {
try {
java.net.URL logoURL = getClass().getResource("/logo.png");
if (logoURL != null) {
ImageIcon icon = new ImageIcon(logoURL);
Image scaledImage = icon.getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
return new RoundedLogo(scaledImage);
}
return null;
} catch (Exception e) {
System.err.println("Erreur avec le logo : " + e.getMessage());
return null;
}
}
private void openLoginWindow() {
new LoginWindow(); // Ouvrir la fenêtre de connexion
this.dispose(); // Fermer la fenêtre actuelle (authentification)
}
public static void main(String[] args) {
new AuthInterface();
}
}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnexionBD {
public static Connection connect() throws SQLException {
try {
// Charger explicitement le pilote JDBC
Class.forName("com.mysql.cj.jdbc.Driver");
// Établir la connexion à la base de données
String url = "jdbc:mysql://localhost:3306/horsebond?useSSL=false&serverTimezone=UTC";
String user = "root";
String password = "";
return DriverManager.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
throw new SQLException("Pilote JDBC non trouvé : " + e.getMessage());
}
}
}
\ No newline at end of file
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
public class EntrainementViewer extends JFrame {
private JTable entrainementsTable;
private DefaultTableModel tableModel;
private JButton addButton;
private JButton editButton;
public EntrainementViewer() {
setTitle("Visualisation des Entraînements - Horsebond");
setSize(800, 600);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
JLabel titleLabel = new JLabel("Liste des Entraînements", JLabel.CENTER);
titleLabel.setFont(new Font("Arial", Font.BOLD, 24));
add(titleLabel, BorderLayout.NORTH);
// Colonnes du tableau
String[] columnNames = {
"ID", "Date", "Type", "Durée", "Description", "Lieu", "Niveau",
"Capacité Max", "Instructeur", "Statut", "Date de Création", "Date de Mise à Jour"
};
tableModel = new DefaultTableModel(columnNames, 0);
entrainementsTable = new JTable(tableModel);
add(new JScrollPane(entrainementsTable), BorderLayout.CENTER);
// Charger les données depuis la base de données
loadEntrainements();
// Ajout des boutons Ajouter et Modifier
addButtons();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
// Ajouter les boutons Ajouter et Modifier
private void addButtons() {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
// Bouton Ajouter
addButton = new JButton("Ajouter Entraînement");
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new EntrainementForm(null); // Passer null car c'est un nouvel ajout
}
});
panel.add(addButton);
// Bouton Modifier
editButton = new JButton("Modifier Entraînement");
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int selectedRow = entrainementsTable.getSelectedRow();
if (selectedRow != -1) {
int entrainementId = (int) tableModel.getValueAt(selectedRow, 0);
new EntrainementForm(entrainementId); // Passer l'ID pour modifier
} else {
JOptionPane.showMessageDialog(EntrainementViewer.this, "Veuillez sélectionner un entraînement à modifier.");
}
}
});
panel.add(editButton);
add(panel, BorderLayout.SOUTH);
}
// Charger les données depuis la base de données
private void loadEntrainements() {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM entrainements";
PreparedStatement statement = connection.prepareStatement(query);
ResultSet resultSet = statement.executeQuery();
// Nettoyer le tableau avant de le remplir
tableModel.setRowCount(0);
// Ajouter les données dans le tableau
while (resultSet.next()) {
Object[] row = {
resultSet.getInt("id"),
resultSet.getTimestamp("date"),
resultSet.getString("type"),
resultSet.getInt("duree"),
resultSet.getString("description"),
resultSet.getString("lieu"),
resultSet.getString("niveau"),
resultSet.getInt("capacite_max"),
resultSet.getString("instructeur"),
resultSet.getString("statut"),
resultSet.getTimestamp("created_at"),
resultSet.getTimestamp("updated_at")
};
tableModel.addRow(row);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de chargement des données : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(EntrainementViewer::new);
}
}
// Formulaire pour Ajouter ou Modifier un Entraînement
class EntrainementForm extends JFrame {
private JTextField dateField, typeField, dureeField, descriptionField, lieuField, niveauField, capaciteField, instructeurField, statutField;
private int entrainementId; // ID de l'entraînement à modifier, ou -1 si ajout
public EntrainementForm(Integer entrainementId) {
this.entrainementId = (entrainementId != null) ? entrainementId : -1;
setTitle(this.entrainementId == -1 ? "Ajouter un Entraînement" : "Modifier un Entraînement");
setSize(400, 400);
setLocationRelativeTo(null);
setLayout(new GridLayout(10, 2));
// Champs du formulaire
dateField = new JTextField();
typeField = new JTextField();
dureeField = new JTextField();
descriptionField = new JTextField();
lieuField = new JTextField();
niveauField = new JTextField();
capaciteField = new JTextField();
instructeurField = new JTextField();
statutField = new JTextField();
// Ajouter les champs dans le formulaire
add(new JLabel("Date"));
add(dateField);
add(new JLabel("Type"));
add(typeField);
add(new JLabel("Durée"));
add(dureeField);
add(new JLabel("Description"));
add(descriptionField);
add(new JLabel("Lieu"));
add(lieuField);
add(new JLabel("Niveau"));
add(niveauField);
add(new JLabel("Capacité Max"));
add(capaciteField);
add(new JLabel("Instructeur"));
add(instructeurField);
add(new JLabel("Statut"));
add(statutField);
// Si c'est une modification, charger les données existantes
if (this.entrainementId != -1) {
loadEntrainementData(entrainementId);
}
// Bouton de soumission
JButton submitButton = new JButton(this.entrainementId == -1 ? "Ajouter" : "Modifier");
submitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (entrainementId == -1) {
addEntrainement();
} else {
updateEntrainement();
}
}
});
add(submitButton);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
}
// Charger les données d'un entraînement existant pour la modification
private void loadEntrainementData(int entrainementId) {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM entrainements WHERE id = ?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setInt(1, entrainementId);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
dateField.setText(resultSet.getString("date"));
typeField.setText(resultSet.getString("type"));
dureeField.setText(String.valueOf(resultSet.getInt("duree")));
descriptionField.setText(resultSet.getString("description"));
lieuField.setText(resultSet.getString("lieu"));
niveauField.setText(resultSet.getString("niveau"));
capaciteField.setText(String.valueOf(resultSet.getInt("capacite_max")));
instructeurField.setText(resultSet.getString("instructeur"));
statutField.setText(resultSet.getString("statut"));
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de chargement des données : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
// Ajouter un nouvel entraînement
private void addEntrainement() {
try (Connection connection = ConnexionBD.connect()) {
String query = "INSERT INTO entrainements (date, type, duree, description, lieu, niveau, capacite_max, instructeur, statut) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, dateField.getText());
statement.setString(2, typeField.getText());
statement.setInt(3, Integer.parseInt(dureeField.getText()));
statement.setString(4, descriptionField.getText());
statement.setString(5, lieuField.getText());
statement.setString(6, niveauField.getText());
statement.setInt(7, Integer.parseInt(capaciteField.getText()));
statement.setString(8, instructeurField.getText());
statement.setString(9, statutField.getText());
statement.executeUpdate();
JOptionPane.showMessageDialog(this, "Entraînement ajouté avec succès.");
dispose(); // Fermer le formulaire après ajout
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur d'ajout de l'entraînement : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
// Modifier un entraînement existant
private void updateEntrainement() {
try (Connection connection = ConnexionBD.connect()) {
String query = "UPDATE entrainements SET date = ?, type = ?, duree = ?, description = ?, lieu = ?, niveau = ?, capacite_max = ?, instructeur = ?, statut = ? WHERE id = ?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, dateField.getText());
statement.setString(2, typeField.getText());
statement.setInt(3, Integer.parseInt(dureeField.getText()));
statement.setString(4, descriptionField.getText());
statement.setString(5, lieuField.getText());
statement.setString(6, niveauField.getText());
statement.setInt(7, Integer.parseInt(capaciteField.getText()));
statement.setString(8, instructeurField.getText());
statement.setString(9, statutField.getText());
statement.setInt(10, entrainementId);
statement.executeUpdate();
JOptionPane.showMessageDialog(this, "Entraînement modifié avec succès.");
dispose(); // Fermer le formulaire après modification
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de modification de l'entraînement : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
}
import java.awt.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.*;
public class LoginWindow extends JFrame {
public LoginWindow() {
setTitle("Connexion");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(800, 300);
setLocationRelativeTo(null);
getContentPane().setBackground(Color.GRAY);
getContentPane().setLayout(null);
RoundedLogo logoLabel = createRoundedLogo();
if (logoLabel != null) {
logoLabel.setBounds(0, -30, 90, 100);
getContentPane().add(logoLabel); }
addFormFields();
setVisible(true);
}
private void addFormFields() {
JLabel usernameLabel = createWhiteLabel("Nom d'utilisateur :", 50, 50);
usernameLabel.setFont(new Font("Georgia", Font.BOLD, 13));
JTextField usernameField = new JTextField();
usernameField.setBounds(200, 50, 150, 25);
getContentPane().add(usernameLabel);
getContentPane().add(usernameField);
JLabel passwordLabel = createWhiteLabel("Mot de passe :", 50, 50);
passwordLabel.setFont(new Font("Georgia", Font.BOLD, 13));
passwordLabel.setBounds(400, 50, 150, 25);
JPasswordField passwordField = new JPasswordField();
passwordField.setBounds(550, 50, 150, 25);
getContentPane().add(passwordLabel);
getContentPane().add(passwordField);
JButton loginButton = new JButton("Se connecter");
loginButton.setBounds(300, 150, 150, 30);
loginButton.addActionListener(e -> loginUser(usernameField.getText(), new String(passwordField.getPassword())));
getContentPane().add(loginButton);
}
private JLabel createWhiteLabel(String text, int x, int y) {
JLabel label = new JLabel(text);
label.setForeground(Color.WHITE);
label.setBounds(x, y, 150, 25);
return label;
}
private void loginUser(String username, String password) {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM utilisateurs WHERE username = ? AND password = ?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, username);
statement.setString(2, password);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
JOptionPane.showMessageDialog(this, "Bienvenue !");
new Menuprincipal(); // Ouvre le menu principal
dispose(); // Ferme la fenêtre de connexion
} else {
JOptionPane.showMessageDialog(this, "Identifiants incorrects.", "Erreur", JOptionPane.ERROR_MESSAGE);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur lors de la connexion : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
private RoundedLogo createRoundedLogo() {
try {
java.net.URL logoURL = getClass().getResource("/logo.png");
if (logoURL != null) {
ImageIcon icon = new ImageIcon(logoURL);
Image scaledImage = icon.getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
return new RoundedLogo(scaledImage);
}
return null;
} catch (Exception e) {
System.err.println("Erreur avec le logo : " + e.getMessage());
return null;
}
}}
\ No newline at end of file
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
public class MatchesWindow extends JFrame {
private JTable matchesTable;
private DefaultTableModel tableModel;
public MatchesWindow() {
setTitle("Gestion des Matches - Horsebond");
setSize(800, 600);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
JLabel titleLabel = new JLabel("Gestion des Matches", JLabel.CENTER);
titleLabel.setFont(new Font("Arial", Font.BOLD, 24));
add(titleLabel, BorderLayout.NORTH);
// Colonnes du tableau
String[] columnNames = {"ID", "Titre", "Type", "Statut", "Date", "Lieu", "Description", "Participants", "Prix", "Exigences"};
tableModel = new DefaultTableModel(columnNames, 0);
matchesTable = new JTable(tableModel);
add(new JScrollPane(matchesTable), BorderLayout.CENTER);
// Boutons pour actions
JPanel buttonPanel = new JPanel(new FlowLayout());
JButton addButton = new JButton("Ajouter un Match");
JButton editButton = new JButton("Modifier un Match");
buttonPanel.add(addButton);
buttonPanel.add(editButton);
add(buttonPanel, BorderLayout.SOUTH);
// Charger les données depuis la base de données
loadMatches();
// Action : Ajouter un match
addButton.addActionListener(e -> openMatchDialog(null));
// Action : Modifier un match
editButton.addActionListener(e -> {
int selectedRow = matchesTable.getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(this, "Veuillez sélectionner un match à modifier.", "Erreur", JOptionPane.WARNING_MESSAGE);
} else {
int matchId = (int) tableModel.getValueAt(selectedRow, 0);
openMatchDialog(matchId);
}
});
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
// Charger les données depuis la base de données
private void loadMatches() {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM matches";
PreparedStatement statement = connection.prepareStatement(query);
ResultSet resultSet = statement.executeQuery();
// Nettoyer le tableau
tableModel.setRowCount(0);
// Ajouter les données dans le tableau
while (resultSet.next()) {
Object[] row = {
resultSet.getInt("id"),
resultSet.getString("title"),
resultSet.getString("type"),
resultSet.getString("status"),
resultSet.getDate("date"),
resultSet.getString("location"),
resultSet.getString("description"),
resultSet.getString("participants"),
resultSet.getString("prize"),
resultSet.getString("requirements")
};
tableModel.addRow(row);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de chargement des données : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
// Ouvrir la fenêtre de dialogue pour ajouter ou modifier un match
private void openMatchDialog(Integer matchId) {
new MatchDialog(this, matchId);
loadMatches(); // Rafraîchir les données après modification ou ajout
}
public static void main(String[] args) {
SwingUtilities.invokeLater(MatchesWindow::new);
}
}
// Classe MatchDialog pour ajouter ou modifier un match
class MatchDialog extends JDialog {
private JTextField titleField, dateField, locationField, descriptionField, participantsField, prizeField, requirementsField;
private JComboBox<String> typeComboBox, statusComboBox;
private JButton saveButton;
private Integer matchId;
public MatchDialog(JFrame parent, Integer matchId) {
super(parent, matchId == null ? "Ajouter un Match" : "Modifier un Match", true);
this.matchId = matchId;
setSize(400, 500); // Ajuster la taille pour qu'elle soit plus raisonnable
setLocationRelativeTo(parent);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10); // Espacement entre les composants
gbc.gridwidth = 2; // Par défaut, les composants prennent toute la largeur
// Titre du match
add(new JLabel("Titre du Match :"), gbc);
titleField = new JTextField();
gbc.gridwidth = 1;
gbc.gridx = 1;
add(titleField, gbc);
// Type
gbc.gridwidth = 1;
gbc.gridx = 0;
add(new JLabel("Type :"), gbc);
typeComboBox = new JComboBox<>(new String[]{"regional", "national"});
gbc.gridx = 1;
add(typeComboBox, gbc);
// Statut
gbc.gridx = 0;
add(new JLabel("Statut :"), gbc);
statusComboBox = new JComboBox<>(new String[]{"upcoming", "completed"});
gbc.gridx = 1;
add(statusComboBox, gbc);
// Date
gbc.gridx = 0;
add(new JLabel("Date (YYYY-MM-DD) :"), gbc);
dateField = new JTextField();
gbc.gridx = 1;
add(dateField, gbc);
// Lieu
gbc.gridx = 0;
add(new JLabel("Lieu :"), gbc);
locationField = new JTextField();
gbc.gridx = 1;
add(locationField, gbc);
// Description
gbc.gridx = 0;
add(new JLabel("Description :"), gbc);
descriptionField = new JTextField();
descriptionField.setPreferredSize(new Dimension(200, 60)); // Taille fixe pour éviter les chevauchements
gbc.gridx = 1;
add(descriptionField, gbc);
// Participants
gbc.gridx = 0;
add(new JLabel("Participants :"), gbc);
participantsField = new JTextField();
gbc.gridx = 1;
add(participantsField, gbc);
// Prix
gbc.gridx = 0;
add(new JLabel("Prix :"), gbc);
prizeField = new JTextField();
gbc.gridx = 1;
add(prizeField, gbc);
// Exigences
gbc.gridx = 0;
add(new JLabel("Exigences :"), gbc);
requirementsField = new JTextField();
gbc.gridx = 1;
add(requirementsField, gbc);
// Bouton Enregistrer
saveButton = new JButton("Enregistrer");
saveButton.addActionListener(e -> saveMatch());
gbc.gridx = 0;
gbc.gridwidth = 2;
gbc.gridy = 10;
add(saveButton, gbc);
if (matchId != null) {
loadMatchData(); // Charger les données du match si modification
}
setVisible(true);
}
// Charger les données d'un match existant
private void loadMatchData() {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM matches WHERE id = ?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setInt(1, matchId);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
titleField.setText(resultSet.getString("title"));
typeComboBox.setSelectedItem(resultSet.getString("type"));
statusComboBox.setSelectedItem(resultSet.getString("status"));
dateField.setText(resultSet.getDate("date").toString());
locationField.setText(resultSet.getString("location"));
descriptionField.setText(resultSet.getString("description"));
participantsField.setText(resultSet.getString("participants"));
prizeField.setText(resultSet.getString("prize"));
requirementsField.setText(resultSet.getString("requirements"));
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur lors du chargement des données : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
// Enregistrer les données du match
private void saveMatch() {
try (Connection connection = ConnexionBD.connect()) {
String query;
if (matchId == null) {
query = "INSERT INTO matches (title, type, status, date, location, description, participants, prize, requirements) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
} else {
query = "UPDATE matches SET title = ?, type = ?, status = ?, date = ?, location = ?, description = ?, participants = ?, prize = ?, requirements = ? WHERE id = ?";
}
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, titleField.getText());
statement.setString(2, (String) typeComboBox.getSelectedItem());
statement.setString(3, (String) statusComboBox.getSelectedItem());
statement.setString(4, dateField.getText());
statement.setString(5, locationField.getText());
statement.setString(6, descriptionField.getText());
statement.setString(7, participantsField.getText());
statement.setString(8, prizeField.getText());
statement.setString(9, requirementsField.getText());
if (matchId != null) {
statement.setInt(10, matchId); // Si modification, on inclut l'ID
}
statement.executeUpdate();
JOptionPane.showMessageDialog(this, "Match enregistré avec succès.");
dispose();
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur lors de l'enregistrement : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
}
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Menuprincipal extends JFrame {
private JButton quitButton; // Bouton Quitter
public Menuprincipal() {
setTitle("HorseBond");
setDefaultCloseOperation(EXIT_ON_CLOSE);
// Taille réduite pour une meilleure esthétique
setSize(800, 600);
setLocationRelativeTo(null);
getContentPane().setBackground(new Color(101, 67, 33)); // Fond noir
getContentPane().setLayout(null);
// Ajout du logo avec bord arrondi
RoundedLogo logoLabel = createRoundedLogo();
if (logoLabel != null) {
logoLabel.setBounds(30, -15, 120, 120);
getContentPane().add(logoLabel);
}
addTitle();
addButtons();
addQuitButton(); // Ajout du bouton Quitter
setVisible(true);
}
private void addTitle() {
JLabel titleLabel = new JLabel("HorseBond", JLabel.CENTER);
titleLabel.setForeground(Color.ORANGE); // Texte blanc
titleLabel.setFont(new Font("Georgia", Font.BOLD, 38));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.WHITE);
titleLabel.setBounds(0, 30, getWidth(), 60); // Centrer le titre
getContentPane().add(titleLabel);
}
private void addButtons() {
String[] buttonLabels = {
"Matchs", "Planning",
"Résultats", "Organisation"
};
int btnWidth = 250; // Largeur ajustée pour une meilleure esthétique
int btnHeight = 100; // Hauteur ajustée
int xSpacing = 20; // Espacement horizontal entre les boutons
int ySpacing = 120; // Espacement vertical entre les rangées
int startY = 150; // Position verticale de départ pour les boutons
for (int i = 0; i < buttonLabels.length; i += 2) {
int btn1X = (getWidth() / 2) - btnWidth - (xSpacing / 2);
int btn2X = (getWidth() / 2) + (xSpacing / 2);
// Création du premier bouton
JButton btn1 = createWhiteButton(buttonLabels[i]);
btn1.setBounds(btn1X, startY, btnWidth, btnHeight);
// Création du second bouton
JButton btn2 = createWhiteButton(buttonLabels[i + 1]);
btn2.setBounds(btn2X, startY, btnWidth, btnHeight);
// Gestion des actions sur les boutons avec un switch
switch (buttonLabels[i]) {
case "Matchs":
btn1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new MatchesWindow(); // Ouvre la fenêtre MatchesWindow
}
});
break;
case "Planning":
btn1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new EntrainementViewer(); // Ouvre la fenêtre EntrainementViewer
}
});
break;
case "Résultats":
btn1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new ResultsViewer(); // Ouvre la fenêtre ResultsViewer
}
});
break;
case "Organisation":
btn1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new OrganisationViewer();
}
});
break;
}
// Gestion des actions pour le second bouton avec un switch
switch (buttonLabels[i + 1]) {
case "Matchs":
btn2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new MatchesWindow(); // Ouvre la fenêtre MatchesWindow
}
});
break;
case "Planning":
btn2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new EntrainementViewer(); // Ouvre la fenêtre EntrainementViewer
}
});
break;
case "Résultats":
btn2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new ResultsViewer(); // Ouvre la fenêtre ResultsViewer
}
});
break;
case "Organisation":
btn2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
new OrganisationViewer();
}
});
break;
}
getContentPane().add(btn1);
getContentPane().add(btn2);
startY += ySpacing;
}
revalidate();
repaint();
}
private JButton createWhiteButton(String text) {
JButton button = new JButton(text);
button.setBackground(Color.WHITE); // Fond blanc
button.setForeground(Color.BLACK); // Texte noir
button.setFocusPainted(false);
button.setFont(new Font("Georgia", Font.BOLD, 20));
button.setBorderPainted(false);
button.setOpaque(true);
button.setBorder(new RoundedBorder(25, Color.WHITE)); // Bords arrondis avec couleur blanche
return button;
}
private void addQuitButton() {
quitButton = new JButton("Se déconnecter");
quitButton.setFont(new Font("Georgia", Font.PLAIN, 16));
quitButton.setBackground(Color.orange); // Fond rouge
quitButton.setForeground(Color.WHITE); // Texte blanc
quitButton.setFocusPainted(false);
quitButton.setOpaque(true);
quitButton.setBounds(getWidth() - 220, getHeight() - 90, 180, 40); // Décalé du bord de droite de 20px et plus petit
quitButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
dispose(); // Ferme la fenêtre actuelle (Menuprincipal)
new AuthInterface().setVisible(true); // Ouvre la fenêtre d'authentification
}
});
getContentPane().add(quitButton);
}
private RoundedLogo createRoundedLogo() {
try {
java.net.URL logoURL = getClass().getResource("/logo.png");
if (logoURL != null) {
ImageIcon icon = new ImageIcon(logoURL);
Image scaledImage = icon.getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
return new RoundedLogo(scaledImage);
}
return null;
} catch (Exception e) {
System.err.println("Erreur avec le logo : " + e.getMessage());
return null;
}
}
public static void main(String[] args) {
new Menuprincipal();
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
public class OrganisationViewer extends JFrame {
private int currentMonth;
private int currentYear;
private JTextArea calendarArea;
private JPanel calendarPanel;
private JLabel titleLabel;
public OrganisationViewer() {
setTitle("Calendrier HorseBond");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(800, 600); // Agrandir la taille de la fenêtre
setLocationRelativeTo(null);
getContentPane().setBackground(Color.ORANGE);
getContentPane().setLayout(null);
// Initialiser le mois et l'année actuels
Calendar calendar = Calendar.getInstance();
currentMonth = calendar.get(Calendar.MONTH);
currentYear = calendar.get(Calendar.YEAR);
addReturnButton(); // Ajouter le bouton "Retour"
addTitle();
addCalendarArea();
addNavigationButtons();
addEventListeners();
setVisible(true);
}
private void addReturnButton() {
JButton backButton = new JButton("Retour");
backButton.setBounds(10, 10, 100, 30); // Position en haut à gauche
backButton.setBackground(Color.RED); // Fond rouge
backButton.setForeground(Color.WHITE); // Texte blanc
backButton.setFont(new Font("Arial", Font.BOLD, 14));
backButton.setFocusable(false);
backButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose(); // Fermer la fenêtre actuelle
// Ouvrir le menu principal (assurez-vous que MenuPrincipal existe)
new Menuprincipal(); // Remplacez par la classe de votre menu principal
}
});
getContentPane().add(backButton);
}
private void addTitle() {
titleLabel = new JLabel("Calendrier HorseBond - " + getMonthName(currentMonth) + " " + currentYear, JLabel.CENTER);
titleLabel.setForeground(Color.WHITE);
titleLabel.setFont(new Font("Arial", Font.BOLD, 20));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.BLACK);
titleLabel.setBounds(0, 50, getWidth(), 50);
getContentPane().add(titleLabel);
}
private void addCalendarArea() {
calendarArea = new JTextArea();
calendarArea.setEditable(false);
calendarArea.setBackground(Color.BLACK);
calendarArea.setForeground(Color.WHITE);
calendarArea.setFont(new Font("Monospaced", Font.PLAIN, 18));
calendarPanel = new JPanel();
calendarPanel.setBackground(Color.BLACK);
calendarPanel.setBounds(50, 100, 700, 400); // Agrandir la taille du panel
calendarPanel.setLayout(new GridLayout(7, 7)); // 7 lignes pour les jours de la semaine + 6 pour le mois
String[] daysOfWeek = {"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"};
for (String day : daysOfWeek) {
JButton dayButton = new JButton(day);
dayButton.setBackground(Color.GRAY);
dayButton.setForeground(Color.WHITE);
dayButton.setEnabled(false);
calendarPanel.add(dayButton);
}
updateCalendar();
getContentPane().add(calendarPanel);
}
private void updateCalendar() {
Calendar calendar = Calendar.getInstance();
calendar.set(currentYear, currentMonth, 1);
int firstDayOfMonth = calendar.get(Calendar.DAY_OF_WEEK);
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
// Re-générer le calendrier chaque fois qu'il change
calendarPanel.removeAll();
String[] daysOfWeek = {"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"};
for (String day : daysOfWeek) {
JButton dayButton = new JButton(day);
dayButton.setBackground(Color.GRAY);
dayButton.setForeground(Color.WHITE);
dayButton.setEnabled(false);
calendarPanel.add(dayButton);
}
// Ajouter les jours
int emptyDays = firstDayOfMonth - 1;
for (int i = 0; i < emptyDays; i++) {
calendarPanel.add(new JLabel(""));
}
for (int day = 1; day <= daysInMonth; day++) {
JButton dayButton = new JButton(String.valueOf(day));
dayButton.setBackground(Color.WHITE);
dayButton.setForeground(Color.BLACK);
if (hasEvent(day)) {
dayButton.setBackground(Color.GREEN); // Modifier la couleur en fonction de l'événement
}
final int finalDay = day;
dayButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
displayEventDescription(finalDay);
}
});
calendarPanel.add(dayButton);
}
calendarPanel.revalidate();
calendarPanel.repaint();
}
private void displayEventDescription(int day) {
try (Connection conn = ConnexionBD.connect()) {
String query = "SELECT evenement FROM evenements WHERE jour = ? AND mois = ?";
try (PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setInt(1, day);
stmt.setInt(2, currentMonth + 1);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
String eventDescription = rs.getString("evenement");
int option = JOptionPane.showOptionDialog(this,
eventDescription + "\nVoulez-vous supprimer cet événement ?",
"Événement du " + day + "/" + (currentMonth + 1) + "/" + currentYear,
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, null, null);
if (option == JOptionPane.YES_OPTION) {
deleteEvent(day);
}
} else {
JOptionPane.showMessageDialog(this, "Aucun événement pour ce jour.", "Pas d'événement", JOptionPane.INFORMATION_MESSAGE);
addNewEvent(day);
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
private void addNewEvent(int day) {
String eventDescription = JOptionPane.showInputDialog(this, "Entrez la description de l'événement:");
if (eventDescription != null && !eventDescription.trim().isEmpty()) {
try (Connection conn = ConnexionBD.connect()) {
String query = "INSERT INTO evenements (jour, mois, evenement) VALUES (?, ?, ?)";
try (PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setInt(1, day);
stmt.setInt(2, currentMonth + 1);
stmt.setString(3, eventDescription);
stmt.executeUpdate();
JOptionPane.showMessageDialog(this, "Événement ajouté !");
updateCalendar();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
} else {
JOptionPane.showMessageDialog(this, "La description de l'événement ne peut pas être vide.");
}
}
private void deleteEvent(int day) {
try (Connection conn = ConnexionBD.connect()) {
String query = "DELETE FROM evenements WHERE jour = ? AND mois = ?";
try (PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setInt(1, day);
stmt.setInt(2, currentMonth + 1);
stmt.executeUpdate();
JOptionPane.showMessageDialog(this, "Événement supprimé !");
updateCalendar();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
private boolean hasEvent(int day) {
try (Connection conn = ConnexionBD.connect()) {
String query = "SELECT COUNT(*) FROM evenements WHERE jour = ? AND mois = ?";
try (PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setInt(1, day);
stmt.setInt(2, currentMonth + 1);
ResultSet rs = stmt.executeQuery();
if (rs.next() && rs.getInt(1) > 0) {
return true;
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}
return false;
}
private void addNavigationButtons() {
JButton prevMonthButton = new JButton("< Mois précédent");
prevMonthButton.setBounds(50, 520, 200, 40);
prevMonthButton.setBackground(Color.WHITE);
prevMonthButton.setForeground(Color.BLACK);
prevMonthButton.setFont(new Font("Arial", Font.BOLD, 18));
prevMonthButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
currentMonth--;
if (currentMonth < 0) {
currentMonth = 11;
currentYear--;
}
updateCalendar();
titleLabel.setText("Calendrier HorseBond - " + getMonthName(currentMonth) + " " + currentYear);
}
});
JButton nextMonthButton = new JButton("Mois suivant >");
nextMonthButton.setBounds(350, 520, 200, 40);
nextMonthButton.setBackground(Color.WHITE);
nextMonthButton.setForeground(Color.BLACK);
nextMonthButton.setFont(new Font("Arial", Font.BOLD, 18));
nextMonthButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
currentMonth++;
if (currentMonth > 11) {
currentMonth = 0;
currentYear++;
}
updateCalendar();
titleLabel.setText("Calendrier HorseBond - " + getMonthName(currentMonth) + " " + currentYear);
}
});
getContentPane().add(prevMonthButton);
getContentPane().add(nextMonthButton);
}
private String getMonthName(int month) {
String[] months = {"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"};
return months[month];
}
private void addEventListeners() {
}
public static void main(String[] args) {
new OrganisationViewer();
}
}
\ No newline at end of file
import java.awt.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.*;
public class RegisterWindow extends JFrame {
public RegisterWindow() {
setTitle("Inscription");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400, 300);
setLocationRelativeTo(null);
getContentPane().setBackground(Color.BLACK);
getContentPane().setLayout(null);
addFormFields();
setVisible(true);
}
private void addFormFields() {
JLabel usernameLabel = createWhiteLabel("Nom d'utilisateur :", 50, 50);
JTextField usernameField = new JTextField();
usernameField.setBounds(200, 50, 150, 25);
getContentPane().add(usernameLabel);
getContentPane().add(usernameField);
JLabel passwordLabel = createWhiteLabel("Mot de passe :", 50, 100);
JPasswordField passwordField = new JPasswordField();
passwordField.setBounds(200, 100, 150, 25);
getContentPane().add(passwordLabel);
getContentPane().add(passwordField);
JButton registerButton = new JButton("S'inscrire");
registerButton.setBounds(150, 200, 100, 30);
registerButton.addActionListener(e -> registerUser(usernameField.getText(), new String(passwordField.getPassword())));
getContentPane().add(registerButton);
}
private JLabel createWhiteLabel(String text, int x, int y) {
JLabel label = new JLabel(text);
label.setForeground(Color.WHITE);
label.setBounds(x, y, 150, 25);
return label;
}
private void registerUser(String username, String password) {
try (Connection connection = ConnexionBD.connect()) {
String query = "INSERT INTO utilisateurs (username, password) VALUES (?, ?)";
PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, username);
statement.setString(2, password);
int rowsInserted = statement.executeUpdate();
if (rowsInserted > 0) {
JOptionPane.showMessageDialog(this, "Inscription réussie !");
new AuthInterface();
dispose();
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur lors de l'inscription : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
}
\ No newline at end of file
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.sql.*;
public class ResultsViewer extends JFrame {
private JTable resultsTable;
private DefaultTableModel tableModel;
private JButton addButton;
private JButton modifyButton;
public ResultsViewer() {
setTitle("Visualisation des Résultats - Horsebond");
setSize(800, 600);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
JLabel titleLabel = new JLabel("Résultats des Matches", JLabel.CENTER);
titleLabel.setFont(new Font("Arial", Font.BOLD, 24));
add(titleLabel, BorderLayout.NORTH);
// Colonnes du tableau
String[] columnNames = {
"ID", "Match ID", "Nom", "Cheval", "Score"
};
// Initialiser le modèle du tableau
tableModel = new DefaultTableModel(columnNames, 0);
resultsTable = new JTable(tableModel);
add(new JScrollPane(resultsTable), BorderLayout.CENTER);
// Charger les données depuis la base de données
loadResults();
// Ajouter les boutons pour ajouter et modifier les résultats
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
addButton = new JButton("Ajouter un Résultat");
modifyButton = new JButton("Modifier un Résultat");
// Ajouter les actions aux boutons
addButton.addActionListener(e -> openAddResultDialog());
modifyButton.addActionListener(e -> openModifyResultDialog());
buttonPanel.add(addButton);
buttonPanel.add(modifyButton);
add(buttonPanel, BorderLayout.SOUTH);
// Désactiver le bouton de modification si aucune ligne n'est sélectionnée
resultsTable.getSelectionModel().addListSelectionListener(e -> {
modifyButton.setEnabled(resultsTable.getSelectedRow() != -1);
});
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
}
// Charger les résultats depuis la base de données
private void loadResults() {
try (Connection connection = ConnexionBD.connect()) {
String query = "SELECT * FROM winners";
PreparedStatement statement = connection.prepareStatement(query);
ResultSet resultSet = statement.executeQuery();
// Nettoyer le tableau avant de le remplir
tableModel.setRowCount(0);
// Ajouter les données dans le tableau
while (resultSet.next()) {
Object[] row = {
resultSet.getInt("id"),
resultSet.getInt("match_id"),
resultSet.getString("name"),
resultSet.getString("horse"),
resultSet.getString("score")
};
tableModel.addRow(row);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de chargement des données : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
// Méthode pour ouvrir la boîte de dialogue d'ajout d'un résultat
private void openAddResultDialog() {
// Créer un panneau de saisie pour ajouter un résultat
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 2));
JTextField matchIdField = new JTextField();
JTextField nameField = new JTextField();
JTextField horseField = new JTextField();
JTextField scoreField = new JTextField();
panel.add(new JLabel("Match ID :"));
panel.add(matchIdField);
panel.add(new JLabel("Nom :"));
panel.add(nameField);
panel.add(new JLabel("Cheval :"));
panel.add(horseField);
panel.add(new JLabel("Score :"));
panel.add(scoreField);
int option = JOptionPane.showConfirmDialog(this, panel, "Ajouter un Résultat", JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION) {
try (Connection connection = ConnexionBD.connect()) {
String query = "INSERT INTO winners (match_id, name, horse, score) VALUES (?, ?, ?, ?)";
PreparedStatement statement = connection.prepareStatement(query);
statement.setInt(1, Integer.parseInt(matchIdField.getText()));
statement.setString(2, nameField.getText());
statement.setString(3, horseField.getText());
statement.setString(4, scoreField.getText());
statement.executeUpdate();
loadResults(); // Recharger les résultats après l'ajout
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur d'ajout du résultat : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
}
// Méthode pour ouvrir la boîte de dialogue de modification d'un résultat
private void openModifyResultDialog() {
int selectedRow = resultsTable.getSelectedRow();
if (selectedRow != -1) {
// Obtenir les valeurs actuelles du résultat sélectionné
int id = (int) resultsTable.getValueAt(selectedRow, 0);
int matchId = (int) resultsTable.getValueAt(selectedRow, 1);
String name = (String) resultsTable.getValueAt(selectedRow, 2);
String horse = (String) resultsTable.getValueAt(selectedRow, 3);
String score = (String) resultsTable.getValueAt(selectedRow, 4);
// Créer un panneau de saisie pour modifier le résultat
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 2));
JTextField matchIdField = new JTextField(String.valueOf(matchId));
JTextField nameField = new JTextField(name);
JTextField horseField = new JTextField(horse);
JTextField scoreField = new JTextField(score);
panel.add(new JLabel("Match ID :"));
panel.add(matchIdField);
panel.add(new JLabel("Nom :"));
panel.add(nameField);
panel.add(new JLabel("Cheval :"));
panel.add(horseField);
panel.add(new JLabel("Score :"));
panel.add(scoreField);
int option = JOptionPane.showConfirmDialog(this, panel, "Modifier un Résultat", JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION) {
try (Connection connection = ConnexionBD.connect()) {
String query = "UPDATE winners SET match_id = ?, name = ?, horse = ?, score = ? WHERE id = ?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setInt(1, Integer.parseInt(matchIdField.getText()));
statement.setString(2, nameField.getText());
statement.setString(3, horseField.getText());
statement.setString(4, scoreField.getText());
statement.setInt(5, id);
statement.executeUpdate();
loadResults(); // Recharger les résultats après la modification
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Erreur de modification du résultat : " + e.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
}
}
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(ResultsViewer::new);
}
}
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Shape;
import java.awt.geom.RoundRectangle2D;
import javax.swing.border.Border;
public class RoundedBorder implements Border {
private final int radius; // Déclaré comme final
private final Color borderColor; // Déclaré comme final
// Constructeur avec le rayon et la couleur
public RoundedBorder(int radius, Color borderColor) {
this.radius = radius;
this.borderColor = borderColor;
}
@Override
public Insets getBorderInsets(java.awt.Component c) {
return new Insets(this.radius + 1, this.radius + 1, this.radius + 1, this.radius + 1);
}
@Override
public boolean isBorderOpaque() {
return false;
}
@Override
public void paintBorder(java.awt.Component c, Graphics g, int x, int y, int width, int height) {
// Utilisation de Graphics2D au lieu de Graphics
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(this.borderColor);
Shape shape = new RoundRectangle2D.Double(x, y, width - 1, height - 1, radius, radius);
g2d.draw(shape); // Utiliser g2d pour dessiner
}
}
\ No newline at end of file
import javax.swing.*;
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.Image;
public class RoundedLogo extends JPanel {
private final Image image;
public RoundedLogo(Image image) {
this.image = image;
setOpaque(false);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setClip(new Ellipse2D.Double(0, 0, getWidth(), getHeight()));
g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
}
@Override
public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
revalidate();
repaint();
}
}
\ No newline at end of file
-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mer. 22 jan. 2025 à 07:16
-- Version du serveur : 9.1.0
-- Version de PHP : 8.3.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `horsebond`
--
-- --------------------------------------------------------
--
-- Structure de la table `chevaux`
--
DROP TABLE IF EXISTS `chevaux`;
CREATE TABLE IF NOT EXISTS `chevaux` (
`id` int NOT NULL AUTO_INCREMENT,
`nom` varchar(100) NOT NULL,
`race` varchar(100) NOT NULL,
`age` int NOT NULL,
`discipline` varchar(100) NOT NULL,
`comportement` varchar(255) NOT NULL,
`taille_cm` int NOT NULL,
`image_url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `chevaux`
--
INSERT INTO `chevaux` (`id`, `nom`, `race`, `age`, `discipline`, `comportement`, `taille_cm`, `image_url`) VALUES
(1, 'Eclipse', 'Selle Français', 8, 'Dressage', 'Calme et attentif', 170, './../../assets/images/National-Horse-Day-1-1200x834.jpg'),
(2, 'Tempête', 'Pur-sang Arabe', 5, 'Saut d\'obstacles', 'Énergique et vif', 155, './../../assets/images/b1.jpg'),
(3, 'Sultan', 'Pur-sang Arabe', 7, 'Endurance', 'Énergique et vif', 165, '\r\n./../../assets/images/67878a2a699b8.jpg'),
(4, 'Odyssée', 'Hanovrien', 10, 'Saut d\'obstacles', 'Puissant et agile', 175, './../../assets/images/Friesian_Stallion.jpg'),
(5, 'Wafia', 'Arabe', 6, 'Dressage', 'Calme', 170, './../../assets/images/g4.jpg'),
(6, 'Amira', 'Pur-sang Arabe', 7, 'Endurance', 'Énergique et vif', 165, './../../assets/images/g6.jpg'),
(7, 'Chamss', 'Hanovrien', 10, 'Saut d\'obstacles', 'Puissant et agile', 175, './../../assets/images/b2.jpg'),
(8, 'Flamme', 'Americain', 11, 'galop', 'calme', 170, './../../assets/images/chevaux/flamme.jpg'),
(11, 'Flammy', 'Selle Français', 10, 'Dressage', 'Calme et attentif', 173, './../../assets/images/chevaux/rayhana.jpg'),
(12, 'Riri', 'Americaine', 7, 'Course', 'Énergique et vif', 165, './../../assets/images/chevaux/wafia.jpg');
-- --------------------------------------------------------
--
-- Structure de la table `documents`
--
DROP TABLE IF EXISTS `documents`;
CREATE TABLE IF NOT EXISTS `documents` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`nom_fichier` varchar(255) NOT NULL,
`type_fichier` varchar(100) NOT NULL,
`chemin_fichier` varchar(255) NOT NULL,
`date_upload` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`description` text,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `documents`
--
INSERT INTO `documents` (`id`, `user_id`, `nom_fichier`, `type_fichier`, `chemin_fichier`, `date_upload`, `description`) VALUES
(1, 7, 'licence_equitation.pdf', 'application/pdf', 'licence_zaynab_2024.pdf', '2025-01-15 09:00:00', 'Licence d\'équitation pour la saison 2024'),
(2, 2, 'certificat_medical.pdf', 'application/pdf', 'certificat_medical_zaynab_2024.pdf', '2025-01-15 09:05:00', 'Certificat médical pour la pratique de l\'équitation'),
(3, 7, 'assurance_cavalier.pdf', 'application/pdf', 'assurance_sdf_2024.pdf', '2025-01-15 10:00:00', 'Attestation d\'assurance responsabilité civile'),
(4, 4, 'licence_competition.pdf', 'application/pdf', 'licence_comp_zinb_2024.pdf', '2025-01-15 11:00:00', 'Licence de compétition niveau amateur'),
(5, 5, 'autorisation_parentale.pdf', 'application/pdf', 'autorisation_test_2024.pdf', '2025-01-15 12:00:00', 'Autorisation parentale pour mineur'),
(6, 6, 'fiche_inscription.pdf', 'application/pdf', 'inscription_teste_2024.pdf', '2025-01-15 13:00:00', 'Formulaire d\'inscription complété'),
(7, 2, 'photo_identite.jpg', 'image/jpeg', 'photo_zaynab_2024.jpg', '2025-01-15 14:00:00', 'Photo d\'identité pour le dossier'),
(8, 3, 'carnet_vaccination.pdf', 'application/pdf', 'vaccins_sdf_2024.pdf', '2025-01-15 15:00:00', 'Carnet de vaccination à jour'),
(9, 4, 'diplome_galop.pdf', 'application/pdf', 'galop7_zinb.pdf', '2025-01-15 16:00:00', 'Diplôme Galop 7'),
(11, 7, 'certtificat', 'certificat', 'uploads/documents/678e1ce1af4ec_1737366753.pdf', '2025-01-20 09:52:33', 'certficat'),
(12, 7, 'Licence_2025.pdf', 'licence', 'uploads/documents/678e20850cee2_Licence_2025.pdf', '2025-01-20 10:08:05', 'Document généré automatiquement'),
(13, 7, 'Certificat_Medical_2025.pdf', 'certificat', 'uploads/documents/678e20850d6e7_Certificat_Medical_2025.pdf', '2025-01-20 10:08:05', 'Document généré automatiquement'),
(14, 7, 'Attestation_Inscription_2025.pdf', 'attestation', 'uploads/documents/678e20850f158_Attestation_Inscription_2025.pdf', '2025-01-20 10:08:05', 'Document généré automatiquement'),
(36, 7, 'Ma photo', 'autre', 'uploads/documents/678eabf1180f0_1737403377.jpg', '2025-01-20 20:02:57', ''),
(21, 10, 'Licence_2025.pdf', 'licence', 'uploads/documents/678e25a5025a9_Licence_2025.pdf', '2025-01-20 10:29:57', 'Document généré automatiquement'),
(22, 10, 'Certificat_Medical_2025.pdf', 'certificat', 'uploads/documents/678e25a502cd4_Certificat_Medical_2025.pdf', '2025-01-20 10:29:57', 'Document généré automatiquement'),
(23, 10, 'Attestation_Inscription_2025.pdf', 'attestation', 'uploads/documents/678e25a503260_Attestation_Inscription_2025.pdf', '2025-01-20 10:29:57', 'Document généré automatiquement'),
(35, 10, 'Ma photo', 'autre', 'uploads/documents/678eab4743f31_1737403207.jpg', '2025-01-20 20:00:07', '');
-- --------------------------------------------------------
--
-- Structure de la table `entrainements`
--
DROP TABLE IF EXISTS `entrainements`;
CREATE TABLE IF NOT EXISTS `entrainements` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`date` datetime NOT NULL,
`type` varchar(100) NOT NULL,
`duree` int NOT NULL,
`description` text,
`lieu` varchar(255) DEFAULT NULL,
`niveau` varchar(50) DEFAULT NULL,
`capacite_max` int DEFAULT NULL,
`instructeur` varchar(100) DEFAULT NULL,
`statut` varchar(20) DEFAULT 'planifié',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_entrainements_date` (`date`),
KEY `idx_entrainements_user` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `entrainements`
--
INSERT INTO `entrainements` (`id`, `user_id`, `date`, `type`, `duree`, `description`, `lieu`, `niveau`, `capacite_max`, `instructeur`, `statut`, `created_at`, `updated_at`) VALUES
(1, 1, '2025-01-20 14:00:00', 'Dressage', 60, 'Séance de dressage pour débutants', 'Manège principal', 'Débutant', 8, 'Marie Dupont', 'planifié', '2025-01-15 20:14:01', '2025-01-15 20:14:01'),
(2, 1, '2025-01-22 10:00:00', 'Saut d\'obstacles', 90, 'Entraînement aux obstacles', 'Carrière extérieure', 'Intermédiaire', 6, 'Jean Martin', 'planifié', '2025-01-15 20:14:01', '2025-01-15 20:14:01'),
(3, 2, '2025-01-21 16:30:00', 'Cross', 120, 'Parcours cross-country', 'Parcours extérieur', 'Avancé', 5, 'Sophie Bernard', 'planifié', '2025-01-15 20:14:01', '2025-01-21 13:43:30'),
(4, 3, '2025-01-23 09:00:00', 'Voltige', 45, 'Initiation à la voltige', 'Manège couvert', 'Avancé', 10, 'Pierre Dubois', 'planifié', '2025-01-15 20:14:01', '2025-01-21 13:59:21');
-- --------------------------------------------------------
--
-- Structure de la table `evenements`
--
DROP TABLE IF EXISTS `evenements`;
CREATE TABLE IF NOT EXISTS `evenements` (
`id` int NOT NULL,
`jour` int DEFAULT NULL,
`mois` int DEFAULT NULL,
`evenement` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `evenements`
--
INSERT INTO `evenements` (`id`, `jour`, `mois`, `evenement`) VALUES
(6, 15, 5, 'Stage d\'initiation à l\'équitation pour enfants'),
(5, 10, 5, 'Événement de test de nouveaux chevaux de compétition'),
(4, 22, 4, 'Rencontre entre éleveurs et cavaliers'),
(3, 5, 4, 'Concours de chevaux de loisirs'),
(2, 18, 3, 'Stage de perfectionnement en dressage'),
(1, 12, 3, 'Compétition de saut d\'obstacles régionale'),
(7, 1, 6, 'Concours de saut d\'obstacles international'),
(8, 20, 6, 'Journée portes ouvertes au centre équestre'),
(9, 12, 7, 'Randonnée équestre à travers la forêt'),
(10, 25, 8, 'Championnat national d\'équitation'),
(11, 9, 9, 'Formation sur la sécurité équestre'),
(12, 17, 10, 'Séance de médiation par le cheval'),
(13, 3, 11, 'Concours de dressage et saut d\'obstacles combinés'),
(14, 14, 12, 'Célébration des champions équestres de l\'année');
-- --------------------------------------------------------
--
-- Structure de la table `inscriptions_matches`
--
DROP TABLE IF EXISTS `inscriptions_matches`;
CREATE TABLE IF NOT EXISTS `inscriptions_matches` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`match_id` int NOT NULL,
`date_inscription` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`statut` enum('en_attente','confirmé','refusé') DEFAULT 'en_attente',
`cheval_id` int NOT NULL,
`niveau` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `match_id` (`match_id`),
KEY `cheval_id` (`cheval_id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `inscriptions_matches`
--
INSERT INTO `inscriptions_matches` (`id`, `user_id`, `match_id`, `date_inscription`, `statut`, `cheval_id`, `niveau`) VALUES
(1, 1, 1, '2025-01-15 13:30:00', 'confirmé', 1, ''),
(2, 2, 1, '2025-01-15 14:00:00', 'en_attente', 2, ''),
(3, 3, 2, '2025-01-16 08:00:00', 'confirmé', 3, ''),
(4, 1, 3, '2025-01-16 09:30:00', 'confirmé', 4, ''),
(5, 2, 2, '2025-01-16 10:00:00', 'refusé', 5, ''),
(6, 4, 1, '2025-01-16 13:00:00', 'en_attente', 2, ''),
(7, 7, 2, '2025-01-19 21:52:11', 'en_attente', 6, ''),
(8, 10, 3, '2025-01-20 18:31:40', 'confirmé', 2, 'Intermédiaire');
-- --------------------------------------------------------
--
-- Structure de la table `matches`
--
DROP TABLE IF EXISTS `matches`;
CREATE TABLE IF NOT EXISTS `matches` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`type` enum('regional','national') NOT NULL,
`status` enum('upcoming','completed') NOT NULL,
`date` date NOT NULL,
`location` varchar(255) NOT NULL,
`description` text,
`participants` varchar(255) DEFAULT NULL,
`prize` varchar(255) DEFAULT NULL,
`requirements` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `matches`
--
INSERT INTO `matches` (`id`, `title`, `type`, `status`, `date`, `location`, `description`, `participants`, `prize`, `requirements`) VALUES
(1, 'Compétition régionale', 'regional', 'completed', '2024-10-15', 'Centre équestre de Metz', 'Compétition régionale de saut d\'obstacles', '15 participants inscrits', '1000€ de prix à gagner', 'Niveau Galop 5 minimum'),
(2, 'Tournoi d\'hiver', 'national', 'upcoming', '2025-02-22', 'Parc national Vosges', 'Tournoi national de dressage', '30 participants attendus', '2500€ de prix à gagner', 'Niveau Galop 7 minimum'),
(3, 'Grand Prix de Jumping', 'national', 'upcoming', '2025-03-15', 'Hippodrome de Longchamp', 'Compétition nationale de saut d\'obstacles', '40 participants attendus', '5000€ de prix', 'Niveau Galop 7 minimum'),
(4, 'Challenge Dressage Regional', 'regional', 'completed', '2024-12-20', 'Centre Équestre Lyon', 'Competition régionale de dressage', '25 participants', '1500€ de prix', 'Niveau Galop 5 minimum'),
(5, 'Coupe de France Endurance', 'national', 'upcoming', '2025-04-10', 'Domaine de Chambord', 'Course d\'endurance de 160km', '30 participants maximum', '7500€ de prix', 'Qualification 2* FEI requise'),
(6, 'Challenge Poney Club', 'regional', 'completed', '2024-11-30', 'Poney Club de Marseille', 'Competition pour jeunes cavaliers', '35 participants', '800€ de prix', 'Niveau Galop 3 minimum'),
(7, 'Championnat Cross-Country', 'national', 'upcoming', '2025-05-22', 'Parc Équestre du Morvan', 'Épreuve complète de cross', '20 participants', '4000€ de prix', 'Niveau Galop 6 minimum'),
(8, 'Trophée des Espoirs', 'regional', 'upcoming', '2025-02-28', 'Centre Équestre de Bordeaux', 'Competition jeunes talents', '45 participants maximum', '5000€ de prix', 'Moins de 18 ans, Galop 4 minimum'),
(10, 'test', 'regional', 'completed', '2025-03-25', 'st die', 'test test ', 'Martin', '4000', 'agsfouilhkj'),
(11, 'test', 'national', 'completed', '2025-01-21', 'test', 'test', 'test', 'test', 'test'),
(12, 'test', 'national', 'completed', '2025-01-25', 'test', 'test', 'test', 'test', 'test'),
(13, 'test', 'national', 'completed', '2025-01-25', 'test', 'test', 'test', 'test', 'test');
-- --------------------------------------------------------
--
-- Structure de la table `newsletter`
--
DROP TABLE IF EXISTS `newsletter`;
CREATE TABLE IF NOT EXISTS `newsletter` (
`id` int NOT NULL AUTO_INCREMENT,
`email` varchar(100) NOT NULL,
`date_inscription` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `newsletter`
--
INSERT INTO `newsletter` (`id`, `email`, `date_inscription`) VALUES
(1, 'zaynab.rifi@hotmail.com', '2025-01-14 14:00:05'),
(2, 'admin@test.com', '2025-01-14 14:04:44'),
(3, 'test@gmail.com', '2025-01-14 14:12:15'),
(4, 'test2@gmail.com', '2025-01-20 09:30:27'),
(5, 'tst4@gmail.com', '2025-01-20 09:33:00');
-- --------------------------------------------------------
--
-- Structure de la table `utilisateurs`
--
DROP TABLE IF EXISTS `utilisateurs`;
CREATE TABLE IF NOT EXISTS `utilisateurs` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`role` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `utilisateurs`
--
INSERT INTO `utilisateurs` (`id`, `username`, `password`, `role`) VALUES
(1, 'admin', 'a', NULL),
(3, 'member', 'm', NULL),
(4, 'membre', 'm', NULL),
(5, 'aya', 'aya', NULL);
-- --------------------------------------------------------
--
-- Structure de la table `winners`
--
DROP TABLE IF EXISTS `winners`;
CREATE TABLE IF NOT EXISTS `winners` (
`id` int NOT NULL AUTO_INCREMENT,
`match_id` int NOT NULL,
`name` varchar(255) NOT NULL,
`photo_url` varchar(255) DEFAULT NULL,
`horse` varchar(255) NOT NULL,
`score` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `match_id` (`match_id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Déchargement des données de la table `winners`
--
INSERT INTO `winners` (`id`, `match_id`, `name`, `photo_url`, `horse`, `score`) VALUES
(1, 6, 'Marie Dubois', './../../assets/images/winners/marie.jpg', 'Eclipse du Soleil', '85.5'),
(2, 4, 'Lucas Martin', './../../assets/images/winners/maried.jpg', 'Petit Tonnerre', '78.3'),
(3, 1, 'Lili marti', './../../assets/images/winners/lili.jpg', 'Flamme', '75'),
(4, 5, 'RIFI Zaynab', NULL, 'Amira', '75.5'),
(5, 8, 'MERIMI Aya', NULL, 'Flamme', '75.5');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
java-app/image.png

20.2 KiB

This diff is collapsed.