diff --git a/config/app.php b/config/app.php index 0dddfdd0d..d073ca3bc 100644 --- a/config/app.php +++ b/config/app.php @@ -28,7 +28,7 @@ return [ | any other location as required by the application or its packages. */ - 'name' => 'October CMS', + 'name' => 'Orient news', /* |-------------------------------------------------------------------------- @@ -62,7 +62,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'Asia/Ashgabat', /* |-------------------------------------------------------------------------- @@ -148,7 +148,7 @@ return [ */ 'loadDiscoveredPackages' => false, - + /* |-------------------------------------------------------------------------- | Class Aliases diff --git a/plugins/pollozen/mostvisited/Plugin.php b/plugins/pollozen/mostvisited/Plugin.php deleted file mode 100644 index 8b57c662b..000000000 --- a/plugins/pollozen/mostvisited/Plugin.php +++ /dev/null @@ -1,52 +0,0 @@ - 'Most Visited Posts', - 'description' => 'Register visit to RainLab Blog publication and retrieve the most visited publications', - 'author' => 'PolloZen', - 'icon' => 'icon-list-ul' - ]; - } - - /** - * Boot method, called right before the request route. - * - * @return array - */ - public function boot(){ - PostModel::extend(function($model){ - $model->hasMany['visits'] = ['PolloZen\MostVisited\Models\Visits']; - }); - - } - - /** - * Registers any front-end components implemented in this plugin. - * - * @return array - */ - public function registerComponents(){ - - return [ - 'PolloZen\MostVisited\Components\RegisterVisit' => 'registerVisit', - 'PolloZen\MostVisited\Components\TopVisited' => 'topPosts', - ]; - } -} diff --git a/plugins/pollozen/mostvisited/README.md b/plugins/pollozen/mostvisited/README.md deleted file mode 100644 index effca54b5..000000000 --- a/plugins/pollozen/mostvisited/README.md +++ /dev/null @@ -1,58 +0,0 @@ -#Most Visited Post for [RainLab Blog](https://octobercms.com/plugin/rainlab-blog) - -Plugin to register visits to [RainLab Blog](https://octobercms.com/plugin/rainlab-blog) Blog Publications and create a list of the most visited posts in a period of time - -##Installing the watcher -**IMPORTANT** - -In order to register the visit to a Publication `RegisterVisit` component must be added to Post Page - -##Create a most visited posts list -Add the `TopVisitedComponent` - -This component has parameters - -**Most Visited From** - The time period to get the most visited publications - -- Today -- Current Week -- Last Week -- All the time - -**Category filter** - -You can select a category filter, this way you can get the Top 10 from a particular category. If no category is selected, the component will retrieve the top 10 from all your publications - -**Top** - -How many publications must be retrieved - -###Examples - -Using these three parameters you can construct different lists. Eg. - -- **Last week**, top **10** from **local news** -- **Today** top **5** from **all the site** -- Top **10** from **all the site** in **all the time** - -###Displaying the results -The `TopVisitedComponent` inject the **mostVisitedPosts** object - - - -Use as you already use the RainLab blog post - -``` -{% for post in mostVisitedPosts %} -
-
-
-

{{post.title}}

- Continue reading -
-
-{% endfor %} -``` - -##Support and bugs reporting -You can write in the forum or visit me in [Github](https://github.com/sanPuerquitoProgramador/most-visited-posts) \ No newline at end of file diff --git a/plugins/pollozen/mostvisited/components/RegisterVisit.php b/plugins/pollozen/mostvisited/components/RegisterVisit.php deleted file mode 100644 index b57105b4c..000000000 --- a/plugins/pollozen/mostvisited/components/RegisterVisit.php +++ /dev/null @@ -1,32 +0,0 @@ - 'Register Visit', - 'description' => 'Attach this component to your blog post page/partial in order to register the user visit' - ]; - } - - public function defineProperties() - { - return []; - } - public function onRun(){ - if($this->page[ 'post' ]){ - if($this->page[ 'post' ]->id){ - $idPost = $this->page[ 'post' ]->id; - $today = Carbon::today(); - $visit = new Visits; - $visit = $visit->firstOrCreate(['post_id'=>$idPost, 'date'=>$today]); - $visit->whereId($visit->id)->increment('visits'); - } - } - } -} diff --git a/plugins/pollozen/mostvisited/components/TopVisited.php b/plugins/pollozen/mostvisited/components/TopVisited.php deleted file mode 100644 index 7a835987b..000000000 --- a/plugins/pollozen/mostvisited/components/TopVisited.php +++ /dev/null @@ -1,196 +0,0 @@ - 'Top Visited Component', - 'description' => 'Retrieve the top visited RainLab Blog Posts' - ]; - } - /** - * Definition of propertys - * @return [array] - */ - public function defineProperties() - { - return [ - 'period' =>[ - 'title' => 'Most visited from:', - 'description' => '', - 'default' => 2, - 'type' => 'dropdown', - 'options' => [ - '1' => 'Today', - '2' => 'Current week', - '3' => 'Yesterday', - '4' => 'Last week', - '5' => 'All time' - ], - 'showExternalParam' => false - ], - 'category' =>[ - 'title' => 'Category Filter', - 'description' => 'Filter result by category. All categories by default', - 'type' => 'dropdown', - 'placeholder' => 'Select a category', - 'showExternalParam' => false, - 'default' => 0 - ], - 'postPerPage' => [ - 'title' => 'Top', - 'description' => 'How many results must be fetched', - 'default' => 5, - 'type' => 'string' - ], - 'postPage' => [ - 'title' => 'Post page', - 'description' => 'Page to show linked posts', - 'type' => 'dropdown', - 'default' => 'blog/post', - 'group' => 'Links', - ], - 'slug' => [ - 'title' => 'rainlab.blog::lang.settings.post_slug', - 'description' => 'rainlab.blog::lang.settings.post_slug_description', - 'default' => '{{ :slug }}', - 'type' => 'string', - 'group' => 'Links' - ] - ]; - } - /** - * [getPostPageOptions] - * @return [array][Blog] - */ - public function getPostPageOptions() - { - return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName'); - } - /** - * [getCategoryOptions] - * @return [array list] [Blog Categories] - */ - public function getCategoryOptions(){ - $categories = [0=>'No filter'] + Category::orderBy('name')->lists('name','id'); - return $categories; - } - public function onRun(){ - $this->prepareVars(); - $this->mostVisitedPosts = $this->page['mostVisitedPosts'] = $this->getMostVisitedPosts(); - - } - - /** - * prepare Vars function - * @return [object] - */ - protected function prepareVars() { - /*Get the category filter*/ - $this->category = ($this->property('category')!=0) ? $this->property('category') : null; - - /* Get post page */ - $this->postPage = $this->property('postPage') ? $this->property('postPage') : '404'; - - /* Top */ - $this->postPerPage = is_int($this->property('postPerPage')) ? $this->property('postPerPage') : 5; - } - - - /** - * getTop Function [Obtiene los Post ID del rango y categorua seleccionados] - * @return [type] [description] - */ - protected function getTop(){ - switch($this->property('period')){ - case '1': - $dateRange = Carbon::today(); - break; - case '2': - $fromDate = Carbon::now()->startOfWeek()->format('Y-m-d'); - $toDate = Carbon::now()->endOfWeek()->format('Y-m-d'); - break; - case '3': - $dateRange = Carbon::yesterday(); - break; - case '4': - $fromDate = Carbon::now()->subDays(7)->startOfWeek()->format('Y/m/d'); - $toDate = Carbon::now()->subDays(7)->endOfWeek()->format('Y/m/d'); - break; - default: - // Si no hay fecha se toman todos - break; - } - - $v = Visits::select('pollozen_mostvisited_visits.post_id'); - - if(isset($dateRange)){ - $v->where('date',$dateRange); - } elseif (isset($fromDate)) { - $v->whereBetween('date', array($fromDate, $toDate)); - } - - $v ->selectRaw('sum(visits) as visits, count(pollozen_mostvisited_visits.post_id) as touchs') - ->groupBy('post_id') - ->orderBy('visits','desc'); - - if($this->category !== null){ - $v->join('rainlab_blog_posts_categories',function($join){ - $join ->on('pollozen_mostvisited_visits.post_id','=','rainlab_blog_posts_categories.post_id') - ->where('rainlab_blog_posts_categories.category_id','=',$this->category); - }); - } - - $v->limit($this->property('postPerPage')); - $topIds = $v -> lists('post_id'); - - return $topIds; - } - - protected function getMostVisitedPosts(){ - /* Obtenemos los ID de los más visitados en el rango solicitado */ - $topIds = $this->getTop(); - if(count($topIds)!=0){ - $placeholders = implode(',', array_fill(0, count($topIds), '?')) ; - - /* Empezamos con el objeto de los posts en general que estén publicados*/ - $p = Post::isPublished(); - $p->whereIn('id', $topIds); - $p->orderByRaw("FIELD(id,{$placeholders})",$topIds); - $mostVisitedPosts = $p->get(); - - /* Agregamos el helper de la URL*/ - $mostVisitedPosts->each(function($post) { - $post->setUrl($this->postPage,$this->controller); - }); - /* Mandamos los resultados */ - return $mostVisitedPosts; - } else { - return []; - } - } -} diff --git a/plugins/pollozen/mostvisited/components/registervisit/default.htm b/plugins/pollozen/mostvisited/components/registervisit/default.htm deleted file mode 100644 index 7b3cab4af..000000000 --- a/plugins/pollozen/mostvisited/components/registervisit/default.htm +++ /dev/null @@ -1 +0,0 @@ -

Nothing to see here. This component is added to the post page in order to register the visit

\ No newline at end of file diff --git a/plugins/pollozen/mostvisited/components/topvisited/default.htm b/plugins/pollozen/mostvisited/components/topvisited/default.htm deleted file mode 100644 index eb8c94e16..000000000 --- a/plugins/pollozen/mostvisited/components/topvisited/default.htm +++ /dev/null @@ -1,18 +0,0 @@ -{% set mostVisitedPosts = __SELF__.mostVisitedPosts %} -
-

Top Publications

-
- -
-
diff --git a/plugins/pollozen/mostvisited/models/Visits.php b/plugins/pollozen/mostvisited/models/Visits.php deleted file mode 100644 index c25bdf364..000000000 --- a/plugins/pollozen/mostvisited/models/Visits.php +++ /dev/null @@ -1,37 +0,0 @@ - ['Rainlab\Blog\Models\Post'] - ]; -} \ No newline at end of file diff --git a/plugins/pollozen/mostvisited/models/visits/columns.yaml b/plugins/pollozen/mostvisited/models/visits/columns.yaml deleted file mode 100644 index b11160b42..000000000 --- a/plugins/pollozen/mostvisited/models/visits/columns.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# =================================== -# List Column Definitions -# =================================== - -columns: - id: - label: ID - searchable: true diff --git a/plugins/pollozen/mostvisited/models/visits/fields.yaml b/plugins/pollozen/mostvisited/models/visits/fields.yaml deleted file mode 100644 index c611f31c7..000000000 --- a/plugins/pollozen/mostvisited/models/visits/fields.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# =================================== -# Form Field Definitions -# =================================== - -fields: - id: - label: ID - disabled: true diff --git a/plugins/pollozen/mostvisited/updates/create_visits_table.php b/plugins/pollozen/mostvisited/updates/create_visits_table.php deleted file mode 100644 index 6ef416413..000000000 --- a/plugins/pollozen/mostvisited/updates/create_visits_table.php +++ /dev/null @@ -1,27 +0,0 @@ -engine = 'InnoDB'; - $table->increments('id'); - $table->integer('post_id')->unsigned(); - $table->date('date'); - $table->smallInteger('visits')->unsigned()->default(0); - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists('pollozen_mostvisited_visits'); - } - -} diff --git a/plugins/pollozen/mostvisited/updates/version.yaml b/plugins/pollozen/mostvisited/updates/version.yaml deleted file mode 100644 index c52463799..000000000 --- a/plugins/pollozen/mostvisited/updates/version.yaml +++ /dev/null @@ -1,5 +0,0 @@ -1.0.1: - - First version of MostVisited. Create the Visitis table - - create_visits_table.php -1.0.2: - - Improve a new query to get the top visited post. Same results in 4x faster diff --git a/plugins/rainlab/blog/models/Category.php b/plugins/rainlab/blog/models/Category.php index 34d00a8c1..3e0072c8b 100644 --- a/plugins/rainlab/blog/models/Category.php +++ b/plugins/rainlab/blog/models/Category.php @@ -46,7 +46,11 @@ class Category extends Model 'table' => 'rainlab_blog_posts_categories', 'scope' => 'isPublished', 'count' => true - ] + ], + 'posts_filtered' => ['RainLab\Blog\Models\Post', + 'table' => 'rainlab_blog_posts_categories', + 'scope' => 'postsWithCats', + ], ]; public function beforeValidate() @@ -78,6 +82,10 @@ class Category extends Model }); } + public function take_posts($count = 3){ + return $this->posts->take($count); + } + /** * Sets the "url" attribute with a URL to this object * diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 951906219..ba73915ee 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -224,6 +224,13 @@ class Post extends Model ; } + public function scopePostsWithCats($query){ + return $query + ->isPublished() + ->with('categories') + ->orderBy('published_at','desc') + ->take(7); + } /** * Lists posts for the frontend * @@ -395,7 +402,7 @@ class Post extends Model return array_get($parts, 0); } - return Html::limit($this->content_html, 600); + return Html::limit($this->content_html, 280); } // diff --git a/plugins/tps/reklama/Plugin.php b/plugins/tps/reklama/Plugin.php new file mode 100644 index 000000000..724e2dddb --- /dev/null +++ b/plugins/tps/reklama/Plugin.php @@ -0,0 +1,17 @@ + 'adverts', + ]; + } + + public function registerSettings() + { + } +} diff --git a/plugins/tps/reklama/components/Advertisement.php b/plugins/tps/reklama/components/Advertisement.php new file mode 100644 index 000000000..009d2bb0d --- /dev/null +++ b/plugins/tps/reklama/components/Advertisement.php @@ -0,0 +1,66 @@ + 'Advertisements', + 'description' => 'Reklamajyklar' + ]; + } + + public function defineProperties(){ + + return [ + 'code' => [ + 'title' => 'Group', + 'description' => 'Choose advertisement group', + 'type' => 'dropdown', + 'required' => 'required', + 'validationMessage' => 'Please select group' + + ], + 'type' => [ + 'title' => 'Display type', + 'description' => 'Choose display type group', + 'type' => 'dropdown', + 'default' => 'single', + 'required' => 'required', + 'validationMessage' => 'Please select type' + ], + 'width' =>[ + 'title' => 'Item width', + 'type' => 'number', + ], + 'height' => [ + 'title' => 'Item height', + 'type' => 'number', + ] + ]; + } + public function getCodeOptions() + { + return Group::all()->pluck('name','code')->toArray(); + } + public function getTypeOptions() + { + return [ + 'single'=>'single', + 'single_slide'=>'single_slide', + 'single_random'=>'single_random', + 'slider'=>'slider', + ]; + } + + public function onRun(){ + $this->group = Group::where('code',$this->property('code')) + ->with('adds') + ->first(); + } +} diff --git a/plugins/tps/reklama/components/advertisement/default.htm b/plugins/tps/reklama/components/advertisement/default.htm new file mode 100644 index 000000000..babc9f68c --- /dev/null +++ b/plugins/tps/reklama/components/advertisement/default.htm @@ -0,0 +1 @@ +{% partial __SELF__ ~ "::"~ __SELF__.property('type') %} diff --git a/plugins/tps/reklama/components/advertisement/single.htm b/plugins/tps/reklama/components/advertisement/single.htm new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/tps/reklama/components/advertisement/single_random.htm b/plugins/tps/reklama/components/advertisement/single_random.htm new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/tps/reklama/components/advertisement/single_slide.htm b/plugins/tps/reklama/components/advertisement/single_slide.htm new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/tps/reklama/components/advertisement/slider.htm b/plugins/tps/reklama/components/advertisement/slider.htm new file mode 100644 index 000000000..c99ee5768 --- /dev/null +++ b/plugins/tps/reklama/components/advertisement/slider.htm @@ -0,0 +1,15 @@ +
+ + +
+ {% for reklama in __SELF__.group.adds %} + + {{reklama.title}} + + {% endfor %} +
+
diff --git a/plugins/tps/reklama/controllers/GroupsController.php b/plugins/tps/reklama/controllers/GroupsController.php new file mode 100644 index 000000000..45965a41f --- /dev/null +++ b/plugins/tps/reklama/controllers/GroupsController.php @@ -0,0 +1,18 @@ + + + + diff --git a/plugins/tps/reklama/controllers/groupscontroller/config_form.yaml b/plugins/tps/reklama/controllers/groupscontroller/config_form.yaml new file mode 100644 index 000000000..a7ec95de8 --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: GroupsController +modelClass: Tps\Reklama\Models\Group +form: $/tps/reklama/models/group/fields.yaml +defaultRedirect: tps/reklama/groupscontroller +create: + redirect: 'tps/reklama/groups/update/:id' + redirectClose: tps/reklama/groupscontroller +update: + redirect: tps/reklama/groups + redirectClose: tps/reklama/groupscontroller diff --git a/plugins/tps/reklama/controllers/groupscontroller/config_list.yaml b/plugins/tps/reklama/controllers/groupscontroller/config_list.yaml new file mode 100644 index 000000000..ad3f829c9 --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/config_list.yaml @@ -0,0 +1,12 @@ +title: GroupsController +modelClass: Tps\Reklama\Models\Group +list: $/tps/reklama/models/group/columns.yaml +recordUrl: 'tps/reklama/groups/update/:id' +noRecordsMessage: 'backend::lang.list.no_records' +recordsPerPage: 20 +showSetup: true +showCheckboxes: true +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' diff --git a/plugins/tps/reklama/controllers/groupscontroller/create.htm b/plugins/tps/reklama/controllers/groupscontroller/create.htm new file mode 100644 index 000000000..570b2b208 --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/reklama/controllers/groupscontroller/index.htm b/plugins/tps/reklama/controllers/groupscontroller/index.htm new file mode 100644 index 000000000..ea43a3636 --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/tps/reklama/controllers/groupscontroller/preview.htm b/plugins/tps/reklama/controllers/groupscontroller/preview.htm new file mode 100644 index 000000000..b583e5be7 --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/tps/reklama/controllers/groupscontroller/update.htm b/plugins/tps/reklama/controllers/groupscontroller/update.htm new file mode 100644 index 000000000..f27c1bbed --- /dev/null +++ b/plugins/tps/reklama/controllers/groupscontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/reklama/controllers/reklamascontroller/_list_toolbar.htm b/plugins/tps/reklama/controllers/reklamascontroller/_list_toolbar.htm new file mode 100644 index 000000000..2d721f4bc --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/_list_toolbar.htm @@ -0,0 +1,18 @@ +
+ + +
diff --git a/plugins/tps/reklama/controllers/reklamascontroller/config_form.yaml b/plugins/tps/reklama/controllers/reklamascontroller/config_form.yaml new file mode 100644 index 000000000..02744863c --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: ReklamasController +form: $/tps/reklama/models/reklama/fields.yaml +modelClass: Tps\Reklama\Models\Reklama +defaultRedirect: tps/reklama/reklamascontroller +create: + redirect: 'tps/reklama/reklamascontroller/update/:id' + redirectClose: tps/reklama/reklamascontroller +update: + redirect: tps/reklama/reklamascontroller + redirectClose: tps/reklama/reklamascontroller diff --git a/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml b/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml new file mode 100644 index 000000000..47471683c --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/config_list.yaml @@ -0,0 +1,12 @@ +title: ReklamasController +modelClass: Tps\Reklama\Models\Reklama +list: $/tps/reklama/models/reklama/columns.yaml +recordUrl: 'tps/reklama/reklamascontroller/update/:id' +noRecordsMessage: 'backend::lang.list.no_records' +recordsPerPage: 20 +showSetup: true +showCheckboxes: true +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' diff --git a/plugins/tps/reklama/controllers/reklamascontroller/create.htm b/plugins/tps/reklama/controllers/reklamascontroller/create.htm new file mode 100644 index 000000000..7c0451f9f --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/reklama/controllers/reklamascontroller/index.htm b/plugins/tps/reklama/controllers/reklamascontroller/index.htm new file mode 100644 index 000000000..ea43a3636 --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/tps/reklama/controllers/reklamascontroller/preview.htm b/plugins/tps/reklama/controllers/reklamascontroller/preview.htm new file mode 100644 index 000000000..7ce5d0964 --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/tps/reklama/controllers/reklamascontroller/update.htm b/plugins/tps/reklama/controllers/reklamascontroller/update.htm new file mode 100644 index 000000000..1fbc39c6e --- /dev/null +++ b/plugins/tps/reklama/controllers/reklamascontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/reklama/lang/en/lang.php b/plugins/tps/reklama/lang/en/lang.php new file mode 100644 index 000000000..6b624675a --- /dev/null +++ b/plugins/tps/reklama/lang/en/lang.php @@ -0,0 +1,6 @@ + [ + 'name' => 'Reklama', + 'description' => '' + ] +]; \ No newline at end of file diff --git a/plugins/tps/reklama/models/Group.php b/plugins/tps/reklama/models/Group.php new file mode 100644 index 000000000..63349895e --- /dev/null +++ b/plugins/tps/reklama/models/Group.php @@ -0,0 +1,42 @@ + ['Tps\Reklama\Models\Reklama', + 'table' => 'tps_reklama_item', + 'count' => true + ], + 'adds' => ['Tps\Reklama\Models\Reklama', + 'table' => 'tps_reklama_item', + 'scope' => 'unExpiered' +// 'order' => 'order asc', +// 'condition' => 'active = 1' + ], + ]; +} diff --git a/plugins/tps/reklama/models/Reklama.php b/plugins/tps/reklama/models/Reklama.php new file mode 100644 index 000000000..c9cc82b38 --- /dev/null +++ b/plugins/tps/reklama/models/Reklama.php @@ -0,0 +1,50 @@ + ['Tps\Reklama\Models\Group', + 'table' => 'tps_reklama_group', + 'order' => 'name' + ], + ]; + + public function scopeUnExpiered($query){ + return $query->where('active',1) + ->where(function ($q) { + $q->where('end_date', '>', Carbon::now(config('app.timezone'))) + ->orWhereNull('end_date'); + }) + ->where(function ($q) { + $q->where('start_date', '<', Carbon::now(config('app.timezone'))) + ->orWhereNull('start_date'); + }) + ->orderBy('order'); + } +} diff --git a/plugins/tps/reklama/models/group/columns.yaml b/plugins/tps/reklama/models/group/columns.yaml new file mode 100644 index 000000000..0ed3b3b87 --- /dev/null +++ b/plugins/tps/reklama/models/group/columns.yaml @@ -0,0 +1,17 @@ +columns: + code: + label: Code + type: text + searchable: true + sortable: true + name: + label: Name + type: text + searchable: true + sortable: true + adds_count: + label: Items + type: number + sortable: true + relation: adds_count + valueFrom: count diff --git a/plugins/tps/reklama/models/group/fields.yaml b/plugins/tps/reklama/models/group/fields.yaml new file mode 100644 index 000000000..130d0cc32 --- /dev/null +++ b/plugins/tps/reklama/models/group/fields.yaml @@ -0,0 +1,12 @@ +fields: + name: + label: Name + span: left + type: text + comment: 'Group name' + code: + label: Code + span: auto + required: 1 + type: text + comment: 'Group code' diff --git a/plugins/tps/reklama/models/reklama/columns.yaml b/plugins/tps/reklama/models/reklama/columns.yaml new file mode 100644 index 000000000..5782b253a --- /dev/null +++ b/plugins/tps/reklama/models/reklama/columns.yaml @@ -0,0 +1,18 @@ +columns: + title: + label: title + type: text + url: + label: url + type: text + start_date: + label: start_date + type: datetime + end_date: + label: end_date + type: datetime + group: + label: group + type: text + relation: group + valueFrom: name diff --git a/plugins/tps/reklama/models/reklama/fields.yaml b/plugins/tps/reklama/models/reklama/fields.yaml new file mode 100644 index 000000000..839f9f1e1 --- /dev/null +++ b/plugins/tps/reklama/models/reklama/fields.yaml @@ -0,0 +1,53 @@ +fields: + title: + label: Title + span: auto + type: text + desciption: + label: Description + span: auto + type: text + url: + label: Url + span: auto + type: text + comment: 'link where to redirect on click' + group: + label: Group + nameFrom: code + descriptionFrom: name + span: auto + required: 1 + type: relation + order: + label: 'Sort order' + span: auto + type: number + comment: 'Sorts in ascending order' + start_date: + label: 'Start Date' + mode: datetime + span: auto + type: datepicker + comment: 'Date when will start showing (leave blank for immediate showing)' + media: + label: 'Media file' + mode: image + span: auto + type: mediafinder + end_date: + label: 'End Date' + mode: datetime + span: auto + type: datepicker + comment: 'Date when will end showing (leave blank for endless show)' + enable_stats: + label: 'Statistics counter' + span: auto + type: switch + comment: 'Enable,disabel counter for views and clicks' + active: + label: Status + span: auto + type: switch + comment: 'Enable, disable status' diff --git a/plugins/tps/reklama/plugin.yaml b/plugins/tps/reklama/plugin.yaml new file mode 100644 index 000000000..b3aaec3aa --- /dev/null +++ b/plugins/tps/reklama/plugin.yaml @@ -0,0 +1,28 @@ +plugin: + name: 'tps.reklama::lang.plugin.name' + description: 'tps.reklama::lang.plugin.description' + author: TPS + icon: oc-icon-ge + homepage: '' +navigation: + main-menu-item: + label: Reklama + url: tps/reklama/groupscontroller + icon: icon-empire + sideMenu: + side-menu-item: + label: Groups + url: tps/reklama/groupscontroller + icon: icon-sitemap + side-menu-item2: + label: Reklama + url: tps/reklama/reklamascontroller + icon: icon-star + side-menu-item3: + label: Statistics + url: tps/reklama/groupscontroller + icon: icon-line-chart +permissions: + reklama: + tab: Reklama + label: Rerklama diff --git a/plugins/tps/reklama/updates/builder_table_create_tps_reklama_group.php b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_group.php new file mode 100644 index 000000000..679efac61 --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_group.php @@ -0,0 +1,23 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->string('name')->nullable(); + $table->string('code'); + }); + } + + public function down() + { + Schema::dropIfExists('tps_reklama_group'); + } +} diff --git a/plugins/tps/reklama/updates/builder_table_create_tps_reklama_item.php b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_item.php new file mode 100644 index 000000000..eef2e0143 --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_item.php @@ -0,0 +1,30 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->string('title', 255)->nullable(); + $table->string('desciption', 255)->nullable(); + $table->string('url', 255)->nullable(); + $table->string('media', 255); + $table->dateTime('start_date')->nullable(); + $table->dateTime('end_date')->nullable(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); + $table->integer('group_id')->unsigned(); + }); + } + + public function down() + { + Schema::dropIfExists('tps_reklama_item'); + } +} diff --git a/plugins/tps/reklama/updates/builder_table_create_tps_reklama_statistika.php b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_statistika.php new file mode 100644 index 000000000..3d5f3677d --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_create_tps_reklama_statistika.php @@ -0,0 +1,24 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->integer('click')->unsigned(); + $table->integer('view')->unsigned(); + $table->date('date'); + }); + } + + public function down() + { + Schema::dropIfExists('tps_reklama_statistika'); + } +} diff --git a/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item.php b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item.php new file mode 100644 index 000000000..c0c32351c --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item.php @@ -0,0 +1,25 @@ +smallInteger('order')->unsigned()->default(0); + $table->boolean('active')->default(1); + }); + } + + public function down() + { + Schema::table('tps_reklama_item', function($table) + { + $table->dropColumn('order'); + $table->dropColumn('active'); + }); + } +} diff --git a/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item_2.php b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item_2.php new file mode 100644 index 000000000..ea4bae710 --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_item_2.php @@ -0,0 +1,23 @@ +boolean('enable_stats')->default(0); + }); + } + + public function down() + { + Schema::table('tps_reklama_item', function($table) + { + $table->dropColumn('enable_stats'); + }); + } +} diff --git a/plugins/tps/reklama/updates/builder_table_update_tps_reklama_statistika.php b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_statistika.php new file mode 100644 index 000000000..1bdd8f7f1 --- /dev/null +++ b/plugins/tps/reklama/updates/builder_table_update_tps_reklama_statistika.php @@ -0,0 +1,23 @@ +integer('item_id')->unsigned(); + }); + } + + public function down() + { + Schema::table('tps_reklama_statistika', function($table) + { + $table->dropColumn('item_id'); + }); + } +} diff --git a/plugins/tps/reklama/updates/version.yaml b/plugins/tps/reklama/updates/version.yaml new file mode 100644 index 000000000..9e2660676 --- /dev/null +++ b/plugins/tps/reklama/updates/version.yaml @@ -0,0 +1,20 @@ +1.0.1: + - 'Initialize plugin.' +1.0.2: + - 'Created table tps_reklama_item' + - builder_table_create_tps_reklama_item.php +1.0.3: + - 'Created table tps_reklama_group' + - builder_table_create_tps_reklama_group.php +1.0.4: + - 'Created table tps_reklama_statistika' + - builder_table_create_tps_reklama_statistika.php +1.0.5: + - 'Updated table tps_reklama_statistika' + - builder_table_update_tps_reklama_statistika.php +1.0.6: + - 'Updated table tps_reklama_item' + - builder_table_update_tps_reklama_item.php +1.0.7: + - 'Updated table tps_reklama_item' + - builder_table_update_tps_reklama_item_2.php diff --git a/scripts/post.sql b/scripts/post.sql index 837456a5b..4a75936c7 100644 --- a/scripts/post.sql +++ b/scripts/post.sql @@ -16,3 +16,12 @@ set rb.featerd_image = wp.guid ////////////// replace image address UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !='' + +///////////////////////post views////// +INSERT INTO orient.vdomah_blogviews_views (views,post_id) +select pp.pageviews,rb.id FROM orient_wordpress.iatm_orient_2_popularpostsdata pp +INNER join orient.rainlab_blog_posts rb on rb.id_en = pp.postid + +INSERT INTO orient.pollozen_mostvisited_visits (post_id,date,visits) +select rb.id, pp.view_date , pp.pageviews FROM orient_wordpress.iatm_orient_2_popularpostssummary pp +INNER join orient.rainlab_blog_posts rb on rb.id_en = pp.postid diff --git a/themes/modern/assets/images/example.svg b/themes/modern/assets/images/example.svg new file mode 100755 index 000000000..71a907ff8 --- /dev/null +++ b/themes/modern/assets/images/example.svg @@ -0,0 +1,3 @@ + + + diff --git a/themes/modern/assets/images/news/1.png b/themes/modern/assets/images/news/1.png new file mode 100755 index 000000000..c681bc55b Binary files /dev/null and b/themes/modern/assets/images/news/1.png differ diff --git a/themes/modern/assets/images/news/2.png b/themes/modern/assets/images/news/2.png new file mode 100755 index 000000000..6b4363007 Binary files /dev/null and b/themes/modern/assets/images/news/2.png differ diff --git a/themes/modern/assets/images/news/3.png b/themes/modern/assets/images/news/3.png new file mode 100755 index 000000000..1fdf6ab76 Binary files /dev/null and b/themes/modern/assets/images/news/3.png differ diff --git a/themes/modern/config/lang.yaml b/themes/modern/config/lang.yaml index 18a50201d..15454afdf 100644 --- a/themes/modern/config/lang.yaml +++ b/themes/modern/config/lang.yaml @@ -23,7 +23,7 @@ ru: page.tags: 'ТЭГИ' page.calendar: 'КАЛЕНДАРЬ НОВОСТЕЙ' page.latest_news: 'Последние новости' - page.more: 'Ещё' + page.more: 'Посмотреть всё' page.search: 'Поиск' page.search_result: 'По результату поиска было найдено: :number статьи' contact: 'НАШИ КОНТАКТЫ' diff --git a/themes/modern/config/settings.yaml b/themes/modern/config/settings.yaml index 17b9c29b7..227c6950b 100644 --- a/themes/modern/config/settings.yaml +++ b/themes/modern/config/settings.yaml @@ -55,4 +55,9 @@ tabs: label: Linkedin default: span: auto + topCategory: + tab: Home Page + label: Top section cateegory + default: events + span: left diff --git a/themes/modern/pages/index.htm b/themes/modern/pages/index.htm index 72317c352..3354c2a5f 100644 --- a/themes/modern/pages/index.htm +++ b/themes/modern/pages/index.htm @@ -7,334 +7,25 @@ robot_follow = "follow" [viewBag] localeTitle[en] = "Home" + +[blogCategories] +slug = "{{ :slug }}" +displayEmpty = 0 +categoryPage = "category" + +[adverts media_partners] +code = "media" +type = "slider" == {% partial 'slider' %} + + + + + -
-
-
-
-
- СОБЫТИЯ -
- - Посмотреть всё - -
-
-
- - - -
-
-
-
-
+{% partial 'index/top_section' category = blogCategories.categories.shift %} +
- - + {% partial 'index/category_posts' category = blogCategories.categories.shift %} + {% partial 'index/category_posts' category = blogCategories.categories.shift %} +
+
+
+ +
+
+
+ {% partial 'index/category_posts' category = blogCategories.categories.shift %} + {% partial 'index/category_posts' category = blogCategories.categories.shift %}
@@ -623,549 +60,8 @@ localeTitle[en] = "Home"
- - -
-
-
- -
-
-
- - + {% partial 'index/category_posts' category = blogCategories.categories.shift %} + {% partial 'index/category_posts' category = blogCategories.categories.shift %}
@@ -1351,76 +247,16 @@ localeTitle[en] = "Home"
ИНТЕРЕСНЫЕ ССЫЛКИ
- - + + - - + + - - + + -
- ТЭГИ -
-
- - COVID-19 - - - АЗЕРБАЙДЖАН - - - АФГАНИСТАН - - - КАСПИЙ - - - COVID-19 - - - КИТАЙ - - - ИРАН - - - АЗЕРБАЙДЖАН - - - - COVID-19 - - - АЗЕРБАЙДЖАН - - - COVID-19 - - - СПОРТ - - - COVID-19 - - - ТУРИЗМ - - - COVID-19 - - - УЗБЕКИСТАН - - - COVID-19 - - - УЗБЕКИСТАН - - -
+ {% partial 'tags' %}
Календарь нОВОСТЕЙ
@@ -1433,7 +269,19 @@ localeTitle[en] = "Home" -{% partial 'partners' %} +
+
+
+ +
+ МЕДИА ПАРТНЕРЫ +
+ + {% component 'media_partners' %} +
+
+
+ {% put scripts %} -{% endput %} +{% endput %} \ No newline at end of file diff --git a/themes/modern/pages/post.htm b/themes/modern/pages/post.htm index 79215ad52..617c2d33b 100644 --- a/themes/modern/pages/post.htm +++ b/themes/modern/pages/post.htm @@ -1,6 +1,6 @@ title = "Пост" url = "/post/:id/:slug" -layout = "master" +layout = "cms" is_hidden = 0 robot_index = "index" robot_follow = "follow" @@ -10,6 +10,7 @@ localeTitle[en] = "Post" [blogPost] slug = "{{ :slug }}" +id = "{{ :id }}" categoryPage = "blog/category" [SeoBlogPost] @@ -17,11 +18,8 @@ post = "post" [views] slug = "{{ :slug }}" - -[registerVisit] ==
-

- {{post.title}}} + {{post.title}}

{% if post.image %} - {{post.title}} + {{post.title}} {% endif %}
- {{post.content}} + {{post.content_html|raw}}
{% partial 'latest_news'%} -
+
\ No newline at end of file diff --git a/themes/modern/partials/index/category_post_item.htm b/themes/modern/partials/index/category_post_item.htm new file mode 100644 index 000000000..dd1744004 --- /dev/null +++ b/themes/modern/partials/index/category_post_item.htm @@ -0,0 +1,14 @@ +
+
+ +
+ + {{post.title}} + +
diff --git a/themes/modern/partials/index/category_posts.htm b/themes/modern/partials/index/category_posts.htm new file mode 100644 index 000000000..a30935ed1 --- /dev/null +++ b/themes/modern/partials/index/category_posts.htm @@ -0,0 +1,39 @@ +{% set posts = category.take_posts(3) %} +
+
+
+ {{category.name}} +
+ + {{'page.more'|_}} + +
+ + {{posts.first.title}} + +
+
+
+
+ {{category.name}} +
+
+
+ +
+
+ + {{posts.first.title}} + +
+ + {% partial 'index/category_post_item' post = posts.1 %} + {% partial 'index/category_post_item' post = posts.last %} + +
diff --git a/themes/modern/partials/index/post_item.htm b/themes/modern/partials/index/post_item.htm new file mode 100644 index 000000000..f0beee86e --- /dev/null +++ b/themes/modern/partials/index/post_item.htm @@ -0,0 +1,23 @@ +
+
+
+ {% if post.categories.count>1 %} + {{post.categories.where('name','!=', category.name).first.name}} + {% else %} + {{post.categories.implode('name',',')}} + {% endif %} +
+
+
+ +
+ + {{post.title}} + +
diff --git a/themes/modern/partials/index/top_section.htm b/themes/modern/partials/index/top_section.htm new file mode 100644 index 000000000..473b793d6 --- /dev/null +++ b/themes/modern/partials/index/top_section.htm @@ -0,0 +1,37 @@ +{% set firstPost = category.posts_filtered.shift %} +
+
+
+
+
+ {{category.name}} +
+ + {{'page.more'|_}} + +
+
+
+
+ + {{firstPost.title}} + +
+ {% partial 'index/post_item' post = firstPost category = category %} +
+
+
+ {% for post_item in category.posts_filtered.splice(0,3)%} + {% partial 'index/post_item' post = post_item category = category %} + {% endfor %} +
+
+ {% for post_item in category.posts_filtered %} + {% partial 'index/post_item' post = post_item category = category%} + {% endfor %} +
+
+
+
+
+
diff --git a/themes/modern/partials/latest_news.htm b/themes/modern/partials/latest_news.htm index 76e71aa94..248967b4a 100644 --- a/themes/modern/partials/latest_news.htm +++ b/themes/modern/partials/latest_news.htm @@ -1,18 +1,18 @@ +[viewBag] + [blogPosts] pageNumber = "{{ :page }}" postsPerPage = 6 noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = "category" -postPage = "category" +postPage = "post" exceptPost = "{{ :id }}" - -[viewBag] ==
{{'page.latest_news'|_}}
-{% for post in posts %}} +{% for post in posts %}
-

{{post.title}}

+
{{post.title}}
{% endfor %} \ No newline at end of file diff --git a/themes/modern/partials/post_list_item.htm b/themes/modern/partials/post_list_item.htm index 70c62bb6f..a9a0acda7 100644 --- a/themes/modern/partials/post_list_item.htm +++ b/themes/modern/partials/post_list_item.htm @@ -1,5 +1,5 @@
- + @@ -33,17 +33,15 @@ stroke-width="1" /> - - 480 - + {{post.views}}
- +
- {{post.excerpt}} + {{post.summary|raw}}
diff --git a/themes/modern/partials/slider.htm b/themes/modern/partials/slider.htm index d51fd94da..7b114e0a6 100644 --- a/themes/modern/partials/slider.htm +++ b/themes/modern/partials/slider.htm @@ -1,67 +1,36 @@ +[blogPosts] +pageNumber = "{{ :page }}" +postsPerPage = 6 +noPostsMessage = "No posts found" +sortOrder = "published_at desc" +categoryPage = "category" +postPage = "post" + +[viewBag] +==
+ {% for post in posts %}
- + {{post.title}} + {% if post.categories.count()>0%}
- Культура, События -
-
-
- -
- Культура, События -
-
-
- -
- Культура, События -
-
-
- -
- Культура, События -
-
-
- -
- Культура, События -
-
-
- -
- Культура, События + {{post.categories.implode('name', ', ')}}
+ {% endif %}
+ {% endfor %}
diff --git a/themes/modern/partials/tags.htm b/themes/modern/partials/tags.htm index 456f74e60..0f882b6a5 100644 --- a/themes/modern/partials/tags.htm +++ b/themes/modern/partials/tags.htm @@ -1,6 +1,6 @@ [blogTags] hideOrphans = 1 -results = 10 +results = 20 direction = "desc" [viewBag] @@ -9,9 +9,9 @@ direction = "desc" {{'page.tags'|_}}
\ No newline at end of file +{% endfor%} +