Exemplo n.º 1
0
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $nodes = Event::find()->where(['status' => 10])->limit(2)->all();
     return $this->render('EventRightWidget', ['nodes' => $nodes]);
 }
Exemplo n.º 2
0
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]);
     $query->andWhere("not ((`state`=" . AppActiveRecord::STATUS_DRAFT . ") AND (`createdBy`!=" . \yii::$app->user->id . "))");
     if (!($this->load($params) && $this->validate())) {
         $query->andFilterWhere(['NOT', ['state' => AppActiveRecord::STATUS_DELETE]]);
         return $dataProvider;
     }
     if ($this->state !== null) {
         if ($this->state == AppActiveRecord::STATUS_DRAFT) {
             $query->andFilterWhere(['state' => $this->state, 'createdBy' => \yii::$app->user->id]);
         } else {
             $query->andFilterWhere(['state' => $this->state]);
         }
     } else {
         $query->andFilterWhere(['NOT', ['state' => AppActiveRecord::STATUS_DELETE]]);
     }
     $query->andFilterWhere(['Id' => $this->Id, 'sourceId' => $this->sourceId, 'cityId' => $this->cityId, 'zoneId' => $this->zoneId, 'localityId' => $this->localityId, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'startTime' => $this->startTime, 'endTime' => $this->endTime, 'status' => $this->status, 'isRecursive' => $this->isRecursive, 'healthStatus' => $this->healthStatus, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'categoryId', $this->categoryId])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'pincode', $this->pincode])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'contactName', $this->contactName])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'shopurl', $this->shopurl])->andFilterWhere(['like', 'price', $this->price])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'recursionData', $this->recursionData])->andFilterWhere(['like', 'oldGuid', $this->oldGuid])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'multipleTimings', $this->multipleTimings])->andFilterWhere(['like', 'weekdaysChecklist', $this->weekdaysChecklist]);
     /*$query->joinWith('eventMap')->andFilterWhere(['like', 'phone', $this->phone])
       ->andFilterWhere(['like', 'mobile', $this->mobile]);//*/
     return $dataProvider;
 }
Exemplo n.º 3
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Event::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,
            'created_date' => $this->created_date,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }
Exemplo n.º 4
0
 public function rightMonthEvents()
 {
     $dateStart = strtotime(date('Y-m-01'));
     $dateEnd = strtotime(date('Y-m-t'));
     $events = Event::find()->andWhere('date >= :dateStart AND date <= :dateEnd', [':dateStart' => $dateStart, ':dateEnd' => $dateEnd])->limit(5)->orderBy(new Expression('rand()'))->all();
     return $this->render('rightWidget/rightMonthEvents', ['events' => $events]);
 }
Exemplo n.º 5
0
 public function actionIndex()
 {
     $today = date('Y-m-d 00:00:00');
     $upcomming_event = Event::find()->where(['>=', 'start_date', $today])->all();
     $past_event = Event::find()->where(['<=', 'close_date', $today])->all();
     return $this->render('index', ['upcomming_event' => $upcomming_event, 'past_event' => $past_event]);
 }
 public function actionShifts($id = null)
 {
     if (!isset($id)) {
         $id = Yii::$app->params['currentEvent'];
     }
     $data = Participant::findUserEventDataByDay($id, Yii::$app->user->id);
     $events = Event::find()->where(['not', ['id' => $id]])->all();
     return $this->render('shifts', ['data' => $data, 'event' => Event::findOne($id), 'events' => $events]);
 }
Exemplo n.º 7
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'object_id' => $this->object_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'event_start' => $this->event_start, 'event_end' => $this->event_end]);
     $query->andFilterWhere(['like', 'object_type', $this->object_type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'event_type', $this->event_type])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
Exemplo n.º 8
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $query->andFilterWhere(['status' => AppActiveRecord::STATUS_DELETE]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'sourceId' => $this->sourceId, 'cityId' => $this->cityId, 'zoneId' => $this->zoneId, 'localityId' => $this->localityId, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'startTime' => $this->startTime, 'endTime' => $this->endTime, 'status' => $this->status, 'isRecursive' => $this->isRecursive, 'healthStatus' => $this->healthStatus, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'isfeature' => $this->isfeature, 'featurepriority' => $this->featurepriority, 'type' => $this->type, 'entityType' => $this->entityType, 'state' => $this->state]);
     $query->andFilterWhere(['like', 'categoryId', $this->categoryId])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'pincode', $this->pincode])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'contactName', $this->contactName])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'shopurl', $this->shopurl])->andFilterWhere(['like', 'price', $this->price])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'recursionData', $this->recursionData])->andFilterWhere(['like', 'oldGuid', $this->oldGuid])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'multipleTimings', $this->multipleTimings])->andFilterWhere(['like', 'weekdaysChecklist', $this->weekdaysChecklist])->andFilterWhere(['like', 'tag', $this->tag])->andFilterWhere(['like', 'alias', $this->alias]);
     return $dataProvider;
 }
Exemplo n.º 9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['eopen_date' => SORT_ASC]]]);
     $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, 'organiser_id' => $this->organiser_id, 'interest_id' => $this->interest_id, 'is_active' => $this->is_active, 'eeopen_date' => $this->eeopen_date, 'eopen_date' => $this->eopen_date, 'eclose_date' => $this->eclose_date, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'created_date' => $this->created_date, 'created_by' => $this->created_by, 'updated_date' => $this->updated_date, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
Exemplo n.º 10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::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, 'category_id' => $this->category_id, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'status' => $this->status, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'meta_title', $this->meta_title])->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])->andFilterWhere(['like', 'meta_description', $this->meta_description]);
     return $dataProvider;
 }
Exemplo n.º 11
0
 public function run()
 {
     $calendarEvents = [];
     // 1. Events
     foreach (Event::find()->orderBy('event_start')->each() as $event) {
         $calendarEvents[] = $event->getFullCalendarEvent();
     }
     // 2. Matches
     foreach (Match::find()->each() as $match) {
         foreach ($match->getEvents() as $event) {
             $calendarEvents[] = $event->getFullCalendarEvent();
         }
     }
     return $this->render('calendar', ['events' => $calendarEvents, 'months' => 3]);
 }
Exemplo n.º 12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['sportName'] = ['asc' => ['{{%sport}}.name' => SORT_ASC], 'desc' => ['{{%sport}}.name' => 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');
         $query->joinWith('{{@sport}}');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'gender' => $this->gender, 'sport_id' => $this->sport_id, 'max_weight' => $this->max_weight, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, '{{%sport}}.url_key' => $this->url_key]);
     $query->andFilterWhere(['like', '{{%event}}.name', $this->name]);
     $query->joinWith(['sport' => function ($q) {
         $q->where('{{%sport}}.name LIKE "%' . $this->sportName . '%"');
     }]);
     return $dataProvider;
 }
Exemplo n.º 13
0
 public function getAllEvents($lastIds = [], $lastDate = 0, $orderBy = self::ORDER_BY_DATE, $dateCreateType = self::DATE_CREATE_ALL, $userId = false, $limit = false)
 {
     $query = Event::find()->from(["t" => Event::tableName()])->andWhere('t.deleted = 0')->addSelect('*');
     if ($lastDate != 0) {
         if ($dateCreateType == self::DATE_CREATE_AFTER) {
             $query = $query->andWhere('t.date >= :date', [':date' => $lastDate]);
         } else {
             $query = $query->andWhere('t.date <= :date', [':date' => $lastDate]);
         }
         if (!empty($lastIds)) {
             $query = $query->andWhere(['not in', 'id', $lastIds]);
         }
     }
     // Определяем сортировку
     if ($orderBy == self::ORDER_BY_ID) {
         $query = $query->orderBy('id DESC');
     } elseif ($orderBy == self::ORDER_BY_DATE) {
         if ($dateCreateType == self::DATE_CREATE_AFTER) {
             $query = $query->orderBy('date ASC');
         } else {
             $query = $query->orderBy('date DESC');
         }
     }
     // Определяем за какой период будем показывать
     if (!empty($limit)) {
         $query = $query->limit((int) $limit);
     } elseif ($dateCreateType == self::DATE_CREATE_ALL) {
         $query = $query->limit(20);
     } elseif ($dateCreateType == self::DATE_CREATE_BEFORE) {
         $query = $query->andWhere('t.date <= :date', [':date' => time()])->limit(20);
     } elseif ($dateCreateType == self::DATE_CREATE_AFTER) {
         $query = $query->andWhere('t.date >= :date', [':date' => time()])->limit(20);
     }
     if (!empty($userId)) {
         $query = $query->andWhere('user_id = :userId', [':userId' => $userId]);
     }
     $query = $query->with(['tagEntity', 'tagEntity.tags']);
     return $query->all();
 }
Exemplo n.º 14
0
 public function actionIndex()
 {
     $article = Article::find()->orderBy(['date_time' => SORT_DESC])->one();
     if ($article->articlePhotos[0]->photo_path == '') {
         if (Yii::$app->language == 'ru') {
             $articleimage = Yii::getAlias('@resource/img/news_ru.jpg');
         } else {
             $articleimage = Yii::getAlias('@resource/img/news_en.jpg');
         }
     } else {
         $articleimage = $article->articlePhotos[0]->photo_path;
     }
     $event = Event::find()->orderBy(['start_timedate' => SORT_ASC])->limit(3)->all();
     $section = Section::find()->limit(8)->all();
     $innovation_text_on_main_page = Setting::find()->where(['key' => 'innovation_text_on_main_page'])->one();
     $cooperation_with_aic = Setting::find()->where(['key' => 'cooperation_with_aic'])->one();
     $fill_in_the_blank = Setting::find()->where(['key' => 'fill_in_the_blank'])->one();
     $find_out_how_we_can_help_you = Setting::find()->where(['key' => 'find_out_how_we_can_help_you'])->one();
     $information_for_Students = Setting::find()->where(['key' => 'information_for_Students'])->one();
     $for_scientists_and_enterpreneurs = Setting::find()->where(['key' => 'for_scientists_and_enterpreneurs'])->one();
     return $this->render('index', ['article' => $article, 'articleimage' => $articleimage, 'event' => $event, 'section' => $section, 'innovation_text_on_main_page' => $innovation_text_on_main_page->settingLan->index, 'cooperation_with_aic' => $cooperation_with_aic->settingLan->index, 'fill_in_the_blank' => $fill_in_the_blank->settingLan->index, 'find_out_how_we_can_help_you' => $find_out_how_we_can_help_you->settingLan->index, 'information_for_Students' => $information_for_Students->settingLan->index, 'for_scientists_and_enterpreneurs' => $for_scientists_and_enterpreneurs->settingLan->index]);
 }
Exemplo n.º 15
0
    ?>
                    <?php 
    echo Html::hiddenInput('EventsSet[sport_id]', $model->sport_id);
    ?>
                <?php 
} else {
    ?>
                    <?php 
    echo $form->field($model, 'sport_id')->dropDownList(ArrayHelper::map(SportSearch::find()->all(), 'id', 'name'));
    ?>
                <?php 
}
?>

                <?php 
echo $form->field($model, 'events')->checkboxList(ArrayHelper::map(Event::find()->bySport($model->sport)->all(), 'id', function ($data) {
    return $data->name . ' (' . $data->gender . ')';
}));
?>

                <div class="form-actions">
                    <div class="row">
                        <div class="col-md-offset-3 col-md-9">
                            <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
                        </div>
                    </div>
                </div>

                <?php 
 public function getEventList()
 {
     $events = Event::find()->all();
     return ArrayHelper::map($events, 'id', 'dropdownName');
 }
Exemplo n.º 17
0
                            </div>
                        </div>
                    </li>  
                    <?php 
}
?>
                </ul>
            </div>
            <h3 class="normal-heading text-uppercase addmarginB20">Upcoming Events</h3>
            <div class="col-4-event-grid col-3-event-grid">
            	<ul class="clearfix">
                	<?php 
$startdate = date("Y-m-d 00:00:00");
$closedate = date("Y-m-d 00:00:00");
// new \yii\db\Expression('NOW()');
$event = Event::find()->where(['>', 'start_date', $startdate])->andWhere(['>=', 'close_date', $closedate])->all();
foreach ($event as $evnt) {
    $eventid = $evnt->id;
    ?>
                	<li>
                    	<div class="box">
                        	<div class="itemImageBlock">
                            	<a href="<?php 
    echo Yii::$app->urlManager->createUrl(['event/view', 'id' => $eventid]);
    ?>
"><img src="<?php 
    echo $evnt->banner;
    ?>
"></a>
                            </div>
                            <div class="detail">
Exemplo n.º 18
0
 public function actionSitemap()
 {
     // проверяем есть ли закэшированная версия sitemap
     $urls = array();
     $items = Item::find()->where(['deleted' => 0])->all();
     $events = \common\models\Event::find()->where(['deleted' => 0])->all();
     $schools = School::find()->where(['deleted' => 0])->all();
     foreach ($items as $item) {
         /** @var Item $item */
         $urls[] = ['url' => $item->getUrl(true), 'priority' => 0.5];
     }
     foreach ($events as $event) {
         /** @var \common\models\Event $event */
         $urls[] = ['url' => $event->getUrl(true), 'priority' => 0.5];
     }
     foreach ($schools as $school) {
         /** @var School $school */
         $urls[] = ['url' => $school->getUrl(true), 'priority' => 0.8];
     }
     Yii::$app->response->format = \yii\web\Response::FORMAT_XML;
     echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     foreach ($urls as $url) {
         echo '<url>';
         echo '<loc>' . $url['url'] . '</loc>';
         echo '<changefreq>weekly</changefreq>';
         echo '<priority>' . $url['priority'] . '</priority>';
         echo '</url>';
     }
     echo '</urlset>';
 }
Exemplo n.º 19
0
 /**
  * Updates an existing event model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     /*$model = $this->findModel($id);
     
             $photos = new ActiveDataProvider([
                     'query' => event_photo::find()->
                         where(['event_id'=>$id]),
             ]);
     
             if ($model->load(Yii::$app->request->post()) && $model->save()) {
     
                     $this->uploadphoto(UploadedFile::getInstances($model, 'images'), $model->id);
     
                 return $this->redirect(['view', 'id' => $model->id]);
             } else {
                 return $this->render('update', [
                     'model' => $model,
                     'photos' => $photos,
                 ]);
             }*/
     $event = Event::find()->where(['id' => $id])->one();
     $event_ru = Event_ru::find()->where(['event_id' => $id])->one();
     $event_en = Event_en::find()->where(['event_id' => $id])->one();
     $photos = new ActiveDataProvider(['query' => event_photo::find()->where(['event_id' => $id])]);
     if ($event->load(Yii::$app->request->post()) && $event_ru->load(Yii::$app->request->post()) && $event_en->load(Yii::$app->request->post())) {
         $event->author_id = Yii::$app->user->identity->id;
         if ($event->save()) {
             $this->uploadphoto(UploadedFile::getInstances($event, 'images'), $event->id);
             $event_ru->save();
             $event_en->save();
         }
         return $this->redirect(['update', 'id' => $event->id]);
     } else {
         return $this->render('update', ['event' => $event, 'event_ru' => $event_ru, 'event_en' => $event_en, 'photos' => $photos]);
     }
 }
Exemplo n.º 20
0
 /**
  * Lists all Event models.
  * @return mixed
  */
 public function actionIndex()
 {
     $eventsDb = Event::find()->all();
     return $this->render('index', ['eventsDb' => $eventsDb]);
 }
Exemplo n.º 21
0
 public function actionMonth($year, $month)
 {
     $dateStart = strtotime($year . '-' . $month . '-01');
     $dateEnd = strtotime(date('Y-m-t', $dateStart));
     $events = Event::find()->andWhere('date >= :dateStart AND date <= :dateEnd', [':dateStart' => $dateStart, ':dateEnd' => $dateEnd])->orderBy('date')->all();
     return $this->render('month', ['events' => $events, 'year' => $year, 'month' => $month]);
 }
 public function actionAdmin()
 {
     $dataProvider = new ActiveDataProvider(['query' => Event::find(), 'pagination' => false]);
     return $this->render('admin', ['dataProvider' => $dataProvider]);
 }
Exemplo n.º 23
0
 public function actionMap()
 {
     if (\Yii::$app->request->isAjax) {
         return $this->renderJson(Event::find()->where('begin > ' . time())->all());
     }
     return $this->render('map');
 }
Exemplo n.º 24
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($this->alias == "") {
             $title = $this->encodestring($this->title);
             $alias = $this->toAscii($title);
             $baseAlias = substr($alias, 0, 250);
             $alias = $baseAlias;
             $i = 1;
             $wheres = ['alias = :alias'];
             $params[':alias'] = $alias;
             if (!is_null($this->id)) {
                 $wheres[] = 'id <> :id';
                 $params = [':id' => $this->id];
             }
             $where = join(' AND ', $wheres);
             while ($findEvent = Event::find()->where($where, $params)->one()) {
                 $alias = $baseAlias . '-' . $i;
                 $params[':alias'] = $alias;
                 $i++;
                 if ($i > 30) {
                     $alias = '';
                     break;
                 }
             }
             $this->alias = $alias;
         }
         return true;
     }
     return false;
 }