index.php 1.8 KB

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