Example #1
0
// @Title 个人信息视图
// @router /info [get]
func (this *ViewTeatherController) Info() {
	//	get teacher profile
	t_profile, _ := models.GetTeacherProfile(this.Data["teacher"].(*models.Teacher).Id)
	this.Data["teacher"].(*models.Teacher).Profile = t_profile

	this.Layout = "teacher/base.html"
	this.TplNames = "teacher/info.html"
}
Example #2
0
// @Tilte 查看教师资料
// @router /teacherInfo [get]
func (this *ViewStudentController) TeacherInfo() {
	if teacher_id, err := this.GetInt64("teacher"); err == nil {
		if teacher, err := models.GetTeacherById(teacher_id); err == nil {
			teacher.Profile, _ = models.GetTeacherProfile(teacher_id)
			this.Data["teacher"] = teacher
		} else {
			this.Redirect("/error", 302)
			this.StopRun()
		}
	} else {
		this.Redirect("/error", 302)
		this.StopRun()
	}

	this.Layout = "student/base.html"
	this.TplNames = "student/teacherInfo.html"
}
Example #3
0
// @Title 修改个人资料视图
// @router /profile [get]
func (this *ViewTeatherController) Profile() {
	if exist := models.TeacherProfileExist(this.Data["teacher"].(*models.Teacher).Id); !exist {
		if err := models.AddTeacherProfile(&models.TeacherProfile{Teacher: this.Data["teacher"].(*models.Teacher)}); err != nil {
			this.Redirect("/error", 302)
			this.StopRun()
		}
	}
	//	get teacher profile
	if t_profile, err := models.GetTeacherProfile(this.Data["teacher"].(*models.Teacher).Id); err == nil {
		this.Data["teacher"].(*models.Teacher).Profile = t_profile
	} else {
		this.Redirect("/error", 302)
		this.StopRun()
	}
	this.Layout = "teacher/base.html"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["Scripts"] = "scripts/signature_scripts.html"
	this.TplNames = "teacher/profile.html"
}