Hello @all,
i am coding a chat and with pure PHP it is working perfect for me. But now i want to implement it into my Vokuro system and i have some problems.
The params are send via ajax(-> userid and username), but they don't reach the function in my Controller, as response i get the whole site. It should look/open like the facebook chat right bottom.
jQuery:
var $panel;
$.ajax({
type: "GET",
url: 'chat/chatPanel?chatUserId='+chatUserId+'&chatUserText='+chatUserText,
async: false,
success : function(text)
{
$panel = text;
}
});
$($panel).appendTo("#chatPosition");
ChatPanel.volt (still pure PHP i know :-) )
<div class="panel panel-default chatBox" id="chatBox'.$chatUserId.'">
<div class="panel-heading">
<ul class="list-inline">
<li class="list-inline-item pull-left"><h1 class="chatUserHeader"><a href="#" class="btn btn-link btn-xs">'.$chatUserText.'</a></h1></li>
<li class="list-inline-item pull-right"><button class="btn-link btn-xs chatBoxSlideDown'.$chatUserId.'"><i class="fa fa-window-minimize fa-lg" aria-hidden="true"></i></button></li>
<li class="list-inline-item pull-right"><button class="btn-link btn-xs chatBoxClose'.$chatUserId.'"><i class="fa fa-times fa-lg" aria-hidden="true"></i></button></li>
</ul>
</div>
<div class="panel-body">
<table class="table" id="panelId'.$chatUserId.'"></table>
</div>
<div class="panel-footer chatFooter">
<div class="form-group">
<textarea placeholder="Message" id="chatTextArea'.$chatUserId.'"></textarea>
</div>
<div class="form-group">
<button class="btn btn-success" id="chatBtnSend'.$chatUserId.'">Absenden</button>
</div>
</div>
</div>
Controller. The chatPanelAction function should load the chatPanel.volt template
<?php
namespace Vokuro\Controllers;
use Phalcon\Tag;
use Phalcon\Mvc\Model\Criteria;
use Phalcon\Paginator\Adapter\Model as Paginator;
use Vokuro\Forms\ChatForm;
use Vokuro\Models\Chat;
use Phalcon\Http\Request;
class ChatController extends ControllerBase{
public function initialize(){
$this->view->setTemplateBefore('private');
}
public function indexAction(){
}
public function chatPanelAction(){
$request = new Request();
$user = $request->get("chatUserId");
echo "MAIL: ".$user;
}
public function getMessageAction(){
}
public function addMessageAction(){
}
}
Thx for your help
Rgds Stefan