Exemplo n.º 1
0
 public function actionSearch()
 {
     $search = Yii::$app->request->post('query');
     $trans_search = Utils::encodestring($search);
     $query = Post::find()->joinWith('tags')->where(['like', 'post.content', $search])->orWhere(['like', 'post.content', $trans_search])->orWhere(['like', 'post.title', $search])->orWhere(['like', 'post.title', $trans_search])->orWhere(['like', 'tags.title', $search])->orWhere(['like', 'tags.title', $trans_search]);
     //->all();
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 10]);
     $pages->pageSizeParam = false;
     $posts = $query->offset($pages->offset)->limit($pages->limit)->orderBy('id desc')->all();
     return $this->render('category', ['category' => 'Пошук: "' . $search . '"', 'posts' => $posts, 'pagination' => $pages, 'search_query' => $search]);
 }
Exemplo n.º 2
0
        echo $user->yearOfBirth;
        ?>
 р. народження</p>
                            <p><?php 
        echo $user->email;
        ?>
</p>
                            <p>На сайті з <?php 
        echo date('d.m.Y', $user->created_at);
        ?>
</p>
                        </div>
                        <div class="col-md-5 user-progress">
                            <div class="progress">
                                <div class="progress-bar progress-bar-<?php 
        echo Utils::progressColor($user->percents);
        ?>
 progress-bar-striped" role="progressbar"
                                     aria-valuenow="<?php 
        echo $user->percents;
        ?>
" aria-valuemin="0" aria-valuemax="100"
                                     style="width: <?php 
        echo $user->percents;
        ?>
%" >
                                    <?php 
        echo $user->percents;
        ?>
%
                                </div>
Exemplo n.º 3
0
" class="thumbnail" target="_blank">
                                                <?php 
        echo $post->get_image();
        ?>
                                            </a>
                                        </div>
                                        <div class="col-md-4">
                                            <p><?php 
        echo $post->truncateContent(300);
        ?>
</p>
                                        </div>
                                        <div class="col-md-5 job-progress">
                                            <div class="progress">
                                                <div class="progress-bar progress-bar-<?php 
        echo Utils::progressColor($post->percents);
        ?>
" role="progressbar"
                                                     aria-valuenow="<?php 
        echo $post->percents;
        ?>
" aria-valuemin="0" aria-valuemax="100"
                                                     style="width: <?php 
        echo $post->percents;
        ?>
%" >
                                                    <?php 
        echo $post->percents;
        ?>
%
                                                </div>