public function getFields() { $years = [null => '']; foreach (range(1990, (int) date('Y')) as $year) { $years[] = $year; } return array_merge(parent::getFields(), ['post' => ['class' => CharField::class, 'label' => UserModule::t('Post')], 'direction' => ['class' => CharField::class, 'label' => UserModule::t('Direction')], 'job_start_at' => ['class' => DropDownField::class, 'choices' => $years, 'label' => UserModule::t('Job start at')], 'job_end_at' => ['class' => DropDownField::class, 'choices' => $years, 'label' => UserModule::t('Job end at')]]); }
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')]]); }