From fd1448175f32dd1ab4e7550a1cd9e8528ea30e58 Mon Sep 17 00:00:00 2001 From: Kerim Date: Fri, 17 Feb 2023 11:39:53 +0500 Subject: [PATCH] latest news --- plugins/rainlab/blog/components/Posts.php | 19 ++++-- .../controllers/StatisticsController.php | 3 + .../statisticscontroller/_linechart.htm | 7 ++- themes/modern2/layouts/new/master-inside.htm | 58 +++++++++---------- .../partials/new/latest-news-mobile.htm | 30 +++------- 5 files changed, 60 insertions(+), 57 deletions(-) diff --git a/plugins/rainlab/blog/components/Posts.php b/plugins/rainlab/blog/components/Posts.php index 4ad11c144..2515c7e12 100644 --- a/plugins/rainlab/blog/components/Posts.php +++ b/plugins/rainlab/blog/components/Posts.php @@ -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 diff --git a/plugins/tps/reklama/controllers/StatisticsController.php b/plugins/tps/reklama/controllers/StatisticsController.php index 035ba3c09..bb8273969 100644 --- a/plugins/tps/reklama/controllers/StatisticsController.php +++ b/plugins/tps/reklama/controllers/StatisticsController.php @@ -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')]; } diff --git a/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm b/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm index 63908d331..19c98671f 100644 --- a/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm +++ b/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm @@ -8,14 +8,17 @@ google.charts.setOnLoadCallback(drawLineChart_); function drawLineChart_(){ + // var all = 20; + + var data = google.visualization.arrayToDataTable([ ['date', 'views', 'clicks',], where('item_id',$id) as $stats):?> - ['date),'m/d')?>', view?>,click?>], + ['date),'m/d')?>', view?>, click?>], ]); var options = { - title: '', + title: ' ', curveType: 'function', legend: { position: 'bottom' } }; diff --git a/themes/modern2/layouts/new/master-inside.htm b/themes/modern2/layouts/new/master-inside.htm index 71ec773f6..953ffa481 100644 --- a/themes/modern2/layouts/new/master-inside.htm +++ b/themes/modern2/layouts/new/master-inside.htm @@ -19,7 +19,7 @@ default = 0 - + {% partial 'new/head' %} {% component 'SeoCmsPage' %} {% styles %} @@ -32,29 +32,29 @@ default = 0
- + {% component 'adverts'%} - +
- - - + + +
- - + + {% partial 'new/mobile-menu' %} - - - + + +
- +
{% endif %} - + {% if this.theme.telegram %}
  • @@ -86,7 +86,7 @@ default = 0
  • {% endif %} - + {% if this.theme.twitter %}
  • @@ -97,35 +97,35 @@ default = 0 {% partial 'new/searchForm' %}
  • - +
    - - + +
    - + {% partial 'newMenu/menu' %} - + {% partial 'new/latest-news-mobile' %} - + - + {% page %} - + {% partial 'new/footer' %} - - - {% scripts %} - {% framework extras %} - + + + {% framework extras %} + {% scripts %} + + - @@ -140,4 +140,4 @@ default = 0 - \ No newline at end of file + diff --git a/themes/modern2/partials/new/latest-news-mobile.htm b/themes/modern2/partials/new/latest-news-mobile.htm index 5b0da27c8..3a7686bea 100644 --- a/themes/modern2/partials/new/latest-news-mobile.htm +++ b/themes/modern2/partials/new/latest-news-mobile.htm @@ -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 == - -== -{% set posts = blogPosts.posts %} -{% set posts_world = blogPosts2.posts %} + +{% set posts = blogPosts.posts %} @@ -34,19 +20,19 @@ function onStart(){

    {{ 'page.latest_news'|_ }}

    - \ No newline at end of file +