registerJsFile('/js/zuck/dist/zuck.min.js',["position"=>$this::POS_HEAD]);
$this->registerCssFile("/js/zuck/dist/zuck.min.css");
$this->registerCssFile("/js/zuck/dist/skins/snapgram.min.css");
?>
cache->getOrSet("site-stories-",function (){
$data = [];
$news = \app\models\front\News::find()->alias('news')
->joinWith('topics t')
->groupBy('news.id')
->andWhere(['t.id'=>157])->limit(10);
$index = 0;
foreach ($news->all() as $news_item)
{
/**
* @var $news_item News
*/
$comments = [];
foreach ($news_item->getCommentsAll()->limit(5)->all() as $comment){
/**
* @var $comment \app\models\base\Comments
*/
$comments[]=[
"message"=>$comment->message,
"published_at"=>$comment->publishedAt
];
}
$data[]=[
"id"=>$news_item->id,
"index"=>$index,
"photo"=>$news_item->preview->getUrl(\app\models\base\Image::SIZE_680x383),
"name"=>str_replace( '"',""",$news_item->title),
"link"=>$news_item->url,
"lastUpdated"=>strtotime($news_item->dt_pub),
"seen"=>false,
"published_at"=>$news_item->publishedAt,
"items"=>[
[
"id"=>$news_item->id,
"type"=>"photo",
"length"=>100,
"lastUpdated"=>strtotime($news_item->dt_pub),
"src"=>$news_item->preview->getUrl(\app\models\base\Image::SIZE_1040x586),
"preview"=>$news_item->preview->getUrl(\app\models\base\Image::SIZE_320x180),
"link"=>$news_item->url,
"linkText"=>str_replace( '"',"'",$news_item->lid),
"seen"=> false,
"lid"=>str_replace( '"',"'",$news_item->lid),
"post_title"=>str_replace( '"',"'",$news_item->title),
"internal_id"=>$news_item->id,
"comments"=>base64_encode(json_encode($comments))
]
]
];
$index++;
}
return json_encode($data);
},60*5);
?>