if (isAdminUserAutenticate()) { echo ' <span class="label label-info pull-right"><a href="' . $dati['info']['root'] . 'modifica/tipo/' . $result["id"] . '">Modifica</a></span> <span><span><span class="label label-success pull-right"><a '; if (modo()) { echo 'id="stato"'; } else { echo 'href="' . $dati['info']['root'] . 'cambia/tipo/' . $result["id"] . '"'; } echo '><i class="fa fa-eye"></i> Abilita</a></span></span></span>'; } echo ' </td> <td>' . $result["id"] . '</td> <td>'; $ricerca = ricerca($utenti, $result["creatore"]); if ($ricerca != -1) { echo $utenti[$ricerca]["nome"]; } echo '</td> <td>' . $cont . '</td> </tr>'; } } } echo ' </tbody> </table>'; } echo ' </div>
if (isUserAutenticate()) { $results = $dati['database']->select("citazioni", "*", array("stato" => "0", "LIMIT" => 4, "ORDER" => "id DESC")); $profs = $dati['database']->select("profs", array("id", "nome"), array("ORDER" => "id")); echo ' <div class="jumbotron"> <div class="container"> <h2 class="text-center"><i class="fa fa-comments fa-2x"></i> Ultime citazioni inserite</h2> <div class="row">'; if ($results != null) { foreach ($results as $key => $result) { echo ' <div class="col-xs-12 col-sm-6 col-md-3"> <blockquote> <p>' . stripcslashes($result["descrizione"]) . '</p> <footer>'; $prof = ricerca($profs, $result["prof"]); if ($prof != -1) { echo $profs[$prof]["nome"]; } echo '</footer> </blockquote> </div>'; } } echo ' </div> <a href="' . $dati['info']['root'] . 'citazioni" class="btn btn-success btn-lg">Mostra di più <i class="fa fa-chevron-right"></i></a> </div> </div> <hr>'; if (!$dati["first"] && $dati["autogestione"] != null) {
$studenti = $dati['database']->select("studenti", "*", array("id" => $dati['database']->max("studenti", "id"), "ORDER" => "persona")); $classi = $dati['database']->select("classi", "*", array("ORDER" => "id")); $utenti = $dati['database']->select("persone", "*", array("ORDER" => "id")); $datas = $dati['database']->select("corsi", "*", array("AND" => array("quando[!]" => null, "stato" => 0), "ORDER" => "id")); if ($datas != null) { foreach ($datas as $data) { $cont = 0; $text = ""; $results = $dati['database']->select("iscrizioni", "*", array("AND" => array("corso" => $data["id"], "stato" => 0))); if ($results != null) { foreach ($results as $result) { $utente = ricerca($utenti, $result["persona"]); if ($utente != -1) { $studente = ricerca($studenti, $result["persona"], "persona"); if ($studente != -1) { $classe = ricerca($classi, $studenti[$studente]["classe"]); if ($classe != -1) { if ($cont != 0) { $text .= "<br>"; } $cont++; $text .= $utenti[$utente]["nome"] . ' (' . $classi[$classe]["nome"] . ')'; } } } } } $pdf->Chapter($data["nome"] . " (" . orario($data["quando"]) . ", " . $data["aule"] . ")", $text); } } $pdf->Output();
$classe = 'Nessuna classe'; } $cont = 0; if (isset($numero[$result["id"]]) && $numero[$result["id"]] != null) { $cont = $numero[$result["id"]]; } else { $cont = 0; } echo ' <tr> <td>' . $result['nome'] . '</td> <td>' . $classe . '</td> <td>' . $scuola . '</td> <td>' . $cont . '</td>'; if (isAdminUserAutenticate()) { $ricerca = ricerca($permessi, $result['id'], "persona"); if ($ricerca != -1) { if ($permessi[$ricerca]["admin"] == 0) { if ($result['stato'] != 0) { echo ' <td id="cred"> <span class="hidden" id="value">' . $result['id'] . '</span> <a class="btn btn-danger" id="reset">Reset credenziali'; if ($result['stato'] != 1) { echo '(recupero effettuato)'; } echo '</a> </td>'; } else { echo ' <td>Username: '******'username'] . ' - Password: '******'password']) . '</td>';
} else { if (isset($newsletter)) { set_time_limit(60 * 50); $corsi = $dati['database']->select("corsi", "*", array("AND" => array("autogestione" => $dati['database']->max("autogestioni", "id"), "quando[!]" => null, "stato" => 0), "ORDER" => "id")); $iscritti = $dati['database']->select("iscrizioni", "*", array("ORDER" => "corso")); $studenti = $dati['database']->select("studenti", "*", array("id" => $dati['database']->max("studenti", "id"), "ORDER" => "persona")); $results = $dati['database']->select("persone", "*"); if ($results != null) { foreach ($results as $result) { if ($result["email"] != "" && $result["inviata"] == 0 && ricerca($studenti, $result["id"], "persona") != -1) { $msg = "<p>Volevamo informarti in relazione alle tue iscrizioni ai corsi dell'autogestione.</p>\n<p>Corsi in cui sei iscritti:</p>"; $iscrizioni = io($iscritti, $result["id"], 0); if ($iscrizioni != null) { // print_r($iscrizioni); foreach ($iscrizioni as $iscrizione) { $corso = ricerca($corsi, $iscrizione); if ($corso != -1) { $msg .= "<p>" . orario($corsi[$corso]["quando"]) . ": " . $corsi[$corso]["nome"] . ", in " . $corsi[$corso]["aule"] . "</p>"; $when = explode(",", $corsi[$corso]["quando"]); } } if ($result["random"] == 1) { $msg .= "<p>Attenzione: alcune iscrizioni potrebbero essere cambiate, quindi ricontrollale!!!</p><br><p>È possibile che almeno uno dei corsi sia stato assegnato a caso, poichè non ti eri iscritto personalmente.</p>"; } send(decode($result["email"]), $dati['info']['sito'], "Riepilogo corsi", $msg, $result["nome"]); $dati['database']->update("persone", array("inviata" => 1), array("id" => $result["id"])); } } } } $dati['database']->update("autogestioni", array("newsletter" => 1), array("id" => $dati["autogestione"]));
} if (isAdminUserAutenticate()) { require_once 'pdf.php'; $pdf = new PDF(); $persone = $dati['database']->select("persone", "*", array("ORDER" => "id")); $studenti = $dati['database']->select("studenti", "*", array("id" => $dati['database']->max("studenti", "id"))); $felpe = $dati['database']->select("felpe", "*"); $datas = $dati['database']->select("classi", "*"); if ($datas != null) { foreach ($datas as $data) { $text = ""; $cont = 0; foreach ($studenti as $key => $studente) { if ($studente["classe"] == $data["id"]) { $persona = ricerca($persone, $studente["persona"]); $felpa = ricerca($felpe, $persone[$persona]["id"]); if ($persona != -1 && $felpa != -1) { if ($cont != 0) { $text .= "</brnewline>"; } $cont++; $text .= $persone[$persona]["nome"] . "<br>Colore: " . colore($felpe[$felpa]["colore"]) . "<br>Taglia: " . taglia($felpe[$felpa]["taglia"]); } unset($studenti[$key]); } } if ($cont != 0) { $pdf->Chapter("Ordini della classe " . $data["nome"], $text); } } }
echo '> <h3>' . $result["nome"] . ' <a href="' . $dati['info']['root'] . 'corso/' . $result["id"] . '"><small>Approfondisci <i class="fa fa-chevron-right"></i></small></a></h3> <span class="hidden" id="value">' . $result["id"] . '</span> <p><strong>Orario: <span id="orario">' . orario($result["quando"]) . '</span></strong></p> <p>Aule: ' . $result["aule"] . '</p> <p id="descrizione">' . $result["descrizione"] . '</p> <p><strong>Creato da '; if (ricerca($utenti, $result["creatore"]) != -1) { echo $utenti[ricerca($utenti, $result["creatore"])]["nome"]; } echo '</strong></p>'; if ($scuola != $result["scuola"]) { echo ' <p><strong>Scuola: '; if (ricerca($scuole, $result["scuola"]) != -1) { echo $scuole[ricerca($scuole, $result["scuola"])]["nome"]; } echo '</strong></p>'; } if ($tempo) { echo ' <ul class="links"> <li><a '; if (modo()) { echo 'id="stato"'; } else { echo 'href="' . $dati['info']['root'] . 'stato/' . $result["id"] . '"'; } echo ' class="btn btn-success"><i class="fa fa-eye"></i> Abilita</a></li> </ul>'; }
echo ' <li><a href="' . $dati['info']['root'] . 'impostazioni">Modifica impostazioni</a></li> <li><a href="' . $dati['info']['root'] . 'email">Modifica email</a></li>'; } echo ' </ul> </div> </div> </div> <div class="col-xs-12 col-md-9">'; } $corsi = $dati['database']->select("corsi", "*", array("AND" => array("stato" => 0, "autogestione" => $dati['autogestione']), "ORDER" => "id")); $results = $dati['database']->select("iscrizioni", "*", array("AND" => array("persona" => $id, "stato" => 0))); if ($results != null) { foreach ($results as $result) { $corso = ricerca($corsi, $result["corso"]); if ($corso != -1) { echo ' <section> <p class="title"><a href="' . $dati['info']['root'] . 'corso/' . $corsi[$corso]["id"] . '">' . $corsi[$corso]["nome"] . '</a>'; echo '</p> <p><strong>Orario: ' . orario($corsi[$corso]["quando"]) . '</strong></p> <p>Aule: ' . $corsi[$corso]["aule"] . '</p> <p id="descrizione">' . $corsi[$corso]["descrizione"] . '</p>'; if ($id == $dati["user"] && tempo($dati['database'])) { if ($corsi[$corso]["quando"] == "1,2,3,4,5") { $squadra = squadra($dati['database'], $dati['autogestione'], $dati["user"]); if ($squadra == null) { echo ' <a id="squad" href="' . $dati['info']['root'] . 'squadra" class="btn btn-primary btn-block btn-lg">Crea squadra</a>'; } else {
require_once 'utility.php'; } if (isAdminUserAutenticate()) { require_once 'pdf.php'; $pdf = new PDF(); $persone = $dati['database']->select("persone", "*", array("ORDER" => "id")); $studenti = $dati['database']->select("studenti", "*", array("id" => $dati['database']->max("studenti", "id"))); $datas = $dati['database']->select("classi", "*"); if ($datas != null) { foreach ($datas as $data) { $text = ""; $cont = 0; $stato = 0; foreach ($studenti as $key => $studente) { if ($studente["classe"] == $data["id"]) { $persona = ricerca($persone, $studente["persona"]); if ($persona != -1) { if ($cont != 0 && $stato != 1) { $text .= "</brnewline>"; } $stato = $persone[$persona]["stato"]; $cont++; if ($stato != 1) { $text .= $persone[$persona]["nome"] . "<br>Username: "******"username"] . "<br>Password: "******"password"]); } } unset($studenti[$key]); } } if ($cont != 0) { $pdf->Chapter("Classe " . $data["nome"], $text);
<blockquote> ' . stripcslashes($result["descrizione"]) . ' <footer>'; $prof = ricerca($profs, $result["prof"]); $utente = ricerca($utenti, $result["creatore"]); if ($prof != -1) { echo $profs[$prof]["nome"]; } if ($utente != -1) { echo ', inserito da <cite title="' . $utenti[$utente]["nome"] . '">' . $utenti[$utente]["nome"] . '</cite>'; } echo '</footer> </blockquote>'; if (ricerca($utenti, $result["da"]) != -1) { echo ' <p id="dis">Disabilitato da ' . $utenti[ricerca($utenti, $result["da"])]["nome"] . '</p>'; } echo ' <ul class="links"> <li><a '; if (modo()) { echo 'id="stato"'; } else { echo 'href="' . $dati['info']['root'] . 'cambia/citazione/' . $result["id"] . '"'; } echo ' class="btn btn-success"><i class="fa fa-eye"></i> Abilita</a></li> </ul> </section> </td> <td>' . $result["id"] . '</td> <td>' . $profs[$prof]["nome"] . '</td>
/** * Individua tutte le riccorenze di un elemento in un'array ordinato * * @param mixed[] $array * @param mixed $elemento * @param string $where Campo di ricerca */ function ricorrenza($array, $elemento, $where = "id") { $result = array(); $i = 0; $index = ricerca($array, $elemento, $where); while ($index != -1) { $result[$i++] = $array[$index]; $index = ricerca($array, $elemento, $where, $index + 1); } return $result; }
echo ' <tr> <td> <sectionlight-grey"> <h3>' . $result["nome"] . '</h3>'; if (isAdminUserAutenticate()) { echo ' <a href="' . $dati['info']['root'] . 'cambia/aula/' . $result["id"] . '" class="label green pull-right"><i class="fa fa-check"></i></a>'; } echo ' <p><strong>Durata: ' . $result["quanto"] . ' ore</strong></p> <p>Luogo: ' . $result["dove"] . '</p> <p id="descrizione">' . $result["descrizione"] . '</p> <p><strong>Creato da ' . $utenti[ricerca($utenti, $result["creatore"])]["nome"]; if (ricerca($utenti, $result["da"]) != -1) { echo ', disabilitato da ' . $utenti[ricerca($utenti, $result["da"])]["nome"]; } echo '</strong></p> </div> </td> </tr>'; } } } echo ' </tbody> </table> </div> </div> </div>'; }
$persone = $dati['database']->select("persone", array("id", "nome", "username", "password", "stato"), array("ORDER" => "id")); $studenti = $dati['database']->select("studenti", "*", array("id" => $dati['database']->max("studenti", "id"), "ORDER" => "persona")); $datas = $dati['database']->select("classi", "*"); if ($datas != null) { foreach ($datas as $data) { $pdf->SetFillColor(200, 220, 255); $pdf->Cell(0, 12, $data["nome"], 0, 1, 'L', true); $y = 75; $x = 150; foreach ($studenti as $key => $studente) { if ($studente["classe"] == $data["id"]) { $persona = ricerca($persone, $studente["persona"]); if ($persona != -1) { $ean = ricerca($eans, $studente["persona"], "persona"); if ($ean != -1) { $code = $eans[ricerca($eans, $studente["persona"], "persona")]["ean"]; // barcode, of course ;) $result = Barcode::fpdf($pdf, $black, $x, $y, $angle, $type, array('code' => $code), $width, $height); $len = $pdf->GetStringWidth($result['hri']); Barcode::rotate(-$len / 2, $result['height'] / 2 + $fontSize + $marge, $angle, $xt, $yt); $nome = $persone[$persona]["nome"]; $pdf->TextWithRotation($x + $xt - (strlen($nome) + strlen($nome) / 2), $y + $yt, $nome, $angle); if ($pdf->GetPageHeight() > $y + 100) { $y += 100; } else { $y = 75; if ($pdf->GetPageWidth() > $x + 270) { $x += 270; } else { $pdf->AddPage(); $x = 150;
$studente = $dati['database']->max('studenti', 'id'); $studenti = $dati['database']->select('studenti', '*', array('id' => $studente - 1, 'ORDER' => 'classe')); for ($i = 0; isset($_POST["opzione" . $i]); $i++) { if ($_POST["opzione" . $i] == -1) { $password = random(5); $username = str_replace(" ", "", strtolower($_POST["nome" . $i])); if (strlen($username) > 200) { $username = substr($username, 0, 200); } while (!isUserFree($dati['database'], $username, "")) { $username .= rand(0, 999); } $user = $dati['database']->insert("persone", array("nome" => $_POST["nome" . $i], "username" => $username, "password" => $password, "email" => "", "stato" => 0)); $dati['database']->insert("studenti", array("id" => $studente, "classe" => $_POST["classe" . $i], "persona" => $user)); } else { $stud = ricerca($studenti, $_POST["opzione" . $i], "classe"); if ($stud != -1) { $dati['database']->insert("studenti", array("id" => $studente, "classe" => $_POST["classe" . $i], "persona" => $studenti[$stud]["persona"])); } } } salva(); } else { $pageTitle = "Aggiornamento utenti"; require_once 'templates/shared/header.php'; echo ' <div class="jumbotron green"> <div class="container text-center"> <h1><i class="fa fa-group fa-2x"></i></h1> <h1>' . $pageTitle . '</h1> <p>Selezionare il file ".txt" contenente le informazioni riguardanti classi e utenti.</p>