public function actionView() { $user = Mindy::app()->getUser(); if ($user->getIsGuest()) { $this->error(403); } $this->addBreadcrumb('Личный кабинет'); $classroom = Classroom::objects()->get(['administrator' => $user]); echo $this->render('user/profile/view.html', ['model' => $user, 'classroom' => $classroom]); }
public function getFields() { $years = [null => '']; foreach (range(1990, (int) date('Y')) as $year) { $years[] = $year; } $classes = []; foreach (Classroom::objects()->valuesList(['id', 'name']) as $cls) { $classes[$cls['id']] = $cls['name']; } return array_merge(parent::getFields(), ['classroom' => ['class' => DropDownField::class, 'label' => ClassroomModule::t('Classroom'), 'choices' => $classes], 'education_start_at' => ['class' => DropDownField::class, 'choices' => $years, 'label' => UserModule::t('Education start date')], 'education_end_at' => ['class' => DropDownField::class, 'choices' => $years, 'label' => UserModule::t('Education end date')]]); }