[+] скорректировал марштуры и добавил страницу пользаков
This commit is contained in:
1 parent
236fd45afa
commit
6576be0c61
6 files changed
+68
-49
No files matched your search
+12
-31
@@ -32,6 +32,7 @@
|
||||
* Получение параметров для шаблона в целом
|
||||
*
|
||||
* @return array
|
||||
* @throws CoreException
|
||||
*/
|
||||
private static function getLayoutParams(): array
|
||||
{
|
||||
@@ -60,9 +61,10 @@
|
||||
* Отдача на рендер
|
||||
*
|
||||
* @param string $template Шаблон
|
||||
* @param array $params Параметры
|
||||
* @param array $params Параметры
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
*/
|
||||
private static function render(string $template, array $params = []): void
|
||||
{
|
||||
@@ -71,23 +73,11 @@
|
||||
echo $twig->render($template, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Отрисовка главной страницы
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function index()
|
||||
{
|
||||
self::render('index.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* Информация о сборке
|
||||
* я
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function info()
|
||||
{
|
||||
$buildInfo = [
|
||||
@@ -101,24 +91,12 @@
|
||||
self::render('info.twig', ['data' => $buildInfo]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Отрисовка диалогов
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function dialogs()
|
||||
{
|
||||
global $USER;
|
||||
self::render('dialogs.twig', ['dialogs' => User::isAuthorized() ? $USER->getDialogs() : []]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Отрисовка диалога
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function dialog(int $id)
|
||||
{
|
||||
global $USER;
|
||||
@@ -153,13 +131,10 @@
|
||||
self::render('users.twig', ['users' => $arUsers]);
|
||||
}
|
||||
|
||||
/**
|
||||
*Тестовая
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function test()
|
||||
|
||||
public static function test($a = null, $b = null, $c = null, $d = null)
|
||||
{
|
||||
print_r([$a, $b, $c, $d]);
|
||||
self::render('test.twig');
|
||||
}
|
||||
|
||||
@@ -187,4 +162,10 @@
|
||||
{
|
||||
self::render('login.twig', ['failed' => true]);
|
||||
}
|
||||
|
||||
public static function userProfile(int $id)
|
||||
{
|
||||
$userData = (new User($id))->getAllUserData(true);
|
||||
self::render('userProfile.twig', ['userData' => $userData]);
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
/** @var $DB DB Объект базы данных */
|
||||
$DB = DB::getInstance();
|
||||
$dialogs = $DB->query(
|
||||
'SELECT * FROM ' . self::TABLE_DIALOGS . ' WHERE `send`="' . $this->user->getId() . '" OR `receive`="' . $this->user->getId() . '"'
|
||||
'SELECT * FROM ' . self::TABLE_DIALOGS . ' WHERE `send`="' . $this->user->getId() . '" OR `receive`="' . $this->user->getId() . '" ORDER BY `date_updated` DESC'
|
||||
);
|
||||
if (empty($dialogs)) {
|
||||
return [];
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
*/
|
||||
private static array $routes = [];
|
||||
|
||||
/**
|
||||
* @var array $paginationRoutes Маршруты, использующие пагинацию
|
||||
*/
|
||||
private static array $paginationRoutes = [];
|
||||
|
||||
/**
|
||||
* Метод вывода 404 ошибки
|
||||
*/
|
||||
@@ -76,6 +81,12 @@
|
||||
{
|
||||
array_shift($params);
|
||||
Registry::set('currentPage', $callback);
|
||||
// Проверка на пагинацию
|
||||
/*if (preg_match('/\/page\/(\d+)$/', $params[1], $paginationParams)) {
|
||||
Registry::set('usePagination', true);
|
||||
Registry::set('page', $paginationParams[1]);
|
||||
}*/
|
||||
|
||||
return call_user_func_array($callback, array_values($params));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user