Ejemplo n.º 1
0
 public function getUnreads()
 {
     return MessageData::getUnreadsByClientId($this->id);
 }
Ejemplo n.º 2
0
    <h2>Conversaciones</h2>
    <?php 
if (count($frs) > 0) {
    ?>
      <table class="table table-bordered">
      <thead>
        <th>Amigo</th>
      </thead>
      <?php 
    foreach ($frs as $fr) {
        ?>
        <tr>
          <td>

          <?php 
        $nmsg = MessageData::countUnReadsByUC($_SESSION["user_id"], $fr->id);
        $color = "label-default";
        if ($nmsg->c > 0) {
            $color = "label-danger";
        }
        echo "<span class='label {$color} pull-right'>" . $nmsg->c . "</span>";
        echo "<a href='./?view=conversation&id={$fr->id}'>";
        if ($fr->receptor_id == Session::$user->id) {
            echo $fr->getSender()->getFullname();
        } else {
            echo $fr->getReceptor()->getFullname();
        }
        echo "</a>";
        ?>

          </td>
Ejemplo n.º 3
0
        <input type="text" class="form-control" name="q" placeholder="Buscar personas ...">
      </div>
      <button type="submit" class="btn btn-default">&nbsp;<i class="fa fa-search"></i>&nbsp;</button>
    </form>
<?php 
}
?>


<ul class="nav navbar-nav navbar-right">
<?php 
if (Session::exists("user_id")) {
    $conversations = ConversationData::getConversations($_SESSION["user_id"]);
    $nmsgs = 0;
    foreach ($conversations as $conversation) {
        $nmsg = MessageData::countUnReadsByUC($_SESSION["user_id"], $conversation->id);
        //  print_r($nmsg);
        $nmsgs += $nmsg->c;
    }
    $nnots = NotificationData::countUnReads($_SESSION["user_id"]);
    ?>
<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;
Ejemplo n.º 4
0
<?php

$conversation = ConversationData::getById($_GET["id"]);
$frs = MessageData::getAllByConversationId($_GET["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>Conversacion</h2>
    <?php 
if (count($frs) > 0) {
    ?>
      <table class="table table-bordered">
      <thead>
        <th>Mensajes</th>
      </thead>
      <tr>
        <td>
          <form role="form" method="post" action="./?action=sendmsg">
<div class="form-group">
    <textarea class="form-control" name="content" required placeholder="Mensaje" rows="3"></textarea>
  </div>
  <input type="hidden" name="ref" value="conversation">
  <input type="hidden" name="conversation_id" value="<?php 
    echo $conversation->id;
Ejemplo n.º 5
0
$targtag = $date->modify('+' . PARAM_ANTEREMINDER_TIME . ' day');
$messagedata = array();
// will become array of array
$email_array = array();
logMessage("SendMessagesCron", "called.");
if (ReminderSent::selectDate(swwat_format_isodate($targtag))) {
    logMessage("SendMessagesCron", "emails for " . swwat_format_isodate($targtag) . " already sent out.");
    exit;
}
$expoList = Expo::selectMultiple();
foreach ($expoList as $expo) {
    if (!$expo->isPast() && $expo->scheduleVisible) {
        $shiftassignments = ShiftAssignmentView::selectDate($expo->expoid, $targtag);
        foreach ($shiftassignments as $shift) {
            if (strcmp(substr(strtolower($shift->stationTitle), 0, 5), "can't")) {
                $message = new MessageData();
                $message->fillData($shift);
                $email = $message->workerEmail;
                // just a convenience
                if (is_null($email)) {
                    logMessage("SendMessagesCron", "Worker has null email:" . var_export($worker, true));
                    continue;
                }
                if (!in_array($email, $email_array)) {
                    $email_array[] = $email;
                    $messagedata[$email] = array();
                    // first time
                }
                $messagedata[$email][] = $message;
            }
        }
Ejemplo n.º 6
0
    print_r($_POST);
    $convid = 0;
    if ($_POST["ref"] == "new") {
        $conv = ConversationData::getConversation($_SESSION["user_id"], $_POST["receptor_id"]);
        if ($conv == null) {
            $c = new ConversationData();
            $c->sender_id = $_SESSION["user_id"];
            $c->receptor_id = $_POST["receptor_id"];
            $cx = $c->add();
            $convid = $cx[1];
        } else {
            $convid = $conv->id;
        }
    } else {
        if ($_POST["ref"] == "conversation") {
            $convid = $_POST["conversation_id"];
        }
    }
    $msg = new MessageData();
    $msg->user_id = $_SESSION["user_id"];
    $msg->conversation_id = $convid;
    $msg->content = $_POST["content"];
    $msg->add();
}
if ($_POST["ref"] == "new") {
    Core::redir("./?view=conversations");
} else {
    if ($_POST["ref"] == "conversation") {
        Core::redir("./?view=conversation&id=" . $convid);
    }
}