<li class="dropdown messages-dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o"></i> <span class="label <?php if ($nnots->c > 0) { echo "label-danger"; } else { echo "label-default"; } ?> "><?php echo $nnots->c; ?> </span> <b class="caret"></b></a> <ul class="dropdown-menu"> <?php if ($nnots->c > 0) { $notifications = NotificationData::getLast5($_SESSION["user_id"]); ?> <li class="dropdown-header"><?php echo $nnots->c; ?> Notificaciones</li> <?php foreach ($notifications as $noti) { $s = $noti->getSender(); $sp = ProfileData::getByUserId($s->id); $img_url = ""; if ($sp->image != "") { $img_url = "storage/users/" . $s->id . "/profile/" . $sp->image; } ?>
$user_id = null; $author_id = null; if ($_POST["t"] == 1) { $post = PostData::getReceptorId($_POST["r"]); $user_id = $post->receptor_ref_id; $author_id = $post->author_ref_id; } else { if ($_POST["t"] == 2) { $post = ImageData::getUserId($_POST["r"]); $user_id = $post->user_id; $author_id = $post->user_id; } } if ($author_id != $_SESSION["user_id"] && $user_id != $_SESSION["user_id"]) { // si es el mismo autor del post, entonces no le notificamos $notification = new NotificationData(); $notification->not_type_id = 1; // like $notification->type_id = $_POST["t"]; // al mismo que nos referenciamos en al crear el comentario $notification->ref_id = $_POST["r"]; // = $notification->receptor_id = $user_id; // en este caso nos referimos a quien va dirigida la notificacion $notification->sender_id = $_SESSION["user_id"]; // ahora al usuario implicado $notification->add(); } /////////// } }
<?php if (Session::getUID() != "") { $u = null; if (Session::getUID() != "") { $u = UserData::getById(Session::getUID()); $user = $u->name . " " . $u->lastname; } ?> <ul class="nav navbar-nav navbar-right navbar-user"> <li><a data-toggle="modal" href="#uploadImageModal"><i class="fa fa-upload"></i> Subir</a></li> <!-- - - - - - - - - - --> <?php $channels = ChannelData::getAllByUID(Session::getUID()); if (count($channels) == 1) { $notifications = NotificationData::getAllByChannelId($channels[0]->id); $notifications5 = NotificationData::getLast5ByChannelId($channels[0]->id); if (count($notifications) > 0) { ?> <li class="dropdown messages-dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o"></i> <span class="label label-danger"><?php echo count($notifications); ?> </span> <b class="caret"></b></a> <ul class="dropdown-menu"> <li class="dropdown-header"><?php echo count($notifications); ?> Notificaciones</li> <?php foreach ($notifications5 as $notif) { $theuser = UserData::getById($notif->user_id);
<?php $f = new FollowerData(); $f->channel_id = $_POST['channel_id']; $f->add(); $u = UserData::getById(Session::getUID()); $channel = ChannelData::getById($_POST['channel_id']); $author = $channel->getUser(); $not_type = NotificationTypeData::getByName("Nuevo Seguidor"); $n = new NotificationData(); $n->brief = "<b>{$u->name} {$u->lastname}</b> Te Sigue"; $n->content = ""; $n->channel_id = $_POST['channel_id']; $n->image_id = "NULL"; $n->comment_id = "NULL"; $n->album_id = "NULL"; $n->notification_type_id = $not_type->id; $n->user_id = Session::getUID(); $n->add(); //index.php?module=channelinfo&id=1 print "<script>window.location='index.php?view=channelinfo&id={$_POST['channel_id']}';</script>";
<?php $notifications = NotificationData::getAllByUserId($_SESSION["user_id"]); ?> <div class="container"> <div class="row"> <div class="col-md-3"> <?php Action::execute("_userbadge", array("user" => Session::$user, "profile" => Session::$profile, "from" => "logged")); Action::execute("_mainmenu", array()); ?> </div> <div class="col-md-7"> <h2>Notificaciones</h2> <?php if (count($notifications) > 0) { ?> <table class="table table-bordered"> <thead> <th>Notificacion</th> </thead> <?php foreach ($notifications as $noti) { ?> <tr class="<?php if (!$noti->is_readed) { echo "warning"; } ?> "> <td>
<?php $channels = ChannelData::getAllByUID(Session::getUID()); if ($channels != null) { $channel = $channels[0]; $notifications = NotificationData::getAllByChannelId($channel->id); foreach ($notifications as $notification) { $notification->del(); } } print "<script>window.location='index.php?view=notifications';</script>";