Esempio n. 1
0
 public function actionView($title)
 {
     $eventId = explode('-', $title)[1];
     //$training = Events::find(['id' => $eventId[1]])->one();
     $training = $this->findModel($eventId);
     return $this->render('training', ['training' => $training, 'organizer' => Profile::findOne(['user_id' => $training['organizer_id']]), 'eventsList' => Events::find()->limit('4')->all()]);
 }
Esempio n. 2
0
 public function getEvents($amount = null)
 {
     $query = Events::find();
     if ($amount) {
         $query->limit($amount);
     }
     return $query->all();
 }
Esempio n. 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'city_id' => $this->city_id, 'event_date' => $this->event_date]);
     $query->andFilterWhere(['like', 'title_uk', $this->title_uk])->andFilterWhere(['like', 'title_ru', $this->title_ru])->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'address', $this->address]);
     return $dataProvider;
 }
Esempio n. 4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 4], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'date' => $this->date, 'price' => $this->price, 'organizer_id' => $this->organizer_id, 'is_user_organizer' => $this->is_user_organizer, 'city_id' => $this->city_id, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'direction', $this->direction])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about', $this->about])->andFilterWhere(['like', 'duration', $this->duration])->andFilterWhere(['like', 'schedule', $this->schedule])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'map_coordinates', $this->map_coordinates]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $this->date_dti_1 = time();
     $this->date_dti_2 = time();
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     // переменная содержит диапазон дат в виде dti = '2015-09-01 2015-09-30'
     // http://www.yiiframework.com/forum/index.php/topic/62788-using-kartik-date-range-picker-for-filtering-in-gridview/
     if (isset($this->dti) && $this->dti != '') {
         $date_explode = explode("TO", $this->dti);
         // извлекаем первую дату
         $date1 = trim($date_explode[0]);
         $y1 = date("y", strtotime($date1));
         $m1 = date("m", strtotime($date1));
         $d1 = date("d", strtotime($date1));
         $this->date_dti_1 = mktime(0, 0, 0, $m1, $d1, $y1);
         $date2 = trim($date_explode[1]);
         $y2 = date("y", strtotime($date2));
         $m2 = date("m", strtotime($date2));
         $d2 = date("d", strtotime($date2));
         $this->date_dti_2 = mktime(23, 59, 59, $m2, $d2, $y2);
     }
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'code' => $this->code]);
     ////$query->andFilterWhere(['>=', 'dti', 'FROM_UNIXTIME('. $this->date_dti_1 . ')']);
     ////$query->orFilterWhere(['<=', 'dti', 'FROM_UNIXTIME('. $this->date_dti_2 . ')']);
     $query->andFilterWhere(['>=', 'dti', $this->date_dti_1]);
     $query->andFilterWhere(['<=', 'dti', $this->date_dti_2]);
     //        if($this->date_dti_1 == $this->date_dti_2){
     //
     //            $query->andFilterWhere(['>=', 'dti', $this->date_dti_1]);
     //        }
     //
     $query->andFilterWhere(['sys_n' => $this->sys_n]);
     //$query->andFilterWhere(['like', 'sys_n', $this->sys_n]);
     return $dataProvider;
 }
Esempio n. 6
0
File: index.php Progetto: jeyfost/jf
    <img src="<?php 
echo Yii::$app->homeUrl;
?>
/img/news.png" class="center-block" />
    <br /><br />
    <div class="news-block">
        <div class="news-block-left">
            <?php 
foreach ($news as $n) {
    ?>
                <?php 
    if ($n->type == "poem") {
        $index_query = Poems::find()->select('header')->where(['id' => $n->stuff_id])->one();
    }
    if ($n->type == "event") {
        $index_query = Events::find()->where(['id' => $n->stuff_id])->one();
    }
    ?>

                <div class="news-entry" id="news<?php 
    echo Html::encode($n->id);
    ?>
"
                     onmouseover="changeNewsEntry('1', 'news<?php 
    echo Html::encode($n->id);
    ?>
', 'img<?php 
    echo Html::encode($n->id);
    ?>
', 'text<?php 
    echo Html::encode($n->id);
Esempio n. 7
0
 public function actionIndex()
 {
     $topPsychologists = new PsychologistTop();
     return $this->render('index', ['topPsychologists' => $topPsychologists->getTopPsychologists(4), 'eventsList' => Events::find()->limit('4')->orderBy('id DESC')->all(), 'articlesList' => Article::find()->with('articleAuthor')->limit('2')->orderBy('id DESC')->all()]);
 }