Exemplo n.º 1
0
     });
     $this->get('/random', function ($request, $response, $args) use($dati) {
         $response = $response->withHeader('Content-type', 'application/pdf');
         $response = $this->renderer->render($response, 'pdf/random.php', array('dati' => $dati));
         return $response;
     });
     $this->get('/squadre', function ($request, $response, $args) use($dati) {
         $response = $response->withHeader('Content-type', 'application/pdf');
         $response = $this->renderer->render($response, 'pdf/squadre.php', array('dati' => $dati));
         return $response;
     });
 });
 $app->get('/download/barcodes', function ($request, $response, $args) use($dati) {
     $response = $this->renderer->render($response, 'pdf/barcodes.php', array('dati' => $dati, 'download' => true));
     $file = 'barcode.txt';
     $res = $app->response();
     $res['Content-Description'] = 'File Transfer';
     $res['Content-Type'] = 'application/octet-stream';
     $res['Content-Disposition'] = 'attachment; filename="' . basename($file) . '"';
     $res['Content-Transfer-Encoding'] = 'binary';
     $res['Expires'] = '0';
     $res['Cache-Control'] = 'must-revalidate';
     $res['Pragma'] = 'public';
     $res['Content-Length'] = filesize($file);
     readfile($file);
     unlink($file);
     return $response;
 });
 /* Blocca/abilita */
 $app->group('/cambia', function () use($dati) {
     $this->get('/aula/:id', function ($request, $response, $args) use($dati) {