// @Tilte 查看课程信息 // @router /courseInfo [get] func (this *ViewStudentController) CourseInfo() { // get teacher course if t_course_id, err := this.GetInt64("course"); err == nil { if t_course, err := models.GetTeacherCourseById(t_course_id); err == nil { // get teacher course class and student list t_course.Classes, _ = models.GetClassesByTeacherCourse(t_course) students, _ := models.GetStudentsByTeacherCourse(t_course) t_course.Orgs["students"] = students t_course.Orgs["s_checks"], _ = models.GetStudentChecksByTeacherCourseAndStudent(t_course, this.Data["student"].(*models.Student).Id) if s_homeworks, err := models.GetStudentHomeworkByTeacherCourseAndStudent(t_course, this.Data["student"].(*models.Student).Id); err == nil { t_course.Orgs["s_homeworks"] = s_homeworks this.Data["t_course"] = t_course } } else { this.Redirect("/error", 302) this.StopRun() } } else { this.Redirect("/error", 302) this.StopRun() } this.Layout = "student/base.html" this.LayoutSections = make(map[string]string) this.LayoutSections["Head_html"] = "student/head/courseInfo_head.html" this.LayoutSections["Scripts"] = "student/scripts/courseInfo_scripts.html" this.TplNames = "student/courseInfo.html" }
// @Title 查看课程作业 // @router /courseHomework [get] func (this *ViewStudentController) CourseHomework() { // get teacher course if t_course_id, err := this.GetInt64("course"); err == nil { if t_course, err := models.GetTeacherCourseById(t_course_id); err == nil { // get student course homework list if homeworks, err := models.GetStudentHomeworkByTeacherCourseAndStudent(t_course, this.Data["student"].(*models.Student).Id); err == nil { t_course.Orgs["s_homeworks"] = homeworks this.Data["t_course"] = t_course // get the term all teachercourse if s_courses, err := models.GetStudentCourseByTerm(t_course.Term, this.Data["student"].(*models.Student).Id); err == nil { this.Data["s_courses"] = s_courses } else { this.Redirect("/error", 302) this.StopRun() } // get all term term_list, err := models.GetTermListByStudentHomework(this.Data["student"].(*models.Student).Id) if err != nil { this.Redirect("/error", 302) this.StopRun() } this.Data["term_list"] = models.RankingTerm(term_list) } else { this.Redirect("/error", 302) this.StopRun() } } else { this.Redirect("/error", 302) this.StopRun() } } else { this.Redirect("/error", 302) this.StopRun() } this.Layout = "student/base.html" this.LayoutSections = make(map[string]string) this.LayoutSections["Head_html"] = "student/head/courseHomework_head.html" this.LayoutSections["Scripts"] = "student/scripts/courseHomework_scripts.html" this.TplNames = "student/courseHomework.html" }