Desafío ACRACB 2.0 – Actividades validadas

{source}<?php

function obtener_session()
{
$session = JFactory::getSession();
return $session->getId();
}
$posted = »;

/*
ESTACIONES NACIONALES
EA
EB
EC
ED
LAS OTRAS EXTRANJERAS
*/

$db = JFactory::getDbo();
//$dir_articulo=’/index.php/dce-actividades/dce-actividades-anunciadas’;
//$dir_articulo_directorio=’/index.php/dce-buscar-referencia’;
$dir_imagenes_corto = ‘/images/’;
$dir_imagenes = $dir_imagenes_corto . ‘bancomu/’;
$dir_imagenes_web = $dir_imagenes_corto . ‘stories/imagenes_web/’;
$dir_imagenes_diplomas = $dir_imagenes_corto . ‘trofeos/’;
$dir_iframe_mas_info = ‘/app/ultimas_actividades_mas_info.php’;
$dir_imagenes_trofeos = $dir_imagenes_corto . ‘trofeos/’;

$dir_rankings = ‘/index.php?option=com_content&view=article&id=832’;
$dir_logs = ‘/index.php?option=com_content&view=article&id=831’;
$dir_actividades_validadas = ‘/index.php?option=com_content&view=article&id=1668’;
$dir_bases = ‘/index.php?option=com_content&view=article&id=1667’;
$dir_desafio = ‘/index.php?option=com_content&view=article&id=1662’;

$cuantas_actividades = 99999;
$cuantos_ranking = 999999;
$tipo_diploma = ’39’;
$prefijo_diploma = ‘DesafioI_’;

if (isset($_GET[«query»])) {$query = $db->escape($_GET[«query»]);}
$query = str_replace(‘%’, », $query);
if (strlen($query) > 0) {$tipo_diploma = $query;} else {$tipo_diploma=39;}

if (in_array($tipo_diploma, array(’39’))) {
$dir_desafio = ‘/index.php?option=com_content&view=article&id=1662’;
}

?>

<script language=»javascript» type=»text/javascript»>
function ir_articulo_bases()
{
var url='<?php echo $dir_bases; ?>&query=<?php echo $tipo_diploma; ?>’;
window.location.href=url;
}
function ir_articulo_desafio()
{
var url='<?php echo $dir_desafio; ?>’;
window.location.href=url;
}
function ir_articulo_actividades_validadas()
{
var url='<?php echo $dir_actividades_validadas; ?>&query=<?php echo $tipo_diploma; ?>’;
window.location.href=url;
}
function ir_articulo_rankings(qrz = »)
{
var url='<?php echo $dir_rankings; ?>&query=<?php echo $tipo_diploma; ?>’;
if (qrz.length > 0) {
url = url + ‘&query2=’ + qrz;
}
window.location.href=url;
}
function ir_articulo_logs()
{
var url='<?php echo $dir_logs; ?>&query=<?php echo $tipo_diploma; ?>’;
window.location.href=url;
}
</script>
<center>
<p align=’center’ style=»font-size:19px»>
<a href=»javascript:ir_articulo_desafio()»><b>Volver al Desafio</b></a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href=»javascript:ir_articulo_bases()»><b>Bases del desafío</b></a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href=»javascript:ir_articulo_rankings()»><b>Rankings</b></a>&nbsp;&nbsp;&nbsp;&nbsp;
<!–<a href=»javascript:ir_articulo_logs()»><b>Logs</b></a>–>
</p>
<br>
</center>
<center><p align=’center’><h2 style=»color:#772f2c»><u><b>Actividades validadas</b></u></h2></p>
<table border=»0″ width=»100%» align=’center’ class=’tabla_acracb’>
<tr class=’tr_cab_acracb’>
<td align=’center’><b>Fecha</b></td>
<td align=’center’>&nbsp;</td>
<td align=’center’><b>Indicativo</b></td>
<td align=’center’>&nbsp;</td>
<td align=’center’><b>Referencia</b></td>
<td align=’center’><b>Qso</b></td>
<td align=’center’><b>Ptos.Ref</b></td>
<td align=’center’><b>Ptos.Prov</b></td>
<td align=’center’><b>Ptos.Modos</b></td>
<td align=’center’><b>Ptos.Bandas</b></td>
<td align=’center’><b>Puntos</b></td>

</tr>
<?php

$i = 0;
$tr_impar = ‘tr_impar_acracb’;
$tr_par = ‘tr_par_acracb’;

$sql =»SELECT n.id,n.Dia,n.Mes,n.Ano,n.Flag,n.pref,n.Qrz,n.act,n.act2,n.Ref,
dl.puntos,dl.ref_nueva,dl.puntos_modos,dl.puntos_bandas,l.qsos,dl.provincia,
CASE when (SELECT count(*) from logs l where tipo_diploma=$tipo_diploma and l.Ref=d.refe) >0 then 1 else 0 END tiene_logs
from nuke_dxnews n left join directorio d on n.ref=d.refe
left join (
SELECT d.*,d.banda_20+d.banda_40+d.banda_80 puntos_bandas,d.modo_ssb+d.modo_cw+d.modo_dg puntos_modos
FROM logs_desafio d where d.tipo=0
) dl on concat(dl.pref,dl.Actividad,dl.act,dl.act2) = concat(n.pref,n.qrz,n.act,n.act2)
and dl.ref=n.ref
and concat(dl.dia,’/’,dl.mes,’/’,dl.ano) = concat(n.dia,’/’,n.mes,’/’,n.ano)
and dl.tipo_diploma=n.tipo_diploma
left join (
SELECT concat(l.pref,l.Actividad,l.act,l.act2) qrz, l.ref,count(*) qsos from logs l where tipo_diploma=$tipo_diploma
group by concat(l.pref,l.Actividad,l.act,l.act2),l.ref
) l on l.qrz = concat(dl.pref,dl.Actividad,dl.act,dl.act2) and l.ref = dl.ref
where 1=1 and n.anular_actividad=0
and n.tipo_diploma=$tipo_diploma
ORDER BY STR_TO_DATE(concat(n.dia,’,’,n.mes,’,’,n.ano),’%d,%m,%Y’) DESC, n.Qrz ASC
LIMIT $cuantas_actividades»;

$db->setQuery($sql);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$Dia = $row->Dia;
$Mes = $row->Mes;
$Ano = $row->Ano;
$Flag = $row->Flag;
$pref = $row->pref;
$Qrz = $row->Qrz;
$act = $row->act;
$act2 = $row->act2;
$Ref = $row->Ref;
$id = $row->id;

$qsos = $row->qsos;
$puntos = $row->puntos;
$puntos_ref_nueva= $row->ref_nueva;
$puntos_provincia= $row->provincia;
$puntos_bandas= $row->puntos_bandas;
$puntos_modos= $row->puntos_modos;

$tiene_logs = $row->tiene_logs;

$tr_class = ($i % 2) ? $tr_impar : $tr_par;
$i++;

?>
<tr class='<?php echo $tr_class; ?>’>
<td align=’center’ width=»10%»><?php echo $Dia . «/» . $Mes . «/» . $Ano; ?></td>
<td align=’left’ width=»5%»><img src=»<?php echo $dir_imagenes . $Flag; ?>.gif» border=»0″ width=»30″ height=»15″ title=»»></td>
<td align=’left’ width=»10%»><b>&nbsp;<a href=»javascript:ir_articulo_rankings(‘<?php echo $pref . $Qrz . $act . $act2; ?>’)»><?php echo $pref . $Qrz . $act . $act2; ?></a>&nbsp;</b></td>
<td align=’left’ width=»5%»>
<?php
$mi_img = «dce_actividad_nook.png»;
if (substr($Ref, 0, 2) == «EF») {
$mi_img = «defe_actividad_nook.png»;
}
if (substr($Ref, 0, 2) == «MV») {
$mi_img = «dmve_actividad_nook.png»;
}

$mi_alt = «No activada»;
if ($tiene_logs > 0) {
$mi_img = «dce_actividad_ok.png»;
if (substr($Ref, 0, 2) == «EF») {
$mi_img = «defe_actividad_ok.png»;
}
if (substr($Ref, 0, 2) == «MV») {
$mi_img = «dmve_actividad_ok.png»;
}

$mi_alt = «Ya activada»;
}
echo ‘<img src=»‘ . $dir_imagenes_web . $mi_img . ‘» width=20 height=20 border=0 title=»‘ . $mi_alt . ‘»>’;
?>
</td>
<td align=’center’ width=»15%»>
<b>&nbsp;<?php echo $Ref; ?>&nbsp;</b>
</td>
<td align=’center’ width=»10%»>
<b>&nbsp;<?php echo $qsos; ?>&nbsp;</b>
</td>
<td align=’center’ width=»5%»><?php echo $puntos_ref_nueva; ?></td>
<td align=’center’ width=»5%»><?php echo $puntos_provincia; ?></td>
<td align=’center’ width=»10%»><?php echo $puntos_modos; ?></td>
<td align=’center’ width=»10%»><?php echo $puntos_bandas; ?></td>
<td align=’center’ width=»15%»><?php echo $puntos; ?></td>
</tr>
<?php
}
?>
</table>
<br>
</center>{/source}

Scroll al inicio