mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Admin: Added tabs in section club
This commit is contained in:
parent
c35f06e9e7
commit
f58464a1e3
2 changed files with 126 additions and 13 deletions
|
@ -80,23 +80,29 @@ final class AdminPresenter extends OpenVKPresenter
|
|||
if(!$club)
|
||||
$this->notFound();
|
||||
|
||||
$this->template->mode = in_array($this->queryParam("act"), ["main", "ban", "followers"]) ? $this->queryParam("act") : "main";
|
||||
|
||||
$this->template->club = $club;
|
||||
|
||||
$this->template->followers = $this->template->club->getFollowers((int) ($this->queryParam("p") ?? 1));
|
||||
|
||||
if($_SERVER["REQUEST_METHOD"] !== "POST")
|
||||
return;
|
||||
|
||||
switch($_POST["act"] ?? "info") {
|
||||
switch($this->queryParam("act")) {
|
||||
default:
|
||||
case "info":
|
||||
case "main":
|
||||
$club->setOwner($this->postParam("id_owner"));
|
||||
$club->setName($this->postParam("name"));
|
||||
$club->setAbout($this->postParam("about"));
|
||||
$club->setShortCode($this->postParam("shortcode"));
|
||||
$club->setVerified(empty($this->postParam("verify") ? 0 : 1));
|
||||
$club->save();
|
||||
break;
|
||||
case "ban":
|
||||
$club->setBlock_reason($this->postParam("ban_reason"));
|
||||
$club->save();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,27 @@
|
|||
|
||||
|
||||
{block content}
|
||||
|
||||
{var isMain = $mode === 'main'}
|
||||
{var isBan = $mode === 'ban'}
|
||||
{var isFollowers = $mode === 'followers'}
|
||||
|
||||
{if $isMain}
|
||||
|
||||
<!-- This main block -->
|
||||
|
||||
<div class="aui-tabs horizontal-tabs">
|
||||
<ul/>
|
||||
<nav class="aui-navgroup aui-navgroup-horizontal">
|
||||
<div class="aui-navgroup-inner">
|
||||
<div class="aui-navgroup-primary">
|
||||
<ul class="aui-nav">
|
||||
<li class="aui-nav-selected"><a href="?act=main">Главное</a></li>
|
||||
<li><a href="?act=ban">Бан</a></li>
|
||||
<li><a href="?act=followers">Участники</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<form class="aui" method="POST">
|
||||
<div class="field-group">
|
||||
<label for="avatar">
|
||||
|
@ -53,20 +72,14 @@
|
|||
</label>
|
||||
<input class="text medium-field" type="text" id="shortcode" name="shortcode" value="{$club->getShortCode()}" />
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="field-group">
|
||||
<br/>
|
||||
<div class="group">
|
||||
<input class="toggle-large" type="checkbox" id="verify" name="verify" value="1" {if $club->isVerified()} checked {/if} />
|
||||
<label for="verify">
|
||||
Верификация
|
||||
</label>
|
||||
<input class="toggle-large" type="checkbox" id="verify" name="verify" value="1" {if $club->isVerified()} checked {/if} />
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="field-group">
|
||||
<label for="ban_reason">
|
||||
Причина бана
|
||||
</label>
|
||||
<input class="text medium-field" type="text" id="ban_reason" name="ban_reason" value="{$club->getBanReason()}" />
|
||||
</div>
|
||||
<div class="buttons-container">
|
||||
<div class="buttons">
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
|
@ -75,4 +88,98 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $isBan}
|
||||
|
||||
<!-- This ban block -->
|
||||
|
||||
<div class="aui-tabs horizontal-tabs">
|
||||
<nav class="aui-navgroup aui-navgroup-horizontal">
|
||||
<div class="aui-navgroup-inner">
|
||||
<div class="aui-navgroup-primary">
|
||||
<ul class="aui-nav">
|
||||
<li><a href="?act=main">Главное</a></li>
|
||||
<li class="aui-nav-selected"><a href="?act=ban">Бан</a></li>
|
||||
<li><a href="?act=followers">Участники</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<form class="aui" method="POST">
|
||||
<div class="field-group">
|
||||
<label for="ban_reason">
|
||||
Причина бана
|
||||
</label>
|
||||
<input class="text" type="text" id="text-input" name="ban_reason" value="{$club->getBanReason()}" />
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="buttons-container">
|
||||
<div class="buttons">
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
<input class="button submit" type="submit" value="Сохранить">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $isFollowers}
|
||||
|
||||
<!-- This followers block -->
|
||||
|
||||
{var followers = iterator_to_array($followers)}
|
||||
|
||||
<div class="aui-tabs horizontal-tabs">
|
||||
<nav class="aui-navgroup aui-navgroup-horizontal">
|
||||
<div class="aui-navgroup-inner">
|
||||
<div class="aui-navgroup-primary">
|
||||
<ul class="aui-nav">
|
||||
<li><a href="?act=main">Главное</a></li>
|
||||
<li><a href="?act=ban">Бан</a></li>
|
||||
<li class="aui-nav-selected"><a href="?act=followers">Участники</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<table rules="none" class="aui aui-table-list">
|
||||
<tbody>
|
||||
<tr n:foreach="$followers as $follower">
|
||||
<td>{$follower->getId()}</td>
|
||||
<td>
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$follower->getAvatarUrl()}" alt="{$follower->getCanonicalName()}" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<a href="{$follower->getURL()}">{$follower->getCanonicalName()}</a>
|
||||
|
||||
<span n:if="$follower->isBanned()" class="aui-lozenge aui-lozenge-subtle aui-lozenge-removed">
|
||||
заблокирован
|
||||
</span>
|
||||
</td>
|
||||
<td>{$follower->isFemale() ? "Женский" : "Мужской"}</td>
|
||||
<td>{$follower->getShortCode() ?? "(отсутствует)"}</td>
|
||||
<td>{$follower->getRegistrationTime()}</td>
|
||||
<td>
|
||||
<a class="aui-button aui-button-primary" href="/admin/users/id{$follower->getId()}">
|
||||
<span class="aui-icon aui-icon-small aui-iconfont-new-edit">Редактировать</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div align="right">
|
||||
{var isLast = ((20 * (($_GET['p'] ?? 1) - 1)) + $amount) < $count}
|
||||
|
||||
<a n:if="($_GET['p'] ?? 1) > 1" class="aui-button" href="?p={($_GET['p'] ?? 1) - 1}">
|
||||
⭁ туда
|
||||
</a>
|
||||
<a n:if="$isLast" class="aui-button" href="?p={($_GET['p'] ?? 1) + 1}">
|
||||
⭇ сюда
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
Loading…
Reference in a new issue