コード例 #1
0
ファイル: admin.go プロジェクト: oblank/rozklad_cdtu
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)
}
コード例 #2
0
ファイル: app.go プロジェクト: oblank/rozklad_cdtu
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)
	}
}
コード例 #3
0
ファイル: app.go プロジェクト: oblank/rozklad_cdtu
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)
	}
}
コード例 #4
0
ファイル: app.go プロジェクト: oblank/rozklad_cdtu
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)
}
コード例 #5
0
ファイル: app.go プロジェクト: oblank/rozklad_cdtu
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)
}