<?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;
<?php if (!isset($_SESSION["user_id"])) { Core::redir("./"); } $frs = ConversationData::getConversations($_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>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
<?php if (!empty($_POST)) { 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") {