[*] поправил стиль диалогоа
This commit is contained in:
1 parent
0048e9f9d7
commit
e8be354a1f
8 files changed
+196
-427
No files matched your search
+70
-1
@@ -128,4 +128,73 @@ body {
|
|||||||
}
|
}
|
||||||
.table tbody tr:nth-child(even){
|
.table tbody tr:nth-child(even){
|
||||||
background: #F7F7F7;
|
background: #F7F7F7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.main textarea {
|
||||||
|
width: 100%;
|
||||||
|
resize: vertical;
|
||||||
|
padding: 15px;
|
||||||
|
height: 150px;
|
||||||
|
border: 1px solid #00abff;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .w100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.main .button {
|
||||||
|
background: #00abff;
|
||||||
|
color: white;
|
||||||
|
border: 0;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .button:hover {
|
||||||
|
background: #0085c7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .messageBox {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .messageBox .message {
|
||||||
|
width: 300px;
|
||||||
|
padding: 20px 10px;
|
||||||
|
position: relative;
|
||||||
|
background: #eee;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .messageBox .message.fromMe {
|
||||||
|
align-self: end;
|
||||||
|
background: #00abff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .messageBox .message.fromCompanion:before {
|
||||||
|
content: "";
|
||||||
|
border: solid transparent;
|
||||||
|
position: absolute;
|
||||||
|
right: 100%;
|
||||||
|
top: 50%;
|
||||||
|
border-right-color: #eee;
|
||||||
|
border-width: 9px;
|
||||||
|
margin-top: -9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main .messageBox .message.fromMe:before {
|
||||||
|
content: "";
|
||||||
|
border: solid transparent;
|
||||||
|
position: absolute;
|
||||||
|
left: 100%;
|
||||||
|
top: 50%;
|
||||||
|
border-right-color: #eeeeee;
|
||||||
|
border-width: 9px;
|
||||||
|
margin-top: -9px;
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
public static function dialogs()
|
public static function dialogs()
|
||||||
{
|
{
|
||||||
global $USER;
|
global $USER;
|
||||||
self::render('dialogs.twig', ['dialogs' => $USER->getDialogs()]);
|
self::render('dialogs.twig', ['dialogs' => User::isAuthorized() ? $USER->getDialogs() : []]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +108,23 @@
|
|||||||
public static function dialog(int $id)
|
public static function dialog(int $id)
|
||||||
{
|
{
|
||||||
global $USER;
|
global $USER;
|
||||||
self::render('dialog.twig', ['messages' => $USER->getMessages($id, true), 'userId' => $USER->getId()]);
|
self::render(
|
||||||
|
'dialog.twig',
|
||||||
|
[
|
||||||
|
'dialog_id' => $id,
|
||||||
|
'messages' => $USER->getMessages($id, true),
|
||||||
|
'userId' => $USER->getId(),
|
||||||
|
'companionId' => $USER->getDialogObject()->getDialogCompanionId($id),
|
||||||
|
'companionName' => (new User($USER->getDialogObject()->getDialogCompanionId($id)))->getName(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function sendMessage(int $userId)
|
||||||
|
{
|
||||||
|
global $USER;
|
||||||
|
$USER->getDialogObject()->sendMessage($userId, $_REQUEST['message']);
|
||||||
|
header('Location: /dialog/' . (int)$_REQUEST['dialogId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -78,10 +78,37 @@
|
|||||||
return $dialogs;
|
return $dialogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Получения ID собеседника диалога
|
||||||
|
*
|
||||||
|
* @param int $dialogId Идентификатор диалога
|
||||||
|
*
|
||||||
|
* @return int|null Идентификатор собеседника
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
public function getDialogCompanionId(int $dialogId): ?int
|
||||||
|
{
|
||||||
|
/** @var $DB DB Объект базы данных */
|
||||||
|
$DB = DB::getInstance();
|
||||||
|
$dialog = $DB->query('SELECT * FROM ' . self::TABLE_DIALOGS . ' WHERE `id`="' . $dialogId . '"');
|
||||||
|
if (empty($dialog)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$dialog = array_shift($dialog);
|
||||||
|
if ((int)$dialog['send'] === $this->user->getId()) {
|
||||||
|
return (int)$dialog['receive'];
|
||||||
|
} elseif ((int)$dialog['receive'] === $this->user->getId()) {
|
||||||
|
return (int)$dialog['send'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Получение сообщений диалога
|
* Получение сообщений диалога
|
||||||
*
|
*
|
||||||
* @param int $dialogId
|
* @param int $dialogId Идентификатор диаолога
|
||||||
|
* @param bool $markDialogViewed Пометить диалог прочитанным
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$result = (DB::getInstance())->getItem(self::TABLE, ['id' => $this->id]);
|
$result = (DB::getInstance())->getItem(self::TABLE, ['id' => $this->id]);
|
||||||
$result = array_merge($result, ['roles' => $this->getRolesObject()->getRoles()]);
|
$result = array_merge($result, ['roles' => $this->getRolesObject()->getRoles()]);
|
||||||
|
$result['nameForDisplay'] = '[' . $result['id'] . '] (' . $result['login'] . ') ' . $result['name'];
|
||||||
|
|
||||||
// В случае запроса безопасных данных убираем лишнее
|
// В случае запроса безопасных данных убираем лишнее
|
||||||
if ($onlySecureData) {
|
if ($onlySecureData) {
|
||||||
@@ -901,8 +902,8 @@
|
|||||||
{
|
{
|
||||||
$dialogs = $this->getDialogObject()->getDialogs();
|
$dialogs = $this->getDialogObject()->getDialogs();
|
||||||
foreach ($dialogs as $key => $dialog) {
|
foreach ($dialogs as $key => $dialog) {
|
||||||
$dialogs[$key]['send_user_data'] = (new self((int)$dialog['send']))->getAllUserData(true);
|
$dialogs[$key]['companionId'] = $this->getDialogObject()->getDialogCompanionId((int)$dialog['id']);
|
||||||
$dialogs[$key]['receive_user_data'] = (new self((int)$dialog['receive']))->getAllUserData(true);
|
$dialogs[$key]['companionData'] = (new self((int)$dialogs[$key]['companionId']))->getAllUserData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dialogs;
|
return $dialogs;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
Router::route('/dialogs', '\Core\App::dialogs');
|
Router::route('/dialogs', '\Core\App::dialogs');
|
||||||
Router::route('/dialog/(\d+)', '\Core\App::dialog');
|
Router::route('/dialog/(\d+)', '\Core\App::dialog');
|
||||||
|
|
||||||
|
Router::route('/users/(\d+)/sendMessage', '\Core\App::sendMessage');
|
||||||
|
|
||||||
Router::route('/404', function () {
|
Router::route('/404', function () {
|
||||||
header('HTTP/1.0 404 Not Found');
|
header('HTTP/1.0 404 Not Found');
|
||||||
echo '404 - Page Not Found';
|
echo '404 - Page Not Found';
|
||||||
|
|||||||
-202
@@ -1,202 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
* The above copyright notice and this permission notice shall be included
|
|
||||||
* in all copies or substantial portions of the Software.
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
die();
|
|
||||||
use Core\DataBases\DB;
|
|
||||||
use Core\Helpers\{Cache, Files};
|
|
||||||
use Core\Models\{User};
|
|
||||||
|
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
|
|
||||||
/** @var $USER User */
|
|
||||||
global $USER;
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="ru">
|
|
||||||
<head>
|
|
||||||
<!-- Обязательные метатеги -->
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
|
|
||||||
<title>Главная тестовая</title>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/codemirror.min.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/mode/xml/xml.min.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/mode/php/php.min.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/mode/sql/sql.min.js"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.3/codemirror.min.css">
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="#">Delta Framework</a>
|
|
||||||
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample04"
|
|
||||||
aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="navbar-collapse collapse" id="navbarsExample04" style="">
|
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" aria-current="page" href="/">Главная</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/admin/">{{ADMIN_PANEL_LINK_NAME}}</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/?clear_cache=Y">{{CLEAR_CACHE_LINK_NAME}}</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" href="/phpcmd.php">{{PHP_CMD_LINK_NAME}}</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
|
||||||
<div class="row justify-content-md-center">
|
|
||||||
<div class="col-md">
|
|
||||||
|
|
||||||
<h1 class="entry-title">Командная строка PHP</h1>
|
|
||||||
<?php if (!empty($USER) && $USER->isAdmin()) { ?>
|
|
||||||
<form action="" method="POST">
|
|
||||||
<input type="hidden" name="execute" value="Y">
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Models\\DB;');">DB</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Models\\User;');">User</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Cache;');">Cache</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Log;');">Log</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Files;');">Files</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Mail;');">Mail</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Pagination;');">
|
|
||||||
Pagination
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Registry;');">Registry
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\SystemFunctions;');">
|
|
||||||
SystemFunctions
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Zip;');">Zip</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\CoreException;');">CoreException
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Template;');">Template</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="query" class="form-label">Введите PHP код для выполнения</label>
|
|
||||||
<textarea class="form-control" rows="8" id="query"
|
|
||||||
name="query"><?php echo isset($_REQUEST['query']) ? $_REQUEST['query'] : ''; ?></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<input id="use_pre" type="checkbox" name="use_pre" value="Y" <?php if (isset($_REQUEST['use_pre'])
|
|
||||||
and $_REQUEST['use_pre'] == 'Y') {
|
|
||||||
echo 'checked';
|
|
||||||
} ?>>
|
|
||||||
<label for="use_pre" class="form-label"> Отображать результат выполнения как текст</label>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<input class="btn btn-primary" type="submit" name="btn" value="Выполнить">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("query"), {
|
|
||||||
lineNumbers: true
|
|
||||||
});
|
|
||||||
|
|
||||||
function addUseSection(button, text) {
|
|
||||||
editor.setValue(text + "\n" + editor.getValue());
|
|
||||||
//button.disabled = true;
|
|
||||||
console.log(button);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php if (isset($_REQUEST['execute']) and $_REQUEST['execute'] == 'Y') {
|
|
||||||
echo '<h2 class="entry-title">Результат</h2><p class="exec_result">';
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (isset($_REQUEST['use_pre']) and $_REQUEST['use_pre'] == 'Y') {
|
|
||||||
echo '<pre>';
|
|
||||||
}
|
|
||||||
eval($_REQUEST['query']);
|
|
||||||
if (isset($_REQUEST['use_pre']) and $_REQUEST['use_pre'] == 'Y') {
|
|
||||||
echo '</pre>';
|
|
||||||
}
|
|
||||||
} catch (ParseError $p) {
|
|
||||||
echo '<div class="alert alert-danger"><p><strong>(ParseError)</strong> Ошибка парсинга: ' . $p->getMessage() . '</p></div>';
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
echo '<div class="alert alert-danger"><p><strong>(Throwable)</strong> Ошибка при выполнении: ' . $e->getMessage()
|
|
||||||
. '</p></div>';
|
|
||||||
} catch (Error $e) {
|
|
||||||
echo '<div class="alert alert-danger"><p><strong>(Error)</strong> Ошибка при выполнении: ' . $e->getMessage() . '</p></div>';
|
|
||||||
}
|
|
||||||
echo '</p>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php } else { ?>
|
|
||||||
<div class="alert alert-danger"><p>Недостаточно прав</p></div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<footer class="py-3 my-4">
|
|
||||||
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
|
|
||||||
</ul>
|
|
||||||
<?php
|
|
||||||
$finish_time = microtime(true);
|
|
||||||
$delta = round($finish_time - START_TIME, 3);
|
|
||||||
if ($delta < 0.001) {
|
|
||||||
$delta = 0.001;
|
|
||||||
}
|
|
||||||
$cacheSize = Cache::getCacheSize();
|
|
||||||
echo '<p class="text-center text-muted">Использовано ОЗУ: ' . round(memory_get_usage() / 1024 / 1024, 2) . ' МБ / БД: ' . round(
|
|
||||||
DB::$workingTime,
|
|
||||||
3
|
|
||||||
) . ' сек (' . DB::$quantity . ' шт.) / Кэш: ' . Files::convertBytes($cacheSize) . ' / Генерация: ' . $delta . ' сек</p>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<p class="text-center text-muted">© <?= date('Y'); ?> Delta Project</p>
|
|
||||||
</footer>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
|
||||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
+46
-119
@@ -1,129 +1,56 @@
|
|||||||
<!doctype html>
|
{% extends 'layout.twig' %}
|
||||||
<html lang="ru">
|
{% block title %}Диалоги{% endblock %}
|
||||||
<head>
|
{% block main %}
|
||||||
<!-- Обязательные метатеги -->
|
{% if isAuthorized %}
|
||||||
<meta charset="utf-8">
|
<h1>Диалог # {{ dialog_id }} с "{{ companionName }} ({{ companionId }})"</h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="/assets/css/custom.css">
|
|
||||||
<title>Главная тестовая</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="#">Delta Framework</a>
|
|
||||||
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample04"
|
|
||||||
aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="navbar-collapse collapse" id="navbarsExample04" style="">
|
<!--
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
<table class="table">
|
||||||
<li class="nav-item">
|
<thead>
|
||||||
<a class="nav-link active" aria-current="page" href="/">Главная</a>
|
<tr>
|
||||||
</li>
|
<td>ID</td>
|
||||||
<li class="nav-item">
|
<td>От</td>
|
||||||
<a class="nav-link" href="/admin/">Админка</a>
|
<td>Кому</td>
|
||||||
</li>
|
<td>Дата</td>
|
||||||
<li class="nav-item">
|
<td>Сообщение</td>
|
||||||
<a class="nav-link" href="/dialogs">Диалоги</a>
|
</tr>
|
||||||
</li>
|
</thead>
|
||||||
{% if isAdmin %}
|
<tbody>
|
||||||
<li class="nav-item">
|
{% for message in messages %}
|
||||||
<a class="nav-link" href="/?clear_cache=Y">Очистка кеша</a>
|
<tr>
|
||||||
</li>
|
<td>{{ message.id }}</td>
|
||||||
{% endif %}
|
<td>{{ message.user_from_data.name }} ({{ message.user_from_data.login }})</td>
|
||||||
|
<td>{{ message.user_to_data.name }} ({{ message.user_to_data.login }})</td>
|
||||||
|
<td>{{ message.date }}</td>
|
||||||
|
<td>{{ message.text }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
-->
|
||||||
|
|
||||||
{% if isAdmin %}
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/phpcmd.php">Командная строка PHP</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
|
|
||||||
</li>
|
<div class="messageBox">
|
||||||
</ul>
|
{% for message in messages %}
|
||||||
</div>
|
<div class="message {% if message.user_from == userId %}fromMe{% else %}fromCompanion{% endif %}">{{ message.text }}</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row justify-content-md-center">
|
|
||||||
<div class="col-md">
|
|
||||||
|
|
||||||
{% if isAuthorized %}
|
|
||||||
<h1>Диалог # {{ dialog_id }}</h1>
|
|
||||||
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>ID</td>
|
|
||||||
<td>От</td>
|
|
||||||
<td>Кому</td>
|
|
||||||
<td>Дата</td>
|
|
||||||
<td>Сообщение</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for message in messages %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ message.id }}</td>
|
|
||||||
<td>{{ message.user_from_data.name }} ({{ message.user_from_data.login }})</td>
|
|
||||||
<td>{{ message.user_to_data.name }} ({{ message.user_to_data.login }})</td>
|
|
||||||
<td>{{ message.date }}</td>
|
|
||||||
<td>{{ message.text }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="messages">
|
<p>
|
||||||
{% for message in messages %}
|
<form method="POST" action="/users/{{ companionId }}/sendMessage">
|
||||||
<div class="dialogContainer {% if message.user_from == userId %}darker{% endif %}">
|
<input type="hidden" name="dialogId" value="{{ dialog_id }}">
|
||||||
<div class="messageFromName">{{ message.user_from_data.name }}</div>
|
<textarea name="message"></textarea>
|
||||||
<p>{{ message.text }}</p>
|
<button class="button w100" type="submit">Отправить</button>
|
||||||
<span class="{% if message.user_from == userId %}time-left{% else %}time-right{% endif %}">{{ message.date }}</span>
|
</form>
|
||||||
</div>
|
</p>
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-error">Вы не авторизованы</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<h1>Вы не авторизованы :(</h1>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<footer class="py-3 my-4">
|
|
||||||
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p class="text-center text-muted">Тут будет статистика</p>
|
|
||||||
<p class="text-center text-muted">© <?= date('Y'); ?> Delta Project</p>
|
|
||||||
</footer>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
+29
-100
@@ -1,101 +1,30 @@
|
|||||||
<!doctype html>
|
{% extends 'layout.twig' %}
|
||||||
<html lang="ru">
|
{% block title %}Диалоги{% endblock %}
|
||||||
<head>
|
{% block main %}
|
||||||
<!-- Обязательные метатеги -->
|
<h1>Диалоги</h1>
|
||||||
<meta charset="utf-8">
|
{% if isAuthorized %}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="/assets/css/custom.css">
|
|
||||||
<title>Главная тестовая</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="#">Delta Framework</a>
|
|
||||||
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample04"
|
|
||||||
aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="navbar-collapse collapse" id="navbarsExample04" style="">
|
<table class="table">
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
<thead>
|
||||||
<li class="nav-item">
|
<tr>
|
||||||
<a class="nav-link active" aria-current="page" href="/">Главная</a>
|
<td>ID</td>
|
||||||
</li>
|
<td>Прочитано</td>
|
||||||
<li class="nav-item">
|
<td>С кем диалог</td>
|
||||||
<a class="nav-link" href="/admin/">Админка</a>
|
<td>Действия</td>
|
||||||
</li>
|
</tr>
|
||||||
<li class="nav-item">
|
</thead>
|
||||||
<a class="nav-link" href="/dialogs">Диалоги</a>
|
<tbody>
|
||||||
</li>
|
{% for dialog in dialogs %}
|
||||||
{% if isAdmin %}
|
<tr>
|
||||||
<li class="nav-item">
|
<td>{{ dialog.id }}</td>
|
||||||
<a class="nav-link" href="/?clear_cache=Y">Очистка кеша</a>
|
<td>{{ dialog.viewed }}</td>
|
||||||
</li>
|
<td>{{ dialog.companionData.nameForDisplay }}</td>
|
||||||
{% endif %}
|
<td><a href="/dialog/{{ dialog.id }}">Открыть диалог</a></td>
|
||||||
|
</tr>
|
||||||
{% if isAdmin %}
|
{% endfor %}
|
||||||
<li class="nav-item">
|
</tbody>
|
||||||
<a class="nav-link" href="/phpcmd.php">Командная строка PHP</a>
|
</table>
|
||||||
</li>
|
{% else %}
|
||||||
{% endif %}
|
<div class="alert alert-error">Вы не авторизованы</div>
|
||||||
|
{% endif %}
|
||||||
<li class="nav-item">
|
{% endblock %}
|
||||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row justify-content-md-center">
|
|
||||||
<div class="col-md">
|
|
||||||
|
|
||||||
{% if isAuthorized %}
|
|
||||||
<h1>Диалоги</h1>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>ID</td>
|
|
||||||
<td>Прочитано</td>
|
|
||||||
<td>Отправитель</td>
|
|
||||||
<td>Получатель</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for dialog in dialogs %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="/dialog/{{ dialog.id }}">{{ dialog.id }}</a></td>
|
|
||||||
<td>{{ dialog.viewed }}</td>
|
|
||||||
<td>{{ dialog.send_user_data.login }}</td>
|
|
||||||
<td>{{ dialog.receive_user_data.login }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<h1>Вы не авторизованы :(</h1>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<footer class="py-3 my-4">
|
|
||||||
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
|
|
||||||
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p class="text-center text-muted">Тут будет статистика</p>
|
|
||||||
<p class="text-center text-muted">© <?= date('Y'); ?> Delta Project</p>
|
|
||||||
</footer>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in new issue
Block a user