latest news

This commit is contained in:
Kerim 2023-02-17 11:39:53 +05:00
parent 3e5891a5af
commit fd1448175f
5 changed files with 60 additions and 57 deletions

View File

@ -230,14 +230,17 @@ class Posts extends ComponentBase
$featured = $this->property('featured') ? $this->property('featured')=='yes':null;
$morque = $this->property('morque') ? $this->property('morque')=='yes':null;
$posts = BlogPost::with(['categories'])->listFrontEnd([
// dump($this->property('typePost'));
$filters = [
'page' => $this->property('pageNumber'),
'sort' => $this->property('sortOrder'),
'perPage' => $this->property('postsPerPage'),
'featured' => $featured,
'morque' => $morque,
'typePost' => empty($this->property('typePost')) ? null : $this->property('typePost'),
// 'typePost' => empty($this->property('typePost')) ? null : $this->property('typePost'),
// 'typePost' => empty($this->property('typePost')) ? null : is_array($this->property('typePost'))
// ? $this->property('typePost')
// : preg_split('/,\s*/', $this->property('typePost'), -1, PREG_SPLIT_NO_EMPTY),
'postGroup' => empty($this->property('categoryGroup')) ? null : $this->property('categoryGroup'),
'search' => trim(input('q')),
'category' => $category,
@ -249,7 +252,15 @@ class Posts extends ComponentBase
'exceptCategories' => is_array($this->property('exceptCategories'))
? $this->property('exceptCategories')
: preg_split('/,\s*/', $this->property('exceptCategories'), -1, PREG_SPLIT_NO_EMPTY),
]);
];
if(!empty($this->property('typePost'))){
$filters["typePost"] = is_array($this->property('typePost'))
? $this->property('typePost')
: preg_split('/,\s*/', $this->property('typePost'), -1, PREG_SPLIT_NO_EMPTY);
}
$posts = BlogPost::with(['categories'])->listFrontEnd($filters);
//dd($this->property('categoryGroup'));
/*
* Add a "url" helper attribute for linking to each post and category

View File

@ -92,6 +92,9 @@ class StatisticsController extends Controller
$this->vars['reklam_stats'] = $stats->get();
dd($stats->get());
$this->vars['count_view'] = 30;
return ['#linechart' => $this->makePartial('linechart')];
}

View File

@ -8,14 +8,17 @@
google.charts.setOnLoadCallback(drawLineChart_<?=$id?>);
function drawLineChart_<?=$id?>(){
// var all = 20;
var data = google.visualization.arrayToDataTable([
['date', 'views', 'clicks',],
<?php foreach($reklam_stats->where('item_id',$id) as $stats):?>
['<?=date_format(date_create($stats->date),'m/d')?>', <?=$stats->view?>,<?=$stats->click?>],
['<?=date_format(date_create($stats->date),'m/d')?>', <?=$stats->view?>, <?=$stats->click?>],
<?php endforeach; ?>
]);
var options = {
title: '<?=$reklam?>',
title: '<?=$reklam?> <?=$count_view?>',
curveType: 'function',
legend: { position: 'bottom' }
};

View File

@ -119,10 +119,10 @@ default = 0
<script src="{{ 'assets/new/jquery.js'|theme}}"></script>
<script src="{{ 'assets/new/scripts/swiper/swiper-bundle.min.js'|theme}}"></script>
<script src="{{ 'assets/new/copy.js'|theme}}"></script>
<script src="{{ 'assets/new/copy.js'|theme}}"></script>
{% framework extras %}
{% scripts %}
{% framework extras %}

View File

@ -2,30 +2,16 @@
[blogPosts]
pageNumber = "{{ :page }}"
typePost = "turkmenistan"
typePost = "turkmenistan, world"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "created_at desc"
categoryPage = 404
postPage = 404
[blogPosts blogPosts2]
pageNumber = "{{ :page }}"
typePost = "world"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "created_at desc"
categoryPage = 404
postPage = 404
==
<?php
function onStart(){
$this["merged"]=$this["blogPosts"]."qq";
}
?>
==
{% set posts = blogPosts.posts %}
{% set posts_world = blogPosts2.posts %}
<!-- ASIDE MOBILE ============-->
@ -35,13 +21,13 @@ function onStart(){
<h2 class="aside-mobile-header">{{ 'page.latest_news'|_ }}</h2>
<ul class="aside-mobile-items">
{% for post in posts %}
<li>
<a href="{{'new/newPost'|page({id:post.id,slug:post.slug})}}">
<div class="time">{{post.published_at|date('H:i')}}</div>
<p class="content">
{{merged}}
{{ post.title }}
</p>
</a>