svg
This commit is contained in:
parent
c5729f13c0
commit
b4ef039943
@ -38,7 +38,7 @@ class AppKernel extends Kernel
|
||||
new Cadoles\CoreBundle\CadolesCoreBundle(),
|
||||
new Cadoles\CronBundle\CadolesCronBundle(),
|
||||
new Cadoles\PortalBundle\CadolesPortalBundle(),
|
||||
new Cadoles\PortalBundle\CadolesWebsocketBundle(),
|
||||
new Cadoles\WebsocketBundle\CadolesWebsocketBundle(),
|
||||
|
||||
];
|
||||
|
||||
|
@ -152,10 +152,17 @@ ivory_ck_editor:
|
||||
language: fr
|
||||
toolbar: "my_toolbar_2"
|
||||
uiColor: "#ffffff"
|
||||
removePlugins: 'elementspath'
|
||||
small_config:
|
||||
language: fr
|
||||
toolbar: "my_toolbar_3"
|
||||
uiColor: "#ffffff"
|
||||
removePlugins: 'elementspath'
|
||||
toolbars:
|
||||
configs:
|
||||
my_toolbar_1: [ "@document1", "-", "@clipboard1", "-", "@basicstyles1", "-", "@paragraph1", "/", "@links1", "-", "@insert1", "-", "@styles1", "-" , "@colors1", "-" , "@tools1" ]
|
||||
my_toolbar_2: [ "@basicstyles1", "-", "@paragraph2", "-", "@insert2", "-", "@styles1"]
|
||||
my_toolbar_3: [ "@basicstyles1", "-", "@paragraph3", "-", "@insert3"]
|
||||
|
||||
items:
|
||||
document1: [ 'Source','-','NewPage','DocProps','Preview','Print','-','Templates' ]
|
||||
@ -163,9 +170,11 @@ ivory_ck_editor:
|
||||
basicstyles1: [ 'Bold','Italic','Underline','RemoveFormat' ]
|
||||
paragraph1: [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ]
|
||||
paragraph2: [ 'JustifyLeft','JustifyCenter','JustifyRight','NumberedList','BulletedList' ]
|
||||
paragraph3: [ 'NumberedList','BulletedList' ]
|
||||
links1: [ 'Link','Unlink','Anchor' ]
|
||||
insert1: [ 'Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ]
|
||||
insert2: [ 'Image','Table','Smiley','Link','Unlink' ]
|
||||
insert3: [ 'Smiley','Link','Unlink' ]
|
||||
styles1: [ 'Styles','Format','Font','FontSize' ]
|
||||
colors1: [ 'TextColor','BGColor' ]
|
||||
tools1: [ 'Maximize', 'ShowBlocks','-','About' ]
|
@ -41,6 +41,7 @@ security:
|
||||
check_path: /saml/acs
|
||||
|
||||
access_control:
|
||||
- { path: ^/websocket, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_USER] }
|
||||
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_USER] }
|
||||
- { path: ^/config, roles: [ROLE_ADMIN, ROLE_MODO] }
|
||||
|
||||
|
@ -40,7 +40,11 @@ class UserGroup
|
||||
*/
|
||||
private $fgmanager = false;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=60, nullable=true)
|
||||
*/
|
||||
private $keyvalue;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@ -122,4 +126,28 @@ class UserGroup
|
||||
{
|
||||
return $this->fgmanager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set keyvalue
|
||||
*
|
||||
* @param string $keyvalue
|
||||
*
|
||||
* @return UserGroup
|
||||
*/
|
||||
public function setKeyvalue($keyvalue)
|
||||
{
|
||||
$this->keyvalue = $keyvalue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keyvalue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeyvalue()
|
||||
{
|
||||
return $this->keyvalue;
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +668,24 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
$em->persist($entityWidget);
|
||||
|
||||
|
||||
|
||||
// Widget Chat
|
||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1840);
|
||||
if(!$entityWidget) $entityWidget = new Widget();
|
||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_chat.png"]);
|
||||
$entityWidget->setId(-1840);
|
||||
$entityWidget->setRoworder(2);
|
||||
$entityWidget->setIcon($entityicon);
|
||||
$entityWidget->setName('Chat');
|
||||
$entityWidget->setDescription("Conversation instantanée");
|
||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_chat");
|
||||
$entityWidget->setHeight("1000");
|
||||
$entityWidget->setAutoajust(false);
|
||||
$entityWidget->setBorder(true);
|
||||
$entityWidget->setOpened(true);
|
||||
$entityWidget->setAccess(["config","user","group"]);
|
||||
$parameter = json_decode('{"fields": []}');
|
||||
$entityWidget->setParameter($parameter);
|
||||
$em->persist($entityWidget);
|
||||
|
||||
|
||||
|
||||
|
@ -1841,4 +1841,41 @@ class PagewidgetController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewchatAction(Request $request,$id,$access="config") {
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
if($usage!="group") {
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Render
|
||||
return $this->render($this->labelentity.':viewchat.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'onheader' => false,
|
||||
'tool' => "cadoles_websocket_chat",
|
||||
'access' => $access,
|
||||
'usage' => $usage,
|
||||
'group' => $group
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,9 @@ cadoles_portal_config_panelwidget_view_info:
|
||||
path: /config/pagewidget/view/info/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewinfo, access: config }
|
||||
|
||||
|
||||
cadoles_portal_config_panelwidget_view_chat:
|
||||
path: /config/pagewidget/view/chat/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewchat, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_pagewidget_widget_sumbit:
|
||||
@ -857,3 +859,7 @@ cadoles_portal_user_panelwidget_view_appexternal:
|
||||
cadoles_portal_user_panelwidget_view_info:
|
||||
path: /pagewidget/view/info/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewinfo, access: user }
|
||||
|
||||
cadoles_portal_user_panelwidget_view_chat:
|
||||
path: /pagewidget/view/chat/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewchat, access: user }
|
||||
|
@ -237,11 +237,24 @@
|
||||
{% set colorbodyfont = color['fontcolorhover'] %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if not entity.border %}
|
||||
{% set colorbodyback = color['colorbody'] %}
|
||||
{% endif %}
|
||||
|
||||
{% if colorbodyfont == colorbodyback %}
|
||||
{% if colorbodyfont == color['main'] %}
|
||||
{% set colorbodyfont=color['fontcolorhover'] %}
|
||||
{% else %}
|
||||
{% set colorbodyfont=color['main'] %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% set stylewidgetbodyframe = "" %}
|
||||
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %}
|
||||
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %}
|
||||
{% if entity.border %}
|
||||
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "padding: 0px 0px 0px 10px; " %}
|
||||
{% endif %}
|
||||
{% if not entity.autoajust %}
|
||||
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %}
|
||||
{% endif %}
|
||||
|
@ -0,0 +1,58 @@
|
||||
{% set theme = app.session.get('theme') %}
|
||||
{% if theme is not empty %}
|
||||
{{ include('@Theme/'~theme~'/function.html.twig') }}
|
||||
{% endif %}
|
||||
|
||||
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
|
||||
|
||||
{% set stylewidget = constants.mystylewidget(entity) %}
|
||||
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
|
||||
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
|
||||
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
|
||||
{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %}
|
||||
{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %}
|
||||
|
||||
{% set color = app.session.get('color') %}
|
||||
{% set colorbodyback = entity.colorbodyback %}
|
||||
{% if colorbodyback is null %}
|
||||
{% set colorbodyback = color['main'] %}
|
||||
{% endif %}
|
||||
|
||||
{% set colorbodyfont = entity.colorbodyfont %}
|
||||
{% if colorbodyfont is null %}
|
||||
{% set colorbodyfont = color['fontcolorhover'] %}
|
||||
{% endif %}
|
||||
|
||||
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
|
||||
{% if canupdate %}
|
||||
<div class="widgetmenu">
|
||||
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if onheader %}
|
||||
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
|
||||
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="widgetheader" style="{{ stylewidgetheader }}">
|
||||
{% if entity.icon %}
|
||||
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
|
||||
{% else %}
|
||||
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
|
||||
{% endif %}
|
||||
<span class="title">{{ entity.name }}</span>
|
||||
</div>
|
||||
|
||||
<div class="widgetbody" style="{{ stylewidgetbodyframe }}">
|
||||
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
@ -10,6 +10,8 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
use Cadoles\WebsocketBundle\Form\ChatType;
|
||||
|
||||
class ChatController extends Controller
|
||||
{
|
||||
public function clientAction($id, Request $request)
|
||||
@ -19,21 +21,46 @@ class ChatController extends Controller
|
||||
die();
|
||||
}
|
||||
else {
|
||||
// Génération d'une clé temporaire d'accès au chat
|
||||
$key = Uuid::uuid4();
|
||||
$user->setKeyvalue($key);
|
||||
$framed=$request->query->get('framed');
|
||||
if($framed) {
|
||||
$border=$request->query->get('border');
|
||||
if($border) {
|
||||
$colorbodyback=$request->query->get('colorbodyfont');
|
||||
$colorbodyfont=$request->query->get('colorbodyback');
|
||||
}
|
||||
else {
|
||||
$colorbodyback=$request->query->get('colorbodyback');
|
||||
$colorbodyfont=$request->query->get('colorbodyfont');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$border=false;
|
||||
$colorbodyback=$this->get('session')->get('color')["main"];
|
||||
$colorbodyfont=$this->get('session')->get('color')["fontcolorhover"];
|
||||
}
|
||||
|
||||
// Sauvegarde
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
|
||||
// On récupère les 100 derniers message du groupe
|
||||
$group=$user=$em->getRepository("CadolesCoreBundle:Group")->find($id);
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($id);
|
||||
if(!$group) die();
|
||||
|
||||
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group],["submitdate"=>"DESC"]);
|
||||
dump($messages);
|
||||
// Génération d'une clé temporaire d'accès au chat
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]);
|
||||
if(!$usergroup) die("noingroup".$user->getUserName());
|
||||
$usergroup->setKeyvalue($key);
|
||||
|
||||
// Sauvegarde
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
|
||||
|
||||
// Récupération des message du groupe
|
||||
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group],["submitdate"=>"DESC"],100);
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(ChatType::class,null,[]);
|
||||
|
||||
// Affichage du chat
|
||||
return $this->render('CadolesWebsocketBundle:Chat:client.html.twig',[
|
||||
@ -42,7 +69,12 @@ class ChatController extends Controller
|
||||
'usesidebar' => false,
|
||||
'userkey' => $key,
|
||||
'groupid' => $id,
|
||||
'messages' => $messages
|
||||
'messages' => $messages,
|
||||
'framed' => $framed,
|
||||
'border' => $border,
|
||||
'colorbodyback' => $colorbodyback,
|
||||
'colorbodyfont' => $colorbodyfont,
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Cadoles\WebsocketBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ColorType;
|
||||
use Cadoles\CoreBundle\Form\IconChoiceType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class ChatType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add("message",CKEditorType::class,[
|
||||
'config_name' => 'small_config',
|
||||
'label' => "Message",
|
||||
'mapped'=> false,
|
||||
'required' => false,
|
||||
'config' => ["height" => "100px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload']
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([]);
|
||||
}
|
||||
}
|
@ -1,11 +1,27 @@
|
||||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
{% if framed %}
|
||||
{% if border %}
|
||||
#page-wrapper {
|
||||
padding: 5px 25px 10px 15px;
|
||||
background: transparent;
|
||||
}
|
||||
{% else %}
|
||||
#page-wrapper {
|
||||
padding: 5px 25px 0px 15px;
|
||||
background: transparent;
|
||||
}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
#page-wrapper { padding-top:20px; padding-bottom:30px; }
|
||||
{% endif %}
|
||||
|
||||
.message {
|
||||
padding:10px;
|
||||
margin-top: 5px;
|
||||
background-color: #{{ color['main'] }};
|
||||
color: #{{ color['fontcolorhover'] }};
|
||||
background-color: #{{ colorbodyback }};
|
||||
color: #{{ colorbodyfont }};
|
||||
}
|
||||
.msgavatar {
|
||||
float:left;
|
||||
@ -19,12 +35,31 @@
|
||||
line-height: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#cke_1_bottom{ display:none }
|
||||
{% endblock %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
{{ form_start(form) }}
|
||||
<div class='row'>
|
||||
{{ form_widget(form.message) }}
|
||||
<a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a>
|
||||
</div>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
<div class="mychat">
|
||||
|
||||
|
||||
{% for message in messages %}
|
||||
<div class='message row'>
|
||||
<div class='msgavatar'><img id='user_avatar_img' src='/{{ alias }}/uploads/avatar/{{message.user.avatar}}' class='avatar'></div>
|
||||
<div class='msgdiv'>
|
||||
<div class='msgtitle'>
|
||||
{{message.user.lastname}} {{message.user.firstname}}<br>
|
||||
<small>{{message.submitdate|date('d/m/Y H:i')}}</small>
|
||||
</div>
|
||||
<div class='msgtopic'>{{message.topic | raw}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@ -60,21 +95,34 @@
|
||||
|
||||
//the callback function in "subscribe" is called everytime an event is published in that channel.
|
||||
session.subscribe("websocket/channel/{{groupid}}", function (uri, payload) {
|
||||
html ="<div class='message row'>";
|
||||
html+="<div class='msgavatar'><img id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+payload.msg.avatar+"' class='avatar'></div>";
|
||||
html+="<div class='msgdiv'>"
|
||||
html+="<div class='msgtitle'>"+payload.msg.lastname+"<br><small>"+new Date(payload.msg.submitdate.date).toLocaleDateString("fr-FR", dateoptions)+"</small></div>";
|
||||
html+="<div class='msgtopic'>"+payload.msg.message+"</div>";
|
||||
html+="</div>";
|
||||
html+="</div>";
|
||||
$(".mychat").append(html);
|
||||
if(payload.msg) {
|
||||
html ="<div class='message row'>";
|
||||
html+="<div class='msgavatar'><img id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+payload.msg.avatar+"' class='avatar'></div>";
|
||||
html+="<div class='msgdiv'>"
|
||||
html+="<div class='msgtitle'>"+payload.msg.lastname+"<br><small>"+new Date(payload.msg.submitdate.date).toLocaleDateString("fr-FR", dateoptions)+"</small></div>";
|
||||
html+="<div class='msgtopic'>"+payload.msg.message+"</div>";
|
||||
html+="</div>";
|
||||
html+="</div>";
|
||||
$(".mychat").prepend(html);
|
||||
|
||||
console.log("Received message", payload.msg);
|
||||
console.log("Received message", payload.msg);
|
||||
}
|
||||
|
||||
if(payload.log) {
|
||||
console.log("Received message", payload.log);
|
||||
}
|
||||
});
|
||||
|
||||
session.publish("websocket/channel/{{groupid}}", "This is a message!");
|
||||
$( "#sendbtn" ).click(function() {
|
||||
var data = CKEDITOR.instances["chat_message"].getData();
|
||||
session.publish("websocket/channel/{{groupid}}", data);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
session.publish("websocket/channel/{{groupid}}", "This is a message!");
|
||||
session.publish("websocket/channel/{{groupid}}", "This is a message!");
|
||||
*/
|
||||
})
|
||||
{% endif %}
|
||||
});
|
||||
|
@ -35,18 +35,10 @@ class WebsocketTopic implements TopicInterface
|
||||
* @return void
|
||||
*/
|
||||
public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
|
||||
{
|
||||
/*
|
||||
$userkey=$request->getAttributes()->get('user');
|
||||
$groupid=$request->getAttributes()->get('group');
|
||||
|
||||
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(['keyvalue'=> $userkey]);
|
||||
if(!$user) $topic->broadcast(['msg' => 'user NOT FIND']);
|
||||
else $topic->broadcast(['msg' => $user->getUsername()]);
|
||||
|
||||
{
|
||||
//this will broadcast the message to ALL subscribers of this topic.
|
||||
$topic->broadcast(['msg' => $connection->resourceId . " group = $groupid && user = $userkey has joined " . $topic->getId()]);
|
||||
*/
|
||||
$topic->broadcast(['log' => $connection->resourceId." has joined ".$topic->getId()]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,15 +74,18 @@ class WebsocketTopic implements TopicInterface
|
||||
|
||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($groupid);
|
||||
if(!$group) {
|
||||
$topic->broadcast(['msg' => 'group NOT FIND']);
|
||||
$topic->broadcast(['log' => 'group NOT FIND']);
|
||||
}
|
||||
|
||||
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(['keyvalue'=> $userkey]);
|
||||
if(!$user) {
|
||||
$topic->broadcast(['msg' => 'user NOT FIND']);
|
||||
$usergroup=$this->em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(['keyvalue'=> $userkey]);
|
||||
if(!$usergroup) {
|
||||
$topic->broadcast(['log' => 'user NOT IN GROUP']);
|
||||
}
|
||||
else {
|
||||
$user=$usergroup->getUser();
|
||||
}
|
||||
|
||||
if($group&&$user) {
|
||||
if($group&&$usergroup&&$user) {
|
||||
$message=new Message();
|
||||
$message->setTopic($event);
|
||||
$message->setUser($user);
|
||||
|
Loading…
Reference in New Issue
Block a user