Initial import
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use app\models\parsed\ArticleParsedInterface;
|
||||
use app\services\ViewReg;
|
||||
|
||||
/**
|
||||
* Class News
|
||||
* @package app\models
|
||||
* @property $title
|
||||
* @property $text
|
||||
* @property $text_short
|
||||
* @property $ts_en_title
|
||||
* @property $ts_en_text
|
||||
* @property $ts_en_text_short
|
||||
* @property $media_key
|
||||
* @property $stream_url
|
||||
* @property $stream_access
|
||||
* @property $partner_id
|
||||
* @property Partner $partner
|
||||
* @property $is_for_publish
|
||||
* @property $article_key
|
||||
*/
|
||||
class News extends _Base implements ArticleParsedInterface
|
||||
{
|
||||
public function getPartner() {
|
||||
return $this->hasOne(Partner::class, ['id' => 'partner_id']);
|
||||
}
|
||||
|
||||
public function id() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function title($lg = null)
|
||||
{
|
||||
$lg = $lg ?? \Yii::$app->language;
|
||||
return $lg == 'en' ? $this->ts_en_title : $this->title;
|
||||
}
|
||||
|
||||
public function text()
|
||||
{
|
||||
return \Yii::$app->language == 'en' ? $this->ts_en_text : $this->text;
|
||||
}
|
||||
|
||||
public function textShort()
|
||||
{
|
||||
return \Yii::$app->language == 'en' ? $this->ts_en_text_short : $this->text_short;
|
||||
}
|
||||
|
||||
public function image($rez = null)
|
||||
{
|
||||
return $this->getSrcOfSingleImage('title_news_image', $rez);
|
||||
}
|
||||
|
||||
public function images($rez = null)
|
||||
{
|
||||
return $this->getSrcOfMultipleImages('news_images', $rez);
|
||||
}
|
||||
|
||||
public function relation()
|
||||
{
|
||||
return ViewReg::generateDirectDetailPageUrl($this, 'news');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user