From 78a1eaeed84e265b6d6bc4f7659ca81798648bc0 Mon Sep 17 00:00:00 2001 From: Kerim Date: Thu, 9 Feb 2023 17:33:49 +0500 Subject: [PATCH] adv settings --- plugins/rainlab/blog/models/Post.php | 2 +- .../tps/reklama/components/Advertisement.php | 11 +- .../components/advertisement/default.htm | 8 +- .../components/advertisement/slider.htm | 75 +-------- .../reklamascontroller/config_filter.yaml | 50 ++++++ .../reklamascontroller/config_list.yaml | 1 + plugins/tps/reklama/models/Reklama.php | 14 +- .../tps/reklama/models/reklama/columns.yaml | 2 +- themes/modern2/layouts/new/master.htm | 19 ++- themes/modern2/pages/new/home.htm | 97 ++++-------- themes/modern2/partials/adv/2adv.htm | 101 +++++++------ themes/modern2/partials/adv/right-sidebar.htm | 34 +++-- .../modern2/partials/adv/right-sidebar2.htm | 45 +++--- .../modern2/partials/newHome/main-popular.htm | 16 +- themes/modern2/partials/newHome/main.htm | 143 ++++++++---------- themes/modern2/partials/newHome/partners.htm | 6 +- .../partials/newHome/right-sidebar.htm | 26 +--- 17 files changed, 306 insertions(+), 344 deletions(-) create mode 100644 plugins/tps/reklama/controllers/reklamascontroller/config_filter.yaml diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 2f7525638..23508bb16 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -234,7 +234,7 @@ class Post extends Model // \Log::info($fields->category_groups->value); // \Log::info($fields->category_groupsq->value); - + if (isset($this->awtor)) { if ($this->awtor->type == 'other' && $context == "create") { $fields->author_name->value = ''; diff --git a/plugins/tps/reklama/components/Advertisement.php b/plugins/tps/reklama/components/Advertisement.php index 0ac950f03..6ec107396 100644 --- a/plugins/tps/reklama/components/Advertisement.php +++ b/plugins/tps/reklama/components/Advertisement.php @@ -117,15 +117,16 @@ class Advertisement extends ComponentBase $statistika->increment('click'); } - //if($data['url']){ - + + // if($data['url']){ + // $this->page['url'] = $data['url']; - //return Redirect::to($data['url']); + // return Redirect::to($data['url']); // return [ // '@#'.$this->alias => $this->renderPartial('@redirect'), //]; - - //} + + // } } } diff --git a/plugins/tps/reklama/components/advertisement/default.htm b/plugins/tps/reklama/components/advertisement/default.htm index 87222bd24..377a61e23 100644 --- a/plugins/tps/reklama/components/advertisement/default.htm +++ b/plugins/tps/reklama/components/advertisement/default.htm @@ -1,16 +1,16 @@ -
+ {% if __SELF__.property('random') %} {% put scripts %} - --> {% endput %} {% else %} {% partial __SELF__ ~ "::"~ __SELF__.property('type') %} {% endif %} -
+ diff --git a/plugins/tps/reklama/components/advertisement/slider.htm b/plugins/tps/reklama/components/advertisement/slider.htm index 263988748..26b27c54d 100644 --- a/plugins/tps/reklama/components/advertisement/slider.htm +++ b/plugins/tps/reklama/components/advertisement/slider.htm @@ -1,9 +1,10 @@ {% if __SELF__.group and __SELF__.group.adds %} -
+ {% for reklama in __SELF__.group.adds %} - + +
{% endfor %} - -{% if __SELF__.property('random') %} - -{% else %} -{% put scripts %} - -{% endput %} -{% endif %} {% endif %} diff --git a/plugins/tps/reklama/controllers/reklamascontroller/config_filter.yaml b/plugins/tps/reklama/controllers/reklamascontroller/config_filter.yaml new file mode 100644 index 000000000..9d3771d75 --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/config_filter.yaml @@ -0,0 +1,50 @@ +# =================================== +# Filter Scope Definitions +# =================================== + +scopes: + title: + label: Title Search + type: text + modelClass: Tps\Reklama\Models\Reklama + scope: FilterName + + category: + + # Filter name + label: rainlab.blog::lang.posts.filter_category + + # Model Class name + modelClass: Tps\Reklama\Models\Group + + # Model attribute to display for the name + nameFrom: name + + # Apply query scope + scope: FilterCategories + + published: + + # Filter name + label: rainlab.blog::lang.posts.filter_published + + # Filter type + type: switch + + # SQL Conditions + conditions: + - active <> '1' + - active = '1' + + published_date: + + # Filter name + label: rainlab.blog::lang.posts.filter_date + + # Filter type + type: daterange + + # SQL Conditions + conditions: created_at >= ':after' AND created_at <= ':before' + + diff --git a/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml b/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml index 47471683c..5815da63b 100644 --- a/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml +++ b/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml @@ -10,3 +10,4 @@ toolbar: buttons: list_toolbar search: prompt: 'backend::lang.list.search_prompt' +filter: config_filter.yaml diff --git a/plugins/tps/reklama/models/Reklama.php b/plugins/tps/reklama/models/Reklama.php index d0e385ed9..2463ad828 100644 --- a/plugins/tps/reklama/models/Reklama.php +++ b/plugins/tps/reklama/models/Reklama.php @@ -21,7 +21,7 @@ class Reklama extends Model * @var string The database table used by the model. */ public $table = 'tps_reklama_item'; - + public $translatable = [ 'media', 'media_mobile', @@ -62,6 +62,18 @@ class Reklama extends Model } + public function scopeFilterName($query, $name) + { + return $query->where('title', 'LIKE', '%' . $name . '%'); + } + + public function scopeFilterCategories($query, $group) + { + return $query->whereHas('group', function ($q) use ($group) { + $q->whereIn('id', $group); + }); + } + public function getViewsAttribute(){ if($this->enable_stats) return $this->stats->sum('view'); diff --git a/plugins/tps/reklama/models/reklama/columns.yaml b/plugins/tps/reklama/models/reklama/columns.yaml index ab9623f7e..9c9f2d046 100644 --- a/plugins/tps/reklama/models/reklama/columns.yaml +++ b/plugins/tps/reklama/models/reklama/columns.yaml @@ -20,8 +20,8 @@ columns: type: text searchable: true sortable: true + select: name relation: group - valueFrom: name views: label: views type: text diff --git a/themes/modern2/layouts/new/master.htm b/themes/modern2/layouts/new/master.htm index 394aa4aa4..1a68045c5 100644 --- a/themes/modern2/layouts/new/master.htm +++ b/themes/modern2/layouts/new/master.htm @@ -53,8 +53,6 @@ random = 0 {% partial 'new/mobile-menu' %} - -
seach
@@ -63,7 +61,7 @@ random = 0

{{'site.slogan'|_}}

@@ -116,9 +114,9 @@ random = 0 {% partial 'new/menu' %} - + {% partial 'new/latest-news-mobile' %} - + {% partial 'new/morque' %} @@ -129,15 +127,20 @@ random = 0 {% partial 'new/footer' %} - + - {% scripts %} + {% scripts %} + {% framework extras %} + + + + @@ -151,4 +154,4 @@ random = 0 - \ No newline at end of file + diff --git a/themes/modern2/pages/new/home.htm b/themes/modern2/pages/new/home.htm index 4ba22233f..1081a070d 100644 --- a/themes/modern2/pages/new/home.htm +++ b/themes/modern2/pages/new/home.htm @@ -12,66 +12,35 @@ robot_follow = "follow" localeTitle[en] = "Home" localeUrl[en] = "/home" -[builderList adv4] -modelClass = "Tps\Reklama\Models\Reklama" -scope = "-" -scopeValue = "{{ :scope }}" -displayColumn = "id" -noRecordsMessage = "No records found" -detailsPage = "-" -detailsUrlParameter = "id" -pageNumber = "{{ :page }}" +[adverts adverts5] +code = 5 +type = "slider" +random = 0 -[builderList adv5] -modelClass = "Tps\Reklama\Models\Reklama" -scope = "-" -scopeValue = "{{ :scope }}" -displayColumn = "id" -noRecordsMessage = "No records found" -detailsPage = "-" -detailsUrlParameter = "id" -pageNumber = "{{ :page }}" +[adverts adverts6] +code = 6 +type = "slider" +random = 0 + +[adverts adverts7] +code = 7 +type = "slider" +random = 0 + +[adverts adverts8] +code = 8 +type = "slider" +random = 0 == -{% put styles %} - - - -{% endput %} - -{% set records = adv4.records %} -{% set displayColumn = adv4.displayColumn %} -{% set noRecordsMessage = adv4.noRecordsMessage %} -{% set detailsPage = adv4.detailsPage %} -{% set detailsKeyColumn = adv4.detailsKeyColumn %} -{% set detailsUrlParameter = adv4.detailsUrlParameter %} - - - {% partial 'newHome/main' %} {% partial 'newHome/main-popular' %} -{% partial 'adv/2adv' records=records id=19 id2=20 %} +{% partial 'adv/2adv' adv1=adverts5 adv2=adverts6 %} {% partial 'newHome/publication' %} - -{% set records = adv5.records %} -{% set displayColumn = adv5.displayColumn %} -{% set noRecordsMessage = adv5.noRecordsMessage %} -{% set detailsPage = adv5.detailsPage %} -{% set detailsKeyColumn = adv5.detailsKeyColumn %} -{% set detailsUrlParameter = adv5.detailsUrlParameter %} - - -{% partial 'adv/2adv' records=records id=21 id2=22 %} +{% partial 'adv/2adv' adv1=adverts7 adv2=adverts8 %} {% partial 'newHome/poleznoe' %} @@ -81,17 +50,17 @@ pageNumber = "{{ :page }}"
{% partial 'newHome/video' %}
- +
{% partial 'newHome/photo' %}
- - + + - - + +
@@ -99,9 +68,9 @@ pageNumber = "{{ :page }}"
- + {% partial 'newHome/partners' header="" %} - +
@@ -114,13 +83,13 @@ pageNumber = "{{ :page }}"
- - + +
- +
@@ -134,9 +103,9 @@ pageNumber = "{{ :page }}"
- + {% put scripts %} - - + + {% endput %} \ No newline at end of file diff --git a/themes/modern2/partials/adv/2adv.htm b/themes/modern2/partials/adv/2adv.htm index f126b6d22..a4f508f9b 100644 --- a/themes/modern2/partials/adv/2adv.htm +++ b/themes/modern2/partials/adv/2adv.htm @@ -2,52 +2,61 @@ ==
\ No newline at end of file + diff --git a/themes/modern2/partials/adv/right-sidebar.htm b/themes/modern2/partials/adv/right-sidebar.htm index d1074375d..7c1e65331 100644 --- a/themes/modern2/partials/adv/right-sidebar.htm +++ b/themes/modern2/partials/adv/right-sidebar.htm @@ -1,16 +1,24 @@ [viewBag] ==
- {% for record in records if record.group_id == id %} - - {% if record.id == 96 %} - - - - {% endif %} - - {% else %} -
  • {{ noRecordsMessage }}
  • - {% endfor %} - -
    \ No newline at end of file + + {% if adv.group and adv.group.adds %} + + {% for reklama in adv.group.adds %} +
    + + + + {{reklama.title}} + + +
    + + {% endfor %} + + {% endif %} + + + diff --git a/themes/modern2/partials/adv/right-sidebar2.htm b/themes/modern2/partials/adv/right-sidebar2.htm index 86fbd034f..fcdd74a2e 100644 --- a/themes/modern2/partials/adv/right-sidebar2.htm +++ b/themes/modern2/partials/adv/right-sidebar2.htm @@ -1,25 +1,30 @@ [viewBag] ==
    -
    -
    - {% for record in records if record.group_id == id and record.active == 1 %} - - \ No newline at end of file + {% endfor %} + + {% endif %} + + + +
    +
    +
    diff --git a/themes/modern2/partials/newHome/main-popular.htm b/themes/modern2/partials/newHome/main-popular.htm index 9c7b0be6c..1b873f7e8 100644 --- a/themes/modern2/partials/newHome/main-popular.htm +++ b/themes/modern2/partials/newHome/main-popular.htm @@ -18,16 +18,12 @@ noRecordsMessage = "No records found" detailsPage = "-" detailsUrlParameter = "id" pageNumber = "{{ :page }}" + +[adverts adverts4] +code = 4 +type = "slider" +random = 0 == -{% set records = adv3.records %} -{% set displayColumn = adv3.displayColumn %} -{% set noRecordsMessage = adv3.noRecordsMessage %} -{% set detailsPage = adv3.detailsPage %} -{% set detailsKeyColumn = adv3.detailsKeyColumn %} -{% set detailsUrlParameter = adv3.detailsUrlParameter %} - - - {% set post = byEditor.posts %}