Файл: upload/core/elements/sidebars/deal.php
Строк: 99
<?php
$user_is_neither = ($user['id'] != $work_prc['creator'] && $user['id'] != $work_prc['worker']);
$arbitrage_success = ($user_is_neither && $users_perms['manage_deal'] == 1);
$blocks = getDealBlocks(
$work_prc,
$user,
$arbitrage_success,
$rating,
$reply_query_comm,
$ank_rating
);
// === Исполнитель ===
$us_full = [
'avatar' => GetAvatar($us['avatar']),
'nick' => nick($us['id']),
'rating_num' => rating_num_worker($us['id']),
'rating_stars' => rating_star_worker($us['id']),
];
// === Заказчик ===
$us_wr_full = [
'avatar' => GetAvatar($us_wr['avatar']),
'nick' => nick($us_wr['id']),
'rating_num' => rating_num_worker($us_wr['id']),
'rating_stars' => rating_star_worker($us_wr['id']),
];
// === Автор отзыва ===
$ank_rating_full = [
'id' => $ank_rating['id'],
'us' => $ank_rating['id'],
'avatar' => GetAvatar($ank_rating['avatar']),
'nick' => nick($ank_rating['id']),
'login' => $ank_rating['login'],
];
if (!empty($rating['id'])) {
$rating_full = [
'id' => $rating['id'],
'rating' => $rating['rating'],
'k_comment' => $rating['k_comment'],
'rating_stars' => rating_num_star_work($rating['rating']),
];
} else {
$rating_full = null;
}
// === История удалённых отзывов ===
$count_del = FetchAssoc(
dbquery("SELECT COUNT(*) AS cnt FROM rating_history WHERE deal = ?", [$id])
);
$deleted_feed_full = [];
if ($count_del['cnt'] > 0 && $users_perms['view_del_comments'] == 1) {
$deleted_feed = dbquery("SELECT * FROM rating_history WHERE deal = ? ORDER BY id", [$id]);
while ($df = FetchAssoc($deleted_feed)) {
$ank = FetchAssoc(dbquery("SELECT * FROM users WHERE id = ?", [$df['us']]));
// история ответов
$reply_history = [];
$history_query = dbquery(
"SELECT * FROM rating_comments_history WHERE rating_id = ? ORDER BY id ASC",
[$df['rating_id']]
);
while ($hist = FetchAssoc($history_query)) {
$reply_history[] = [
'new_message' => $hist['new_message'],
'created_at' => !empty($hist['created_at']) ? vremja($hist['created_at']) : null,
'changed_at' => !empty($hist['changed_at']) ? vremja($hist['changed_at']) : null,
'deleted_at' => !empty($hist['deleted_at']) ? vremja($hist['deleted_at']) : null,
];
}
$deleted_feed_full[] = [
'avatar' => GetAvatar($ank['avatar']),
'nick' => nick($ank['id']),
'rating' => $df['rating'],
'rating_stars' => render_stars_by_value($df['rating']),
'k_comment' => $df['k_comment'],
'deleted_at' => $df['deleted_at'],
'reply_history'=> $reply_history,
];
}
}
// === РЕНДЕР TWIG ===
$sidebar = $view->render('components/sidebars/deal.html', [
'home' => homeLink(),
'work' => $work,
'work_prc' => $work_prc,
'blocks' => $blocks,
'us' => $us_full,
'us_wr' => $us_wr_full,
'rating' => $rating_full,
'reply_query_comm' => $reply_query_comm,
'ank_rating' => $ank_rating_full,
'users_perms' => $users_perms,
'count_del' => $count_del,
'deleted_feed' => $deleted_feed_full,
'user' => $user,
'id' => $id,
]);
return $sidebar;
?>