public function actionIndex($class = '', $view = 'index', $order = 'publishedon desc')
 {
     $query = Content::find()->andFilterWhere(['class' => $class, 'status' => Content::STATUS_PUBLISHED]);
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $elements = $query->orderBy($order)->offset($pagination->offset)->limit($pagination->limit)->all();
     if (empty($elements)) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     return $this->render($view, ['elements' => $elements, 'pagination' => $pagination]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Content::find();
     $query->where(['class' => $params['class']]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'class' => $this->class, 'content' => $this->content, 'createdby' => $this->createdby, 'createdon' => $this->createdon, 'updatedon' => $this->updatedon, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'seo_url', $this->seo_url])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
Exemple #3
0
</p>
                </article>               
            </section>
            <!--right column-->
            <aside class="col-lg-3 col-md-3 col-sm-3">
                <!--Popular articles-->
                <figure class="widget shadow r_corners wrapper m_bottom_30">
                    <figcaption>
                        <h3 class="color_light">Это интересно</h3>
                    </figcaption>
                    <div class="widget_content">
                        <?php 
$first = true;
?>
                        <?php 
foreach (Content::find()->where(['class' => 'blog', 'status' => Content::STATUS_PUBLISHED])->orderBy('RAND()')->limit(3)->all() as $model) {
    ?>
                            <?php 
    echo $first ? '<hr class="m_bottom_15">' : '';
    ?>
 
                            <?php 
    $first = false;
    ?>
                            <article class="clearfix m_bottom_15">
                                <?php 
    echo Html::img(Image::thumb($model->image, 80, 80), ['class' => 'f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0']);
    ?>
                                <?php 
    echo Html::a($model->name, ['/content/site/view-by-url', 'url' => $model->seo_url, 'view' => 'view'], ['class' => 'color_dark d_block bt_link p_vr_0']);
    ?>
Exemple #4
0
                <!-- /.kopa-entry-list -->
                <!-- Pagination -->
                <?php 
echo LinkPager::widget(['pagination' => $pagination]);
?>
 
            </div>
            <!-- /.kopa-main-col -->

            <div class="sidebar col-md-3 pt-70">

                <div class="widget kopa-article-list-widget article-list-1">
                    <h3 class="widget-title style3">Популярное:</h3>
                    <ul class="clearfix">
                        <?php 
foreach (Content::find()->where(['status' => Content::STATUS_PUBLISHED, 'class' => 'blog'])->limit(5)->orderBy('views desc')->all() as $model) {
    ?>
                            <li>
                                <article class="entry-item clearfix">
                                    <div class="entry-thumb">
                                        <?php 
    echo Html::a(Html::img(Image::thumb($model->image, 76, 76)), ['view-by-url', 'url' => $model->seo_url, 'view' => 'blog']);
    ?>
                                    </div>
                                    <div class="entry-content">
                                        <h6 class="entry-title style1"><?php 
    echo Html::a($model->name, ['view-by-url', 'url' => $model->seo_url, 'view' => 'blog']);
    ?>
<span></span></h6>
                                        <span class="entry-date"><i class="fa fa-calendar"></i><?php 
    echo $model->publishedondate;
Exemple #5
0
echo $model->content;
?>
</p>

                    </div>
                    <!-- End Text -->
                </div>
                <!-- End Post -->
                <!-- Prev/Next Post -->
                <div class="clearfix mt-40">
                    <?php 
$seo_url = Content::find()->where(['class' => $model->class, 'status' => Content::STATUS_PUBLISHED])->orderBy('publishedon desc')->one()->seo_url;
if ($seo_url != $model->seo_url) {
    echo Html::a('<i class="fa fa-angle-left"></i>&nbsp;Предыдущая новость', ['view-by-url', 'url' => $seo_url, 'view' => 'blog'], ['class' => 'blog-item-more left']);
}
$seo_url = Content::find()->where(['class' => $model->class, 'status' => Content::STATUS_PUBLISHED])->orderBy('publishedon asc')->one()->seo_url;
if ($seo_url != $model->seo_url) {
    echo Html::a('Следующая новость &nbsp;<i class="fa fa-angle-right"></i>', ['view-by-url', 'url' => $seo_url, 'view' => 'blog'], ['class' => 'blog-item-more right']);
}
?>
                </div>
                <!-- End Prev/Next Post -->

            </div>
            <!-- End Content -->

        </div>

    </div>
</section>
<!-- End Section -->
Exemple #6
0
                        </article> 
                        <!-- entry item -->
                        <div class="kopa-divide"></div>

                    </div>

                </div>
                <!-- main column -->

                <div class="sidebar col-md-3 col-sm-12">

                    <div class="widget kopa-article-list-widget article-list-1">
                        <h3 class="widget-title style3">Читайте также:</h3>
                        <ul class="clearfix">
                       <?php 
foreach (Content::find()->where(['status' => Content::STATUS_PUBLISHED, 'class' => 'blog'])->andWhere('id <> ' . $model->id)->limit(5)->orderBy('RAND()')->all() as $model) {
    ?>
                            <li>
                                <article class="entry-item clearfix">
                                    <div class="entry-thumb">
                                        <?php 
    echo Html::a(Html::img(Image::thumb($model->image, 76, 76)), ['view-by-url', 'url' => $model->seo_url, 'view' => 'blog']);
    ?>
                                    </div>
                                    <div class="entry-content">
                                        <h6 class="entry-title style1"><?php 
    echo Html::a($model->name, ['view-by-url', 'url' => $model->seo_url, 'view' => 'blog']);
    ?>
<span></span></h6>
                                        <span class="entry-date"><i class="fa fa-calendar"></i><?php 
    echo $model->publishedondate;
Exemple #7
0
    </div>
</section>
<!--End Our Team-->

<!-- Divider -->
<hr class="mt-0 mb-0 " />
<!-- End Divider -->

<!-- Ask About Us -->
<section class="small-section bg-dark bg-dark-alfa-90 fullwidth-slider" data-background="<?php 
echo \Yii::$app->assetManager->publish('@common/themes/samidel/assets/images/photo_for_template/2.jpg')[1];
?>
">
<?php 
foreach (Content::find()->where(['class' => 'ask', 'status' => Content::STATUS_PUBLISHED])->all() as $model) {
    ?>
    <!-- Slide Item -->
    <div>
        <div class="container relative">
            <div class="row">
                <div class="col-md-8 col-md-offset-2 align-center">
                    <!-- Section Icon -->
                    <div class="section-icon">
                        <span class="icon-quote"></span>
                    </div>
                    <!-- Section Title -->
                    <h3 class="small-title font-alt"><?php 
    echo $model->name;
    ?>
</h3>