Created
March 10, 2020 10:44
-
-
Save demonio/4a29840994253cf4b7b4b331c54c2935 to your computer and use it in GitHub Desktop.
Una forma de ver los eventos de partidas y charlas en modo parrilla.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url_partidas = ''; | |
$url_charlas = ''; | |
$json = file_get_contents($url_partidas); | |
$partidas = json_decode($json); | |
#echo '<pre>' . print_r($a, 1) . '</pre>'; | |
$json = file_get_contents($url_charlas); | |
$charlas = json_decode($json); | |
foreach ($charlas as $charla) { | |
$dia = date('d', strtotime($charla->date_beg)); | |
$hora = date('H', strtotime($charla->date_beg)); | |
$minuto = date('i', strtotime($charla->date_beg)); | |
$minutos = (strtotime($charla->date_end)-strtotime($charla->date_beg))/60; | |
$charlas_partidas[] = (object)[ | |
'tipo'=>'charla', | |
'color'=>'purple', | |
'dia'=>$dia, | |
'hora_con_decimales'=>$hora+($minuto/60), | |
'canal'=>$charla->channel, | |
'enlace_titulo'=>$charla->title, | |
'enlace_texto'=>$charla->title, | |
'minutos'=>$minutos/30 | |
]; | |
} | |
foreach ($partidas as $partida) { | |
$dia = date('d', strtotime($partida->starting_time)); | |
$hora = date('H', strtotime($partida->starting_time)); | |
$minuto = date('i', strtotime($partida->starting_time)); | |
$enlace = ($partida->stream_channel) | |
? $partida->stream_channel | |
: "https://partidas.netconplay.com/games/$partida->id"; | |
$charlas_partidas[] = (object)[ | |
'tipo'=>'partida', | |
'color'=>'teal', | |
'dia'=>$dia, | |
'hora_con_decimales'=>$hora+($minuto/60), | |
'canal'=>$enlace, | |
'enlace_titulo'=>"$partida->title\n$partida->game_system\n$partida->name", | |
'enlace_texto'=>$partida->title, | |
'sistema'=>$partida->game_system, | |
'autor'=>$partida->name, | |
'minutos'=>$partida->duration_hours*2 | |
]; | |
} | |
if ( ! empty($_GET['debug'])) { | |
die('<pre>' . print_r($charlas_partidas, 1) . '</pre>'); | |
} | |
$dias_semantica = [17=>'Miércoles', 18=>'Jueves', 19=>'Viernes', 20=>'Sábado', 21=>'Domingo', 22=>'Lunes']; | |
?><!DOCTYPE html> | |
<html> | |
<title>Partidas NETCON</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> | |
<style> | |
.w3-container a { | |
text-decoration:none; | |
} | |
.w3-container li { | |
border:1px solid #CCC; | |
} | |
small.w3-purple, small.w3-teal { | |
border-radius:8px; | |
display:block; | |
height:17px; width:100%; | |
padding:0 .5em; | |
} | |
small.w3-purple a, small.w3-teal a { | |
display:block; height:17px; overflow:hidden; | |
} | |
.grey-column { | |
display:flex; align-items:center; | |
height:850px; width:100px; | |
position:absolute; top:95px; | |
} | |
.grey-column span { margin:0 auto; } | |
</style> | |
<body style="height:100vh; overflow-x:auto"> | |
<div class="w3-container"> | |
<div style="position:relative; z-index:-1"> | |
<?php $dia=0; foreach ($dias_semantica as $dia_semantica): ?> | |
<?php for ($i=0; $i<24; ++$i): | |
$color = ($i%2===0) ? 'EEE' : 'FEF'; ?> | |
<div class="grey-column" style="background:#<?=$color?>; left:<?=$dia+($i*100)?>px"><span><?=$i?>:00</span></div> | |
<?php endfor; ?> | |
<?php $dia+=2400; endforeach; ?> | |
</div> | |
<div style="position:relative"> | |
<h2 style="white-space:nowrap">Parrilla de programación de charlas y partidas creada por Mr demonio con amor para estas NETCON19</h2> | |
<?php $dia=0; foreach ($dias_semantica as $dia_semantica): ?> | |
<div style="position:absolute; left:<?=$dia?>px; top:40px;"><?=$dia_semantica?></div> | |
<?php for ($i=0; $i<24; ++$i): ?> | |
<div style="position:absolute; left:<?=$dia+($i*100)?>px; top:60px; width:100px; text-align:center"><?=$i?>:00</div> | |
<?php endfor; ?> | |
<?php $dia+=2400; endforeach; ?> | |
</div> | |
<div style="position:relative; margin-top:40px"> | |
<?php | |
$dia_actual = 17; | |
foreach ($charlas_partidas as $charla_partida): | |
if ($charla_partida->dia <> $dia_actual) { | |
$posicion_fila = 0; | |
$dia_actual = $charla_partida->dia; | |
} | |
$comienzo_dia = ($charla_partida->dia-17)*2400; | |
?> | |
<div style="position:absolute; left:<?=$comienzo_dia+($charla_partida->hora_con_decimales*100)?>px; top:<?=$posicion_fila?>px; height:25px; width:<?=$charla_partida->minutos*50?>px; overflow:hidden"> | |
<small class="w3-<?=$charla_partida->color?>"> | |
<a href="<?=$charla_partida->canal?>" target="_blank" title="<?=$charla_partida->enlace_titulo?>"> | |
<?=$charla_partida->enlace_texto?> | |
</a> | |
</small> | |
</div> | |
<?php | |
$posicion_fila+=20; | |
endforeach; | |
?> | |
</div> | |
<div style="position:relative; margin-top:850px""> | |
<?php $dia=0; foreach ($dias_semantica as $dia_semantica): ?> | |
<?php for ($i=0; $i<24; ++$i): ?> | |
<div style="position:absolute; left:<?=$dia+($i*100)?>px; top:40px; width:100px; text-align:center"><?=$i?>:00</div> | |
<?php endfor; ?> | |
<div style="position:absolute; left:<?=$dia?>px; top:60px;"><?=$dia_semantica?></div> | |
<?php $dia+=2400; endforeach; ?> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment