Ejemplo n.º 1
0
<?php

include_once "../../../clases/usuarios.php";
include_once "../../../clases/publicaciones.php";
switch ($_POST["method"]) {
    case "get_Notificaciones":
        getNotificaciones();
        break;
}
function getNotificaciones()
{
    if (!isset($_SESSION)) {
        session_start();
    }
    $usr = new usuario();
    if ($_SESSION['id_rol'] == '1' || $_SESSION['id_rol'] == '2') {
        $id_user_noti = null;
    } else {
        $id_user_noti = $_SESSION["id"];
    }
    $alerts = $usr->getAllNotificaciones($id_user_noti, $_POST['pagina']);
    if (TRUE) {
        $notificaciones = '';
        foreach ($alerts as $a => $val) {
            $fecha = $val["fecha"];
            $tipo = $val["tipo"];
            $id_pana = $val["pana"];
            $id_pub = $val["pub"];
            $id_pre = $val["pregunta"];
            $pub = new publicaciones($id_pub);
            $segundos = strtotime('now') - strtotime($fecha);
Ejemplo n.º 2
0
<?php

include "db.php";
include "notificacionDao.php";
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if ($_GET["estado"]) {
        return getNotificacionesInicio($db);
    } else {
        return getNotificaciones($db);
    }
}