Exemplo n.º 1
0
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);
            $tiempo = $pub->getTiempo($segundos);
            if ($tipo == 1) {
                //Pregunta
                $foto = $pub->getFotoPrincipal();
                $title = $pub->tituloFormateado();
                $id = 1;
                $tema = "Te Preguntaron";
                $link = "pre_pub";
            }
            if ($tipo == 2) {
                //Repuesta
                $foto = $pub->getFotoPrincipal();
                $title = $pub->tituloFormateado();
                $id = 2;
                $tema = "Te Respondieron";
                $link = "resp_pub";
            }
            if ($tipo == 3) {
                //Panas
                $foto = $usr->buscarFotoUsuario($id_pana);
                $id = $id_pana;
                $title = $usr->getPana($id_pana);
                $tema = "Ahora te sigue";
                $link = "ver-noti-seguidor";
            }
            if ($tipo == 4) {
                //Publicacion
                $foto = $pub->getFotoPrincipal();
                $title = $pub->tituloFormateado();
                $tema = "Nueva Publicacion";
                $id = $id_pub;
                $link = "detalle";
            }
            $img_noti = $foto;
            $usuario_class = '';
            //definir para mostrar el modal o redireccionar a la tienda
            $usuario_name = $title;
            $accion_noti = $tema;
            $time_noti = $tiempo;
            $notificaciones .= '<div class="col-xs-12 notificaciones pointer ' . $link . '" data-id_pub="' . $id_pub . '" data-id="' . $id . '" >
					<div class="row">
						<div class="col-xs-3 col-sm-4 col-md-2 col-lg-2 text-center">							
								<img id="img-perfil" src="' . $img_noti . '" class="img foto-max-80   foto-perfil " data-id="1268"   >							
						</div>
						<div class="col-xs-9 col-sm-6 col-md-10 col-lg-10">
							<div>
								<span class=" vin-blue t14"><b>' . $usuario_name . '</b></span>
								' . $accion_noti . '
							</div>
							<div>
								<span class="t12 grisO "><i class="glyphicon glyphicon-time t14  opacity"></i>' . $time_noti . '</span>
							</div>
						</div>
					</div>
				</div>';
        }
    }
    echo json_encode(array('notificaciones' => $notificaciones));
}
Exemplo n.º 2
0
<?php

/***CODIGO PARA NOTIFICACIONES****/
if (!isset($_SESSION)) {
    session_start();
}
$usr = new usuario($_SESSION["id"]);
$bd = new bd();
$cant_compras = $usr->getCantRespuestas();
$cant_ventas = $usr->getCantNotificacionPregunta();
$cant_panas = $usr->getCantPanas();
$cant_pub = $usr->getCantNotiPublicaciones();
$status = $usr->s_status_usuarios_id;
$alerts = $usr->getAllNotificaciones($_SESSION["id"]);
$visto = 0;
include_once "clases/publicaciones.php";
/***FIN*****/
include_once 'clases/bd.php';
include_once 'clases/fotos.php';
include_once 'clases/sedes.php';
include_once 'clases/restricciones.php';
$obj_sede = new sede();
/**VALIDAMOS QUE EL USUARIO NO TENGA RESTRINGIDA LA PAGINA ACTUAL**/
$obj_restricciones = new restricciones($_SESSION['id_rol'], $_SERVER['SCRIPT_NAME']);
$respuesta = $obj_restricciones->show_page;
if (!$respuesta) {
    echo '<script>window.location.replace("admin-usr.php")</script>';
}
//**BUSCAMOS FOTO DE USUARIO**** (DEBE CARGARSE POR EL ID DE LA SESSION)
if (isset($_SESSION["id"])) {
    $foto_obj = new fotos();
Exemplo n.º 3
0
				
	<?php 
$usr = new usuario($_SESSION["id"]);
$cant_compras = $usr->getCantRespuestas();
$cant_ventas = $usr->getCantNotificacionPregunta();
/*$cant_panas = $usr -> getCantPanas();
	$cant_pub = $usr -> getCantNotiPublicaciones();*/
$cant_panas = 0;
$cant_pub = 0;
$status = $usr->s_status_usuarios_id;
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);
$visto = 0;
include_once "clases/publicaciones.php";
$alertas = $cant_compras[0]["cant"] + $cant_ventas[0]["cant"] + $cant_panas[0]["cant"] + $cant_pub[0]["cant"];
?>
			 		
		
				<li id="notificacion" data-id="<?php 
echo $_SESSION["id"];
?>
" class="dropdown">
					<a href="#" data-toggle="dropdown" role="button" class="dropdown-toggle marT10 li-icon-top" onclick="<?php 
echo $visto = 1;
?>
" aria-expanded="false"
					style="">