mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
feat(global): news on left menu
Co-authored-by: Slava Petrov <55963296+saursvepur@users.noreply.github.com>
This commit is contained in:
parent
1677d9849e
commit
4c9c650cff
6 changed files with 34 additions and 2 deletions
|
@ -7,7 +7,7 @@ use Chandler\Security\Authenticator;
|
||||||
use Latte\Engine as TemplatingEngine;
|
use Latte\Engine as TemplatingEngine;
|
||||||
use openvk\Web\Models\Entities\IP;
|
use openvk\Web\Models\Entities\IP;
|
||||||
use openvk\Web\Themes\Themepacks;
|
use openvk\Web\Themes\Themepacks;
|
||||||
use openvk\Web\Models\Repositories\{IPs, Users, APITokens, Tickets, Reports, CurrentUser};
|
use openvk\Web\Models\Repositories\{IPs, Users, APITokens, Tickets, Reports, CurrentUser, Posts};
|
||||||
use WhichBrowser;
|
use WhichBrowser;
|
||||||
|
|
||||||
abstract class OpenVKPresenter extends SimplePresenter
|
abstract class OpenVKPresenter extends SimplePresenter
|
||||||
|
@ -207,6 +207,17 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
$userValidated = 0;
|
$userValidated = 0;
|
||||||
$cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0;
|
$cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0;
|
||||||
|
|
||||||
|
if(OPENVK_ROOT_CONF['openvk']['preferences']['news']['show']) {
|
||||||
|
$post = (new Posts)->getPostsFromUsersWall(-OPENVK_ROOT_CONF['openvk']['preferences']['news']['groupId'], 1, 1);
|
||||||
|
$post = iterator_to_array($post)[0];
|
||||||
|
|
||||||
|
$text = wordwrap($post->getText(false), 150, '\n', false);
|
||||||
|
$text = explode('\n', $text)[0];
|
||||||
|
|
||||||
|
$this->template->newsText = $text;
|
||||||
|
$this->template->newsLink = '/wall' . $post->getPrettyId();
|
||||||
|
}
|
||||||
|
|
||||||
if(!is_null($user)) {
|
if(!is_null($user)) {
|
||||||
$this->user = (object) [];
|
$this->user = (object) [];
|
||||||
$this->user->raw = $user;
|
$this->user->raw = $user;
|
||||||
|
|
|
@ -240,6 +240,14 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="news" n:if="OPENVK_ROOT_CONF['openvk']['preferences']['news']['show']">
|
||||||
|
<b>{_news} </b>
|
||||||
|
<hr size="1">
|
||||||
|
<text>{$newsText}...</text>
|
||||||
|
<br><br>
|
||||||
|
<a href="{$newsLink}">{_news_more}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['commerce'] && $thisUser->getCoins() != 0" id="votesBalance">
|
<div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['commerce'] && $thisUser->getCoins() != 0" id="votesBalance">
|
||||||
{tr("you_still_have_x_points", $thisUser->getCoins())|noescape}
|
{tr("you_still_have_x_points", $thisUser->getCoins())|noescape}
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
|
@ -2314,7 +2314,7 @@ li {
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#votesBalance {
|
#votesBalance, #news {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
background-color: #f6f6f6;
|
background-color: #f6f6f6;
|
||||||
|
@ -2323,6 +2323,11 @@ li {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#news b {
|
||||||
|
color: #8A0000;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.cookies-popup {
|
.cookies-popup {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
|
@ -1072,6 +1072,8 @@
|
||||||
"time_today" = "today";
|
"time_today" = "today";
|
||||||
"time_yesterday" = "yesterday";
|
"time_yesterday" = "yesterday";
|
||||||
|
|
||||||
|
"news" = "News";
|
||||||
|
"news_more" = "More »";
|
||||||
"points" = "Votes";
|
"points" = "Votes";
|
||||||
"points_count" = "votes";
|
"points_count" = "votes";
|
||||||
"on_your_account" = "on your account";
|
"on_your_account" = "on your account";
|
||||||
|
|
|
@ -1023,6 +1023,9 @@
|
||||||
"time_minutes_ago" = "$1 минут назад";
|
"time_minutes_ago" = "$1 минут назад";
|
||||||
"time_today" = "сегодня";
|
"time_today" = "сегодня";
|
||||||
"time_yesterday" = "вчера";
|
"time_yesterday" = "вчера";
|
||||||
|
|
||||||
|
"news" = "Новости";
|
||||||
|
"news_more" = "Подробнее »";
|
||||||
"points" = "Голоса";
|
"points" = "Голоса";
|
||||||
"points_count" = "голосов";
|
"points_count" = "голосов";
|
||||||
"on_your_account" = "на вашем счету";
|
"on_your_account" = "на вашем счету";
|
||||||
|
|
|
@ -111,6 +111,9 @@ openvk:
|
||||||
defaultMobileTheme: ""
|
defaultMobileTheme: ""
|
||||||
defaultFeaturePhoneTheme: ""
|
defaultFeaturePhoneTheme: ""
|
||||||
logs: true
|
logs: true
|
||||||
|
news:
|
||||||
|
show: false
|
||||||
|
groupId: 1
|
||||||
|
|
||||||
telemetry:
|
telemetry:
|
||||||
plausible:
|
plausible:
|
||||||
|
|
Loading…
Reference in a new issue