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; $featured = $this->property('featured') ? $this->property('featured')=='yes':null;
$morque = $this->property('morque') ? $this->property('morque')=='yes':null; $morque = $this->property('morque') ? $this->property('morque')=='yes':null;
// dump($this->property('typePost'));
$posts = BlogPost::with(['categories'])->listFrontEnd([ $filters = [
'page' => $this->property('pageNumber'), 'page' => $this->property('pageNumber'),
'sort' => $this->property('sortOrder'), 'sort' => $this->property('sortOrder'),
'perPage' => $this->property('postsPerPage'), 'perPage' => $this->property('postsPerPage'),
'featured' => $featured, 'featured' => $featured,
'morque' => $morque, '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'), 'postGroup' => empty($this->property('categoryGroup')) ? null : $this->property('categoryGroup'),
'search' => trim(input('q')), 'search' => trim(input('q')),
'category' => $category, 'category' => $category,
@ -249,7 +252,15 @@ class Posts extends ComponentBase
'exceptCategories' => is_array($this->property('exceptCategories')) 'exceptCategories' => is_array($this->property('exceptCategories'))
? $this->property('exceptCategories') ? $this->property('exceptCategories')
: preg_split('/,\s*/', $this->property('exceptCategories'), -1, PREG_SPLIT_NO_EMPTY), : 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')); //dd($this->property('categoryGroup'));
/* /*
* Add a "url" helper attribute for linking to each post and category * 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(); $this->vars['reklam_stats'] = $stats->get();
dd($stats->get());
$this->vars['count_view'] = 30;
return ['#linechart' => $this->makePartial('linechart')]; return ['#linechart' => $this->makePartial('linechart')];
} }

View File

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

View File

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

View File

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