from server 12.01

This commit is contained in:
root 2023-01-12 15:01:54 +05:00
parent ec413ac734
commit 0bb170eb98
7 changed files with 180 additions and 21 deletions

View File

@ -0,0 +1,88 @@
title = "new/getBy"
url = "/get-by/:authorId"
layout = "new/master-inside"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"
==
<?php
function onStart(){
$currentLocale = $this->activeLocale;
$this['authorId'] = $this->param('authorId');
$this['authorName'] = Tps\Tps\Models\Authors::find($this['authorId']);
$this['blogPosts'] = RainLab\Blog\Models\Post::where('author_id', $this['authorId'])->where('locale', 'ru')->orderBy('published_at', 'DESC')->paginate(10);
}
?>
==
{% set records = media.records %}
{% set displayColumn = media.displayColumn %}
{% set noRecordsMessage = media.noRecordsMessage %}
{% set detailsPage = media.detailsPage %}
{% set detailsKeyColumn = media.detailsKeyColumn %}
{% set detailsUrlParameter = media.detailsUrlParameter %}
<!-- HEAD end ======== -->
<main class="rubric-main">
<div class="container">
<div class="rubric-inner">
<div class="trending-head">
<h2 style="text-transform: capitalize;">{{ authorName.name }} </h2>
<span></span>
</div>
<div class="rubric-items {% if group == 'poster' %} affiche-items {% endif %}">
{% for post in blogPosts %}
{% if group == 'poster' %}
{% partial 'new/afisha-item' post = post %}
{% else %}
{% partial 'new/post_list_item' post = post %}
{% endif %}
{% else %}
<p>No posts found</p>
{% endfor %}
</div>
{% partial 'new/pagination' items = blogPosts %}
</div>
</div>
</main>
<section class="photo-scroller">
<div class="photo-scroller-inner">
<div class="swiper photoScrollerSwiper">
<div class="swiper-wrapper">
</div>
<div class="photo-scroller-prev video-prev">
<img src="{{'assets/new/icons/arrow-left-white.svg'|theme}}" alt="" />
</div>
<div class="photo-scroller-next video-next">
<img src="{{'assets/new/icons/arrow-right-white.svg'|theme}}" alt="" />
</div>
</div>
<div class="photo-scroller-closer">
<img src="{{'assets/new/icons/close.svg'|theme}}" alt="" />
</div>
</div>
</section>
{% put scripts %}
<script src="{{'assets/new/scripts/core/rubric.js'|theme}}"></script>
{% endput %}

View File

@ -71,9 +71,9 @@ function onStart(){
if($this['categorySlug']){
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::where('type', $this['categorySlug'])->orderBy('created_at', 'DESC')->get();
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::where('type', $this['categorySlug'])->orderBy('published_at', 'DESC')->paginate(9);
}else{
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::orderBy('created_at', 'DESC')->get();
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::orderBy('published_at', 'DESC')->paginate(9);
}
@ -113,6 +113,7 @@ function onStart(){
<li class="no-data">{{ 'no Records' }}</li>
{% endfor %}
</div>
{% partial 'new/pagination' items = mediaPostsFilter %}
{% else %}
<div class="rubric-items {% if group == 'poster' %} affiche-items {% endif %}">
@ -126,12 +127,12 @@ function onStart(){
<p>No posts found</p>
{% endfor %}
</div>
{% partial 'new/pagination' items = blogPosts.posts %}
{% endif %}
{% partial 'new/pagination' items = blogPosts.posts %}
</div>
</div>

View File

@ -9,8 +9,8 @@ robot_follow = "follow"
function onStart(){
$this['backendUsers'] = Tps\Tps\Models\Authors::all();
$this['yearq'] = $this->param('year');
$this['allPost'] = $this['posts'] = RainLab\Blog\Models\Post::count();
$this['allPostYear'] = $this['posts'] = RainLab\Blog\Models\Post::whereYear('published_at', $this['yearq'])->count();
$this['allPost'] = $this['posts'] = RainLab\Blog\Models\Post::whereHas('awtor')->where('locale', 'ru')->count();
$this['allPostYear'] = $this['posts'] = RainLab\Blog\Models\Post::whereHas('awtor')->whereYear('published_at', $this['yearq'])->where('locale', 'ru')->count();
}
?>
==
@ -27,7 +27,7 @@ function onStart(){
</style>
<div style="padding: 20px;">
<div style="text-align: center;">
<h2>{{ yearq }} report</h2>
<h2>{{ yearq }} report by authors</h2>
</div>
<table style="border: 1px solid black;width: 100%;">
<tr style="background: #ffc577;font-weight: bold;">
@ -49,24 +49,24 @@ function onStart(){
<td>Dekabr</td>
</tr>
{% for index, record in backendUsers %}
{% partial 'report/report' user = record.name index = index userId = record.id year = yearq %}
{% partial 'report/awtor' user = record index = index userId = record.id year = yearq %}
{% endfor %}
<tr style="background: #a77427;font-weight: bold;">
<td colspan="2" >HEMMESI</td>
<td>{{ allPost }}</td>
<td style="background: #a77427;">{{ allPostYear }}</td>
{% partial 'report/yearAll' month = 1 %}
{% partial 'report/yearAll' month = 2 %}
{% partial 'report/yearAll' month = 3 %}
{% partial 'report/yearAll' month = 4 %}
{% partial 'report/yearAll' month = 5 %}
{% partial 'report/yearAll' month = 6 %}
{% partial 'report/yearAll' month = 7 %}
{% partial 'report/yearAll' month = 8 %}
{% partial 'report/yearAll' month = 9 %}
{% partial 'report/yearAll' month = 10 %}
{% partial 'report/yearAll' month = 11 %}
{% partial 'report/yearAll' month = 12 %}
{% partial 'report/yearAllAwtor' month = 1 %}
{% partial 'report/yearAllAwtor' month = 2 %}
{% partial 'report/yearAllAwtor' month = 3 %}
{% partial 'report/yearAllAwtor' month = 4 %}
{% partial 'report/yearAllAwtor' month = 5 %}
{% partial 'report/yearAllAwtor' month = 6 %}
{% partial 'report/yearAllAwtor' month = 7 %}
{% partial 'report/yearAllAwtor' month = 8 %}
{% partial 'report/yearAllAwtor' month = 9 %}
{% partial 'report/yearAllAwtor' month = 10 %}
{% partial 'report/yearAllAwtor' month = 11 %}
{% partial 'report/yearAllAwtor' month = 12 %}
</tr>
</table>
</div>

View File

@ -0,0 +1,30 @@
[viewBag]
==
<?php
function onStart()
{
$userId = $this->userId;
$year = $this->year;
//dd($userId);
$this['postCount'] = Db::table('rainlab_blog_posts')->where('author_id', $userId)->count();
}
?>
==
<tr>
<td>{{ index + 1 }}</td>
<td>{{user.name}}</td>
<td>{{ postCount == 0 ? "" : postCount }}</td>
{% partial 'report/yearAwtor' year = year userId = userId %}
{% partial 'report/monthAwtor' month = 1 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 2 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 3 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 4 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 5 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 6 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 7 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 8 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 9 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 10 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 11 year = year userId = userId %}
{% partial 'report/monthAwtor' month = 12 year = year userId = userId %}
</tr>

View File

@ -0,0 +1,14 @@
[viewBag]
==
<?php
function onStart()
{
$userId = $this->userId;
$month = $this->month;
$year = $this->year;
//dd($userId);
$this['countByMonth'] = Db::table('rainlab_blog_posts')->where('author_id', $userId)->whereMonth('published_at', $month)->whereYear('published_at', $year)->where('locale', 'ru')->count();
}
?>
==
<td><a href="/get-by/{{userId}}" target="_blank">{{ countByMonth == 0 ? '' : countByMonth }}</a></td>

View File

@ -0,0 +1,13 @@
[viewBag]
==
<?php
function onStart()
{
$month = $this->month;
$year = $this->param('year');
//dd($userId);
$this['countByYearAll'] = RainLab\Blog\Models\Post::whereHas('awtor')->whereYear('published_at', $year)->whereMonth('published_at', $month)->where('locale', 'ru')->count();
}
?>
==
<td>{{ countByYearAll == 0 ? "" : countByYearAll }}</td>

View File

@ -0,0 +1,13 @@
[viewBag]
==
<?php
function onStart()
{
$userId = $this->userId;
$year = $this->year;
//dd($userId);
$this['countByYear'] = Db::table('rainlab_blog_posts')->where('author_id', $userId)->whereYear('published_at', $year)->where('locale', 'ru')->count();
}
?>
==
<td style="background: #ffc577;font-weight: bold;">{{ countByYear == 0 ? '' : countByYear }}</td>