par
cassius25 » 06 juin 2022, 01:56
Je suis sur um projet de gestion d'emploi de temps pour une université. La partie création est bonne mais la partie qui me pose problème c'est comment faire pour afficher les informations de mon emploi sous forme de tableaux dans mon navigateur. Voici un peu mon bout de code pour le faire
Code : Tout sélectionner
<?php
session_start();
/**
* Inclusion de la page de connexion à la base de données
*/
require('connexion.php');
// TRAITEMENT POUR LA PAGE PERSONNALISÉE DU RECTEUR
$sqlH = "SELECT DISTINCT (horaire) FROM jour_horaire";
$horaires = $connexion->query($sqlH);
$horaire = $horaires->fetch_all();
$sqlNiveau = "SELECT DISTINCT(niveau) FROM emploi_etudiant";
$niveaux = $connexion->query($sqlNiveau);
$sqlFiliere = "SELECT (nom_filiere) FROM emploi_etudiant";
$filieres = $connexion->query($sqlFiliere);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css">
<title>Gestion des emplois de temps</title>
<style>
li a,
th {
text-transform: uppercase;
}
h1 {
text-align: center;
}
.pull-right {
margin-top: 3.8px;
margin-right: 5px;
}
html {
margin: 10px;
}
#printable {
width: 100%;
margin: auto;
}
@media print {
.btn,
caption {
display: none;
}
}
i {
text-transform: uppercase;
}
i {
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<section class="row">
<!-- EN-TETE DE NOTRE PAGE -->
<?php include('utils/navS.php'); ?>
</nav>
</section>
</div>
<div class="row" id="printable">
<h4 style="text-decoration:underline;text-align: center; font-family:'Times New Roman', Times, serif; font-weight: bold;font-size: xx-large;">EMPLOI DE TEMPS DES ÉTUDIANTS</h4>
<?php
if ($filieres->num_rows > 0) {
$f = 0;
$filiere = $filieres->fetch_all();
$filiereSize = count($filiere);
//print_r($filiere);
//die();
while ($f < $filiereSize) {
$faculty = $filiere[$f][0];
if ($niveaux->num_rows > 0) {
$k = 0;
$niveau = $niveaux->fetch_all();
// print_r($niveau);
//die();
while ($k < 3) {
$level = $niveau[$k][0];
$sql = "SELECT * FROM emploi_etudiant WHERE niveau = '" . $level . "' AND nom_filiere = '" . $faculty . "'";
$result = $connexion->query($sql);
if ($result->num_rows > 0) {
?>
<section class="col-lg-12 table-responsive well">
<table class="table table-bordered table-striped table-condensed">
<caption>
<h4>EMPLOI DE TEMPS DES ÉTUDIANTS</h4>
<blockquote style="text-transform: uppercase;"><?php echo $faculty . " - " . $level; ?></blockquote>
</caption>
<thead>
<th class="success">Horaires</th>
<th class="warning">Lundi</th>
<th class="danger">Mardi</th>
<th class="active">Mercredi</th>
<th class="success">Jeudi</th>
<th class="primary">Vendredi</th>
<th class="info">Samedi</th>
<th class="default">Dimanche</th>
</thead>
<tbody>
<?php
$i = 0;
while ($rows = $result->fetch_assoc() or $i < 5) {
?>
<tr>
<td class="success">
<?php
echo $horaire[$i][0];
?>
</td>
<?php
switch ($rows['jour']) {
case 'Lundi':
?>
<td class="danger">
<i><?php echo $rows['code_ue']; ?></i><br> |
<i><?php echo $rows['nom_salle']; ?></i> |<br>
<i><?php echo $rows['nom_enseignant']; ?></i>
</td>
<?php
break;
case 'Mardi':
?>
<td class="danger"></td>
<td class="success">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="active"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Mercredi':
?>
<<td class="danger">
</td>
<td class="active"></td>
<td class="success">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Jeudi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Vendredi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"></td>
<td class="primary">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Samedi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="primary">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Dimanche':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="default">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<?php
break;
default:
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
}
$i = $i + 1;
?>
</tr>
<?php
}
}
?>
<tbody>
</table>
</section>
<?php
$k = $k + 1;
}
}
$f = $f + 1;
}
}
?>
</div>
<div class="col-lg-6">
<button onclick="actualiser()" class="btn btn-lg btn-success">REFRESH</button>
<button class="btn btn-lg btn-warning pull-right" onclick="imprimer()">PRINT THIS PAGE</button>
</div>
<script>
function actualiser() {
window.location.reload(true);
}
function imprimer() {
window.print();
}
</script>
</body>
</html>
et voici comment ça s'affiche dans mon navigateur
[img]file:///home/anc-em/Images/errerEmploi.png[/img]
Comment dois-je faire ? Merci d'avance
Je suis sur um projet de gestion d'emploi de temps pour une université. La partie création est bonne mais la partie qui me pose problème c'est comment faire pour afficher les informations de mon emploi sous forme de tableaux dans mon navigateur. Voici un peu mon bout de code pour le faire
[code]
<?php
session_start();
/**
* Inclusion de la page de connexion à la base de données
*/
require('connexion.php');
// TRAITEMENT POUR LA PAGE PERSONNALISÉE DU RECTEUR
$sqlH = "SELECT DISTINCT (horaire) FROM jour_horaire";
$horaires = $connexion->query($sqlH);
$horaire = $horaires->fetch_all();
$sqlNiveau = "SELECT DISTINCT(niveau) FROM emploi_etudiant";
$niveaux = $connexion->query($sqlNiveau);
$sqlFiliere = "SELECT (nom_filiere) FROM emploi_etudiant";
$filieres = $connexion->query($sqlFiliere);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css">
<title>Gestion des emplois de temps</title>
<style>
li a,
th {
text-transform: uppercase;
}
h1 {
text-align: center;
}
.pull-right {
margin-top: 3.8px;
margin-right: 5px;
}
html {
margin: 10px;
}
#printable {
width: 100%;
margin: auto;
}
@media print {
.btn,
caption {
display: none;
}
}
i {
text-transform: uppercase;
}
i {
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<section class="row">
<!-- EN-TETE DE NOTRE PAGE -->
<?php include('utils/navS.php'); ?>
</nav>
</section>
</div>
<div class="row" id="printable">
<h4 style="text-decoration:underline;text-align: center; font-family:'Times New Roman', Times, serif; font-weight: bold;font-size: xx-large;">EMPLOI DE TEMPS DES ÉTUDIANTS</h4>
<?php
if ($filieres->num_rows > 0) {
$f = 0;
$filiere = $filieres->fetch_all();
$filiereSize = count($filiere);
//print_r($filiere);
//die();
while ($f < $filiereSize) {
$faculty = $filiere[$f][0];
if ($niveaux->num_rows > 0) {
$k = 0;
$niveau = $niveaux->fetch_all();
// print_r($niveau);
//die();
while ($k < 3) {
$level = $niveau[$k][0];
$sql = "SELECT * FROM emploi_etudiant WHERE niveau = '" . $level . "' AND nom_filiere = '" . $faculty . "'";
$result = $connexion->query($sql);
if ($result->num_rows > 0) {
?>
<section class="col-lg-12 table-responsive well">
<table class="table table-bordered table-striped table-condensed">
<caption>
<h4>EMPLOI DE TEMPS DES ÉTUDIANTS</h4>
<blockquote style="text-transform: uppercase;"><?php echo $faculty . " - " . $level; ?></blockquote>
</caption>
<thead>
<th class="success">Horaires</th>
<th class="warning">Lundi</th>
<th class="danger">Mardi</th>
<th class="active">Mercredi</th>
<th class="success">Jeudi</th>
<th class="primary">Vendredi</th>
<th class="info">Samedi</th>
<th class="default">Dimanche</th>
</thead>
<tbody>
<?php
$i = 0;
while ($rows = $result->fetch_assoc() or $i < 5) {
?>
<tr>
<td class="success">
<?php
echo $horaire[$i][0];
?>
</td>
<?php
switch ($rows['jour']) {
case 'Lundi':
?>
<td class="danger">
<i><?php echo $rows['code_ue']; ?></i><br> |
<i><?php echo $rows['nom_salle']; ?></i> |<br>
<i><?php echo $rows['nom_enseignant']; ?></i>
</td>
<?php
break;
case 'Mardi':
?>
<td class="danger"></td>
<td class="success">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="active"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Mercredi':
?>
<<td class="danger">
</td>
<td class="active"></td>
<td class="success">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Jeudi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Vendredi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"></td>
<td class="primary">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Samedi':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="primary">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<td class="default"><?php echo ""; ?></td>
<?php
break;
case 'Dimanche':
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="default">
<p><?php echo $rows['code_ue']; ?></p>
<p><?php echo $rows['nom_salle']; ?></p>
<p><?php echo $rows['nom_enseignant']; ?></p>
</td>
<?php
break;
default:
?>
<td class="danger"></td>
<td class="active"></td>
<td class="success"></td>
<td class="warning"><?php echo ""; ?></td>
<td class="primary"><?php echo ""; ?></td>
<td class="info"><?php echo ""; ?></td>
<td class="default"><?php echo ""; ?></td>
<?php
}
$i = $i + 1;
?>
</tr>
<?php
}
}
?>
<tbody>
</table>
</section>
<?php
$k = $k + 1;
}
}
$f = $f + 1;
}
}
?>
</div>
<div class="col-lg-6">
<button onclick="actualiser()" class="btn btn-lg btn-success">REFRESH</button>
<button class="btn btn-lg btn-warning pull-right" onclick="imprimer()">PRINT THIS PAGE</button>
</div>
<script>
function actualiser() {
window.location.reload(true);
}
function imprimer() {
window.print();
}
</script>
</body>
</html>
[/code]
et voici comment ça s'affiche dans mon navigateur
[img]file:///home/anc-em/Images/errerEmploi.png[/img]
Comment dois-je faire ? Merci d'avance