예제 #1
0
        </div>
    </header>

    <div id="wrapper">
        <?php 
echo $content;
?>
    </div>

    <footer id="colophon" class="site-footer" role="contentinfo">
        <div class="footer-wrapper">

            <div class="bottom-banners-area">
                <?php 
$bannerBlock = SiteBlock::getBanner(Banner::REGION_BOTTOM);
if ($bannerBlock) {
    echo $this->render($bannerBlock['view'], isset($bannerBlock['data']) ? $bannerBlock['data'] : []);
}
?>
            </div>

            <div class="footer-bottom">
                <div class="block-top">
                    <a target="_blank" href="/rss.xml">
                        <div class="button rss"></div>
                        <div class="text">RSS</div>
                    </a>
                    <a href="<?php 
echo Url::to('/information');
?>
예제 #2
0
        break;
    case 'grid-main-column':
        $region = Banner::REGION_FIRST_COLUMN;
        $isSmall = false;
        break;
    default:
        $region = 0;
        break;
}
?>
<div class="grid-column <?php 
echo $classes;
?>
">
<?php 
if ($classes == 'grid-column-2' || $classes == 'grid-sidebar-column') {
    echo $this->render('@frontend/views/site/alert');
}
if ($region == Banner::REGION_THIRD_COLUMN) {
    $bannerBlock = SiteBlock::getBanner(Banner::REGION_TOP_THIRD_COLUMN);
    if ($bannerBlock) {
        echo $this->render($bannerBlock['view'], isset($bannerBlock['data']) ? $bannerBlock['data'] : []);
    }
}
foreach ($blocks as $block) {
    if ($block) {
        echo $this->render($block['view'], isset($block['data']) ? $block['data'] : []);
    }
}
?>
</div>
 /**
  * Profile
  */
 public function actionProfile()
 {
     /** @var \common\modules\user\models\Profile $profile */
     if (Yii::getAlias('@app') == Yii::getAlias('@backend')) {
         throw new NotFoundHttpException('Страница не найдена.');
     }
     $profile = Yii::$app->user->identity->profile;
     // blogPostsDataProvider
     $query = Post::find()->where(['is_public' => 1, 'user_id' => $profile->user->id, 'content_category_id' => Post::CATEGORY_BLOG]);
     $query->orderBy(['created_at' => SORT_DESC]);
     $blogPostsDataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 5, 'pageParam' => 'bpage', 'pageSizeParam' => 'bpsize']]);
     $connection = Yii::$app->db;
     $countSql = 'SELECT COUNT(*) as count  
         FROM comments c1 
         LEFT JOIN posts p ON p.id = c1.commentable_id 
         WHERE c1.user_id = :user_id AND c1.id IN (
             SELECT c2.parent_id 
             FROM comments c2 
             WHERE c2.parent_id = c1.id
         )';
     $cmd = $connection->createCommand($countSql);
     $cmd->bindValue(':user_id', $profile->user->id);
     $commentsCountData = $cmd->queryAll();
     $commentsCount = $commentsCountData[0]['count'];
     $commentsPagination = new Pagination(['totalCount' => $commentsCount, 'pageSize' => 10, 'pageParam' => 'cpage', 'pageSizeParam' => 'cpsize']);
     // AND c1.parent_id IS NULL
     $sql = 'SELECT c1.id 
         FROM comments c1 
         LEFT JOIN posts p ON p.id = c1.commentable_id 
         WHERE c1.user_id = :user_id AND c1.id IN (
             SELECT c2.parent_id 
             FROM comments c2 
             WHERE c2.parent_id = c1.id
         ) 
         ORDER BY c1.created_at DESC 
         LIMIT :offset, :rows';
     $cmd = $connection->createCommand($sql);
     $cmd->bindValue(':user_id', $profile->user->id);
     $cmd->bindValue(':offset', $commentsPagination->offset);
     $cmd->bindValue(':rows', $commentsPagination->limit);
     $commentsData = $cmd->queryAll();
     $ids = [];
     foreach ($commentsData as $data) {
         $ids[] = $data['id'];
     }
     $initialComments = Comment::find()->where(['id' => $ids])->orderBy(['created_at' => SORT_DESC])->all();
     $comments = $initialComments;
     $ids = [];
     foreach ($comments as $comment) {
         $ids[] = $comment->id;
     }
     $childComments = Comment::find()->where(['parent_id' => $ids])->orderBy(['created_at' => SORT_ASC])->all();
     if (count($childComments) > 0) {
         $initialComments = array_merge($initialComments, $childComments);
     }
     $parentIDs = [];
     foreach ($initialComments as $comment) {
         if ($comment->parent_id != null) {
             $parentIDs[] = $comment->parent_id;
         }
     }
     $sortedComments = [];
     foreach ($initialComments as $comment) {
         if ($comment->parent_id == null || $comment->user_id == $profile->user->id && in_array($comment->id, $parentIDs)) {
             $index = 0;
         } else {
             $index = $comment->parent_id;
         }
         $sortedComments[$index][] = $comment;
     }
     $commentForm = new CommentForm();
     $additionalBlocks = ['fisrtBanner' => SiteBlock::getBanner(\common\models\Banner::REGION_FIRST_COLUMN), 'secondBanner' => SiteBlock::getBanner(\common\models\Banner::REGION_FIRST_COLUMN), 'photo_news' => SiteBlock::getPhotoNews(), 'video_news' => SiteBlock::getVideoNews(), 'subscribing' => SiteBlock::getSubscribingForm(), 'questionBlock' => SiteBlock::getQuestionBlock()];
     // render
     return $this->render('@frontend/views/site/index', ['templateType' => 'col2', 'title' => 'Профиль', 'columnFirst' => ['user_comments' => ['view' => '@frontend/views/profile/user_comments', 'data' => ['comments' => $sortedComments, 'pagination' => $commentsPagination, 'commentForm' => $commentForm]], 'profile' => ['view' => '@frontend/views/profile/profile_view', 'data' => compact('profile')], 'blog_column' => ['view' => '@frontend/views/profile/blog_posts', 'data' => ['blogPostsDataProvider' => $blogPostsDataProvider]], 'additional_data' => ['view' => '@frontend/views/profile/additional_data', 'data' => ['blocks' => $additionalBlocks]]], 'columnSecond' => ['blogs' => SiteBlock::getBlogPosts()]]);
 }
예제 #4
0
        ?>
						<div class="video-icon"></div>
					<?php 
    } elseif ($post->with_photo) {
        ?>
						<div class="photo-icon"></div>
					<?php 
    }
    ?>
				</div>
			</div>
		</div>		
	</div>
	<?php 
    if ($enableBanners && $count && $count % 10 == 0) {
        $bannerBlock = SiteBlock::getBanner(Banner::REGION_NEWS);
        if ($bannerBlock) {
            echo $this->render($bannerBlock['view'], isset($bannerBlock['data']) ? $bannerBlock['data'] : []);
        }
    }
}
?>
	<div class="header no-border">
		<a href="<?php 
echo Url::to('/news');
?>
">
			<div class="link-to-all-icon"></div>
			<div class="link-to-all-text">Все новости:</div>
		</a>
	</div>
예제 #5
0
 /**
  * Url: /video/{$id}-{$slug}
  * @param int $id Album id
  * @param string $slug Album slug
  * @return mixed
  * @throws NotFoundHttpException
  */
 public function actionVideoPost($id, $slug)
 {
     $videoPost = VideoPost::find()->where(['id' => $id, 'is_public' => 1])->one();
     if (!isset($videoPost)) {
         throw new NotFoundHttpException('Страница не найдена.');
     }
     $image = $videoPost->getAsset();
     $video = $videoPost->getVideoAsset();
     $options = ['templateType' => 'col2', 'title' => 'Dynamomania.com | Видео: ' . $videoPost->title, 'columnFirst' => ['content' => ['view' => '@frontend/views/site/video_post', 'data' => compact('videoPost', 'image', 'video')]], 'columnSecond' => ['short_news' => SiteBlock::getShortNews()]];
     $banner = SiteBlock::getBanner(Banner::REGION_UNDER_NEWS);
     $count = 0;
     while ($banner) {
         $count++;
         $options['columnFirst']['banner-' . $count] = $banner;
         $options['columnFirst']['banner-' . $count]['weight'] = 2;
         $banner = SiteBlock::getBanner(Banner::REGION_UNDER_NEWS);
     }
     $options['columnFirst']['comments'] = Comment::getCommentsBlock($videoPost->id, Comment::COMMENTABLE_VIDEO);
     $options['columnFirst']['comments']['weight'] = 5;
     usort($options['columnFirst'], 'self::cmp');
     return $this->render('@frontend/views/site/index', $options);
 }