Reklama plugin
This commit is contained in:
parent
b3b6493b8d
commit
d7e10e2864
|
|
@ -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',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
<?php namespace PolloZen\MostVisited;
|
||||
|
||||
use Backend;
|
||||
use System\Classes\PluginBase;
|
||||
use RainLab\Blog\Models\Post as PostModel;
|
||||
|
||||
/**
|
||||
* MostVisited Plugin Information File
|
||||
*/
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
public $require = ['RainLab.Blog'];
|
||||
/**
|
||||
* Returns information about this plugin.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
'name' => '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',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -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 %}
|
||||
<div class="post">
|
||||
<div class="postImage"><img alt="" src="{{post.featured_images[0].path}}"></div>
|
||||
<div class="post-content">
|
||||
<h3>{{post.title}}</h3>
|
||||
<a href="{{post.url}}">Continue reading</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
```
|
||||
|
||||
##Support and bugs reporting
|
||||
You can write in the forum or visit me in [Github](https://github.com/sanPuerquitoProgramador/most-visited-posts)
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php namespace PolloZen\MostVisited\Components;
|
||||
|
||||
use Cms\Classes\ComponentBase;
|
||||
use Carbon\Carbon;
|
||||
use PolloZen\MostVisited\Models\Visits;
|
||||
|
||||
class RegisterVisit extends ComponentBase
|
||||
{
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
'name' => '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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
<?php namespace PolloZen\MostVisited\Components;
|
||||
|
||||
use Cms\Classes\Page;
|
||||
use Cms\Classes\ComponentBase;
|
||||
use Carbon\Carbon;
|
||||
use PolloZen\MostVisited\Models\Visits;
|
||||
use RainLab\Blog\Models\Post;
|
||||
use RainLab\Blog\Models\Category;
|
||||
|
||||
class TopVisited extends ComponentBase
|
||||
{
|
||||
/**
|
||||
* @var Illuminate\Database\Eloquent\Collection | array
|
||||
*/
|
||||
public $mostVisitedPosts;
|
||||
|
||||
/**
|
||||
* Reference to the page name for linking to posts.
|
||||
* @var string
|
||||
*/
|
||||
public $postPage;
|
||||
|
||||
/**
|
||||
* Category filter
|
||||
*/
|
||||
public $category;
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
'name' => '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 [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
<p>Nothing to see here. This component is added to the post page in order to register the visit</p>
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{% set mostVisitedPosts = __SELF__.mostVisitedPosts %}
|
||||
<div class="popular-post">
|
||||
<h3>Top Publications</h3>
|
||||
<div>
|
||||
<ul>
|
||||
{% for post in mostVisitedPosts %}
|
||||
<li>
|
||||
<div>
|
||||
<div class="thumb"><img alt="" src="{{post.featured_images[0].path}}"></div>
|
||||
<div class="post-content">
|
||||
<h3><a href="{{post.url}}">{{post.title}}</a></h3>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php namespace PolloZen\MostVisited\Models;
|
||||
|
||||
use Model;
|
||||
// use RainLab\Blog\Models\Category as BlogCategory;
|
||||
use RainLab\Blog\Models\Post;
|
||||
use Config;
|
||||
|
||||
|
||||
/**
|
||||
* Visits Model
|
||||
*/
|
||||
class Visits extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'pollozen_mostvisited_visits';
|
||||
|
||||
/**
|
||||
* @var array Guarded fields
|
||||
*/
|
||||
protected $guarded = ['*'];
|
||||
|
||||
/**
|
||||
* @var array Fillable fields
|
||||
*/
|
||||
protected $fillable = ['post_id','date'];
|
||||
|
||||
/**
|
||||
* @var array Relations
|
||||
*/
|
||||
|
||||
public $belongsTo = [
|
||||
'post' => ['Rainlab\Blog\Models\Post']
|
||||
];
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# ===================================
|
||||
# List Column Definitions
|
||||
# ===================================
|
||||
|
||||
columns:
|
||||
id:
|
||||
label: ID
|
||||
searchable: true
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# ===================================
|
||||
# Form Field Definitions
|
||||
# ===================================
|
||||
|
||||
fields:
|
||||
id:
|
||||
label: ID
|
||||
disabled: true
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<?php namespace PolloZen\MostVisited\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Schema\Blueprint;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class CreateVisitsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pollozen_mostvisited_visits', function(Blueprint $table)
|
||||
{
|
||||
$table->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');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<?php namespace Tps\Reklama;
|
||||
|
||||
use System\Classes\PluginBase;
|
||||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
public function registerComponents()
|
||||
{
|
||||
return [
|
||||
'Tps\Reklama\Components\Advertisement' => 'adverts',
|
||||
];
|
||||
}
|
||||
|
||||
public function registerSettings()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?php namespace Tps\Reklama\Components;
|
||||
|
||||
|
||||
use Cms\Classes\ComponentBase;
|
||||
use Tps\Reklama\Models\Group;
|
||||
|
||||
class Advertisement extends ComponentBase
|
||||
{
|
||||
public $group;
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
'name' => '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();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{% partial __SELF__ ~ "::"~ __SELF__.property('type') %}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<div class="partnerSlider">
|
||||
<button class="p1">
|
||||
<span></span>
|
||||
</button>
|
||||
<button class="n1">
|
||||
<span></span>
|
||||
</button>
|
||||
<div class="partnerSlider__inner">
|
||||
{% for reklama in __SELF__.group.adds %}
|
||||
<a href="{{reklama.url|default('#')}}" class="partnerSlider__item">
|
||||
<img src="{{reklama.media|media}}" alt="{{reklama.title}}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php namespace Tps\Reklama\Controllers;
|
||||
|
||||
use Backend\Classes\Controller;
|
||||
use BackendMenu;
|
||||
|
||||
class GroupsController extends Controller
|
||||
{
|
||||
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController' ];
|
||||
|
||||
public $listConfig = 'config_list.yaml';
|
||||
public $formConfig = 'config_form.yaml';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
BackendMenu::setContext('Tps.Reklama', 'main-menu-item', 'side-menu-item');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php namespace Tps\Reklama\Controllers;
|
||||
|
||||
use Backend\Classes\Controller;
|
||||
use BackendMenu;
|
||||
|
||||
class ReklamasController extends Controller
|
||||
{
|
||||
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController' ];
|
||||
|
||||
public $listConfig = 'config_list.yaml';
|
||||
public $formConfig = 'config_form.yaml';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
BackendMenu::setContext('Tps.Reklama', 'main-menu-item', 'side-menu-item2');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<div data-control="toolbar">
|
||||
<a href="<?= Backend::url('tps/reklama/groupscontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', true)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/groupscontroller') ?>">GroupsController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.create')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.create_and_close')) ?>
|
||||
</button>
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/reklama/groupscontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/reklama/groupscontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?= $this->listRender() ?>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/groupscontroller') ?>">GroupsController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<div class="form-preview">
|
||||
<?= $this->formRenderPreview() ?>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<p>
|
||||
<a href="<?= Backend::url('tps/reklama/groupscontroller') ?>" class="btn btn-default oc-icon-chevron-left">
|
||||
<?= e(trans('backend::lang.form.return_to_list')) ?>
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/groupscontroller') ?>">GroupsController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-request-data="redirect:0"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.save')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
data-request="onDelete"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
|
||||
</button>
|
||||
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/reklama/groupscontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/reklama/groupscontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<div data-control="toolbar">
|
||||
<a href="<?= Backend::url('tps/reklama/reklamascontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', true)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>">ReklamasController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.create')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.create_and_close')) ?>
|
||||
</button>
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?= $this->listRender() ?>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>">ReklamasController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<div class="form-preview">
|
||||
<?= $this->formRenderPreview() ?>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<p>
|
||||
<a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>" class="btn btn-default oc-icon-chevron-left">
|
||||
<?= e(trans('backend::lang.form.return_to_list')) ?>
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>">ReklamasController</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-request-data="redirect:0"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.save')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
data-request="onDelete"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
|
||||
</button>
|
||||
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/reklama/reklamascontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php return [
|
||||
'plugin' => [
|
||||
'name' => 'Reklama',
|
||||
'description' => ''
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php namespace Tps\Reklama\Models;
|
||||
|
||||
use Model;
|
||||
|
||||
/**
|
||||
* Model
|
||||
*/
|
||||
class Group extends Model
|
||||
{
|
||||
use \October\Rain\Database\Traits\Validation;
|
||||
|
||||
/*
|
||||
* Disable timestamps by default.
|
||||
* Remove this line if timestamps are defined in the database table.
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'tps_reklama_group';
|
||||
|
||||
/**
|
||||
* @var array Validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
];
|
||||
|
||||
public $hasMany = [
|
||||
'adds_count' => ['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'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php namespace Tps\Reklama\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Model;
|
||||
|
||||
/**
|
||||
* Model
|
||||
*/
|
||||
class Reklama extends Model
|
||||
{
|
||||
use \October\Rain\Database\Traits\Validation;
|
||||
|
||||
/*
|
||||
* Disable timestamps by default.
|
||||
* Remove this line if timestamps are defined in the database table.
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'tps_reklama_item';
|
||||
|
||||
/**
|
||||
* @var array Validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
];
|
||||
|
||||
public $belongsTo = [
|
||||
'group' => ['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');
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateTpsReklamaGroup extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tps_reklama_group', function($table)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id')->unsigned();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('code');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tps_reklama_group');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateTpsReklamaItem extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tps_reklama_item', function($table)
|
||||
{
|
||||
$table->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');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateTpsReklamaStatistika extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tps_reklama_statistika', function($table)
|
||||
{
|
||||
$table->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');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsReklamaItem extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_reklama_item', function($table)
|
||||
{
|
||||
$table->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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsReklamaItem2 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_reklama_item', function($table)
|
||||
{
|
||||
$table->boolean('enable_stats')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_reklama_item', function($table)
|
||||
{
|
||||
$table->dropColumn('enable_stats');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace Tps\Reklama\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsReklamaStatistika extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_reklama_statistika', function($table)
|
||||
{
|
||||
$table->integer('item_id')->unsigned();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_reklama_statistika', function($table)
|
||||
{
|
||||
$table->dropColumn('item_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="940" height="160" viewBox="0 0 940 160">
|
||||
<rect id="Реклама_большая_1_" data-name="Реклама большая (1)" width="940" height="160" fill="#b4b4b4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 229 B |
Binary file not shown.
|
After Width: | Height: | Size: 945 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 483 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 294 KiB |
|
|
@ -23,7 +23,7 @@ ru:
|
|||
page.tags: 'ТЭГИ'
|
||||
page.calendar: 'КАЛЕНДАРЬ НОВОСТЕЙ'
|
||||
page.latest_news: 'Последние новости'
|
||||
page.more: 'Ещё'
|
||||
page.more: 'Посмотреть всё'
|
||||
page.search: 'Поиск'
|
||||
page.search_result: 'По результату поиска было найдено: :number статьи'
|
||||
contact: 'НАШИ КОНТАКТЫ'
|
||||
|
|
|
|||
|
|
@ -55,4 +55,9 @@ tabs:
|
|||
label: Linkedin
|
||||
default:
|
||||
span: auto
|
||||
topCategory:
|
||||
tab: Home Page
|
||||
label: Top section cateegory
|
||||
default: events
|
||||
span: left
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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]
|
||||
==
|
||||
<article class="news__content">
|
||||
|
||||
<header>
|
||||
<time class="news__date">
|
||||
<span>{{post.published_at|date('d.m.Y')}}</span>
|
||||
|
|
@ -31,16 +29,16 @@ slug = "{{ :slug }}"
|
|||
<span>{{post.published_at|date('H:i')}}</span>
|
||||
</time>
|
||||
<h1 class="news__title">
|
||||
{{post.title}}}
|
||||
{{post.title}}
|
||||
</h1>
|
||||
{% if post.image %}
|
||||
<picture class="news__image">
|
||||
<img src="{{post.image|media|resize(983,null, { mode: 'contain' })}}" alt="{{post.title}}">
|
||||
<img src="{{post.featured_image|media}}" alt="{{post.title}}">
|
||||
</picture>
|
||||
{% endif %}
|
||||
</header>
|
||||
<div class="news__body">
|
||||
{{post.content}}
|
||||
{{post.content_html|raw}}
|
||||
</div>
|
||||
<div class="news__footer">
|
||||
<div class="news__footer-social">
|
||||
|
|
@ -145,10 +143,6 @@ slug = "{{ :slug }}"
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="news__footer-name">
|
||||
Нуры АМАНОВ
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<div class="news__sidebar">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<div class="card">
|
||||
<div class="card__header">
|
||||
<time class="card__header-date"><span>{{post.published_at|date('d.m.Y')}}</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 4">
|
||||
<path id="Polygon_1" data-name="Polygon 1" d="M2,0,4,2,2,4,0,2Z"
|
||||
fill="#a2a2a2" />
|
||||
</svg>
|
||||
<span>{{post.published_at|date('H:i')}}</span>
|
||||
</time>
|
||||
</div>
|
||||
<a href="{{'post'|page({id:post.id,slug:post.slug})}}" class="card__link">
|
||||
{{post.title}}
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
{% set posts = category.take_posts(3) %}
|
||||
<div class="main__body-column">
|
||||
<div class="main__body-header">
|
||||
<div class="main__body-header-title">
|
||||
{{category.name}}
|
||||
</div>
|
||||
<a href="{{'category'|page({slug:category.slug})}}" class="main__body-header-link">
|
||||
{{'page.more'|_}}
|
||||
</a>
|
||||
</div>
|
||||
<a href="{{'assets/images/news/1.png'|theme}}" class="primary progressive replace">
|
||||
<img class="preview" src="{{'assets/images/lazy/1.jpg'|theme}}" alt="{{posts.first.title}}">
|
||||
</a>
|
||||
<div class="main__body-card">
|
||||
<div class="card">
|
||||
<div class="card__header">
|
||||
<div class="card__header-category">
|
||||
{{category.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card__header">
|
||||
<time class="card__header-date"><span>{{posts.first.published_at|date('d.m.Y')}}</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 4">
|
||||
<path id="Polygon_1" data-name="Polygon 1" d="M2,0,4,2,2,4,0,2Z"
|
||||
fill="#a2a2a2" />
|
||||
</svg>
|
||||
<span>{{posts.first.published_at|date('H:i')}}</span>
|
||||
</time> </span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{'post'|page({id:posts.first.id,slug:posts.first.slug})}}" class="card__link">
|
||||
{{posts.first.title}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% partial 'index/category_post_item' post = posts.1 %}
|
||||
{% partial 'index/category_post_item' post = posts.last %}
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<div class="card">
|
||||
<div class="card__header">
|
||||
<div class="card__header-category">
|
||||
{% if post.categories.count>1 %}
|
||||
{{post.categories.where('name','!=', category.name).first.name}}
|
||||
{% else %}
|
||||
{{post.categories.implode('name',',')}}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card__header">
|
||||
<time class="card__header-date"><span>{{post.published_at|date('d.m.Y')}}</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 4">
|
||||
<path id="Polygon_1" data-name="Polygon 1" d="M2,0,4,2,2,4,0,2Z"
|
||||
fill="#a2a2a2" />
|
||||
</svg>
|
||||
<span>{{post.published_at|date('H:i')}}</span>
|
||||
</time>
|
||||
</div>
|
||||
<a href="{{'post'|page({id:post.id,slug:post.slug})}}" class="card__link">
|
||||
{{post.title}}
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{% set firstPost = category.posts_filtered.shift %}
|
||||
<section class="event">
|
||||
<div class="auto__container">
|
||||
<div class="event__inner">
|
||||
<div class="event__header">
|
||||
<div class="event__header-title">
|
||||
{{category.name}}
|
||||
</div>
|
||||
<a href="{{'category'|page({slug:category.slug})}}" class="event__header-link">
|
||||
{{'page.more'|_}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="event__body">
|
||||
<div class="event__body-row">
|
||||
<div class="event__body-image">
|
||||
<a href="{{'assets/images/news/1.png'|theme}}" class="primary progressive replace">
|
||||
<img class="preview" src="{{'assets/images/lazy/1.jpg'|theme}}" alt="{{firstPost.title}}">
|
||||
</a>
|
||||
<div class="event__body-card">
|
||||
{% partial 'index/post_item' post = firstPost category = category %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="event__body-column">
|
||||
{% for post_item in category.posts_filtered.splice(0,3)%}
|
||||
{% partial 'index/post_item' post = post_item category = category %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="event__body-column">
|
||||
{% for post_item in category.posts_filtered %}
|
||||
{% partial 'index/post_item' post = post_item category = category%}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -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]
|
||||
==
|
||||
<div class="news__sidebar-title">
|
||||
{{'page.latest_news'|_}}
|
||||
</div>
|
||||
{% for post in posts %}}
|
||||
{% for post in posts %}
|
||||
<div class="card">
|
||||
<div class="card__header">
|
||||
<time class="news__date">
|
||||
|
|
@ -37,7 +37,7 @@ exceptPost = "{{ :id }}"
|
|||
</div>
|
||||
</div>
|
||||
<a href="{{postPage|page({slug:post.slug,id:post.id})}}" class="card__link">
|
||||
<h2>{{post.title}}</h2>
|
||||
<h6>{{post.title}}</h6>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<div class="heading__row">
|
||||
<a href="images/news/1.png" class="heading__image primary progressive replace">
|
||||
<a href="{{'assets/images/news/1.png'|theme}}" class="heading__image primary progressive replace">
|
||||
<picture>
|
||||
|
||||
<img class="preview" src="{{post.featured_image|media}}" alt="">
|
||||
|
|
@ -33,17 +33,15 @@
|
|||
stroke-width="1" />
|
||||
</g>
|
||||
</svg>
|
||||
<span>
|
||||
480
|
||||
</span>
|
||||
<span>{{post.views}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="heading__content-body">
|
||||
<a href="#" >
|
||||
<a href="{{postPage|page({id:post.id,slug:post.slug})}}" >
|
||||
<h2 class="heading__content-body-link">{{post.title}}</h2>
|
||||
</a>
|
||||
<div class="heading__content-body-para">
|
||||
{{post.excerpt}}
|
||||
{{post.summary|raw}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,67 +1,36 @@
|
|||
[blogPosts]
|
||||
pageNumber = "{{ :page }}"
|
||||
postsPerPage = 6
|
||||
noPostsMessage = "No posts found"
|
||||
sortOrder = "published_at desc"
|
||||
categoryPage = "category"
|
||||
postPage = "post"
|
||||
|
||||
[viewBag]
|
||||
==
|
||||
<section class="hero">
|
||||
<div class="auto__container">
|
||||
<div class="hero__inner">
|
||||
<div class="slider">
|
||||
<div class="slider__inner">
|
||||
{% for post in posts %}
|
||||
<div class="slider__item">
|
||||
<img src="images/news/2.png" alt="">
|
||||
<img src="{{post.featured_image|media}}" alt="{{post.title}}">
|
||||
{% if post.categories.count()>0%}
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
</div>
|
||||
</div>
|
||||
<div class="slider__item">
|
||||
<img src="images/news/2.png" alt="">
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
</div>
|
||||
</div>
|
||||
<div class="slider__item">
|
||||
<img src="images/news/2.png" alt="">
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
</div>
|
||||
</div>
|
||||
<div class="slider__item">
|
||||
<img src="images/news/3.png" alt="">
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
</div>
|
||||
</div>
|
||||
<div class="slider__item">
|
||||
<img src="images/news/2.png" alt="">
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
</div>
|
||||
</div>
|
||||
<div class="slider__item">
|
||||
<img src="images/news/2.png" alt="">
|
||||
<div class="slider__item-category">
|
||||
Культура, События
|
||||
{{post.categories.implode('name', ', ')}}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="slider__nav">
|
||||
<div class="slider__nav-inner">
|
||||
<a class="active" href="#" data-slide="1">
|
||||
<span>ORIENT вышел на ленту Euronews</span>
|
||||
</a>
|
||||
<a href="#" data-slide="2">
|
||||
<span>В Туркменистане определят лучших дизайнеров эксклюзивной одежды</span>
|
||||
</a>
|
||||
<a href="#" data-slide="3">
|
||||
<span>Дубай создаст альянс по распределению вакцин от COVID-19</span>
|
||||
</a>
|
||||
<a href="#" data-slide="4">
|
||||
<span>Хлопковая пряжа и нефтяной кокс – что покупает зарубежный бизнес на
|
||||
туркменской
|
||||
бирже </span>
|
||||
</a>
|
||||
<a href="#" data-slide="5">
|
||||
<span>ORIENT вышел на ленту Euronews</span>
|
||||
</a>
|
||||
<a href="#" data-slide="6">
|
||||
<span>ORIENT вышел на ленту Euronews</span>
|
||||
{% for post in posts %}
|
||||
<a class="active" href="#" data-slide="{{loop.index}}">
|
||||
<span>{{post.title}}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[blogTags]
|
||||
hideOrphans = 1
|
||||
results = 10
|
||||
results = 20
|
||||
direction = "desc"
|
||||
|
||||
[viewBag]
|
||||
|
|
@ -9,9 +9,9 @@ direction = "desc"
|
|||
{{'page.tags'|_}}
|
||||
</div>
|
||||
<div class="main__sidebar-tag">
|
||||
{% for tag in tags %}
|
||||
<a class="main__sidebar-tag-link" href="{{tag.url}}">
|
||||
{{tag.title}}
|
||||
{% for tag in blogTags.tags %}
|
||||
<a class="main__sidebar-tag-link" href="{{'tag'|page({slug:tag.slug})}}">
|
||||
{{tag.name}}
|
||||
</a>
|
||||
{% endofr%}
|
||||
{% endfor%}
|
||||
</div>
|
||||
Loading…
Reference in New Issue