Commit c4bd5866 authored by Roca Philippe's avatar Roca Philippe
Browse files

pages d'affichage et bdd vide

parent 64c1a0e9
<?php
namespace App\Controllers;
use App\Objets\ClientObjets;
use App\Objets\EvaluationObjets;
use App\Objets\ParticipantObjets;
use App\Objets\QuestionObjets;
use App\Objets\SessionObjets;
use Psr\Container\ContainerInterface;
use App\Objets\PlanningObjets;
use PDO;
class AffichageController
{
protected $conteneur;
public function __construct(ContainerInterface $conteneur)
{
$this->conteneur = $conteneur;
}
public function accueil($request, $response, $args)
{
$evaluation = new EvaluationObjets($this->conteneur);
$evaluation = $evaluation->evalutationActive();
$contenu = [
'title' => 'Affichage',
'evaluation' => $evaluation,
];
return $this->conteneur->view->render($response,'affichageAccueil.twig', $contenu);
}
public function bilan($request, $response, $args)
{
$evaluation = new EvaluationObjets($this->conteneur);
$evaluation = $evaluation->evalutationActive();
$listeSessions = new SessionObjets($this->conteneur);
$listeSessions = $listeSessions->listerSessions($evaluation->id, 0);
$sessions = array();
foreach ($listeSessions as $unSession)
{
$id_session = $unSession->id;
$session = new SessionObjets($this->conteneur);
$listeCategories = new QuestionObjets($this->conteneur);
$session->listeCategories = $listeCategories->listerCategories($evaluation->id, $id_session);
$listeJury = new ClientObjets($this->conteneur);
$session->listeJury = $listeJury->listerClientJury($evaluation->id);
$session = $session->sessionQuestionnaire($id_session);
$epreuves = $session->epreuves;
$participants = new ParticipantObjets($this->conteneur);
$session->participants = $participants->listerParticipantsSession($evaluation->id, $id_session);
foreach ($session->participants as $participant) {
$calcul = new QuestionObjets($this->conteneur);
$participant = $calcul->resultatParicipant($participant, $epreuves, $session->listeCategories, $session->listeJury);
$participant->nbEvaluation = $calcul->nbEvaluations($participant);
}
$session->epreuves = $epreuves;
array_push($sessions, $session);
}
$contenu = [
'title' => 'Résultats',
'evaluation' => $evaluation,
'sessions' => $sessions,
];
return $this->conteneur->view->render($response,'affichageBilan.twig', $contenu);
}
public function planning($request, $response, $args)
{
$evaluation = new EvaluationObjets($this->conteneur);
$evaluation = $evaluation->evalutationActive();
/** On charge la liste des sites */
$hauteur_max = 0;
$sites = $this->conteneur->db->prepare("SELECT * FROM planning_sites WHERE id_evaluation = :id_evaluation ORDER BY nom");
$sites->execute([
'id_evaluation' => $evaluation->id,
]);
$sites = $sites->fetchAll(PDO::FETCH_OBJ);
foreach($sites as $site){
$actions = $this->conteneur->db->prepare("SELECT a.*, e.nom, e.etablissement, s.titre AS session FROM planning_actions AS a LEFT JOIN equipes AS e ON a.id_equipe = e.id LEFT JOIN sessions AS s ON s.id = a.id_session WHERE a.id_evaluation = :id_evaluation AND id_site = :id_site ORDER BY a.debut ASC");
$actions->execute([
'id_evaluation' => $evaluation->id,
'id_site' => $site->id,
]);
$actions = $actions->fetchAll(PDO::FETCH_OBJ);
foreach ($actions as $action){
$h1 = strtotime($evaluation->debut);
$h2 = strtotime($action->debut);
$action->top = ($h2-$h1)/60;
if ($action->top * 2 >= $hauteur_max) $hauteur_max = ($action->top * 2) + ($action->duree * 2);
$h1 = strtotime($action->debut);
$h2 = strtotime("01:30:00");
$h3 = strtotime("03:30:00");
$avant = date("H:i:00", $h1-$h2);
$apres = date("H:i:00", $h1+$h3);
$action->statut = 0;
$liaison = $this->conteneur->db->prepare("SELECT * FROM liaisons_clients_questionnaires WHERE id_equipe = :id_equipe AND id_evaluation = :id_evaluation AND ip_client != 'pre-eval' AND maj >= :avant AND maj <= :apres ORDER BY id DESC LIMIT 1");
$liaison->execute([
'id_evaluation' => $evaluation->id,
'id_equipe' => $action->id_equipe,
'avant' => $avant,
'apres' => $apres,
]);
$liaison = $liaison->fetch(PDO::FETCH_OBJ);
if ($liaison != false && $liaison->statut = 1) $action->statut = 1;
}
$site->actions = $actions;
}
/** On regarde l'heure pour le curseur du planning */
$h1 = strtotime($evaluation->debut);
$h2 = strtotime(date("H:i:00"));
$curseur = ($h2-$h1)/60;
$contenu = [
'title' => 'Planning',
'evaluation' => $evaluation,
'sites' => $sites,
'hauteur' => $hauteur_max,
'curseur' => $curseur,
];
return $this->conteneur->view->render($response,'affichagePlanning.twig', $contenu);
}
}
\ No newline at end of file
......@@ -381,4 +381,13 @@ class QuestionObjets
return $participant;
}
public function nbEvaluations($participant){
$nbEval = $this->conteneur->db->prepare("SELECT COUNT(DISTINCT ip_jury) AS nb FROM reponses WHERE id_equipe = :id_equipe AND ip_jury != 'pre-eval'");
$nbEval->execute([
'id_equipe' => $participant->id,
]);
$nbEval = $nbEval->fetch(PDO::FETCH_OBJ);
return $nbEval->nb;
}
}
......@@ -33,4 +33,5 @@ $container['view'] = function ($container) {
require __DIR__ . '/../routes/administration.php';
require __DIR__ . '/../routes/raspberry.php';
require __DIR__ . '/../routes/jury.php';
require __DIR__ . '/../routes/affichage.php';
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
// création d'une fonction comportant les identifiants de connexion au FTP :
function mysql_structure() {
$host = 'localhost';
$user = 'root';
$pass = 'password';
$base = 'git_site_emi';
// création d'un fichier affichant en boucle le contenu des tuples de la base :
mysql_connect($host, $user, $pass);
mysql_select_db($base);
$tables = array("dcculture_blog", "dccycloblog_media");
foreach ($tables as $table) {
$res = mysql_query("SHOW CREATE TABLE $table");
if ($res)
{
$insertions = "";
$dumpsql[] = "DROP TABLE IF EXIST $table;";
$tableau = mysql_fetch_array($res);
$tableau[1] .= ";";
$dumpsql[] = str_replace("\n", "", $tableau[1]);
$req_table = mysql_query("SELECT * FROM $table");
$nbr_champs = mysql_num_fields($req_table);
while ($ligne = mysql_fetch_array($req_table))
{
$insertions .= "INSERT INTO $table VALUES(";
for ($i=0; $i<=$nbr_champs-1; $i++)
{
$insertions .= "'" . mysql_real_escape_string($ligne[$i]) . "', ";
}
$insertions = substr($insertions, 0, -2);
$insertions .= ");\n";
}
if ($insertions != "")
{
$dumpsql[] = $insertions;
}
}
}
return implode("\r", $dumpsql);
}
// creation d'une fonction file_put_content si le script est en PHP4 :
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents ne peut pas écrire dans le fichier.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
// création du fichier de dump sur le même niveau que ce fichier dump.php
file_put_contents("sqltables_".date("d-n-Y").".sql", mysql_structure());
// effacement du fichier precedant (créé 7 jours plus tot)
$time_old = getdate(mktime()-(7*24*3600));
$an = $time_old['year'];
$mois = $time_old['mon'];
$jour = $time_old['mday'];
// formatage des jours à 1 chiffre
for($k=1; $k<10; $k++)
{
if ($jour==$k)
{
$jour='0'.$jour;
}
}
$date_old=$jour.'-'.$mois.'-'.$an;
$file_old="sqldump_".$date_old.".sql";
unlink($file_old);
?>
public/img/logo_2.png

16.3 KB | W: | H:

public/img/logo_2.png

73.2 KB | W: | H:

public/img/logo_2.png
public/img/logo_2.png
public/img/logo_2.png
public/img/logo_2.png
  • 2-up
  • Swipe
  • Onion skin
public/img/qrcodeAdmin.png

2.41 KB | W: | H:

public/img/qrcodeAdmin.png

2.38 KB | W: | H:

public/img/qrcodeAdmin.png
public/img/qrcodeAdmin.png
public/img/qrcodeAdmin.png
public/img/qrcodeAdmin.png
  • 2-up
  • Swipe
  • Onion skin
public/img/qrcodeAdminBig.png

8 KB | W: | H:

public/img/qrcodeAdminBig.png

7.98 KB | W: | H:

public/img/qrcodeAdminBig.png
public/img/qrcodeAdminBig.png
public/img/qrcodeAdminBig.png
public/img/qrcodeAdminBig.png
  • 2-up
  • Swipe
  • Onion skin
public/img/qrcodeJury.png

2.41 KB | W: | H:

public/img/qrcodeJury.png

2.38 KB | W: | H:

public/img/qrcodeJury.png
public/img/qrcodeJury.png
public/img/qrcodeJury.png
public/img/qrcodeJury.png
  • 2-up
  • Swipe
  • Onion skin
public/img/qrcodeJuryBig.png

7.95 KB | W: | H:

public/img/qrcodeJuryBig.png

7.95 KB | W: | H:

public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
  • 2-up
  • Swipe
  • Onion skin
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: May 29, 2019 at 02:30 PM
-- Server version: 5.7.23
-- PHP Version: 7.1.22
-- Adminer 4.7.5 MySQL dump
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `dane_eval_4`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`titre` varchar(255) DEFAULT 'Nouvelle catégorie',
`id_evaluation` int(11) DEFAULT NULL,
`id_session` int(11) DEFAULT '0'
`id_session` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `titre`, `id_evaluation`, `id_session`) VALUES
(1, 'Jury', 1, 1),
(2, 'Robot', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `clients`
--
DROP TABLE IF EXISTS `clients`;
CREATE TABLE `clients` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nom` varchar(255) DEFAULT 'nom',
`ip` varchar(255) DEFAULT '0.0.0.0',
`premiere_connexion` date DEFAULT NULL,
`autorisation` int(11) DEFAULT '0',
`administration` int(11) DEFAULT '0'
`administration` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `clients`
--
INSERT INTO `clients` (`id`, `nom`, `ip`, `premiere_connexion`, `autorisation`, `administration`) VALUES
(1, 'localhost', '::1', '2019-05-29', 0, 0),
(2, '172.18.0.157', '172.18.0.157', '2019-05-29', 0, 0);
-- --------------------------------------------------------
--
-- Table structure for table `configuration`
--
DROP TABLE IF EXISTS `configuration`;
CREATE TABLE `configuration` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cle` varchar(255) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL
`value` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `configuration`
--
INSERT INTO `configuration` (`id`, `cle`, `value`) VALUES
(1, 'code_jury', 'DANE19'),
(2, 'url_serveur', 'http://172.18.0.157:8888');
-- --------------------------------------------------------
--
-- Table structure for table `delegations`
--
(1, 'code_jury', 'DANE19'),
(2, 'url_serveur', 'http://172.18.1.41');
DROP TABLE IF EXISTS `delegations`;
CREATE TABLE `delegations` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_client` varchar(255) DEFAULT NULL,
`id_session` int(11) DEFAULT NULL,
`id_equipe` int(11) DEFAULT NULL,
`id_evaluation` int(11) DEFAULT NULL
`id_evaluation` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `equipes`
--
DROP TABLE IF EXISTS `equipes`;
CREATE TABLE `equipes` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nom` varchar(255) DEFAULT 'Nouvelle équipe',
`etablissement` varchar(255) DEFAULT 'Collège Lycée',
`id_evaluation` int(11) DEFAULT NULL,
`id_session` int(11) DEFAULT '0',
`actif` int(11) DEFAULT '0'
`actif` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `equipes`
--
INSERT INTO `equipes` (`id`, `nom`, `etablissement`, `id_evaluation`, `id_session`, `actif`) VALUES
(1, 'Clg F. Mauriac', 'Houdan', 1, 1, 0),
(2, 'Clg Galilée', 'Limay', 1, 1, 0),
(3, 'Clg Le bois d\'Aulne', 'Conflans Sainte-Honorine', 1, 1, 0),
(4, 'Clg L. Pasteur', 'Mantes-la-Jolie', 1, 1, 0),
(5, 'Clg L. Pergaud', 'Maurepas', 1, 1, 0),
(6, 'Clg M. Pagnol', 'Bonnières sur Seine', 1, 1, 0),
(7, 'Clg Montaigne', 'Conflans Sainte-Honorine', 1, 1, 0),
(8, 'Clg P. Bert', 'Chatou', 1, 1, 0),
(9, 'Clg P. Verlaine', 'Les Mureaux', 1, 1, 0),
(10, 'Clg R. Descartes', 'Fontenay-Le-Fleury', 1, 1, 0),
(11, 'Lyc Anhèo Glidji', 'Togo', 1, 1, 0),
(12, 'DANCE BOT', 'Collège Claude Chappe', 2, 17, 0),
(13, 'FabLab_Paul_Valery', 'Lycée Paul Valéry', 2, 17, 0),
(14, 'Fresnel1 ', 'Lycée Fresnel', 2, 17, 0),
(15, 'RCR', 'Collège Claude Chappe', 2, 23, 0),
(16, 'Les geeks du 15', 'Collège Modigliani', 2, 23, 0),
(17, 'Robotix 2', 'Collège Boris Vian', 2, 23, 0),
(18, 'Collège 1', 'Démonstration', 1, 1, 0),
(19, 'Collège 2', 'Démonstration', 1, 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `evaluations`
--
DROP TABLE IF EXISTS `evaluations`;
CREATE TABLE `evaluations` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`titre` varchar(255) NOT NULL DEFAULT 'Titre',
`soustitre` varchar(255) DEFAULT NULL,
`annee` int(11) DEFAULT NULL,
`mode` varchar(255) DEFAULT 'unique',
`actif` int(11) DEFAULT '1',
`debut` varchar(255) DEFAULT NULL
`debut` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `evaluations`
--
INSERT INTO `evaluations` (`id`, `titre`, `soustitre`, `annee`, `mode`, `actif`, `debut`) VALUES
(1, 'Robotyc', 'Finale départementale', 2019, 'unique', 1, '09:00:00'),
(2, 'Robocup Junior', 'Finale IDF', 2019, 'qrcode', 0, '09:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `liaisons_categories_questions`
--
(1, 'Mon évaluation', 'unique', 2020, 'unique', 1, '09:00:00');
DROP TABLE IF EXISTS `liaisons_categories_questions`;
CREATE TABLE `liaisons_categories_questions` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_question` int(11) DEFAULT NULL,
`id_categorie` int(11) DEFAULT NULL
`id_categorie` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `liaisons_categories_questions`
--
INSERT INTO `liaisons_categories_questions` (`id`, `id_question`, `id_categorie`) VALUES
(1, 1, 1),
(2, 20, 1),
(3, 1, 2),
(4, 21, 2),
(5, 23, 2),
(6, 24, 2),
(7, 25, 2),
(8, 26, 2),
(9, 27, 2),
(10, 29, 2),
(11, 30, 2),
(12, 31, 2);
-- --------------------------------------------------------
--
-- Table structure for table `liaisons_clients_questionnaires`
--
DROP TABLE IF EXISTS `liaisons_clients_questionnaires`;
CREATE TABLE `liaisons_clients_questionnaires` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_client` varchar(255) DEFAULT NULL,
`id_equipe` int(11) DEFAULT NULL,
`id_evaluation` int(11) DEFAULT NULL,
`id_session` int(11) DEFAULT NULL,
`statut` int(11) DEFAULT '0',
`maj` varchar(255) DEFAULT NULL
`maj` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `planning_actions`
--
DROP TABLE IF EXISTS `planning_actions`;
CREATE TABLE `planning_actions` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_site` int(11) DEFAULT NULL,
`titre` varchar(255) DEFAULT NULL,
`id_evaluation` int(11) DEFAULT NULL,
`id_equipe` int(11) DEFAULT NULL,
`id_session` int(11) DEFAULT NULL,
`debut` varchar(255) DEFAULT NULL,
`duree` int(11) DEFAULT NULL
`duree` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `planning_actions`
--
INSERT INTO `planning_actions` (`id`, `id_site`, `titre`, `id_evaluation`, `id_equipe`, `id_session`, `debut`, `duree`) VALUES
(1, 1, 'Lancement', 1, 0, 0, '09:00:00', 15),
(2, 4, 'Lancement', 1, 0, 0, '09:00:00', 15),
(3, 1, 'Installation', 1, 2, 0, '09:15:00', 25),
(4, 4, 'Installation', 1, 4, 0, '09:15:00', 25),
(5, 1, '', 1, 2, 0, '09:40:00', 25),
(6, 1, 'Installation', 1, 5, 0, '10:05:00', 25),
(7, 1, '', 1, 5, 0, '10:30:00', 25),
(8, 1, 'Installation', 1, 9, 0, '10:55:00', 25),
(9, 1, '', 1, 9, 0, '11:20:00', 25),
(10, 1, 'Installation', 1, 3, 0, '11:45:00', 25),
(11, 1, 'Pause jury', 1, 0, 0, '12:10:00', 40),
(12, 1, '', 1, 3, 0, '12:50:00', 25),
(13, 1, 'Installation', 1, 1, 0, '13:15:00', 25),
(14, 1, '', 1, 1, 0, '13:40:00', 25),
(15, 1, 'Installation', 1, 11, 0, '14:05:00', 25),
(16, 1, '', 1, 11, 0, '14:30:00', 25),
(17, 4, '', 1, 4, 0, '10:05:00', 25),
(18, 4, 'Installation', 1, 6, 0, '10:30:00', 25),
(19, 4, '', 1, 6, 0, '10:55:00', 25),
(20, 4, 'Installation', 1, 10, 0, '11:20:00', 25),
(21, 4, '', 1, 10, 0, '11:45:00', 25),
(22, 4, 'Pause jury', 1, 0, 0, '12:10:00', 40),
(23, 4, 'Installation', 1, 7, 0, '12:50:00', 25),
(24, 4, '', 1, 7, 0, '13:15:00', 25),
(25, 4, 'Installation', 1, 8, 0, '13:40:00', 25),
(26, 4, '', 1, 8, 0, '14:05:00', 25),
(27, 1, 'Délibération jury', 1, 0, 0, '14:55:00', 20),
(28, 4, 'Délibération jury', 1, 0, 0, '14:55:00', 20),
(29, 1, 'Remise des prix', 1, 0, 0, '15:15:00', 30),
(30, 4, 'Remise des prix', 1, 0, 0, '15:15:00', 30);
-- --------------------------------------------------------
--