public static function ActionSaveMessage($chatId)
 {
     ChatModel::saveMessage($chatId, 1, $_POST['message']);
     exit('ok');
     if (UserModel::isUserLoggedIn() and ChatModel::isUserInChat($chatId, UserModel::getUserId())) {
     }
 }
 public static function actionDialog($chatId)
 {
     $dictionary = UserModel::getLangArray();
     $menuClass = [0 => '', 1 => '', 2 => 'active', 3 => '', 4 => ''];
     $userStyle = UserModel::getUserStyle();
     $id = UserModel::getUserId();
     $user = UserModel::getInfo($id);
     $messages = ChatModel::getChatMessages($chatId);
     if (ChatModel::isUserInChat($chatId, UserModel::getUserId())) {
         $lastMessage = end($messages);
         $timestamp = $lastMessage['timestamp'];
         $view = 'templates/userProfile.php';
         $profile_content = 'templates/dialog.php';
         $links = ['userProfile.css', 'dialog.css', 'webcam.css'];
         $scripts = ['dragAndDropDownload.js', 'follow.js', 'messager.js', 'MediaAPI.js'];
         include_once view . '/templates/template.php';
     } else {
         header('Location: /rules');
     }
 }