index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* @var $descargas app\models\Descarga[] */
  3. /* @var $estaciones array */
  4. /* @var $primer \DateTime */
  5. /* @var $ultimo \DateTime */
  6. ?>
  7. <style>
  8. .site-card {
  9. min-height: 100vh;
  10. width: 100vw;
  11. padding: 20px;
  12. background: #ececec;
  13. }
  14. .content {
  15. width: 100%;
  16. height: 100%;
  17. }
  18. .full-width {
  19. width: 100%;
  20. }
  21. </style>
  22. <div>
  23. <table border="1" width="100%" id="tabla">
  24. <tr>
  25. <th>pc</th>
  26. <th>ciudad</th>
  27. <th>clave</th>
  28. <th>siglas</th>
  29. <th>frecuencia</th>
  30. <?php $f = (clone $primer); ?>
  31. <?php while($f <= $ultimo): ?>
  32. <th>
  33. <?= $f->format("d/m/Y") ?>
  34. </th>
  35. <?php $f->add(new \DateInterval("P1D")); ?>
  36. <?php endwhile; ?>
  37. </tr>
  38. <?php $estacion = ""; ?>
  39. <?php foreach ($estaciones as $pc => $est): ?>
  40. <?php foreach($est as $clave => $info): ?>
  41. <tr>
  42. <td><?= $pc ?></td>
  43. <td><?= $info['ciudad'] ?></td>
  44. <td><?= $clave ?></td>
  45. <td><?= $info['siglas'] ?></td>
  46. <td><?= $info['frecuencia'] ?></td>
  47. <?php $fecha = (clone $primer); ?>
  48. <?php while($fecha <= $ultimo): ?>
  49. <?php $d = null; ?>
  50. <?php if(isset($descargas[$pc][$clave][$fecha->format("Y-m-d")])): ?>
  51. <?php $d = $descargas[$pc][$clave][$fecha->format("Y-m-d")]; ?>
  52. <?php endif; ?>
  53. <?php if($d !== null): ?>
  54. <td style="background-color: <?= $d["color"] ?>; text-align: center ">
  55. <?= $d["descargados"] ?> / <?= $d["total"] ?>
  56. </td>
  57. <?php else: ?>
  58. <td></td>
  59. <?php endif; ?>
  60. <?php $fecha->add(new \DateInterval("P1D")); ?>
  61. <?php endwhile ?>
  62. </tr>
  63. <?php endforeach ?>
  64. <?php endforeach ?>
  65. </table>
  66. </div>