File: /home/austral3d/fourdplan.com/php/barrasuperior.php
<?php
//coneccion servidor y base de datos
require('conexion.php');
$con_rol = mysql_query("select * from Usuario where id = '".$_SESSION['id']."'");
if(mysql_result($con_rol,0,"empresa_id") == 1)
{
$notificacion = mysql_query("select * from Notificacion group by id");
$noti = mysql_num_rows($notificacion);
$notificacionleida = mysql_query("select * from Notificacion N join NotificacionesLeidas L where N.id = L.notificacion_id and usuario_id = '".$_SESSION['id']."' GROUP by N.id");
$leida = mysql_num_rows($notificacionleida);
$notificacionActiva = $noti - $leida;
}else{
$consulta_empresa_id = mysql_query("select empresa_id From Usuario where id = '".$_SESSION['id']."'");
$id_empresa = mysql_fetch_array($consulta_empresa_id);
$consulta_proyecto_id = mysql_query("select id from Proyecto where empresa_id = '".$id_empresa[0]."'");
$id_proyecto = mysql_fetch_array($consulta_proyecto_id);
$consulta_notificacion = mysql_query("select * from Notificacion where proyecto_id = '".$id_proyecto[0]."' group by id");
$noti = mysql_num_rows($consulta_notificacion);
$notificacionleida = mysql_query("select * from Notificacion N join NotificacionesLeidas L where N.id = L.notificacion_id and usuario_id = '".$_SESSION['id']."' GROUP by N.id");
$leida = mysql_num_rows($notificacionleida);
$notificacionActiva = $noti - $leida;
}
if(empty($_GET['lenguaje'])){
$lenguaje = false;
}else{
$lenguaje = $_GET['lenguaje'];
}
if($lenguaje){?>
<li role="presentation"><a href="notificaciones.php?lenguaje=true"> <span <?php if($notificacionActiva>0){echo 'class="label label-danger"';}else{echo 'class="label label-primary"';}?>>(<?php echo $notificacionActiva;?>) <img src="../img/correo.png" /></span></a></li>
<?php }else{?>
<li role="presentation"><a href="notificaciones.php"> <span <?php if($notificacionActiva>0){echo 'class="label label-danger"';}else{echo 'class="label label-primary"';}?>>(<?php echo $notificacionActiva;?>) <img src="../img/correo.png" /></span></a></li>
<?php
}
?>