<?php

require_once("../config/conexion.php");
require_once("../models/Notificaciones.php");
$notificaciones = new Notificaciones();
/* =============================================
  JAVASCRIPT
  ============================================= */
switch ($_GET["op"]) {    
    case "listar":
        $datos = $notificaciones->ConsultarNotificaciones($_SESSION["usuariodbk"]);
        $data = Array();               
        foreach ($datos as $row) {
            $sub_array = array();
            $sub_array[] = $row["notificaciondbk"];
            $sub_array[] = $row["not_mensaje"];
            $sub_array[] = $row["not_tipo"];
            $sub_array[] = $row["not_fecha"];                                               
            $sub_array[] = '<a href="'.$row["not_linkrespuesta"].'" class="btn btn-warning" role="button">Ir</a>';
            $data[] = $sub_array;            
        }
        $results = array(
            "sEcho" => 1,
            "iTotalRecords" => count($data),
            "iTotalDisplayRecords" => count($data),
            "aaData" => $data
        );
        echo json_encode($results);
        break;    
}
?>
