Send message with video chat link - refs #7558

1.10.x
Angel Fernando Quiroz Campos 11 years ago
parent 4cc1573135
commit ae5cbc6f22
  1. 23
      main/inc/ajax/chat.ajax.php
  2. 14
      main/inc/lib/chat.lib.php
  3. 4
      main/inc/lib/javascript/chat/js/chat.js

@ -73,11 +73,18 @@ switch ($action) {
$room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
if ($room !== false) {
echo Display::url(
get_lang('StartVideoChat'),
$videoChatLink = Display::url(
Display::tag(
'i',
null,
['class' => 'fa fa-video-camera']
) . " " . get_lang('StartVideoChat'),
api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['room_name']}"
);
$chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false);
echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
break;
}
@ -115,10 +122,18 @@ switch ($action) {
break;
}
echo Display::url(
get_lang('StartVideoChat'),
$videoChatLink = Display::url(
Display::tag(
'i',
null,
['class' => 'fa fa-video-camera']
) . " " . get_lang('StartVideoChat'),
api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room=$roomName"
);
$chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false);
echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
break;
default:
echo '';

@ -172,7 +172,7 @@ class Chat extends Model
* @param string Message
* @return void Prints "1"
*/
public function send($from_user_id, $to_user_id, $message)
public function send($from_user_id, $to_user_id, $message, $printResult = true)
{
$user_friend_relation = SocialManager::get_relation_between_contacts($from_user_id, $to_user_id);
if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) {
@ -207,11 +207,15 @@ class Chat extends Model
$this->save($params);
}
echo "1";
exit;
if ($printResult) {
echo "1";
exit;
}
} else {
echo "0";
exit;
if ($printResult) {
echo "0";
exit;
}
}
}

@ -396,6 +396,10 @@ function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) {
);
$.when(createForm).done(function(response) {
$('#global-modal')
.find('.modal-dialog')
.removeClass('modal-lg');
$('#global-modal')
.find('.modal-body')
.html(response);

Loading…
Cancel
Save