diff --git a/common/models/Event.php b/common/models/Event.php index 65e6e11..6ba4829 100644 --- a/common/models/Event.php +++ b/common/models/Event.php @@ -125,6 +125,13 @@ class Event extends \yii\db\ActiveRecord return $this->hasOne(Room::className(),['id' => 'id_room']); } + /** + * @return Card|\yii\db\ActiveQuery + */ + public function getCard() { + return $this->hasOne(Card::className(),['id_card' => 'id_card']); + } + /** * @return \common\models\EventRegistration[]|\yii\db\ActiveQuery */ diff --git a/common/modules/event/EventModule.php b/common/modules/event/EventModule.php new file mode 100644 index 0000000..02a437d --- /dev/null +++ b/common/modules/event/EventModule.php @@ -0,0 +1,16 @@ +render('index'); + } +} diff --git a/common/modules/event/controllers/EventController.php b/common/modules/event/controllers/EventController.php new file mode 100644 index 0000000..2a66c29 --- /dev/null +++ b/common/modules/event/controllers/EventController.php @@ -0,0 +1,251 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + + $module = EventModule::getInstance(); + $allowedActions = [ 'index','view', 'reserve-card','cancel-registration','delete-registration' ]; + if ( $module->mode == 'admin' ){ + $allowedActions[] = 'create'; + $allowedActions[] = 'update'; + $allowedActions[] = 'delete'; + } + $behaviors['access'] = [ + 'class' => \yii\filters\AccessControl::className(), + 'rules' => [ + // allow authenticated users + [ + 'actions' =>$allowedActions, + 'allow' => true, + 'roles' => ['@'], + ], + // everything else is denied + ], + ]; + + return $behaviors; + } + + /** + * Lists all Event models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new EventSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + $permissions = new EventPermissions(); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'permissions' => $permissions + ]); + } + + /** + * Displays a single Event model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException + */ + public function actionView($id) + { + $eventRegistrationManager = new EventRegistrationManager(); + + + $dataProvider = new ActiveDataProvider([ + 'query' => $eventRegistrationManager->createFindRegistrationsQuery($id), + ] + ); + return $this->render('view', [ + 'model' => $this->findModel($id), + 'dataProvider' => $dataProvider, + 'permissions' => new EventPermissions() + ]); + } + + /** + * Creates a new Event model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Event(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Event model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Event model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException + * @throws \yii\db\Exception + */ + public function actionDelete($id) + { + $manager = new EventRegistrationManager(); + $manager->deleteEvent($this->findModel($id)); + return $this->redirect(['index']); + } + + + /** + * @param $id + * @return \yii\web\Response + * @throws \yii\db\Exception + * @throws \Exception + */ + public function actionCancelRegistration($id) + { + $eventRegistrationManager = new EventRegistrationManager(); + $db = \Yii::$app->db; + $tx = $db->beginTransaction(); + try{ + $registration = $eventRegistrationManager->loadRegistration($id); + $eventRegistrationManager->cancelRegistration($registration); + $tx->commit(); + return $this->redirect(['view', 'id' => $registration->id_event]); + }catch (\Exception $ex){ + $tx->rollBack(); + throw $ex; + } + } + + /** + * @param $id + * @return \yii\web\Response + * @throws \yii\db\Exception + * @throws \Exception + */ + public function actionDeleteRegistration($id) + { + $eventRegistrationManager = new EventRegistrationManager(); + $db = \Yii::$app->db; + $tx = $db->beginTransaction(); + try{ + $registration = $eventRegistrationManager->loadRegistration($id); + $eventRegistrationManager->deleteRegistration($registration); + $tx->commit(); + return $this->redirect(['view', 'id' => $registration->id_event]); + }catch (\Exception $ex){ + $tx->rollBack(); + throw $ex; + } + } + + /** + * @param $id + * @return string|\yii\web\Response + * @throws NotFoundHttpException + * @throws \yii\db\Exception + */ + public function actionReserveCard($id) + { + + $event = $this->findModel($id); + + $model = new CardEventRegistrationForm(); + $model->event_id = $id; + if ($model->load(Yii::$app->request->post())) { + if ($model->validate()) { + $manager = new EventRegistrationManager(); + try { + $manager->registerCard($model); + } catch (HttpException $e) { + if (array_key_exists($e->getCode(), EventRegistrationManager::$STATES)) { + $model->addError("card_number", Yii::t('event-registration', EventRegistrationManager::$STATES[$e->getCode()])); + } else { + $model->addError("card_number", Yii::t('event-registration', "Unknown Error")); + } + } + } + if ($model->hasErrors()) { + return $this->render('register_card', [ + 'model' => $model, + 'event' => $event, + ]); + } else { + return $this->redirect(['view', 'id' => $id]); + } + } + return $this->render('register_card', [ + 'model' => $model, + 'event' => $event, + ]); + } + + /** + * Finds the Event model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Event the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Event::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/common/modules/event/models/EventPermissions.php b/common/modules/event/models/EventPermissions.php new file mode 100644 index 0000000..fdfadf4 --- /dev/null +++ b/common/modules/event/models/EventPermissions.php @@ -0,0 +1,42 @@ +mode; + if ( $moduleMode == 'admin'){ + $this->allowCreate = true; + $this->allowDelete = true; + $this->allowEdit = true; + $this->allowIndexCreatedAt = true; + } + } + +} \ No newline at end of file diff --git a/common/modules/event/models/EventSearch.php b/common/modules/event/models/EventSearch.php new file mode 100644 index 0000000..6e6b80b --- /dev/null +++ b/common/modules/event/models/EventSearch.php @@ -0,0 +1,157 @@ + 250], + [['startDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'start', 'timeZone' => 'UTC'], + [['endDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'end', 'timeZone' => 'UTC'], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = new Query(); + + $query->select([ + 'event.id as event_id', + 'event.start as event_start', + 'event.end as event_end', + 'event.created_at as event_created_at', + 'event.updated_at as event_updated_at', + 'event.deleted_at as event_deleted_at', + 'event.seat_count as event_seat_count', + 'trainer.name as trainer_name', + 'room.name as room_name', + 'event_type.name as event_type_name', + new Expression('count(event_registration.id) as registration_count') + ]); + + $query->from("event"); + $query->innerJoin('trainer', 'event.id_trainer = trainer.id'); + $query->innerJoin('room', 'event.id_room = room.id'); + $query->innerJoin('event_type', 'event_type.id = event.id_event_type'); + $query->leftJoin('event_registration', 'event_registration.id_event = event.id'); + $query->groupBy( + [ + 'event_id', + 'event_start', + 'event_end', + 'event_created_at', + 'event_updated_at', + 'event_deleted_at', + 'trainer_name', + 'room_name', + 'event_type_name', + ] + ); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' => [ + 'defaultOrder' => [ + 'event_start' => SORT_DESC + ], + 'attributes' => Helper::mkYiiSortItems([ + ['event_id'], + ['event_start'], + ['event_end'], + ['trainer_name'], + ['room_name'], + ['event_type_name'], + ['customer_name'], + ['event_created_at'], + ['event_updated_at'], + ['event_deleted_at'], + ['registration_count'], + ['event_seat_count'], + ]), + ] + ]); + + $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([ + 'event.id' => $this->id, + ]); + $query->andFilterWhere( + ['room.id' => $this->roomName] + ); + + $query->andFilterWhere( + ['trainer.id' => $this->trainerName] + ); + + $query->andFilterWhere( + ['event_type.id' => $this->eventTypeName] + ); + + if (isset($this->start)) { + $query->andWhere( + [ + '>=', + 'start', + $this->start + ] + ); + } + + if (isset($this->end)) { + $query->andWhere( + [ + '<=', + 'end', + $this->end + ] + ); + } + + return $dataProvider; + } +} diff --git a/common/modules/event/views/default/index.php b/common/modules/event/views/default/index.php new file mode 100644 index 0000000..c240414 --- /dev/null +++ b/common/modules/event/views/default/index.php @@ -0,0 +1,12 @@ +
+

context->action->uniqueId ?>

+

+ This is the view content for action "context->action->id ?>". + The action belongs to the controller "context) ?>" + in the "context->module->id ?>" module. +

+

+ You may customize this page by editing the following file:
+ +

+
diff --git a/common/modules/event/views/event/_form.php b/common/modules/event/views/event/_form.php new file mode 100644 index 0000000..7defefb --- /dev/null +++ b/common/modules/event/views/event/_form.php @@ -0,0 +1,54 @@ + + +
+
+
+ + + + field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [ + 'pluginOptions' => [ + 'autoclose' => true, + 'format' => 'yyyy.mm.dd hh:ii' + ], + 'options' => [ + 'autocomplete' => 'off' + ] + ]); + ?> + + field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [ + 'pluginOptions' => [ + 'autoclose' => true, + 'format' => 'yyyy.mm.dd hh:ii' + ], + 'options' => [ + 'autocomplete' => 'off' + ] + ]) + ?> + field($model, 'seat_count')->textInput() ?> + + field($model, 'id_room')->dropDownList(\common\models\Room::roomOptions(false, true)) ?> + + field($model, 'id_trainer')->dropDownList(\common\models\Trainer::trainerOptions(false, true)) ?> + + field($model, 'id_event_type')->dropDownList(\common\models\EventType::eventTypeOptions(false, true)) ?> + +
+ isNewRecord ? Yii::t('event', 'Create') : Yii::t('event', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
+
+
diff --git a/common/modules/event/views/event/_form_register_card.php b/common/modules/event/views/event/_form_register_card.php new file mode 100644 index 0000000..c2ac420 --- /dev/null +++ b/common/modules/event/views/event/_form_register_card.php @@ -0,0 +1,23 @@ + + +
+ + + + field($model, 'card_number')->textInput() ?> + +
+ isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/common/modules/event/views/event/_search.php b/common/modules/event/views/event/_search.php new file mode 100644 index 0000000..ccfe966 --- /dev/null +++ b/common/modules/event/views/event/_search.php @@ -0,0 +1,74 @@ + + + diff --git a/common/modules/event/views/event/_view.php b/common/modules/event/views/event/_view.php new file mode 100644 index 0000000..ca2a6b4 --- /dev/null +++ b/common/modules/event/views/event/_view.php @@ -0,0 +1,73 @@ + +
+
+

Esemény

+
+
+
+
+ $model, + 'attributes' => [ + 'id', + 'created_at:datetime', + 'updated_at:datetime', + 'deleted_at:datetime', + ], + ]); + } catch (Exception $e) { + echo "failed to render event details "; + } ?> +
+
+ $model, + 'attributes' => [ + [ + 'attribute' => 'eventType.name', + 'label' => $model->getAttributeLabel('id_event_type') + ], + 'start:datetime', + 'end:datetime', + [ + 'attribute' => 'room.name', + 'label' => $model->getAttributeLabel('id_room') + ], + [ + 'attribute' => 'trainer.name', + 'label' => $model->getAttributeLabel('id_trainer') + ], + ], + ]); + } catch (Exception $e) { + echo "Failed to render view"; + } ?> +
+
+ $model, + 'attributes' => [ + 'seat_count', + 'eventRegistrationCount', + 'openSeatCount', + ], + ]); + } catch (Exception $e) { + echo "Failed to render view"; + } ?> +
+
+
+ +
diff --git a/common/modules/event/views/event/create.php b/common/modules/event/views/event/create.php new file mode 100644 index 0000000..de74c84 --- /dev/null +++ b/common/modules/event/views/event/create.php @@ -0,0 +1,21 @@ +title = Yii::t('event', 'Create Event'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/common/modules/event/views/event/index.php b/common/modules/event/views/event/index.php new file mode 100644 index 0000000..ed16844 --- /dev/null +++ b/common/modules/event/views/event/index.php @@ -0,0 +1,162 @@ +title = Yii::t('event', 'Events'); +$this->params['breadcrumbs'][] = $this->title; + +$indexTableTemplateButtons = ['{view}']; // '{view} {update} {reserve-card}'; +if ( $permissions->allowCreate ){ + $indexTableTemplateButtons[] = '{update}'; +} +$indexTableTemplateButtons[] = '{reserve-card}'; + + +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ allowCreate ){ + echo Html::a(Yii::t('event', 'Create Event'), ['create'], ['class' => 'btn btn-success']); + } + ?> +

+ + 'event_id', + 'label' => \Yii::t('event', 'ID') + ], + [ + 'attribute' => 'event_type_name', + 'label' => \Yii::t('event', 'Id Event Type') + ], + [ + 'attribute' => 'event_start', + 'label' => \Yii::t('event', 'Start'), + 'format' => 'datetime' + ], + [ + 'attribute' => 'event_end', + 'label' => \Yii::t('event', 'End'), + 'format' => 'time' + ], + [ + 'attribute' => 'event_seat_count', + 'label' => \Yii::t('event', 'Seat Count') + ], + [ + 'attribute' => 'registration_count', + 'label' => \Yii::t('event', 'Registration Count') + ], + [ + 'attribute' => 'room_name', + 'label' => \Yii::t('event', 'Room Name') + ], + [ + 'attribute' => 'trainer_name', + 'label' => \Yii::t('event', 'Trainer Name') + ], + [ + 'attribute' => 'event_created_at', + 'label' => \Yii::t('event', 'Created At'), + 'format' => 'datetime', + 'allow' => $permissions->allowIndexCreatedAt + ], + [ + 'attribute' => 'event_updated_at', + 'label' => \Yii::t('event', 'Updated At'), + 'format' => 'datetime' + ], + [ + 'attribute' => 'event_deleted_at', + 'label' => \Yii::t('event', 'Deleted At'), + 'format' => 'datetime' + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => join("",$indexTableTemplateButtons), + 'urlCreator' => function ($action, $model, $key, $index) { + $params = ['id' => $model['event_id']]; + $params[0] = "event" . '/' . $action; + return \yii\helpers\Url::toRoute($params); + }, + 'buttons' => [ + 'view' => function ($url, $model, $key) { + $options = [ + 'title' => Yii::t('yii', 'View'), + 'aria-label' => Yii::t('yii', 'View'), + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + }, + 'update' => function ($url, $model, $key) { + $options = [ + 'title' => Yii::t('yii', 'Update'), + 'aria-label' => Yii::t('yii', 'Update'), + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + }, + 'delete' => function ($url, $model, $key) { + $options = [ + 'title' => Yii::t('yii', 'Delete'), + 'aria-label' => Yii::t('yii', 'Delete'), + 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), + 'data-method' => 'post', + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + }, + 'reserve-card' => function ($url, $model, $key) { + $options = [ + 'title' => Yii::t('yii', 'Register'), + 'aria-label' => Yii::t('yii', 'Register'), + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + } + ] + + ], + ]); + ?> + + $dataProvider, + 'columns' => $columns + ]); ?> + +
diff --git a/common/modules/event/views/event/register_card.php b/common/modules/event/views/event/register_card.php new file mode 100644 index 0000000..3f1e473 --- /dev/null +++ b/common/modules/event/views/event/register_card.php @@ -0,0 +1,23 @@ +title = Yii::t('event-registration', 'Create Event Registration'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_view', ['model' => $event]); ?> + + render('_form_register_card', [ + 'model' => $model, + ]) ?> + +
diff --git a/common/modules/event/views/event/update.php b/common/modules/event/views/event/update.php new file mode 100644 index 0000000..19874fe --- /dev/null +++ b/common/modules/event/views/event/update.php @@ -0,0 +1,21 @@ +title = Yii::t('event', 'Update Event:') . ' ' . $model->id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = Yii::t('event', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/common/modules/event/views/event/view.php b/common/modules/event/views/event/view.php new file mode 100644 index 0000000..69afa98 --- /dev/null +++ b/common/modules/event/views/event/view.php @@ -0,0 +1,187 @@ +title = \Yii::t('event', 'Event Details'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; + +/** + * @var \common\modules\event\EventModule + */ +$module = \common\modules\event\EventModule::getInstance(); + +function isReservationOpen($model) +{ + $canceled = isset($model['event_registration_canceled_at']); + $deleted = isset($model['event_registration_deleted_at']); + return !$canceled && !$deleted; +} + + +function getCommonColumnsHtmlOptions($model) +{ + $options = []; + if (!isReservationOpen($model)) { + $options['style'] = 'text-decoration: line-through;'; + } + return $options; +} + +?> +
+ +

title) ?>

+ +

+ allowEdit) { + echo Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); + } + if ($model->canReserve()) { + echo Html::a(Yii::t('event', 'Reservation'), ['reserve-card', 'id' => $model->id], ['class' => 'btn btn-primary']); + } + ?> + allowDelete) { + + if ($model->canDelete()) { + echo Html::a(Yii::t('event', 'Delete'), ['delete', 'id' => $model->id], [ + 'class' => 'btn btn-danger pull-right', + 'data' => [ + 'confirm' => Yii::t('event', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]); + } + } + ?> +

+ + render('_view', ['model' => $model]); ?> + +
+
+

Foglalások

+
+
+ $dataProvider, + 'columns' => [ + [ + 'attribute' => 'card_number', + 'label' => \Yii::t('event', 'Card Number'), + 'contentOptions' => function ($model) { + return getCommonColumnsHtmlOptions($model); + }, + 'format' => 'raw', + 'value' => function ($model, $key, $index, $column) { + if ( \common\modules\event\EventModule::getInstance()->mode =='frontend' ){ + return Html::a($model['card_number'], ['/ticket/create', 'number' => $model['card_number']]); + }else{ + return Html::a($model['card_number'], ['card/view', 'id' => $model['card_id_card']]); + } + } + ], + [ + 'attribute' => 'customer_name', + 'label' => \Yii::t('event', 'Customer Name'), + 'contentOptions' => function ($model) { + return getCommonColumnsHtmlOptions($model); + }, + 'format' => 'raw', + 'value' => function ($model, $key, $index, $column) { + if ( \common\modules\event\EventModule::getInstance()->mode =='frontend' ) { + return Html::a($model['customer_name'], ['/ticket/create', 'number' => $model['card_number']]); + }else{ + return Html::a($model['customer_name'], ['customer/view', 'id' => $model['customer_id_customer']]); + } + } + ], + [ + 'attribute' => 'customer_email', + 'label' => \Yii::t('event', 'Customer Email'), + 'contentOptions' => function ($model) { + return getCommonColumnsHtmlOptions($model); + } + ], + [ + 'attribute' => 'event_registration_created_at', + 'label' => \Yii::t('event', 'Event Registration Created At'), + 'contentOptions' => function ($model) { + return getCommonColumnsHtmlOptions($model); + } + ], + [ + 'attribute' => 'event_registration_canceled_at', + 'format' => 'datetime', + 'label' => \Yii::t('event', 'Canceled At'), + 'contentOptions' => function () { + $options = []; + return $options; + } + ], + [ + 'attribute' => 'event_registration_deleted_at', + 'format' => 'datetime', + 'label' => \Yii::t('event', 'Deleted At'), + 'contentOptions' => function () { + $options = []; + return $options; + }, + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{cancel-registration} {delete-registration}', + 'urlCreator' => function ($action, $model) { + $params = ['id' => $model['event_registration_id']]; + $params[0] = "event" . '/' . $action; + return \yii\helpers\Url::toRoute($params); + }, + 'buttons' => [ + 'cancel-registration' => function ($url, $model) { + if (isset($model['event_registration_canceled_at'])) { + return ""; + } + $options = [ + 'title' => Yii::t('event', 'Cancel'), + 'aria-label' => Yii::t('event', 'Cancel'), + 'data-confirm' => Yii::t('event', 'Are you sure you want to cancel this item? Usage count won\'t be restored!'), + 'data-method' => 'post', + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + }, + 'delete-registration' => function ($url, $model) { + if (isset($model['event_registration_canceled_at'])) { + return ""; + } + $options = [ + 'title' => Yii::t('yii', 'Delete'), + 'aria-label' => Yii::t('yii', 'Delete'), + 'data-confirm' => Yii::t('event', 'Are you sure you want to delete this item? Usage count will be restored!'), + 'data-method' => 'post', + 'data-pjax' => '0', + ]; + return Html::a('', $url, $options); + }, + ] + + ], + ] + ]); + } catch (Exception $e) { + echo "Failed to render registrations"; + } + ?> +
+
+ + +
diff --git a/frontend/components/FrontendMenuStructure.php b/frontend/components/FrontendMenuStructure.php index c8c116f..7ca381e 100644 --- a/frontend/components/FrontendMenuStructure.php +++ b/frontend/components/FrontendMenuStructure.php @@ -104,9 +104,16 @@ class FrontendMenuStructure $this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'), 'items' => $items - - ]; + + $items = []; + + $this->menuItems[] = ['label' => Yii::t('event', 'Events'), + 'url' => ["event/event/index"] +// 'items' => $items + ]; + + } } diff --git a/frontend/config/main.php b/frontend/config/main.php index 6781f21..58e70e7 100644 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -49,5 +49,11 @@ return [ 'errorAction' => 'site/error', ], ], + 'modules' => [ + 'event' => [ + 'class' => 'common\modules\event\EventModule', + 'mode' => 'frontend' + ], + ], 'params' => $params, ];