add basic event objects

This commit is contained in:
Roland Schneider 2018-12-12 20:42:17 +01:00
parent 5599d2ef4b
commit b6e590f196
54 changed files with 2811 additions and 0 deletions

View File

@ -165,6 +165,21 @@ class AdminMenuStructure{
]; ];
///////////////////////////// /////////////////////////////
// Group Training
/////////////////////////////
if ( Yii::$app->user ){
$items = [];
$items[] = ['label' => 'Edzők', 'url' => ['/trainer' ] ];
$items[] = ['label' => 'Termek', 'url' => ['/room' ] ];
$items[] = ['label' => 'Esemény típusok', 'url' => ['/event-type' ] ];
$items[] = ['label' => 'Események', 'url' => ['/event' ] ];
$items[] = ['label' => 'Esemény regisztrációk', 'url' => ['/event-registration' ] ];
$this->menuItems[] = ['label' => 'Csoportos edzés', 'url' => $this->emptyUrl,
'items' => $items
];
}
/////////////////////////////
// Development // Development
///////////////////////////// /////////////////////////////
if ( Yii::$app->user ){ if ( Yii::$app->user ){

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Event;
use backend\models\EventSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* EventController implements the CRUD actions for Event model.
*/
class EventController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Event models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new EventSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Event model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* 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
*/
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
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* 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.');
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\EventRegistration;
use backend\models\EventRegistrationSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* EventRegistrationController implements the CRUD actions for EventRegistration model.
*/
class EventRegistrationController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all EventRegistration models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new EventRegistrationSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single EventRegistration model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new EventRegistration model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new EventRegistration();
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 EventRegistration 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);
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 EventRegistration model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the EventRegistration model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return EventRegistration the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = EventRegistration::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\EventType;
use backend\models\EventTypeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* EventTypeController implements the CRUD actions for EventType model.
*/
class EventTypeController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all EventType models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new EventTypeSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single EventType model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new EventType model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new EventType();
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 EventType 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);
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 EventType model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the EventType model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return EventType the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = EventType::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Room;
use backend\models\RoomSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* RoomController implements the CRUD actions for Room model.
*/
class RoomController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Room models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new RoomSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Room model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Room model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Room();
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 Room 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);
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 Room model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Room model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Room the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Room::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,126 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Trainer;
use backend\models\TrainerSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TrainerController implements the CRUD actions for Trainer model.
*/
class TrainerController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Trainer models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TrainerSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Trainer model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Trainer model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Trainer();
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 Trainer 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 Trainer model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($id)
{
$trainer = $this->findModel($id);
$trainer->active = Trainer::ACTIVE_OFF;
$trainer->update( );
return $this->redirect(['index']);
}
/**
* Finds the Trainer model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Trainer the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Trainer::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\EventRegistration;
/**
* EventRegistrationSearch represents the model behind the search form about `common\models\EventRegistration`.
*/
class EventRegistrationSearch extends EventRegistration
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'id_event', 'id_customer'], 'integer'],
[['created_at', 'updated_at', 'canceled_at'], 'safe'],
];
}
/**
* @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 = EventRegistration::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,
'id_event' => $this->id_event,
'id_customer' => $this->id_customer,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'canceled_at' => $this->canceled_at,
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,153 @@
<?php
namespace backend\models;
use common\components\Helper;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Event;
use yii\db\Expression;
use yii\db\Query;
/**
* EventSearch represents the model behind the search form about `common\models\Event`.
*/
class EventSearch extends Event
{
public $roomName;
public $trainerName;
public $eventTypeName;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id','roomName', 'trainerName','eventTypeName'], 'string' , 'max' => 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',
'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',
'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'],
['registration_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;
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\EventType;
/**
* EventTypeSearch represents the model behind the search form about `common\models\EventType`.
*/
class EventTypeSearch extends EventType
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id'], 'integer'],
[['name', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @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 = EventType::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_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name]);
return $dataProvider;
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Room;
/**
* RoomSearch represents the model behind the search form about `common\models\Room`.
*/
class RoomSearch extends Room
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'seat_count'], 'integer'],
[['name', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @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 = Room::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,
'seat_count' => $this->seat_count,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name]);
return $dataProvider;
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Trainer;
/**
* TrainerSearch represents the model behind the search form about `common\models\Trainer`.
*/
class TrainerSearch extends Trainer
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'active'], 'integer'],
[['name', 'phone', 'email', 'password', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @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 = Trainer::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,
'active' => $this->active,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'phone', $this->phone])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'password', $this->password]);
return $dataProvider;
}
}

View File

@ -167,6 +167,8 @@ class TransferSearch extends Transfer
} }
} }
['like', 'name', ['test', 'sample']]
$query->andFilterWhere([ $query->andFilterWhere([
'transfer.id_account' => $this->id_account, 'transfer.id_account' => $this->id_account,
'transfer.status' => $this->status, 'transfer.status' => $this->status,

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_event')->textInput() ?>
<?= $form->field($model, 'id_customer')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'canceled_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventRegistrationSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-registration-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'id_event') ?>
<?= $form->field($model, 'id_customer') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'canceled_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('event-registration', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('event-registration', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->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;
?>
<div class="event-registration-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventRegistrationSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event-registration', 'Event Registrations');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event-registration', 'Create Event Registration'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'id_event',
'id_customer',
'created_at',
'updated_at',
// 'canceled_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->title = Yii::t('event-registration', 'Update {modelClass}: ', [
'modelClass' => 'Event Registration',
]) . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('event-registration', 'Update');
?>
<div class="event-registration-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,40 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\EventRegistration */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-registration-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('event-registration', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('event-registration', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('event-registration', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'id_event',
'id_customer',
'created_at',
'updated_at',
'canceled_at',
],
]) ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-type-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-type', 'Create') : Yii::t('event-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventTypeSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-type-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
</div>
</div>
<div class="panel-footer">
<?= Html::submitButton(Yii::t('event-type', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = Yii::t('event-type', 'Create Event Type');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventTypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event-type', 'Event Types');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event-type', 'Create Event Type'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = Yii::t('event-type', 'Update Event Type:') . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('event-type', 'Update');
?>
<div class="event-type-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\EventType */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-type-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('event-type', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('event-type', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('event-type', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,49 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
]);
?>
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
])
?>
<?= $form->field($model, 'id_room')->dropDownList(\common\models\Room::roomOptions(false, true) ) ?>
<?= $form->field($model, 'id_trainer')->dropDownList(\common\models\Trainer::trainerOptions(false, true) ) ?>
<?= $form->field($model, 'id_event_type')->dropDownList(\common\models\EventType::eventTypeOptions(false, true) ) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('event', 'Create') : Yii::t('event', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,74 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\EventSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="event-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'id') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
]); ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
],
'options' => [
'autocomplete' => 'off'
]
])
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'roomName')->dropDownList(\common\models\Room::roomOptions(true)) ?>
</div>
</div>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'trainerName')->dropDownList(\common\models\Trainer::trainerOptions(true)) ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?php echo $form->field($model, 'eventTypeName')->dropDownList(\common\models\EventType::eventTypeOptions(true)) ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
</div>
</div>
</div>
<div class="panel-footer">
<?= Html::submitButton(Yii::t('event', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->title = Yii::t('event', 'Create Event');
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,70 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('event', 'Events');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('event', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => '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' => 'datetime'
],
[
'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'
],
[
'attribute' => 'event_updated_at',
'label' => \Yii::t('event', 'Updated At'),
'format' => 'datetime'
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->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');
?>
<div class="event-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,51 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Event */
$this->title = $model->trainer->name . "/" . $model->eventType->name . "/" . $model->room->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('event', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('event', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'start:datetime',
'end:datetime',
[
'attribute' => 'room.name',
'label' => $model->getAttributeLabel('id_room')
],
[
'attribute' => 'trainer.name',
'label' => $model->getAttributeLabel('id_trainer')
],
[
'attribute' => 'eventType.name',
'label' => $model->getAttributeLabel('id_event_type')
],
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

View File

@ -0,0 +1,25 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="room-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'seat_count')->textInput(['type' => 'number']) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('room', 'Create') : Yii::t('room', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\RoomSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="room-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?php
// ///////////////////////////////////////
// Search Pane
// ///////////////////////////////////////
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<?php
// ///////////////////////////////////////
// Search fields
// ///////////////////////////////////////
?>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
</div>
</div>
<div class="panel-footer">
<?php
// ///////////////////////////////////////
// Search button
// ///////////////////////////////////////
?>
<?= Html::submitButton(Yii::t('room', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = Yii::t('room', 'Create Room');
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\RoomSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('room', 'Rooms');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('room', 'Create Room'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'seat_count',
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = Yii::t('room', 'Update Room: ') . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('room', 'Update');
?>
<div class="room-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Room */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="room-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('room', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('room', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('room', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'seat_count',
'created_at',
'updated_at',
],
]) ?>
</div>

View File

@ -0,0 +1,20 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="trainer-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'active')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('trainer', 'Create') : Yii::t('trainer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,49 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\TrainerSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Keresés</h3>
</div>
<div class="panel-body">
<div class="trainer-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'name') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'phone') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?= $form->field($model, 'email') ?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<?php echo $form->field($model, 'active')->dropDownList([
'' => \Yii::t("trainer","All"),
\common\models\Trainer::ACTIVE_OFF => \Yii::t("trainer","active_off"),
\common\models\Trainer::ACTIVE_ON => \Yii::t("trainer","active_on"),
]) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('trainer', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = Yii::t('trainer', 'Create Trainer');
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TrainerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('trainer', 'Trainers');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('trainer', 'Create Trainer'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'name',
'phone',
'email:email',
['attribute' => 'active' , 'value' => function ($model){ return \common\models\Trainer::prettyPrintActive($model->active) ;} ],
'created_at:datetime',
'updated_at:datetime',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = Yii::t('trainer', 'Update Trainer:' ) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('trainer', 'Update');
?>
<div class="trainer-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,44 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Trainer */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="trainer-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('trainer', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('trainer', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('trainer', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'phone',
'email:email',
[
'attribute' => 'active',
'value' => \common\models\Trainer::prettyPrintActive($model->active)
],
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

View File

@ -0,0 +1,24 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Create Event Type' => 'Új esemény Típus',
'Update Event Type:' => 'Esemény Típus adatainak módosítása:',
'Event Types' => 'Esemény Típusok',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
];

View File

@ -0,0 +1,36 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Seat Count' => 'Férőhelyek száma',
'Create Event' => 'Új esemény',
'Update Event:' => 'Esemény adatainak módosítása:',
'Events' => 'Események',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
'Start' => 'Esemény kezdete',
'End' => 'Esemény vége',
'Room Name' => 'Terem',
'Trainer Name' => 'Edző',
'Event start' => 'Esemény Kezdete',
'Event end' => 'Esemény vége',
'Id Room' => 'Terem',
'Id Trainer' => 'Edző',
'Id Event Type' => 'Esemény Típus',
'Registration Count' => 'Résztvevők'
];

View File

@ -0,0 +1,25 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.06.
* Time: 7:55
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Seat Count' => 'Férőhelyek száma',
'Create Room' => 'Új terem',
'Update Room:' => 'Terem adatainak módosítása:',
'Rooms' => 'Termek',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'All' => 'Mind',
];

View File

@ -0,0 +1,38 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'ID' => 'ID',
'Name' => 'Név',
'Phone' => 'Telefon',
'Email' => 'E-Mail',
'Password' => 'Jelszó',
'Active' => 'Aktív',
'Created At' => 'Létrehozási dátum, idő',
'Updated At' => 'Módosítási dátum, idő',
'Create Trainer' => 'Új edző',
'Trainers' => 'Edzők',
'Search' => 'Keres',
'Create' => 'Mentés',
'Update' => 'Módosít',
'Delete' => 'Törlés',
'active_on' => 'Aktív',
'active_off' => 'Inaktív',
'Update Trainer:' => 'Edző adatainak módosítása:',
'All' => 'Mind',
];

111
common/models/Event.php Normal file
View File

@ -0,0 +1,111 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event".
*
// * @property integer $id
* @property integer $start
* @property integer $end
* @property integer $id_room
* @property integer $id_trainer
* @property integer $id_event_type
* @property string $created_at
* @property string $updated_at
*/
class Event extends \yii\db\ActiveRecord
{
public $startDateString;
public $endDateString;
public $timestampStart;
public $timestampEnd;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['startDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'start', 'timeZone' => 'UTC'],
[['endDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'end' , 'timeZone' => 'UTC'],
[['id_trainer','id_room', 'id_event_type'], 'required'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event', 'ID'),
'start' => Yii::t('event', 'Start'),
'end' => Yii::t('event', 'End'),
'id_room' => Yii::t('event', 'Id Room'),
'id_trainer' => Yii::t('event', 'Id Trainer'),
'id_event_type' => Yii::t('event', 'Id Event Type'),
'created_at' => Yii::t('event', 'Created At'),
'updated_at' => Yii::t('event', 'Updated At'),
'trainerName' => Yii::t('event', 'Trainer Name'),
'roomName' => Yii::t('event', 'Room Name'),
'eventTypeName' => Yii::t('event', 'Típus'),
'event_start' => Yii::t('event', 'Start'),
'event_end' => Yii::t('event', 'End'),
'startDateString' => Yii::t('event', 'Start'),
'endDateString' => Yii::t('event', 'End'),
'status' => Yii::t('event', 'Status'),
];
}
public function afterFind()
{
parent::afterFind(); // TODO: Change the autogenerated stub
$format = "Y.m.d H:i";
$date = new \DateTime();
$date->setTimestamp($this->start);
$date->setTimezone(new \DateTimeZone('UTC'));
$this->startDateString = $date->format($format);
$date->setTimestamp($this->end);
$this->endDateString = $date->format($format);
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function getEventType(){
return $this->hasOne(EventType::className(),['id' => 'id_event_type']);
}
public function getTrainer(){
return $this->hasOne(Trainer::className(),['id' => 'id_trainer']);
}
public function getRoom(){
return $this->hasOne(Room::className(),['id' => 'id_room']);
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "event_registration".
*
* @property integer $id
* @property integer $id_event
* @property integer $id_customer
* @property string $created_at
* @property string $updated_at
* @property string $canceled_at
*/
class EventRegistration extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_registration';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_event', 'id_customer'], 'integer'],
[['created_at', 'updated_at', 'canceled_at'], 'required'],
[['created_at', 'updated_at', 'canceled_at'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event-registration', 'ID'),
'id_event' => Yii::t('event-registration', 'Id Event'),
'id_customer' => Yii::t('event-registration', 'Id Customer'),
'created_at' => Yii::t('event-registration', 'Created At'),
'updated_at' => Yii::t('event-registration', 'Updated At'),
'canceled_at' => Yii::t('event-registration', 'Canceled At'),
];
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "event_type".
*
* @property integer $id
* @property string $name
* @property string $created_at
* @property string $updated_at
*/
class EventType extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'event_type';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['name'], 'unique'],
[['name'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('event-type', 'ID'),
'name' => Yii::t('event-type', 'Name'),
'created_at' => Yii::t('event-type', 'Created At'),
'updated_at' => Yii::t('event-type', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function asOptions(){
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
}
public static function eventTypeOptions($all = false, $emptyString = false){
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('event-type','All')];
}
if ( $emptyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
}

83
common/models/Room.php Normal file
View File

@ -0,0 +1,83 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "room".
*
* @property integer $id
* @property string $name
* @property integer $seat_count
* @property string $created_at
* @property string $updated_at
*/
class Room extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'room';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'seat_count'], 'required'],
[['seat_count'], 'integer'],
[['name'], 'unique'],
[['name'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('room', 'ID'),
'name' => Yii::t('room', 'Name'),
'seat_count' => Yii::t('room', 'Seat Count'),
'created_at' => Yii::t('room', 'Created At'),
'updated_at' => Yii::t('room', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public function asOptions(){
$items = ArrayHelper::map(Room::find()->all(),'id','name');
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
}
public static function roomOptions($all = false, $emtpyString = false){
$items = ArrayHelper::map(Room::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('room','All')];
}
if ( $emtpyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
}

94
common/models/Trainer.php Normal file
View File

@ -0,0 +1,94 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "trainer".
*
* @property integer $id
* @property string $name
* @property string $phone
* @property string $email
* @property string $password
* @property integer $active
* @property string $created_at
* @property string $updated_at
*/
class Trainer extends \yii\db\ActiveRecord
{
const ACTIVE_ON = 1;
const ACTIVE_OFF = 0;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'trainer';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['active'], 'integer'],
[['name', 'email'], 'string', 'max' => 255],
[['phone'], 'string', 'max' => 20],
[['name','phone','email'] , 'required'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('trainer', 'ID'),
'name' => Yii::t('trainer', 'Name'),
'phone' => Yii::t('trainer', 'Phone'),
'email' => Yii::t('trainer', 'Email'),
'password' => Yii::t('trainer', 'Password'),
'active' => Yii::t('trainer', 'Active'),
'created_at' => Yii::t('trainer', 'Created At'),
'updated_at' => Yii::t('trainer', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public static function prettyPrintActive($active){
if ( $active == Trainer::ACTIVE_ON ){
return \Yii::t("trainer",'active_on');
}
return \Yii::t("trainer",'active_off');
}
public static function trainerOptions($all = false, $emptyString = false){
$items = ArrayHelper::map(Trainer::find()->all(),'id','name');
$extra = [];
if ( $all ) {
$extra = ['' => \Yii::t('trainer','All')];
}
if ( $emptyString ) {
$extra = ['' => '' ];
}
return ArrayHelper::merge($extra,$items);
}
}

View File

@ -0,0 +1,96 @@
<?php
use yii\db\Migration;
class m181129_054015_add_group_training_tables extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%trainer}}', [
'id' => $this->primaryKey(),
'name' => $this->string(255),
'phone' => $this->string(20),
'email' => $this->string(255),
'password' => $this->string(255),
'active' => $this->integer(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->createTable('{{%room}}', [
'id' => $this->primaryKey(),
'name' => $this->string(255),
'seat_count' => $this->integer(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->createTable('{{%event_type}}', [
'id' => $this->primaryKey(),
'name' => $this->string(255),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->createTable('{{%event}}', [
'id' => $this->primaryKey(),
'start' => $this->integer(),
'end' => $this->integer(),
'id_room' => $this->integer(),
'id_trainer' => $this->integer(),
'id_event_type' => $this->integer(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->createTable('{{%event_registration}}', [
'id' => $this->primaryKey(),
'id_event' => $this->integer(),
'id_customer' => $this->integer(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
'canceled_at' => $this->dateTime()->notNull(),
], $tableOptions);
// $this->execute("DELIMITER $$
//
//CREATE TRIGGER event_seat_count_check
// AFTER INSERT ON event_registration FOR EACH ROW
// BEGIN
// IF (SELECT COUNT(id) FROM event_registration
// WHERE canceled_at is null AND id_event = NEW.id_event) > ( select
// THEN
// SIGNAL SQLSTATE '45000'
// SET MESSAGE_TEXT = 'Max seat count exceeded!';
// END IF;
// END;
//$$");
}
public function down()
{
echo "m181129_054015_add_group_training_tables cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,41 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m181205_050104_create_trigger_event_registration extends Migration
{
public function up()
{
$this->addColumn('{{%event}}',"seat_count",$this->integer());
$this->execute("CREATE TRIGGER event_seat_count_check
AFTER INSERT ON event_registration FOR EACH ROW
BEGIN
IF (SELECT coalesce(COUNT(id),0) FROM event_registration
WHERE canceled_at is null AND id_event = NEW.id_event)
>
(SELECT coalesce(seat_count,0) from event where id_event = NEW.id_event)
THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'MAX_SEAT_COUNT_EXCEEDED';
END IF;
END;
");
}
public function down()
{
$this->execute("DROP TRIGGER IF EXISTS event_seat_count_check;");
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

38
doc/group_training.txt Normal file
View File

@ -0,0 +1,38 @@
trainer
id
name
phone
email
password
active
room
id
name
seats
event_type
id
type
created_at
updated_at
event
id
start
end
id_room
id_trainer
id_type
seats_reserved
created_at
updated_at
event_registration
id
id_event
id_customer
status
created_at
canceled_at