Файл: app/admin/support/article.php
Строк: 53
<?php
$api = new Api;
Core::only('level', 4);
if (filter_has_var(INPUT_GET, 'id'))
{
$filter = [
'id' => filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT)
];
$show = $api->query('support.show', ['id' => $filter['id']]);
$comments = $api->query('support.comments', ['id_support' => $filter['id']]);
}
if (isset($show['code']))
{
Core::go("/admin");
}
$smarty->header('Техническая поддержка');
if (filter_has_var(INPUT_POST, 'submit') && $show['close'] != 1)
{
$send = $api->query('support.comments.add', ['id_user' => $user['id'], 'text' => $_POST['text'], 'id_support' => $filter['id']]);
if (isset($send['code']))
{
$error = $send['code'];
}
elseif (isset($send['id']))
{
Core::go('?id=' . $filter['id']);
}
}
$listing[] = [
'title' => $show['title'],
'icon' => 'info',
'div' => 'razdel',
'count' => $comments['count_all']
];
$listing[] = [
'title' => Filter::output($show['text']),
'div' => 'menu'
];
$listing[] = [
'title' => Lang::word('Дата').': ' . Core::time($show['time']),
'div' => 'menu'
];
$elements = null;
if ($show['close'] != 1)
{
$elements[] = [
'type' => 'textarea',
'title' => Lang::word('Сообщение'),
'br' => 1,
'info' => [
'name' => 'text',
]
];
$elements[] = [
'type' => 'submit',
'info' => [
'name' => 'submit',
'value' => Lang::word('Отправить')
]
];
}
$pages = new Pages($comments['count_all'], $config['pages']);
if ($comments['count_all'] == 0)
{
$posts[] = [
'title' => Lang::word('Нет сообщений.')
];
}
else
{
foreach($comments['list'] AS $value)
{
$data[] = $value;
}
for($i = $start; $i < $comments['count_all'] && $i < $config['pages'] * $page; $i++)
{
$posts[] = [
'image' => $data[$i]['id_agent'] != 0 ? '<photo>#</photo>' : User::photo($data[$i]['id_user']),
'title' => $data[$i]['id_agent'] != 0 ? 'Агент тех. поддержки' : User::login($data[$i]['id_user']),
'post' => Filter::output($data[$i]['text']),
'time' => Core::time($data[$i]['time'])
];
}
}
Core::show('error');
$smarty->assign([
'listing' => $listing,
'post' => $posts,
'method' => 'POST',
'action' => '?id=' . $filter['id'],
'el' => $elements
]);
$smarty->display('listing.tpl');
$smarty->display('form.tpl');
$smarty->display('posts.tpl');
$pages->view('?id=' . $filter['id']);
$smarty->footer();