<?php
require_once('shared/conexionBD.php');

$lineaGet = htmlentities($_GET['linea'], ENT_NOQUOTES,"UTF-8");
if (empty($lineaGet)) {
  header('Location: 404.php');
}
mysqli_query($conexion,"SET NAMES utf8");

?>
<!DOCTYPE html>
<html xml:lang="es" lang="es">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->

    <!--Producción-->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-125019062-2"></script>

    <!--Producción-->
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'UA-125019062-2');
    </script>

    <!-- End Global site tag (gtag.js) - Google Analytics -->
  <!-- [if IE]> -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta http-equiv="cleartype" content="on"/>
  <!-- <![endif] -->

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title><?php echo $lineaGet; ?> – S&amp;P</title>
  <meta name="keywords" content="Magento, Varien, E-commerce"/>
  <meta name="robots" content="INDEX,FOLLOW"/>

  <link rel="icon" href="https://statics.solerpalau.com/skin/frontend/solerpalau/default/favicon.ico" type="image/x-icon"/>
  <link rel="shortcut icon" href="https://statics.solerpalau.com/skin/frontend/solerpalau/default/favicon.ico" type="image/x-icon"/>

  <meta name="msapplication-TileColor" content="#ffffff">
  <meta name="theme-color" content="#ffffff">
  <!-- bootstrap 4 -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">


  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
  <script type="text/javascript">
    var $j = jQuery.noConflict();
  </script>

  <script type="text/javascript" src="js/events.js"></script>

  <!-- estilo princripal -->
  <link rel="stylesheet" type="text/css" href="css/style-css01.css" media="all" />

  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">


</head>
<body class=" cms-page-view cms-produccion-distribucion-logistica level-2 customer-logged-out">
  <!-- aqui va el header -->
  <?php include 'header.php' ?>

  <script type="text/javascript">
    //<![CDATA[
    if (typeof HIB.menu == 'object' && typeof HIB.menu.init == 'function') {
      HIB.menu.init();
    }
    //]]>
  </script>

  <div class="main-container col1-layout">
    <div class="breadcrumbs">
      <div class="container">
        <ul xmlns:v="http://rdf.data-vocabulary.org/#">
          <li class="0" typeof="v:Breadcrumb">
            <a href="index.php"
                title="Inicio"
                rel="v:url" property="v:title">
              Inicio</a>

              <div class="arrow-breadcrumbs-level3"><img height="10" width="8" src="https://statics.solerpalau.com/skin/frontend/solerpalau/default/images/svg/arrow-breadcrumbs.svg"/></div>
              <div class="arrow-breadcrumbs-level2"><img height="10" width="8" src="https://statics.solerpalau.com/skin/frontend/solerpalau/default/images/svg/arrow-breadcrumbs-white.svg"/></div> &nbsp;
          </li>
          <li class="2">
            <a>División <?php echo "$lineaGet"; ?></a>
          </li>
        </ul>
      </div>
    </div>
    <div class="main">
      <div class="col-main">
       <main>
        <div id="overlaySearch" class="overlay">
          <!-- Overlay content -->
          <div id="searchResults" class="overlay-content grid"></div>
        </div>

        <div class="page-title dark">
            <img src="media/home/categories_home/<?php
            if(file_exists("media/home/categories_home/".$lineaGet.".jpg")){
                echo($lineaGet);
            }else{
                echo('Habitat');
            }
            ?>.jpg" alt="<?php echo($lineaGet); ?>" class="category-image" />

          <div class="page-title-container">
            <div class="page-title-content container">

              <h1 class="h1"><?php echo  $lineaGet; ?></h1>
            </div>
          </div>
        </div>
        <div class="category-products">
          <div class="bar-title-simple">
            <p class="h2"><?php echo "División $lineaGet"; ?></p>
          </div>
          <div class="container">
            <div class="row mb-5">
              <!-- Se comienza a imprimir los submodelos -->
              <?php
              $rutaImagenCompleta = '';
              $linea = trim($lineaGet);
              $arrFiltrado = filtrarDatos($modelosGlobal,html_entity_decode($linea),$arrImgs);

              if (!empty($arrFiltrado)) {
                foreach($arrFiltrado as $datos) {

                  if (!empty($datos['URL'])) {
                    $imagen = $datos['URL'];
                  }else{

                    $imagen = $datos['ID'].".jpg";
                    $fichero = 'ALP/'.$imagen;
                    // si la imagen no esta en el directorio
                    $imagen = (file_exists($fichero)) ? $rutaImagenCompleta = $fichero :  $rutaImagenCompleta = 'media/noimagen.jpg' ;
                  }
                  $modelo = $datos['MODELO'];

                  ?>
                  <div class="col-md-4">
                    <div class="card hp-100">
                      <p class="text-center producto">
                        <a href="modelo.php?linea=<?php echo ($lineaGet) ?>&modelo=<?php echo(urlencode($modelo)) ?>" title="<?php echo $modelo ?>" >
                          <img  id="img-producto" src="<?php echo $imagen ?>"
                          alt="<?php echo $modelo ?>"  />
                        </a> </p>
                        <div class="product-info">
                          <a href="modelo.php?linea=<?php echo($lineaGet) ?>&modelo=<?php echo(urlencode($modelo)) ?>" title="<?php echo $imagen ?>">
                            <p class="text-center">
                              <b><?php echo $modelo ?> </b>
                            </p>
                          </a>
                        </div>
                      </div>
                    </div>
                  <?php } }else{
                    echo 'No se encontraron modelos disponibles';
                  } ?>
                  <!-- Termina seccion de submodelos -->
                  <?php 
                    if(html_entity_decode($lineaGet) == 'Atenuación Acústica') {

                      echo "<div class='col-md-4'>
                              <div class='card hp-100'>
                                <p class='text-center producto'>
                                  <a class='loader' id='btn-".$cont++."' href='atenuadores.php'>
                                    <img  id='img-".$cont++."' class='loadImg' src='media/img/loader2.gif' width='50px' style='position: absolute;display:none' /> ";
    
                      echo          "<svg aria-hidden='true' style='max-width: 100px; height: 200px;' focusable='false' data-prefix='fas' data-icon='calculator' class='svg-inline--fa fa-calculator fa-w-14' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path fill='currentColor' d='M400 0H48C22.4 0 0 22.4 0 48v416c0 25.6 22.4 48 48 48h352c25.6 0 48-22.4 48-48V48c0-25.6-22.4-48-48-48zM128 435.2c0 6.4-6.4 12.8-12.8 12.8H76.8c-6.4 0-12.8-6.4-12.8-12.8v-38.4c0-6.4 6.4-12.8 12.8-12.8h38.4c6.4 0 12.8 6.4 12.8 12.8v38.4zm0-128c0 6.4-6.4 12.8-12.8 12.8H76.8c-6.4 0-12.8-6.4-12.8-12.8v-38.4c0-6.4 6.4-12.8 12.8-12.8h38.4c6.4 0 12.8 6.4 12.8 12.8v38.4zm128 128c0 6.4-6.4 12.8-12.8 12.8h-38.4c-6.4 0-12.8-6.4-12.8-12.8v-38.4c0-6.4 6.4-12.8 12.8-12.8h38.4c6.4 0 12.8 6.4 12.8 12.8v38.4zm0-128c0 6.4-6.4 12.8-12.8 12.8h-38.4c-6.4 0-12.8-6.4-12.8-12.8v-38.4c0-6.4 6.4-12.8 12.8-12.8h38.4c6.4 0 12.8 6.4 12.8 12.8v38.4zm128 128c0 6.4-6.4 12.8-12.8 12.8h-38.4c-6.4 0-12.8-6.4-12.8-12.8V268.8c0-6.4 6.4-12.8 12.8-12.8h38.4c6.4 0 12.8 6.4 12.8 12.8v166.4zm0-256c0 6.4-6.4 12.8-12.8 12.8H76.8c-6.4 0-12.8-6.4-12.8-12.8V76.8C64 70.4 70.4 64 76.8 64h294.4c6.4 0 12.8 6.4 12.8 12.8v102.4z'></path></svg>";
                      echo      "</p>
                                <div class='product-info'>
                                  <p class='text-center'>
                                    <b> Selecciona tu atenuador </b>
                                  </p>
                                </div>
                              </a> 
                            </div>
                        </div>";
                    }
                  ?>
                </div>
              </div>

            </div>
          </main>
        </div>
      </div>
    </div>
    <style>
      .bar {
      height: 30px!important;
      }
    </style>
    <!-- aqui va el footer -->
    <?php
  // cerrar conexión de base de datos
    mysqli_close( $conexion );
    include 'footer.php' ?>
  </script>


</div>
</div>
</body>

</html>
