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

@ -19,7 +19,7 @@ default = 0
<html lang="{{ activeLocale }}"> <html lang="{{ activeLocale }}">
<head> <head>
{% partial 'new/head' %} {% partial 'new/head' %}
{% component 'SeoCmsPage' %} {% component 'SeoCmsPage' %}
{% styles %} {% styles %}
@ -32,29 +32,29 @@ default = 0
<section class="big-banner"> <section class="big-banner">
<!-- <a href="#"> --> <!-- <a href="#"> -->
<picture> <picture>
{% component 'adverts'%} {% component 'adverts'%}
</picture> </picture>
<!-- </a> --> <!-- </a> -->
</section> </section>
<!-- HEAD ======== --> <!-- HEAD ======== -->
<header class="header"> <header class="header">
<div class="container"> <div class="container">
<div class="header-inner"> <div class="header-inner">
{% partial 'new/mobile-menu' %} {% partial 'new/mobile-menu' %}
<div class="header-search-icon"> <div class="header-search-icon">
<img src="{{ 'assets/new/icons/search.svg'|theme}}" alt="" /> <img src="{{ 'assets/new/icons/search.svg'|theme}}" alt="" />
</div> </div>
<div class="header-left"> <div class="header-left">
<a href="/" class="header-logo"> <a href="/" class="header-logo">
<!-- <img src="{{ 'assets/images/newYearLogo.png'|theme}}" alt="" /> --> <!-- <img src="{{ 'assets/images/newYearLogo.png'|theme}}" alt="" /> -->
@ -78,7 +78,7 @@ default = 0
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if this.theme.telegram %} {% if this.theme.telegram %}
<li> <li>
<a href="{{ this.theme.telegram }}"> <a href="{{ this.theme.telegram }}">
@ -86,7 +86,7 @@ default = 0
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if this.theme.twitter %} {% if this.theme.twitter %}
<li> <li>
<a href="{{ this.theme.twitter }}"> <a href="{{ this.theme.twitter }}">
@ -97,35 +97,35 @@ default = 0
</ul> </ul>
{% partial 'new/searchForm' %} {% partial 'new/searchForm' %}
</div> </div>
<div class="header-burger"> <div class="header-burger">
<img src="{{ 'assets/new/icons/burger.svg'|theme}}" alt="" /> <img src="{{ 'assets/new/icons/burger.svg'|theme}}" alt="" />
</div> </div>
</div> </div>
</div> </div>
</header> </header>
{% partial 'newMenu/menu' %} {% partial 'newMenu/menu' %}
{% partial 'new/latest-news-mobile' %} {% partial 'new/latest-news-mobile' %}
<!-- HEAD end ======== --> <!-- HEAD end ======== -->
{% page %} {% page %}
{% partial 'new/footer' %} {% partial 'new/footer' %}
<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>
{% scripts %} {% framework extras %}
{% framework extras %} {% scripts %}
<!-- javascript end <!-- javascript end
============================================= --> ============================================= -->
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
@ -140,4 +140,4 @@ default = 0
</body> </body>
</html> </html>

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(){ {% set posts = blogPosts.posts %}
$this["merged"]=$this["blogPosts"]."qq";
}
?>
==
{% set posts = blogPosts.posts %}
{% set posts_world = blogPosts2.posts %}
<!-- ASIDE MOBILE ============--> <!-- ASIDE MOBILE ============-->
@ -34,19 +20,19 @@ function onStart(){
<div class="aside-mobile-inner"> <div class="aside-mobile-inner">
<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>
</li> </li>
{% endfor %} {% endfor %}
<li> <li>
<a href="/new/posts/news" class="aside-mobile-more">{{'new.read.more'|_}}</a> <a href="/new/posts/news" class="aside-mobile-more">{{'new.read.more'|_}}</a>
@ -57,4 +43,4 @@ function onStart(){
</button> </button>
</div> </div>
</section> </section>
<!-- ASIDE MOBILE end ============ --> <!-- ASIDE MOBILE end ============ -->