public function actionEvent()
 {
     $model = new Event();
     $model['title'] = 'Hội thảo Khoa học bệnh Melioidosis tại Việt Nam lần I';
     $model['category_id'] = 1;
     $model['image'] = '/uploads/demo/event/Poster-Hoi-nghi-Vien-VSV2.jpg';
     $model['content'] = 'Melioidosis (hay còn gọi là bệnh Whitmore) là bệnh truyền nhiễm cấp tính nguy hiểm do loài vi khuẩn Burkholderia pseudomallei sống ở trong đất gây nên. Melioidosis có bệnh cảnh lâm sàng đa dạng, tiến triển nhanh và có nguy cơ dẫn đến tử vong cao, với tỷ lệ tử vong trên 50% nếu bệnh nhân không được chẩn đoán sớm và điều trị kháng sinh kịp thời. Từ lâu, Việt Nam được coi là một nước nằm trong vùng có nguy cơ nhiễm bệnh melioidosis cao nhưng thông tin dịch tễ học về tỷ lệ người mắc bệnh gần như không có. Nhiều bác sỹ và cán bộ xét nghiệm vi sinh lâm sàng tại các bệnh viện tuyến vẫn còn chưa để ý và chưa có nhiều kinh nghiệm phản xạ với các ca nhiễm bệnh. Nhằm nâng cao tinh thần cảnh giác trong xét nghiệm, chẩn đoán và điều trị bệnh melioidosis, cũng như cung cấp các kiến thức mới nhất về tình hình dịch bệnh trong nước và trên Thế giới, Viện Vi sinh vật và Công nghệ Sinh học – Đại học Quốc gia Hà Nội tiến hành tổ chức "Hội thảo Khoa học bệnh Melioidosis tại Việt Nam lần thứ 1" với chủ đề "Nâng cao cảnh giác trong xét nghiệm, chẩn đoán và điều trị bệnh melioidosis". Hội thảo có sự tham gia báo cáo của 05 chuyên gia Quốc tế nghiên cứu chuyên sâu về bệnh melioidosis tại các vùng dịch bệnh trên Thế giới và 05 báo cáo viên trong nước.';
     $model['start_date'] = date('Y-m-d H:i:s', time());
     $model['end_date'] = date('Y-m-d H:i:s', time());
     $model['location'] = 'Phòng Hội thảo tầng 1, Tòa nhà ULIS – SUNWAH, Đại học Quốc gia Hà Nội - 144 – Xuân Thủy, Cầu Giấy, Hà Nội';
     $model['status'] = 10;
     if ($model->save()) {
         echo 'Ok';
     }
 }
Example #2
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]);
 }
Example #3
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;
 }
 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]);
 }
Example #5
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;
    }
 /**
  * Finds the ReviewCategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $slug
  * @return ReviewCategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($slug)
 {
     if (($model = Event::findOne(['slug' => $slug])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 protected function loadEvent($id)
 {
     if (($model = Event::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionSimilar()
 {
     $exists = false;
     $upsert = false;
     $reason = "";
     $params = Yii::$app->getRequest()->getQueryParams();
     $_fb_source_id = 18;
     $_venue_ids = isset($params['venue_id']) ? $params['venue_id'] : "1";
     $_venue_id_arr = explode(',', $_venue_ids);
     $_startDate = isset($params['startDate']) ? $params['startDate'] : '';
     $_endDate = isset($params['endDate']) ? $params['endDate'] : '';
     $_startTime = isset($params['startTime']) ? $params['startTime'] : '';
     $_endTime = isset($params['endTime']) ? $params['endTime'] : '';
     $events = Event::getSimilarEvents($params);
     if (sizeof($events)) {
         // if source type == facebook
         //                      if
         //                          fb_event_id is same => update
         //                      else
         //                          fb_event_id is diff => insert ()
         //
         // if venue is different => unpublish (pass)
         // if timings are different => unpublish (pass)
         foreach ($events as $event) {
             $venues = $event['venues'];
             $source_id = $event['sourceId'];
             $startDate = isset($params['startDate']) ? $params['startDate'] : '';
             $endDate = isset($params['endDate']) ? $params['endDate'] : '';
             $startTime = isset($params['startTime']) ? $params['startTime'] : '';
             $endTime = isset($params['endTime']) ? $params['endTime'] : '';
             if ($_startDate == $startDate && $_endDate == $endDate && $_startTime == $startTime && $_endTime == $endTime) {
                 foreach ($venues as $venue) {
                     if (in_array($venue['Id'], $_venue_id_arr)) {
                         if ($_fb_source_id == $source_id) {
                             $upsert = true;
                         } else {
                             $exists = true;
                         }
                     }
                 }
             }
         }
     }
     if (!$exists) {
         $state = "unpublish";
         $reason = "Seems to be a new event";
     } else {
         if ($upsert) {
             $state = "unpublish";
             $reason = "Previously added facebook event set to be updated";
         } else {
             $state = "abort";
             $reason = "duplicate event found";
         }
     }
     return array('state' => $state, 'reason' => $reason);
 }
 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]);
 }
 public function getEvent()
 {
     if ($this->_event === false) {
         $this->_event = Event::findOne($this->event_id);
     }
     if ($this->_event === null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     return $this->_event;
 }
Example #11
0
 public function getModel()
 {
     $event = \Yii::$app->db->cache(function () {
         return Event::findOne($this->eventId);
     }, 20);
     $user = \Yii::$app->db->cache(function () {
         return User::findOne($this->userId);
     }, 20);
     return ['event' => $event, 'user' => $user];
 }
Example #12
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;
 }
 /**
  * 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;
 }
Example #14
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;
 }
Example #15
0
 protected function prepareSubscribeEvent()
 {
     /**
      * @var  $data \common\models\Wall\SubscribeEvent
      */
     $data = $this->model->getData();
     $event = \Yii::$app->db->cache(function () use($data) {
         return Event::findOne($data->eventId);
     }, 60);
     $user = \Yii::$app->db->cache(function () use($data) {
         return User::findOne($data->userId);
     }, 60);
     return array_merge($data->toArray(), ['event' => $event, 'user' => $user]);
 }
Example #16
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;
 }
Example #17
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]);
 }
 /**
  * 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;
 }
Example #19
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();
 }
 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]);
 }
Example #21
0
 public function run()
 {
     $nearest = Event::getNearest(7);
     $dates_array = [];
     $weekdays = [1 => 'пн.', 2 => 'вт.', 3 => 'ср.', 4 => 'чт.', 5 => 'пт.', 6 => 'сб.', 7 => 'вс.'];
     $current_date = new \DateTime(date('Y-m-d'));
     for ($i = 0; $i < 7; ++$i) {
         if ($i != 0) {
             $current_date->modify('+1 day');
         }
         $dates_array[] = ['date' => $current_date->format('Y-m-d'), 'day' => $current_date->format('j'), 'weekday' => $current_date->format('N'), 'timestamp' => $current_date->getTimestamp()];
     }
     echo '<ul class="event-calendar">';
     echo '<li class="event-calendar-all" title="Все события"><i class="md md-apps"></i></li>';
     foreach ($dates_array as $date) {
         $class = $date['weekday'] == 6 || $date['weekday'] == 7 ? 'weekend' : '';
         if (!isset($nearest[$date['date']])) {
             $class .= ' disabled';
         }
         echo '<li class="calendar-item ' . $class . '" data-date="' . $date['timestamp'] . '" ><a href="#"><span>' . $date['day'] . '</span><small>' . $weekdays[$date['weekday']] . '</small></a></li>';
     }
     echo '</ul>';
 }
 public function actionSave($event_id, $user_id, $type)
 {
     if (!\Yii::$app->request->isAjax) {
         $this->redirect(['']);
     }
     if ($type == 'edit-description') {
         $Event = Event::findOne(['id' => $event_id, 'user_id' => $user_id]);
         if (!$Event) {
             throw new HttpException(403);
         }
         $Event->description = nl2br(trim(htmlspecialchars($_POST['description'])));
         $Event->save();
         return $this->renderJson(html_entity_decode($Event->description));
     }
 }
Example #23
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvents()
 {
     return $this->hasMany(Event::className(), ['sport_id' => 'id'])->inverseOf('sport');
 }
Example #24
0
 /**
  * @return $this
  */
 public function getEvents()
 {
     return $this->hasMany(Event::className(), ['id' => 'event_id'])->viaTable('{{%events_set_event}}', ['events_set_id' => 'id'])->groupBy('id');
 }
Example #25
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]);
 }
Example #26
0
 /**
  * Events
  */
 public function createEvents()
 {
     if (isset($this->registration_start) && $this->registration_start > $now) {
         $event = new Event();
         $event->object_type = $this->competition_type;
         $event->object_id = $this->competition_id;
         $event->category = Event::TYPE_COMPETITION_REGSTART;
         $event->event_start = $this->registration_start;
         $event->save();
     }
     if (isset($this->registration_end) && $this->registration_end > $now) {
         $event = new Event();
         $event->object_type = $this->competition_type;
         $event->object_id = $this->competition_id;
         $event->category = Event::TYPE_COMPETITION_REGEND;
         $event->event_start = $this->registration_end;
         $event->save();
     }
     if (isset($this->start_date) && $this->start_date > $now) {
         $event = new Event();
         $event->object_type = $this->competition_type;
         $event->object_id = $this->competition_id;
         $event->category = Event::TYPE_COMPETITION;
         $event->event_start = $this->start_date;
         $event->save();
     }
 }
 public function copyToEvent($event_id)
 {
     $old_event = $this->event;
     $new_event = Event::findOne($event_id);
     $time_diff = $new_event->start - $old_event->start - floor(($new_event->start - $old_event->start) / (60 * 60 * 24));
     $new_team = new Team();
     $new_team->attributes = $this->attributes;
     $new_team->name = "Copy of " . $this->name;
     $new_team->event_id = $event_id;
     $new_team->save();
     //Copy shifts
     $old_shifts = $this->shifts;
     foreach ($old_shifts as $old_shift) {
         $new_shift = new Shift();
         $new_shift->attributes = $old_shift->attributes;
         $new_shift->team_id = $new_team->id;
         $new_shift->start_time += $time_diff;
         $new_shift->save();
     }
     return $new_team->id;
 }
Example #28
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvent()
 {
     return $this->hasOne(Event::className(), ['id' => 'event_id']);
 }
Example #29
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvents()
 {
     return $this->hasMany(Event::className(), ['interest_id' => 'id']);
 }
Example #30
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">