func (c Admin) Schedule() revel.Result { connection := c.connected() User := connection.Username days, pairs := database.DaysPairsData(c.DB) faculties := database.FacultiesList(c.DB) return c.Render(User, days, pairs, faculties) }
func (c Application) GroupCurrent(groupName string) revel.Result { group := models.Groups{} err := c.DB.Where("name = ?", groupName).First(&group).Error if err != nil { return c.Redirect(Application.Group) } else { faculties, groups, years := database.GroupsData(c.DB) days, pairs := database.DaysPairsData(c.DB) days_out := database.GroupSchedule(c.DB, group.Id, days, pairs) return c.Render(faculties, groups, years, days, pairs, group, days_out) } }
func (c Application) TeacherCurrent(teacherName string) revel.Result { teacher := models.Teachers{} parsedTeacherName := strings.Split(teacherName, "_") err := c.DB.Where(&models.Teachers{FirstName: parsedTeacherName[1], LastName: parsedTeacherName[0], MiddleName: parsedTeacherName[2]}).First(&teacher).Error if err != nil { fmt.Println(err) return c.Redirect(Application.Teacher) } else { faculties, departments, teachers := database.TeachersData(c.DB) days, pairs := database.DaysPairsData(c.DB) days_out := database.TeacherSchedule(c.DB, teacher.Id, days, pairs) return c.Render(faculties, departments, teachers, days, pairs, teacher, days_out) } }
func (c Application) Teacher() revel.Result { faculties, departments, teachers := database.TeachersData(c.DB) days, pairs := database.DaysPairsData(c.DB) return c.Render(faculties, departments, teachers, days, pairs) }
func (c Application) Group() revel.Result { faculties, groups, years := database.GroupsData(c.DB) days, pairs := database.DaysPairsData(c.DB) return c.Render(faculties, groups, years, days, pairs) }