<?php
//llamamos la constante URL
require '../util/constants.php';
//controlamos que se haya iniciado session.
require '../class/sessions.php';
$objSes = new Sessions();
$objSes->init();

$profile = $objSes->get('profi');

if((!isset($profile))&&($profile != 'Admin')){
    header('location: ' . URL);
}




?>




<!DOCTYPE html>
<html lang="es">
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="css/estilos.css" />
        <link rel="stylesheet" href="css/forms.css" />
        <script src="js/jquery-1.11.2.min.js"></script>
    </head>
    <body>
        <header><h1>@Nbocaz</h1></header>
        <nav>
            <ul>
                <li><a href="<?php echo URL;?>admin/index.php">Inicio</a></li>
                <li><a href="<?php echo URL;?>admin/showBooks.php">Ver Libros</a></li>
                 <li><a href="<?php echo URL;?>admin/index.php">Inicio</a></li>
                <li><a href="<?php echo URL;?>http://localhost/excel/">cerrar</a></li>
            </ul>
        </nav>
        <div id="wrapper">
            <div id="left">
                <h2>!</h2>
               
            </div>
            <div id="">
                
                <?php
                
                require '../class/books.php';
                $objBook = new Books();
                $result = $objBook->show_books();
                
                ?>
                
                <h2>Listado de RUC</h2>
                <div class="space"></div>
                <a class="opcion" href="<?php echo URL;?>admin/newB.php">Insertar Nuevo Libro</a>
                <div class="space"></div>
                <form name="upload" action="<?php echo URL;?>admin/uploadB.php" method="POST" enctype="multipart/form-data">
                    <label>Cargar RUC:</label>
                    <div class="fileinputs">
                        <input type="file" name="file" id="file" class="file" />
                    </div>
                    <div class="space"></div>
                    <input type="submit" name="submit" id="submit" value="ENVIAR"/>
                </form>
                <div class="space"></div>
                <table border="0">
                    <tr>
                        <th>RUC</th>
                        <th>DIGITAL</th>
                        <th>PRECLASIFICACION</th>
                        <th>INSTRUCCION</th>
                        <th>ESTADO</th>
                        <th>FECHA</th>
                        
                        <th colspan="2">Acciones</th>
                    </tr><?php
                    if($result){
                        foreach ($result as $key => $value) {?>
                    <tr>
                        <td><?php echo $value['codeBo'];?></td>
                        <td><?php echo $value['titleB'];?></td>
                        <td><?php echo $value['autorB'];?></td>
                        <td><?php echo $value['editoB'];?></td>
                        <td><?php echo $value['descrB'];?></td>
                        <td><?php echo $value['dateBo'];?></td>
                       
                        <td><a class="opcion" href="<?php echo URL;?>admin/editB.php?id=<?php echo $value['idBook'];?>">Editar</a></td>
                        <td><a class="opcion" href="<?php echo URL;?>admin/deleB.php?id=<?php echo $value['idBook'];?>">Eliminar</a></td>
                    </tr><?php }
                    }else{?>
                    <tr>
                        <td colspan="7" align="center">No hay RUC registrados</td>


                    </tr><?php 


   date_default_timezone_set('America/Santiago');
$fecha_actual=date("d-m-Y");

echo $fecha_actual;

                } ?>
                </table>
            </div>
        </div>
    </body>
</html>
