<?php

include_once __DIR__ . '/ezsql/ezsql_core.php';
include_once __DIR__ . '/ezsql/ezsql_mysqli.php';

$config = require 'database.php';

$db = new ezSQL_mysqli(
    $config['username'],
    $config['password'],
    $config['database'],
    $config['host']
);

$query = "SELECT * FROM preprint where visualizza='SI' order by date DESC";

$entries = $db->get_results($query);

?>
<!DOCTYPE html>
<html>

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Preprints LNF</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css">

	<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

	<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script>

	<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
	<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
	<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
body{
font-family: 'Roboto', sans-serif;
}
</style>
</head>

<body>
	<div class="container-fluid">

		<div class="row">
			<div class="col-12">
				<br>
				<h1><img src="1_LNF_LOGO_SIGLA.png" height="48"> Preprints INFN - Library LNF</h1>
				<p>Lo scopo delle Note-LNF/INFN è quello di documentare attività di ricerca teoriche o sperimentali effettuate da personale dipendente o associato ai LNF/INFN. La richiesta di pubblicazione di una nota si effettua compilando gli appositi moduli: <a href="http://library.lnf.infn.it/nota-interna-lnf/">modulo LNF</a>, <a href="http://library.lnf.infn.it/nota-interna-infn/">modulo INFN</a>.<br>
Per quanto riguarda le Note-LNF la pubblicazione online è soggetta al seguente <a href="http://www.lnf.infn.it/sis/preprint/LNF_Internal_Note_publishing_rules1.1.pdf">iter autorizzativo</a>.<br>
Il testo completo delle note è disponibile in formato PDF. Il catalogo NOTE LNF include tutte le note LNF dal 1953 ad oggi, mentre il catalogo NOTE INFN quelle dal 1987 ad oggi.</p>
			</div>
			<div class="col-sm-6">
			</div>
		</div>

			<div class="row">
				<div class="col-12">
					<hr>
					<table id="table_id" class="table table-striped table-bordered" style="width:100%">
						<thead>
							<tr>
								<th>ID</th>
								<th>Data</th>
								<th>Titolo</th>
								<th>Anno</th>
								<!--<th>Numero</th>-->
								<th>PDF</th>
								<th>Autori</th>
								<!--<th>Sezione</th>-->
								<th>Abstract</th>
							</tr>
						</thead>
						<tbody>

							<?php
					
							foreach ($entries as $entry):  ?>

								<tr>
									<td>
									<?php echo $entry->id; ?>
									</td>
									<td><?php echo $entry->date; ?></td>

									<td><?php echo $entry->titolo; ?></td>

									<td><?php echo $entry->anno; ?></td>

									<!--<td><?php //echo $entry->numero; ?></td>-->

									<td><a target="_blank" href="getfilepdf.php?filename=<?php echo $entry->pdf; ?>"><?php echo $entry->pdf; ?></a></td>

									<td><?php echo $entry->autori; ?></td>

									<!--<td><?php //echo $entry->sezione; ?></td>-->

									<td><?php echo $entry->abstract; ?></td>
								</tr>

							<?php endforeach; ?>

						</tbody>
					</table>
					<?php

				
					?>
					<p>
					
				</div>
			</div>

	</div>
	<div class="row">
			<div class="col-12">

			<p style="text-align: center;"><i>developed by Sara Reda</i></p>
			</div>
		</div>

	<script type="text/javascript">
		$(document).ready(function() {
			$('#table_id').DataTable({
				dom: 'lfrBtip',
				buttons: [
					'copyHtml5',
					'excelHtml5',
					'csvHtml5',
					'pdfHtml5',
					'print'
				],
				pageLength: 25,
				order: [
					[1, "desc"]
				],
			});
		});
	</script>

</body>

</html>