getPhotoFact(); if ($fact !== null) { echo '

', Yii::t('site', 'Фотофакты'), '

'; echo CHtml::link(CHtml::image($fact->imageBehavior->getFileUrl('preview')), array('news/view', 'link' => $fact->link)); echo '

', CHtml::link($fact->i18n->name, array('news/view', 'link' => $fact->link)), '

'; echo '
'; } } else { $criteria = new CDbCriteria(array( 'order' => 'rand()' )); $criteria->addInCondition('gallery_id', $galleryIds); /** @var $photos GalleryPhoto[] */ $photos = GalleryPhoto::model()->with('i18n')->findAll($criteria); if (count($photos) > 0) { echo '

', Yii::t('site', 'Фотофакты'), '

'; $data = array(); foreach ($photos as $photo) { $data[] = array( 'image' => $photo->getUrl('small'), 'url' => $photo->i18n->link, ); } $data = CJavaScript::encode($data); echo ''; $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $cs->registerScript('photofact', <<'; } } ?>