Ejemplo n.º 1
0
    die("LOGINPROBLEM");
} else {
    $user_level = get_user_level($utente);
    if ($user_level == 0) {
        die("LOGINPROBLEM");
    }
    if ($user_level == 1) {
        die('LOGINPROBLEM');
    }
    $ora = $_POST["ora"];
    $db = database_connect();
    $result = $db->query("SELECT utenti.nome, utenti.cognome from utenti where level = '0' and (SELECT COUNT(*) from iscrizioni where iscrizioni.idUtente = utenti.id and iscrizioni.ora = '{$ora}') = 0 ORDER by cognome, nome asc") or die($db->error);
    $file = array();
    $code = "\n<style>td, th{border:1px solid; padding: 5px 30px;}</style> <h3 style='text-align:center; margin-bottom:0px;'>L. S. \"G. Galilei\" - \"Finestra tecnica\"</h3><h1 style='text-align:center;margin-bottom: 5px; margin-top:15px;'>" . getStringaOra($ora) . "</h1>";
    $code .= "<table style='border-collapse:collapse; margin-top:20px;'><tbody><tr>\n  <td style='width:230px;'><b>Cognome</b></td>\n  <td style='width:230px;'><b>Nome</b>  </td>\n  <td style='width:250px; text-align:center;'><b>Firma</b>  </td>\n</tr>";
    while ($utente = $result->fetch_assoc()) {
        $code .= "<tr>\n              <td>" . $utente["cognome"] . "</td>\n              <td>" . $utente["nome"] . "</td>\n              <td></td>\n            </tr>";
    }
    $code .= "</tbody></table>";
    $mpdf = new mPDF('utf-8', "A4");
    // , '' , '' , 50 , 1 , 1 , 1 , 1 , 1);
    $mpdf->SetDisplayMode('fullpage');
    $mpdf->list_indent_first_level = 0;
    // 1 or 0 - whether to indent the first level of a list
    $mpdf->WriteHTML($code);
    chdir("./tmp/orebuche/");
    $fileName = getStringaOraBreve($ora);
    $mpdf->Output("{$fileName}.pdf", "F");
    //rename("$fileName.pdf", getStringaOraBreve($ora)."/".$fileName.".pdf");
    echo $fileName . ".pdf";
}
Ejemplo n.º 2
0
function generaRegistroOra($idLezione, $ora)
{
    $db = database_connect();
    $result = $db->query("SELECT utenti.nome, utenti.cognome, corsi.titolo, corsi.descrizione, aule.nomeAula as aula\n\t                    from utenti, corsi, lezioni, corsi_docenti, aule\n\t                    where lezioni.id = {$idLezione} AND\n\t                          corsi.id = lezioni.idCorso AND\n\t\t\t\t\t\t\t\tcorsi.id = corsi_docenti.idCorso\n                                AND corsi_docenti.idDocente = utenti.id\n                                AND lezioni.idAula = aule.id\n                                GROUP BY corsi.id");
    $dettagliLezione = $result->fetch_assoc();
    $result = $db->query("SELECT utenti.nome, utenti.cognome, utenti.classe\n\t                      from  utenti, iscrizioni\n\t                      where iscrizioni.idLezione = '{$idLezione}' AND\n\t                            iscrizioni.idUtente = utenti.id AND\n\t                            iscrizioni.partecipa = '1' ORDER BY cognome, nome");
    $code = "<h3 style='text-align:center; margin-bottom:0px;'>L. S. \"G. Galilei\" - \"Finestra tecnica\"</h3><h1 style='text-align:center;margin-bottom: 5px; margin-top:15px;'>" . $dettagliLezione["titolo"] . "</h1>";
    $code .= "<h4 style='text-align:center; margin-top:0px;'>" . getStringaOra($ora) . " - AULA " . $dettagliLezione["aula"] . "</h4>";
    $code .= "<span style='font-size:110%;'><b>DOCENTE: </b>" . $dettagliLezione["nome"][0] . ". " . $dettagliLezione["cognome"] . "</span><br/>";
    $code .= "<br/><span style='font-size:110%; margin-top:30px;'><b>ARGOMENTO: </b>_______________________________________________________________</span>";
    $code .= "<br/></br/><br/><style>td, th{border:1px solid; padding: 5px 15px;}</style>";
    $code .= "<table style='border-collapse:collapse; margin-top:20px;'><tbody><tr>\n\t  <td style='width:230px;'><b>Cognome</b></td>\n\t  <td style='width:230px;'><b>Nome</b>  </td>\n\t  <td style='width:100px; text-align:center;'><b>Classe</b>  </td>\n\t  <td style='width:150px; text-align:center;'><b>Assente (*)</b>  </td>\n\t</tr>";
    while ($iscritto = $result->fetch_assoc()) {
        $code .= "<tr style='height:40px;'>\n\t    <td>\n\t    " . $iscritto["cognome"] . "\n\t    </td>\n\t    <td>\n\t    " . $iscritto["nome"] . "\n\t    </td>\n\t    <td style='text-align:center;'>\n\t    " . $iscritto["classe"] . "\n\t    </td>\n\t    <td> </td>\n\t  </tr>";
    }
    $code .= "<tr style='color:white;'>\n\t            <td style='color:white;'>.</td>\n\t            <td></td>\n\t            <td></td>\n\t            <td></td>\n\t          </tr>\n\t          <tr style='color:white;'>\n\t            <td style='color:white;'>.</td>\n\t            <td></td>\n\t            <td></td>\n\t            <td></td>\n\t          </tr>\n\t          <tr style='color:white;'>\n\t            <td style='color:white;'>.</td>\n\t            <td></td>\n\t            <td></td>\n\t            <td></td>\n\t          </tr>\n\t          <tr style='color:white;'>\n\t            <td style='color:white;'>.</td>\n\t            <td></td>\n\t            <td></td>\n\t            <td></td>\n\t          </tr>\n\t          <tr style='color:white;'>\n\t            <td style='color:white;'>.</td>\n\t            <td></td>\n\t            <td></td>\n\t            <td></td>\n\t          </tr>";
    $code .= "</tbody></table><br/><br/>\n\t<b style='font-size:110%;'>(*) Va SOLO segnata l'assenza dello studente con la lettera A</b><br/><br/><br/>\n\t<div style='text-align:right'>\n\t<b >FIRMA del DOCENTE</b><br/><br/>\n\t__________________________________________\n\n\t</div>\n\t";
    $mpdf = new mPDF('utf-8', "A4");
    // , '' , '' , 50 , 1 , 1 , 1 , 1 , 1);
    $mpdf->SetDisplayMode('fullpage');
    $mpdf->list_indent_first_level = 0;
    // 1 or 0 - whether to indent the first level of a list
    $mpdf->WriteHTML($code);
    if (!file_exists("./tmp/registrini" . getStringaOraBreve($ora))) {
        mkdir("./tmp/registrini/" . getStringaOraBreve($ora), 0777, true);
        chmod("./tmp/registrini/" . getStringaOraBreve($ora), 0777);
    }
    $fileName = getStringaOraBreve($ora) . "/" . $dettagliLezione["titolo"] . "_" . getStringaOraBreve($ora) . "_" . $dettagliLezione["aula"];
    $mpdf->Output("./tmp/registrini/{$fileName}.pdf", "F");
}