This commit is contained in:
Bilal 2022-10-06 11:29:53 +02:00
commit af4b827eba
33 changed files with 7670 additions and 0 deletions

12
Grup'App.iml Normal file
View File

@ -0,0 +1,12 @@
<?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$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="mariadb-connector" level="project" />
</component>
</module>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,216 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mar. 04 oct. 2022 à 15:55
-- Version du serveur : 10.8.3-MariaDB
-- Version de PHP : 8.1.7
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 : `boudjeml`
--
-- --------------------------------------------------------
--
-- Structure de la table `Comptes`
--
CREATE TABLE `Comptes` (
`idCompte` int(11) NOT NULL,
`idGrade` int(11) NOT NULL,
`utilisateur` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`pass` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Comptes`
--
INSERT INTO `Comptes` (`idCompte`, `idGrade`, `utilisateur`, `pass`) VALUES
(0, 0, 'admin', 'admin'),
(1, 1, 'prof', 'prof'),
(2, 2, 'eleve', 'eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Demandes`
--
CREATE TABLE `Demandes` (
`idRequete` int(11) NOT NULL,
`idCompte` int(11) NOT NULL,
`type` int(11) NOT NULL,
`contenu` text COLLATE utf8mb4_unicode_ci NOT NULL,
`quand` date NOT NULL,
`heure` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `Grades`
--
CREATE TABLE `Grades` (
`idGrade` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Grades`
--
INSERT INTO `Grades` (`idGrade`, `intitule`) VALUES
(0, 'Administrateur'),
(1, 'Professeur'),
(2, 'Eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Groupes`
--
CREATE TABLE `Groupes` (
`idGroupe` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Groupes`
--
INSERT INTO `Groupes` (`idGroupe`, `intitule`) VALUES
(0, 'Groupe de TP 1'),
(1, 'Groupe de TP 2'),
(2, 'Groupe de TP 3');
-- --------------------------------------------------------
--
-- Structure de la table `Membres`
--
CREATE TABLE `Membres` (
`idCompte` int(11) NOT NULL,
`idGroupe` int(11) DEFAULT NULL,
`nom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`prenom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`adresse` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`numero` text COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Membres`
--
INSERT INTO `Membres` (`idCompte`, `idGroupe`, `nom`, `prenom`, `adresse`, `numero`) VALUES
(0, NULL, 'Upec', 'Fontainebleau', 'Route forestière Hurtault 77300 Fontainebleau', '01.45.17.10.00'),
(1, NULL, 'Florent', 'Madelaine', NULL, '01.45.17.65.94'),
(2, 0, 'Bilal', 'Boudjemline', '14 rue Charles Meunier Avon', '06.60.30.19.27');
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGrade` (`idGrade`);
--
-- Index pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD PRIMARY KEY (`idRequete`),
ADD KEY `idCompte` (`idCompte`);
--
-- Index pour la table `Grades`
--
ALTER TABLE `Grades`
ADD PRIMARY KEY (`idGrade`);
--
-- Index pour la table `Groupes`
--
ALTER TABLE `Groupes`
ADD PRIMARY KEY (`idGroupe`);
--
-- Index pour la table `Membres`
--
ALTER TABLE `Membres`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGroupe` (`idGroupe`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `Comptes`
--
ALTER TABLE `Comptes`
MODIFY `idCompte` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Demandes`
--
ALTER TABLE `Demandes`
MODIFY `idRequete` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `Grades`
--
ALTER TABLE `Grades`
MODIFY `idGrade` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Groupes`
--
ALTER TABLE `Groupes`
MODIFY `idGroupe` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD CONSTRAINT `Comptes_ibfk_1` FOREIGN KEY (`idGrade`) REFERENCES `Grades` (`idGrade`);
--
-- Contraintes pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD CONSTRAINT `Demandes_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`);
--
-- Contraintes pour la table `Membres`
--
ALTER TABLE `Membres`
ADD CONSTRAINT `Membres_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`),
ADD CONSTRAINT `Membres_ibfk_2` FOREIGN KEY (`idGroupe`) REFERENCES `Groupes` (`idGroupe`);
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 */;

File diff suppressed because it is too large Load Diff

Binary file not shown.

22
src/BButton.java Normal file
View File

@ -0,0 +1,22 @@
/* [BButon]
* Desc: To create a CheckBox fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JButton;
public class BButton extends JButton {
public String title;
public BButton(String name) {
super(name);
this.title = name;
}
@Override
public String toString() {
return "Button name: " + this.title;
}
}

81
src/BDatabase.java Normal file
View File

@ -0,0 +1,81 @@
/* [BDatabase]
* Desc: To create Operationnal Database Link fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.sql.*;
import java.sql.Connection;
import java.util.ArrayList;
import org.mariadb.jdbc.*;
// Maitre
public class BDatabase {
public String db_host;
public String db_name;
public String db_user;
protected String db_password;
protected Connection link;
protected int current_user;
public BDatabase() {
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
this.db_name = "boudjeml";
this.db_user = "boudjeml";
this.db_password = "fcy2u8RXOrfdPIpA";
try {
Class.forName("org.mariadb.jdbc.Driver");
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.link = DriverManager.getConnection(this.db_host + this.db_name, this.db_user, this.db_password);
System.out.println("Success Connected.");
} catch (SQLException e) {
System.out.println("Error with SQL connexion.\n" + e);
System.exit(-1);
}
}
public ArrayList<String> fetchAll(String request) {
try {
ArrayList<String> toReturn = new ArrayList<String>();
ResultSet rs = this.link.prepareStatement(request).executeQuery();
for(int i = 0; rs.next(); i++) {
toReturn.add(i, String.valueOf(rs.getString(1)));
}
System.out.println("Succes: " + request);
return toReturn;
} catch(SQLException e) {
System.out.println("Error with the statement : " + e);
return null;
}
}
public Connection getSharedObject() {
return this.link;
}
public String getUser() {
return this.db_user;
}
public String getHost() {
return this.db_host;
}
public String getDatabaseName() {
return this.db_name;
}
@Override
public String toString() {
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
}
}

78
src/BFrame.java Normal file
View File

@ -0,0 +1,78 @@
/* [BFrame]
* Desc: To create Operationnal JFrame fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.ImageIcon;
import java.awt.GridBagLayout;
public class BFrame extends JFrame {
public String title;
public int location_x = 1;
public int location_y = 1;
public int width = 500;
public int height = 500;
public boolean isOpen = false;
public int onClose = 3;
public BFrame(String titlee, int oC) {
this.title = titlee;
this.onClose = oC;
initBFrame();
}
public BFrame(String titlee, int size_x, int size_y, int oC) {
this.title = titlee;
this.width = size_x;
this.height = size_y;
this.onClose = oC;
initBFrame();
}
public BFrame(String titlee, int loca_x, int loca_y, int size_x, int size_y, int oC) {
this.title = titlee;
this.location_x = loca_x;
this.location_y = loca_y;
this.width = size_x;
this.height = size_y;
this.onClose = oC;
initBFrame();
}
protected void initBFrame() {
ImageIcon icon = new ImageIcon("src/assets/img/logo.png");
this.setTitle(this.title);
this.setLocation(this.location_x, this.location_y);
this.setSize(this.width, this.height);
this.setLayout(new GridBagLayout());
this.setIconImage(icon.getImage());
this.setDefaultCloseOperation(this.onClose);
}
public void openBFrame() {
this.isOpen = true;
this.setVisible(true);
}
public void closeBFrame() {
this.isOpen = false;
this.setVisible(false);
}
public void refreshBFrame() {
SwingUtilities.updateComponentTreeUI(this);
}
public boolean isVisible() {
return this.isOpen;
}
@Override
public String toString() {
return this.title + ": is opened";
}
}

24
src/BImage.java Normal file
View File

@ -0,0 +1,24 @@
/* [BImage]
* Desc: To create Operationnal JLabel Image fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
public class BImage extends JLabel {
public JLabel image;
public BImage(String path) throws IOException {
this.image = new JLabel(new ImageIcon(ImageIO.read(new File(path))));
}
public JLabel getImage() {
return this.image;
}
}

46
src/BInput.java Normal file
View File

@ -0,0 +1,46 @@
/* [BInput]
* Desc: To create Operationnal JTextfield fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JTextField;
import java.awt.*;
public class BInput extends JTextField {
public int width = 100;
public int height = 50;
public String inner;
public Color color = Color.BLACK;
public BInput(String in) {
this.inner = in;
this.setText(in);
}
public BInput(int w, int h) {
this.width = w;
this.height = h;
this.setPreferredSize(new Dimension(w, h));
}
public BInput(int w, int h, Color c) {
this.width = w;
this.height = h;
this.color = c;
this.setPreferredSize(new Dimension(w, h));
this.setBackground(this.color);
}
public void setSize(int w, int h) {
this.width = w;
this.height = h;
this.setPreferredSize(new Dimension(w, h));
}
@Override
public String toString() {
return this.width + "\n" + this.height;
}
}

22
src/BLabel.java Normal file
View File

@ -0,0 +1,22 @@
/* [BLabel]
* Desc: To create Operationnal JLabel fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import javax.swing.JLabel;
public class BLabel extends JLabel {
public String title = " ";
public BLabel(String titleOfLabel) {
super(titleOfLabel);
this.title = titleOfLabel;
}
@Override
public String toString() {
return "JLabel value is: " + this.title;
}
}

104
src/BLayout.java Normal file
View File

@ -0,0 +1,104 @@
/* [BLayout]
* Desc: To create a layout fast :)
* GitHub: https://github.com/lalBi94
* Created by: Bilal Boudjemline
* 28/09/2022 at 20:35
* */
import java.awt.GridBagConstraints;
import java.awt.Insets;
public class BLayout extends GridBagConstraints {
public int PositionOnX = 0;
public int PositionOnY = 0;
public int takeCaseOnX = 1;
public int takeCaseOnY = 1;
public double sizeOnX = 0.0f;
public double sizeOnY = 0.0f;
public int padding_top = 1;
public int padding_left = 1;
public int padding_bottom = 1;
public int padding_right = 1;
public Insets padding = new Insets(this.padding_top, this.padding_left, this.padding_bottom, this.padding_right);
public int positionOnScreen = GridBagConstraints.NORTH;
public int filler = GridBagConstraints.BASELINE;
public BLayout() {
initLayout();
}
public BLayout(int positionX, int positionY, int manyCaseX, int manyCaseY, double sizeX,
double sizeY, Insets pad, int positionOnScreen, int filling) {
this.PositionOnX = positionX;
this.PositionOnY = positionY;
this.takeCaseOnX = manyCaseX;
this.takeCaseOnY = manyCaseY;
this.sizeOnX = sizeX;
this.sizeOnY = sizeY;
this.padding_top = pad.top;
this.padding_left = pad.left;
this.padding_bottom = pad.bottom;
this.padding_right = pad.right;
this.padding = pad;
this.positionOnScreen = positionOnScreen;
this.filler = filling;
initLayout();
}
private void initLayout() {
this.gridx = this.PositionOnX;
this.gridy = this.PositionOnY;
this.gridheight = this.takeCaseOnX;
this.gridwidth = this.takeCaseOnY;
this.weightx = this.sizeOnX;
this.weighty = this.sizeOnY;
this.insets = this.padding;
this.anchor = this.positionOnScreen;
this.fill = this.filler;
}
public void setPositionX(int by) {
this.PositionOnX = by;
initLayout();
}
public void setPositionY(int by) {
this.PositionOnY = by;
initLayout();
}
public void setTakeCaseOnX(int by) {
this.takeCaseOnX = by;
initLayout();
}
public void setTakeCaseOnY(int by) {
this.takeCaseOnY = by;
initLayout();
}
public void setSizeX(double by) {
this.sizeOnX = by;
initLayout();
}
public void setSizeY(double by) {
this.sizeOnY = by;
initLayout();
}
public void setPadding(Insets by) {
this.padding = by;
initLayout();
}
public void setAnchor(int by) {
this.positionOnScreen = by;
initLayout();
}
public void setFill(int by) {
this.filler = by;
initLayout();
}
}

100
src/Home.java Normal file
View File

@ -0,0 +1,100 @@
import javax.swing.*;
import java.lang.management.ManagementPermission;
import java.sql.Connection;
public class Home extends BFrame{
protected BDatabase sharedObject;
protected BLayout settings = new BLayout();
protected int grade;
protected String firstname;
protected String lastname;
protected String adress;
protected String phonenumber;
protected Home(BDatabase link, int type, String fn, String ln) {
super(
"Grup'App - " + fn + " " + ln + " " + "[" + link.current_user + "]",
400,
400,
JFrame.DISPOSE_ON_CLOSE
);
this.firstname = fn;
this.lastname = ln;
this.sharedObject = link;
this.grade = type;
init();
if(this.grade == 0) {
admin();
} else if(this.grade == 1) {
prof();
} else if(this.grade == 2) {
eleve();
}
}
private void init() {
this.firstname = this.sharedObject.fetchAll(
"SELECT nom FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.lastname = this.sharedObject.fetchAll(
"SELECT prenom FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.adress = this.sharedObject.fetchAll(
"SELECT adresse FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
this.phonenumber = this.sharedObject.fetchAll(
"SELECT numero FROM Membres WHERE idCompte=" + this.sharedObject.current_user
).get(0);
JOptionPane.showMessageDialog(this, "Bonjour " + this.firstname + " " + this.lastname + " !");
}
private void admin() {
BLabel[] blank = {
new BLabel(" "),
new BLabel(" ")
};
BButton maganageGroupe = new BButton("Gestion des groupes");
this.settings.setPositionX(1);
this.settings.setPositionY(0);
this.add(maganageGroupe, this.settings);
this.settings.setPositionX(1);
this.settings.setPositionY(1);
this.add(blank[0], this.settings);
BButton maganageMembers = new BButton("Gestion des Membres");
this.settings.setPositionX(1);
this.settings.setPositionY(2);
this.add(maganageMembers, this.settings);
this.settings.setPositionX(1);
this.settings.setPositionY(3);
this.add(blank[1], this.settings);
BButton requestMembers = new BButton("Gestion des requetes");
this.settings.setPositionX(1);
this.settings.setPositionY(4);
this.add(requestMembers, this.settings);
ManageStudent goToManage = new ManageStudent(this.sharedObject);
this.openBFrame();
}
private void prof() {
this.openBFrame();
}
private void eleve() {
this.openBFrame();
}
}

105
src/LoginConnection.java Normal file
View File

@ -0,0 +1,105 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.Array;
import java.util.ArrayList;
import java.util.Objects;
import javax.swing.*;
public class LoginConnection extends BFrame implements ActionListener {
protected BInput inUser;
protected BInput inPasswd;
public LoginConnection(String title, int x, int y, int mode) throws IOException {
super(title, x, y, mode);
BImage logo = new BImage("src/assets/img/logo.png");
BLayout settings = new BLayout();
BLabel[] blank = {
new BLabel(" "),
new BLabel(" "),
new BLabel(" ")
};
settings.setPositionX(1);
this.add(logo.getImage(), settings);
settings.setPositionY(3);
this.add(blank[0], settings);
BLabel laUser = new BLabel("Utilisateur");
settings.setPositionY(4);
this.add(laUser, settings);
this.inUser = new BInput(300, 20);
settings.setPositionY(5);
this.add(inUser, settings);
settings.setPositionY(6);
this.add(blank[1], settings);
BLabel laPasswd = new BLabel("Mot de passe");
settings.setPositionY(7);
this.add(laPasswd, settings);
this.inPasswd = new BInput(300, 20);
settings.setPositionY(8);
this.add(inPasswd, settings);
settings.setPositionY(9);
this.add(blank[2], settings);
BButton login = new BButton("Connexion");
login.addActionListener(this);
settings.setPositionY(10);
this.add(login, settings);
this.openBFrame();
this.refreshBFrame();
}
@Override
public void actionPerformed(ActionEvent e) {
BDatabase init = new BDatabase();
String pass = inPasswd.getText();
String user = inUser.getText();
int grade = -1;
boolean canConnect = false;
if(init.fetchAll("SELECT utilisateur FROM Comptes WHERE utilisateur='" + user + "'").size() == 0) {
JOptionPane.showMessageDialog(this, "Utilisateur introuvable.");
} else {
String username = init.fetchAll("SELECT utilisateur FROM Comptes WHERE utilisateur='" + user + "'").get(0);
String passwd = init.fetchAll("SELECT pass FROM Comptes WHERE utilisateur='" + user + "'").get(0);
if(!Objects.equals(passwd, pass)) {
JOptionPane.showMessageDialog(this, "Mot de passe incorrect.");
} else {
canConnect = true;
grade = Integer.parseInt(
init.fetchAll(
"SELECT idGrade FROM Comptes WHERE utilisateur='" + user + "'").get(0)
);
init.current_user = Integer.parseInt(
init.fetchAll(
"SELECT idCompte FROM Comptes WHERE utilisateur='" + user + "'").get(0)
);
}
}
if(canConnect) {
String firstname = init.fetchAll(
"SELECT nom FROM Membres WHERE idCompte=" + init.current_user
).get(0);
String lastname = init.fetchAll(
"SELECT prenom FROM Membres WHERE idCompte=" + init.current_user
).get(0);
Home home = new Home(init, grade, firstname, lastname);
} else{
System.out.println("Erreur.");
}
}
}

12
src/Main.java Normal file
View File

@ -0,0 +1,12 @@
import javax.swing.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
//test
// BDatabase db = new BDatabase();
// ManageStudent test = new ManageStudent(db);
LoginConnection goToLogin = new LoginConnection("Grup'App", 400, 400, JFrame.EXIT_ON_CLOSE);
}
}

110
src/ManageStudent.java Normal file
View File

@ -0,0 +1,110 @@
import javax.swing.JFrame;
import javax.swing.JList;
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class ManageStudent extends BFrame implements ActionListener {
protected BInput inSearch;
protected BButton btnSearch;
protected JList<String> student;
protected BButton moveTo;
protected BButton addTo;
protected BButton seeReq;
protected BDatabase sharedObject;
protected ArrayList<String> tmp;
protected ArrayList<String> tmp2;
protected String[] data;
protected BLayout settings;
public ManageStudent(BDatabase so) {
super("Manageur d'Eleve", 800, 400, JFrame.DISPOSE_ON_CLOSE);
this.settings = new BLayout();
this.sharedObject = so;
this.settings.setAnchor(GridBagConstraints.NORTHWEST);
this.inSearch = new BInput(150, 30);
this.settings.setPositionX(0);
this.settings.setPositionY(0);
this.add(inSearch, this.settings);
this.btnSearch = new BButton("Rechercher");
this.settings.setPositionX(1);
this.settings.setPositionY(0);
this.btnSearch.setActionCommand("search");
this.btnSearch.addActionListener(this);
this.add(btnSearch, this.settings);
this.student = refreshList("");
this.settings.setFill(GridBagConstraints.BOTH);
this.settings.setPositionX(0);
this.settings.setPositionY(1);
this.settings.setSizeX(1.0f);
this.settings.setSizeY(1.0f);
this.settings.setTakeCaseOnY(2);
this.settings.setTakeCaseOnX(2);
this.add(this.student, this.settings);
this.settings.setSizeX(1.0f);
this.settings.setSizeY(1.0f);
this.settings.setTakeCaseOnY(1);
this.settings.setTakeCaseOnX(1);
this.settings.setFill(GridBagConstraints.NONE);
this.settings.setAnchor(GridBagConstraints.CENTER);
this.moveTo = new BButton("Deplacer");
this.settings.setPositionX(2);
this.settings.setPositionY(1);
this.add(moveTo, this.settings);
this.addTo = new BButton("Ajouter");
this.settings.setPositionX(3);
this.settings.setPositionY(1);
this.add(addTo, this.settings);
this.seeReq = new BButton("Voir ses demandes");
this.settings.setPositionX(4);
this.settings.setPositionY(1);
this.add(seeReq, this.settings);
this.openBFrame();
this.refreshBFrame();
}
protected JList<String> refreshList(String student) {
this.tmp = new ArrayList<>();
this.tmp2 = new ArrayList<>();
this.tmp = this.sharedObject.fetchAll(
"SELECT nom FROM Membres WHERE nom LIKE '%" + student + "%'"
);
this.tmp2 = this.sharedObject.fetchAll(
"SELECT prenom FROM Membres WHERE nom LIKE '%" + student + "%'"
);
this.data = new String[tmp.size()];
for(int i = 0; i <= tmp.size()-1; i++) {
this.data[i] = tmp.get(i) + " " + tmp2.get(i);
System.out.println(this.data[i] + " | " + i);
}
JList<String> list = new JList<>(this.data);
this.refreshBFrame();
return list;
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand() == "search") {
refreshList(this.inSearch.getText());
} else {
System.out.println("ok");
}
}
}

BIN
src/assets/img/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
src/assets/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,216 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mar. 04 oct. 2022 à 15:55
-- Version du serveur : 10.8.3-MariaDB
-- Version de PHP : 8.1.7
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 : `boudjeml`
--
-- --------------------------------------------------------
--
-- Structure de la table `Comptes`
--
CREATE TABLE `Comptes` (
`idCompte` int(11) NOT NULL,
`idGrade` int(11) NOT NULL,
`utilisateur` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`pass` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Comptes`
--
INSERT INTO `Comptes` (`idCompte`, `idGrade`, `utilisateur`, `pass`) VALUES
(0, 0, 'admin', 'admin'),
(1, 1, 'prof', 'prof'),
(2, 2, 'eleve', 'eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Demandes`
--
CREATE TABLE `Demandes` (
`idRequete` int(11) NOT NULL,
`idCompte` int(11) NOT NULL,
`type` int(11) NOT NULL,
`contenu` text COLLATE utf8mb4_unicode_ci NOT NULL,
`quand` date NOT NULL,
`heure` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `Grades`
--
CREATE TABLE `Grades` (
`idGrade` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Grades`
--
INSERT INTO `Grades` (`idGrade`, `intitule`) VALUES
(0, 'Administrateur'),
(1, 'Professeur'),
(2, 'Eleve');
-- --------------------------------------------------------
--
-- Structure de la table `Groupes`
--
CREATE TABLE `Groupes` (
`idGroupe` int(11) NOT NULL,
`intitule` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Groupes`
--
INSERT INTO `Groupes` (`idGroupe`, `intitule`) VALUES
(0, 'Groupe de TP 1'),
(1, 'Groupe de TP 2'),
(2, 'Groupe de TP 3');
-- --------------------------------------------------------
--
-- Structure de la table `Membres`
--
CREATE TABLE `Membres` (
`idCompte` int(11) NOT NULL,
`idGroupe` int(11) DEFAULT NULL,
`nom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`prenom` text COLLATE utf8mb4_unicode_ci NOT NULL,
`adresse` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`numero` text COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `Membres`
--
INSERT INTO `Membres` (`idCompte`, `idGroupe`, `nom`, `prenom`, `adresse`, `numero`) VALUES
(0, NULL, 'Upec', 'Fontainebleau', 'Route forestière Hurtault 77300 Fontainebleau', '01.45.17.10.00'),
(1, NULL, 'Florent', 'Madelaine', NULL, '01.45.17.65.94'),
(2, 0, 'Bilal', 'Boudjemline', '14 rue Charles Meunier Avon', '06.60.30.19.27');
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGrade` (`idGrade`);
--
-- Index pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD PRIMARY KEY (`idRequete`),
ADD KEY `idCompte` (`idCompte`);
--
-- Index pour la table `Grades`
--
ALTER TABLE `Grades`
ADD PRIMARY KEY (`idGrade`);
--
-- Index pour la table `Groupes`
--
ALTER TABLE `Groupes`
ADD PRIMARY KEY (`idGroupe`);
--
-- Index pour la table `Membres`
--
ALTER TABLE `Membres`
ADD PRIMARY KEY (`idCompte`),
ADD KEY `idGroupe` (`idGroupe`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `Comptes`
--
ALTER TABLE `Comptes`
MODIFY `idCompte` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Demandes`
--
ALTER TABLE `Demandes`
MODIFY `idRequete` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `Grades`
--
ALTER TABLE `Grades`
MODIFY `idGrade` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `Groupes`
--
ALTER TABLE `Groupes`
MODIFY `idGroupe` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `Comptes`
--
ALTER TABLE `Comptes`
ADD CONSTRAINT `Comptes_ibfk_1` FOREIGN KEY (`idGrade`) REFERENCES `Grades` (`idGrade`);
--
-- Contraintes pour la table `Demandes`
--
ALTER TABLE `Demandes`
ADD CONSTRAINT `Demandes_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`);
--
-- Contraintes pour la table `Membres`
--
ALTER TABLE `Membres`
ADD CONSTRAINT `Membres_ibfk_1` FOREIGN KEY (`idCompte`) REFERENCES `Comptes` (`idCompte`),
ADD CONSTRAINT `Membres_ibfk_2` FOREIGN KEY (`idGroupe`) REFERENCES `Groupes` (`idGroupe`);
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 */;

3261
src/assets/info/model.mdj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.