示例#1
0
$noticia = new Noticia();
$count = NULL;
if (isset($_POST['txtCveNoticia'])) {
    if ($_POST['txtCveNoticia'] != 0) {
        $noticia = new Noticia($_POST['txtCveNoticia']);
    }
}
if (isset($_POST['xAccion'])) {
    if ($_POST['xAccion'] == 'grabar') {
        $noticia->setCveReata($_SESSION['cve_usuario']);
        $noticia->setTipoEvento(1);
        // Tipo boletin
        $noticia->setTitulo($_POST['txtTitulo']);
        $noticia->setNoticiaCorta($_POST['txtNoticiaCorta']);
        $noticia->setNoticia($_POST['txtNoticia']);
        $noticia->setCveModifico($_SESSION['cve_usuario']);
        $noticia->setActivo(isset($_POST['cbxActivo']) ? 1 : 0);
        $count = $noticia->grabar();
    }
    if ($_POST['xAccion'] == 'eliminar') {
        $noticia->borrar($_POST['txtCveNoticia']);
    }
    if ($_POST['xAccion'] == 'logout') {
        unset($_SESSION['cve_usuario']);
        unset($_SESSION['nombre']);
        header('Location:login.php');
        return;
    }
}
$sql = "SELECT * FROM noticias ORDER BY cve_noticia DESC";
$rst = UtilDB::ejecutaConsulta($sql);