<repo_name>lexdu53/laFactory<file_sep>/src/main/resources/templates/admin/admin-dashboard.php
<?php
session_start();
include("../config.php");
include("../class/user.class.php");
include("../class/admin.class.php");


// structure de la page : 
// On inclue le header : 
// Titre De la page : 
$titre_page_act = "Admin Dashboard";
include("../includes/header.inc.php");


// On envoit le menu de la page : 

include("../includes/nav.inc.php");
$user = new User();

if ($user->already_connect() == 1 AND $_SESSION['user_type'] == 1)
{
$admin = new admin();


if(isset($_POST['form_reinit_site'])) // Si le formulaire de reinitalisation a été envoyé : 
{
    $retour_reinit_site = $admin->reinit_site();

}
if(isset($_FILES['bdd_csv'])) // si un fichier à été envoyé
{
    $retour_insert_csv = $admin->import_file();
}
    
$nbFormation= $admin->getNbFormation();
$nbMention = $admin->getNbMention();
$nbDomaine = $admin->getNbDomaine();
$nbUsers = $admin->getNbUsers();





// Body :
?>
                <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Dashboard</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-road fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $nbFormation; ?></div>
                                    <div>Formation(s)</div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-green">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-list-alt fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $nbMention; ?></div>
                                    <div>Mention(s)</div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-yellow">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-asterisk fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $nbDomaine; ?></div>
                                    <div>Domaine(s)</div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
                <div class="col-lg-3 col-md-6">
                    <div class="panel panel-red">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-3">
                                    <i class="fa fa-male fa-5x"></i>
                                </div>
                                <div class="col-xs-9 text-right">
                                    <div class="huge"><?php echo $nbUsers; ?></div>
                                    <div>Utilisateur(s)</div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
            </div>


            <div class="row">
                <div class="col-lg-8">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-arrow-right fa-2x"></i> <i class="fa fa-database fa-2x"></i>  Import CSV dans la base
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div id="morris-area-chart"></div>
                            <form role="form" id="form_import_data" method="post" action="admin-dashboard.php" enctype="multipart/form-data">
                                        <div class="well">
                                            <h4>Fichier CSV sous la forme:</h4>
                                            Annee;Niveau; Domaine;Mention; Groupe_accreditation;Parcours; Parcours_Etab;Parcours_Part; Partenariats_UBL;Partenariats_Autres
                                            <br><b style="color:red;"><i class="fa fa-warning fa-1x"></i> Attention: l'importation d'un fichier CSV implique la surppression des anciennes données de la base</b>
                                        </div>
                                        
                                        <div class="form-group">
                                            <label>Fichier (CSV | max. 2 Mo | Encodage UTF-8) :</label>
                                            
                                            <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
                                            <input type="file" name="bdd_csv" id="bdd_csv" />
                                        </div>
                                        
                                        <div class="form-group">
                                            <label>Vérification des doublons</label>
                                            <div class="checkbox">
                                                <label>
                                                    <input type="checkbox" name="verifdoublons" id="verifdoublons" value="">Trouver et supprimer automatiquement les doublons
                                                </label>
                                            </div>
                                        </div>
                                      
                                        <button type="submit" name="submit" value="Importer" class="btn btn-success">Importer</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </form>
                                    <?php
                                    if(isset($_FILES['bdd_csv'])) // si un fichier à été envoyé
                                    {
                                        echo $retour_insert_csv;
                                    }
                                    ?>
                        </div>
                        <!-- /.panel-body -->
                    </div>


                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-8 -->
                <div class="col-lg-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-times fa-2x"></i> <i class="fa fa-database fa-2x"></i>  Effacer la base
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                                     <form role="form" id="form_reinit_site" method="post" action="admin-dashboard.php">
                                        <div class="well">
                                            <h4>Effacer la base de données:</h4>
                                            <br><b style="color:red;"><i class="fa fa-warning fa-1x"></i> Attention: La réinitialisation est irréversible pour la base de données.</b>
                                        </div>

                                        <div class="form-group">
                                            <label>Souhaitez vous réinitialiser le site ? </label>
                                            <div class="checkbox">
                                                <label>
                                                    <input type="checkbox" name="reinit_site" id="reinit_site" value="">OUI
                                                </label>
                                            </div>
                                        </div>
                                        <button type="submit" name="form_reinit_site" value="Réinitialiser" class="btn btn-danger">Réinitialiser</button>
                                        <button type="reset" class="btn btn-info">Reset</button>
                                    </form>

                                    <?php
                                    if(isset($_POST['form_reinit_site'])) // Si le formulaire de reinitalisation a été envoyé : 
                                    {
                                        echo $retour_reinit_site;
                                    }
                                    ?>

                        </div>
                        <!-- /.panel-body -->
                    </div>

                </div>
                <!-- /.col-lg-4 -->
            </div>
            <!-- /.row -->


        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->
<?php
// Fin Body 

}
else {
    echo'<script language="javascript">window.location.href = "../pages/index.php"</script>';
}

// On envoit le footer : 
include("../includes/footer.inc.php");

?><file_sep>/src/main/resources/application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/LaFactory
spring.datasource.username=adminjava
spring.datasource.password=<PASSWORD>
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

spring.thymeleaf.cache=false
<file_sep>/src/main/java/org/lafactory/Service/IetapeCreationService.java
package org.lafactory.Service;

import java.util.Collection;

import org.lafactory.entities.etapeCreation;

public interface IetapeCreationService {
	public etapeCreation getetapeCreation(int id);
	public void setetapeCreation(etapeCreation etapeCreation);
	public int deletapeCreation(int id);
	
	public Collection<etapeCreation> getAlletapeCreation(int id);
	public void setetapesCreation(Collection<etapeCreation> etapesCreation);
	public int delAlletapeCreation(int idOrigami);

	
}
<file_sep>/src/main/java/org/lafactory/entities/Origami.java
package org.lafactory.entities;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="origami")
public class Origami {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID")
	private int id;

	@Column(name="NOM")
	private String nom;
	
	@ManyToOne
	@JoinColumn(name="DIFFICULTE")
	private difOrigami difficulte;
	
	@ManyToOne
	@JoinColumn(name="TYPEORIGAMI")
	private typeOrigami type;
	
	@Column(name="TEMPSREAL")
	private int tempsReal;
	
	@Column(name="NBFEUILLE")
	private int nbFeuille;
	
	@Column(name="NOTE")
	private int note; 
	
	@Column(name="ACTIVE")
	private int active;
	
	@Column(name="TUTOYT")
	private String tutoYT;
	
	public Origami() {
		super();
		// TODO Auto-generated constructor stub
	}


	public Origami(String nom, difOrigami difficulte, typeOrigami type, int tempsReal, int nbFeuille, int note,
			int active, String tutoYT) {
		super();
		this.nom = nom;
		this.difficulte = difficulte;
		this.type = type;
		this.tempsReal = tempsReal;
		this.nbFeuille = nbFeuille;
		this.note = note;
		this.active = active;
		this.tutoYT = tutoYT;
	}


	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public difOrigami getDifficulte() {
		return difficulte;
	}

	public void setDifficulte(difOrigami difficulte) {
		this.difficulte = difficulte;
	}

	public typeOrigami getType() {
		return type;
	}

	public void setType(typeOrigami type) {
		this.type = type;
	}

	public int getTempsReal() {
		return tempsReal;
	}

	public void setTempsReal(int tempsReal) {
		this.tempsReal = tempsReal;
	}

	public int getNbFeuille() {
		return nbFeuille;
	}

	public void setNbFeuille(int nbFeuille) {
		this.nbFeuille = nbFeuille;
	}


	public int getNote() {
		return note;
	}

	public void setNote(int note) {
		this.note = note;
	}

	public int getActive() {
		return active;
	}

	public void setActive(int active) {
		this.active = active;
	}

	public String getTutoYT() {
		return tutoYT;
	}

	public void setTutoYT(String tutoYT) {
		this.tutoYT = tutoYT;
	}

	
}
<file_sep>/src/main/java/org/lafactory/dao/UsersRepository.java
package org.lafactory.dao;

import org.lafactory.entities.Users;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UsersRepository
extends JpaRepository<Users, Integer>{

}
<file_sep>/src/main/java/org/lafactory/Service/IdifOrigami.java
package org.lafactory.Service;

import org.lafactory.entities.difOrigami;

public interface IdifOrigami {
	public difOrigami getdifOrigami(int id);
	public void setdifOrigami(difOrigami origami);
	public int deldifOrigami(int id);
	
}
<file_sep>/src/main/java/org/lafactory/dao/typeOrigamiRepository.java
package org.lafactory.dao;

import org.lafactory.entities.typeOrigami;
import org.springframework.data.jpa.repository.JpaRepository;

public interface typeOrigamiRepository
extends JpaRepository<typeOrigami, Integer>{

}
<file_sep>/src/main/resources/templates/table2.php
<?php 
session_start();
include("../config.php");
include("../class/user.class.php");
include("../class/general.class.php");
include("../class/formation.class.php");

//On inclue la classe de base pour géré le site:
//include("$url_site/class/index.class.php");


// structure de la page : 
// On inclue le header : 
// Titre De la page : 
$titre_page_act = "Formations";
include("../includes/header.inc.php");


// On envoit le menu de la page : 

include("../includes/nav.inc.php");




// Body :
?>
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Formations</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            DataTables Advanced Tables
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th>Année</th>
                                        <th>Niveau</th>
                                        <th>Domaine</th>
                                        <th>Mention</th>
                                        <!-- <th>Groupe d'accréditation</th> -->
                                        <th>Parcours</th>
                                        <th>Etablissement</th>
                                        <!--<th>Parcours Part</th>-->
                                        <th>Partenariats UBL</th>
                                        <th>Partenariats Autres</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $general = new general();
                                    $datatable = $general->getAllFormations();
                                    //print_r ($datatable);
                                    echo $general->getTable($datatable);


                                    ?>
                                    
                                </tbody>
                            </table>
                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

<?php
// Fin Body 
// On envoit le footer : 
include("../includes/footer.inc.php");

    
?><file_sep>/src/main/resources/templates/logout.php
<?php
session_start();
include("../config.php");
include("../class/user.class.php");

//On inclue la classe de base pour géré le site:
//include("$url_site/class/index.class.php");


// structure de la page : 
// On inclue le header : 
// Titre De la page : 
$titre_page_act = "Index :D";
include("../includes/header.inc.php");

$login = new User();

if ($login->already_connect() == 1 )
{
    $login->logout();
    echo'<script language="javascript">window.location.href = "../pages/index.php"</script>';
}
else
{
	echo'<script language="javascript">window.location.href = "../pages/index.php"</script>';

}

    // Fin Body 

    // On envoit le footer : 
    include("../includes/footer.inc.php");

?><file_sep>/src/main/java/org/lafactory/LaFactoryApplication.java
package org.lafactory;

import org.lafactory.dao.UsersRepository;
import org.lafactory.entities.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class LaFactoryApplication implements CommandLineRunner{
	@Autowired
	private UsersRepository usersRepository;
	public static void main(String[] args) {
		SpringApplication.run(LaFactoryApplication.class, args);
				
	}
	@Override
	public void run(String... args) throws Exception {
		usersRepository.save(new Users("RIDE", "Arnaud", "admin", "admin"));
	}
	
}
<file_sep>/src/main/java/org/lafactory/entities/difOrigami.java
package org.lafactory.entities;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="difOrigami")
public class difOrigami {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID")
	private int id;
	
	@Column(name="NOM")
	private String nom;

	public difOrigami(int id, String nom) {
		super();
		this.id = id;
		this.nom = nom;
	}

	public difOrigami() {
		super();
		// TODO Auto-generated constructor stub
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}
	
	
	
}
