url = "/"
layout = "default_new"
title = "TDH"
is_hidden = 0

[newsPosts]
pageNumber = "{{ :page }}"
postsPerPage = 10
noPostsMessage = "Отсутсвие постов"
sortOrder = "published_at desc"
postFeatured = 0
postPage = 404
categoryPage = 404
==
<?php
use RainLab\Translate\Classes\Translator;
protected $translator;

function onStart()
{
    $this['currentLanguage'] = $this->activeLocale;

    $this->translator = Translator::instance();
    $this['SelectedLanguage'] = $this->activeLocale = $this->translator->getLocale();

    // featured news
    $featured = \Indikator\News\Models\Posts::where("featured", true)
        ->where("locale", App::getLocale())
        ->where("status", 1)
        ->orderBy('published_at', 'desc')
        ->get()->first();

    $this['postFeatured'] = $featured;
    if($featured->image){
        $this['imageType'] = $featured->image[0]["type"];
    }
    // end featured news


    // last news
    $this['lastNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())
        ->where("status", 1)->where("category_id", "!=", $this->theme->colleagues_news)
        ->whereNotIn('category_id', [20,21,22])
        ->orderBy('published_at', 'desc')
        ->limit(10)->get();
    // end last news

    $this['partners'] = \Admin\Partners\Models\Partner::where('type', 'partner')->get();
    $this['colleagues'] = \Admin\Partners\Models\Partner::where('type', 'colleague')->get();

    // intro news 3rd column
    $this['intro_cat_news'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())
        ->where("status", 1)->where("category_id", $this->theme->intro_cat_news)
        ->orderBy('published_at', 'desc')
        ->limit(10)->get();

    $this["intro_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->intro_cat_news)->first();
    // end intro new

}
?>
==
{% set CurrentLanguage = SelectedLanguage %}

{% partial 'home_new_intro' %}
{% partial 'home_new_banner_news' %}
{% partial 'home_new_last_news' %}
{% partial 'home_n_new_media' %}
