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

bouton pour regénérer les qrcodes

parent 598e634b
......@@ -407,6 +407,60 @@ class AdministrationController
}
public function administrationQrcodesGenerer($request, $response, $args)
{
$evaluation = $this->conteneur->db->query("SELECT * FROM evaluations WHERE actif = 1")->fetch(PDO::FETCH_OBJ);
$config = new ConfigurationObjets($this->conteneur);
$config = $config->getConfiguration('url_serveur');
$urlAdmin = $config->value;
$urlAdmin .= $_SERVER["REQUEST_URI"];
$urlJury = $config->value;
$urlJury .= $_SERVER["REQUEST_URI"];
$urlJury=str_replace("administration/configuration","",$urlJury);
$urlAdmin=str_replace("configuration","",$urlAdmin);
$urlQrcode=$urlJury;
$urlQrcode .= 'evaluation/';
$qrCodeAdmin = new QrCode($urlAdmin);
$qrCodeAdmin->setSize(300);
$qrCodeJury = new QrCode($urlJury);
$qrCodeJury->setSize(300);
// Save it to a file
$qrCodeAdmin->writeFile(__DIR__.'/../../public/img/qrcodeAdmin.png');
$qrCodeJury->writeFile(__DIR__.'/../../public/img/qrcodeJury.png');
$qrCodeAdmin->setSize(1000);
$qrCodeJury->setSize(1000);
$qrCodeAdmin->writeFile(__DIR__.'/../../public/img/qrcodeAdminBig.png');
$qrCodeJury->writeFile(__DIR__.'/../../public/img/qrcodeJuryBig.png');
$listeParticipants = $this->conteneur->db->prepare("SELECT * FROM equipes WHERE id_evaluation = :id_evaluation ");
$listeParticipants->execute([
'id_evaluation' => $evaluation->id,
]);
$listeParticipants = $listeParticipants->fetchAll(PDO::FETCH_OBJ);
foreach ($listeParticipants as $participant) {
$urlEquipe = $urlQrcode;
$urlEquipe .= $participant->id;
$qrCodeEquipe = new QrCode($urlEquipe);
$qrCodeEquipe->setSize(400);
$qrCodeEquipe->writeFile(__DIR__.'/../../public/qrcodes/equipe_'.$participant->id.'.png');
}
return $response->withRedirect($this->conteneur->router->pathFor('administrationQrcodes', ['id_session' => 0]));
}
}
public/img/qrcodeAdmin.png

2.38 KB | W: | H:

public/img/qrcodeAdmin.png

2.62 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

7.98 KB | W: | H:

public/img/qrcodeAdminBig.png

8.32 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.38 KB | W: | H:

public/img/qrcodeJury.png

2.62 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

8.32 KB | W: | H:

public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
public/img/qrcodeJuryBig.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -76,13 +76,12 @@
<i class="fas fa-users"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<div class="collapse navbar-collapse" id="ff">
<ul class="nav navbar-nav ml-auto">
{% for uneSession in listeSessions %}
<li class="nav-item {% if session.id == uneSession.id %} active {% endif %} ">
<a class="nav-link" href="{{ path_for('administrationQrcodes', { id_session: uneSession.id }) }}">{{ uneSession.titre }}</a>
</li>
{% endfor %}
<li class="nav-item ">
<a class="nav-link" href="{{ path_for('administrationQrcodesGenerer') }}">Regénérer les qrCodes</a>
</li>
</ul>
</div>
......@@ -110,7 +109,11 @@
</div>
</div>
<div class="text-right">
{% for uneSession in listeSessions %}
<a class="btn {% if session.id == uneSession.id %} btn-primary {% else %} btn-secondary {% endif %}" href="{{ path_for('administrationQrcodes', { id_session: uneSession.id }) }}">{{ uneSession.titre }}</a>
{% endfor %}
</div>
{% if session != NULL %}
<div class="d-flex align-items-center p-3 my-3 text-white-50 bg-purple rounded shadow-sm">
......
......@@ -98,6 +98,7 @@ $app->group('/administration', function (){
$this->post('/configuration', AdministrationController::class . ':configuration')->setName('administrationConfiguration');
$this->get('/qrcodes/{id_session}', AdministrationController::class . ':administrationQrcodes')->add(AdministrationController::class . ':autorisationAdmin')->setName('administrationQrcodes');
$this->get('/qrcodes/generer/', AdministrationController::class . ':administrationQrcodesGenerer')->add(AdministrationController::class . ':autorisationAdmin')->setName('administrationQrcodesGenerer');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment