Viewing file: dt_led.php (2.9 KB) -rwxrwxr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php class dt_led extends led_datos_tabla { function get_listado($filtro=array()) { //$url = 'http://172.22.32.133/led/aplicacion.php?ai=led'.urlencode('||').'3470';
$url = file_get_contents('../php/url_reproduccion.txt');
$where = array();
if (isset($filtro['id_led'])) { $where[] = "t_l.id_led = '".$filtro['id_led']."'"; } if (isset($filtro['descripcion'])) { $where[] = "t_l.descripcion ILIKE ".quote("%{$filtro['descripcion']}%"); } if (isset($filtro['estado'])) { $where[] = "t_l.estado = '".$filtro['estado']."'"; } if (isset($filtro['codigo'])) { $where[] = "t_l.codigo = '".$filtro['codigo']."'"; } if (isset($filtro['id_lista_noticia'])) { $where[] = "t_l.id_lista_noticia = '".$filtro['id_lista_noticia']."'"; } if (isset($filtro['id_lista_noticia2'])) { $where[] = "t_l.id_lista_noticia2 = '".$filtro['id_lista_noticia2']."'"; }
$sql = "SELECT t_l.id_led, t_l.fecha_alta, t_l.usuario_alta, t_l.descripcion, t_l.estado, t_l.id_lista_noticia, t_l.id_lista_noticia2, CASE WHEN t_l.estado = 'A' THEN 'Activo' WHEN t_l.estado = 'I' THEN 'Incativo' ELSE t_l.estado END as estado_descripcion, t_ln.descripcion as id_lista_noticia_nombre, t_ln.fecha_modificacion, t_ln2.descripcion as id_lista_noticia2_nombre, t_l.codigo, '$url'||'&led='||t_l.codigo as url_reproduccion, t_l.usar_streaming, t_l.canal_streaming, t_l.hora_desde, t_l.hora_hasta, t_l.hora_desde2, t_l.hora_hasta2, t_l.carga_fecha, t_l.carga_ip, t_l.zocalo FROM led as t_l LEFT OUTER JOIN lista_noticia as t_ln ON (t_l.id_lista_noticia = t_ln.id_lista_noticia) LEFT OUTER JOIN lista_noticia as t_ln2 ON (t_l.id_lista_noticia2 = t_ln2.id_lista_noticia) ORDER BY t_l.descripcion"; if (count($where)>0) { $sql = sql_concatenar_where($sql, $where); } return toba::db('led')->consultar($sql); }
function get_led($id_led) { $filtro['id_led'] = $id_led; $datos = $this->get_listado($filtro); return $datos[0]; }
function get_led_activo($id_led) { $filtro['id_led'] = $id_led; $filtro['estado'] = 'A'; $datos = $this->get_listado($filtro); return $datos[0]; }
function get_led_por_codigo($codigo) { $filtro['codigo'] = $codigo; $datos = $this->get_listado($filtro); return $datos[0]; }
function get_led_por_codigo_activo($codigo, $cargar = false) { $filtro['codigo'] = $codigo; $filtro['estado'] = 'A'; $datos = $this->get_listado($filtro);
if($cargar){ $sql ="UPDATE led SET carga_fecha = '".date("Y-m-d H:i:s")."', carga_ip = '".$this->getRealIP()."' WHERE id_led = '".$datos[0]['id_led']."'"; toba::db('led')->ejecutar($sql); }
return $datos[0]; }
private function getRealIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; return $_SERVER['REMOTE_ADDR']; }
}
?>
|