group training changes
This commit is contained in:
@@ -4,9 +4,13 @@ namespace common\modules\event\controllers;
|
||||
|
||||
use common\manager\EventRegistrationManager;
|
||||
use common\models\CardEventRegistrationForm;
|
||||
use common\models\EventEquipmentType;
|
||||
use common\models\EventEquipmentTypeAssignment;
|
||||
use common\models\EventRegistrationEquipmentTypeAssignment;
|
||||
use common\modules\event\EventModule;
|
||||
use common\modules\event\models\copy\ClearWeekForm;
|
||||
use common\modules\event\models\copy\CopyWeekSearch;
|
||||
use common\modules\event\models\EventEquipmentTypeForm;
|
||||
use common\modules\event\models\EventPermissions;
|
||||
use common\modules\event\models\timetable\TimeTableSearch;
|
||||
use DateTime;
|
||||
@@ -43,11 +47,12 @@ class EventController extends Controller
|
||||
|
||||
$module = EventModule::getInstance();
|
||||
assert(isset($module), 'event module not set');
|
||||
$allowedActions = ['index', 'view', 'reserve-card', 'cancel-registration', 'delete-registration', 'timetable', 'copy-week','clear-week'];
|
||||
$allowedActions = ['index', 'view', 'reserve-card', 'cancel-registration', 'delete-registration', 'timetable', 'copy-week','clear-week',];
|
||||
if ($module->mode === 'backend') {
|
||||
$allowedActions[] = 'create';
|
||||
$allowedActions[] = 'update';
|
||||
$allowedActions[] = 'delete';
|
||||
$allowedActions[] = 'equipment-types-assignment';
|
||||
}
|
||||
$behaviors['access'] = [
|
||||
'class' => AccessControl::class,
|
||||
@@ -93,14 +98,19 @@ class EventController extends Controller
|
||||
{
|
||||
$eventRegistrationManager = new EventRegistrationManager();
|
||||
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $eventRegistrationManager->createFindRegistrationsQuery($id),
|
||||
]
|
||||
);
|
||||
|
||||
$equipmentAssignmentDataProvider = new ActiveDataProvider([
|
||||
'query' => EventEquipmentTypeAssignment::find()->andWhere(['id_event' => $id]),
|
||||
]
|
||||
);
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
'dataProvider' => $dataProvider,
|
||||
'equipmentAssignmentDataProvider' => $equipmentAssignmentDataProvider,
|
||||
'permissions' => new EventPermissions()
|
||||
]);
|
||||
}
|
||||
@@ -295,6 +305,36 @@ class EventController extends Controller
|
||||
return $this->redirect(['timetable', []]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id the id
|
||||
* @return string
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function actionEquipmentTypesAssignment($id)
|
||||
{
|
||||
// $event = $this->findModel($id);
|
||||
$formModel = new EventEquipmentTypeForm(
|
||||
['idEvent' => $id]
|
||||
);
|
||||
$formModel->loadEvent();
|
||||
$formModel->loadAssignedEquipment();
|
||||
if (Yii::$app->request->isPost) {
|
||||
if ($formModel->load(Yii::$app->request->post()) && $formModel->save()) {
|
||||
$this->redirect(['view','id' => $formModel->event->id]);
|
||||
}
|
||||
}else{
|
||||
if ( !isset($formModel->event) ){
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
$formModel->equipmentTypeList = EventEquipmentType::find()->orderBy(['name' => SORT_ASC])->all();
|
||||
|
||||
return $this->render('equipment-types-assignment', [
|
||||
'formModel' => $formModel
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Event model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
|
||||
Reference in New Issue
Block a user