Viewing file: dt_video.php (1.98 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php class dt_video extends led_datos_tabla { function get_listado($filtro=array()) { $where = array(); if (isset($filtro['id_video'])) { $where[] = "t_v.id_video = '".$filtro['id_video']."'"; } if (isset($filtro['estado'])) { $where[] = "t_v.estado = '".$filtro['estado']."'"; } if (isset($filtro['tipo'])) { $where[] = "t_v.tipo = '".$filtro['tipo']."'"; } if (isset($filtro['descripcion'])) { $where[] = "t_v.descripcion ILIKE ".quote("%{$filtro['descripcion']}%"); }
$sql = "SELECT t_v.id_video, t_v.fecha_alta, t_v.usuario_alta, t_v.estado, t_v.tipo, CASE WHEN t_v.tipo = 'local' THEN 'Archivo local' WHEN t_v.tipo = 'youtube' THEN 'Youtube' WHEN t_v.tipo = 'url' THEN 'URL Externa' ELSE t_v.tipo END as tipo_descripcion, t_v.archivo, t_v.youtube, t_v.url, t_v.descripcion FROM video as t_v ORDER BY t_v.descripcion"; if (count($where)>0) { $sql = sql_concatenar_where($sql, $where); } return toba::db('led')->consultar($sql); }
function get_video($id_video) { $filtro['id_video'] = $id_video; $datos = $this->get_listado($filtro); return $datos[0]; }
function get_descripciones() { $sql = "SELECT id_video, descripcion, tipo FROM video ORDER BY descripcion"; return toba::db('led')->consultar($sql); } function get_archivo($id_video) { $sql = "SELECT archivo FROM video WHERE id_video = '$id_video'"; return toba::db('led')->consultar_fila($sql); }
function eliminar($id_video) { $sql = "SELECT archivo FROM video WHERE id_video = '$id_video'"; $dato = toba::db('led')->consultar_fila($sql);
$sql = "DELETE FROM video WHERE id_video = '$id_video'"; if (toba::db('led')->ejecutar($sql)){
$folder_path = "../www/video/"; $nombre_archivo = $dato['archivo']; $destino = $folder_path.$nombre_archivo;
@unlink($destino);
return true;
}else{
return false;
} }
} ?>
|