Esempio n. 1
0
// Serves the problems list page
func (this *ProblemController) List() {
	problem := models.Problem{}
	problems, _ := problem.GetRecent()
	this.Data["problems"] = problems
	this.Data["title"] = "Home | List "
	this.Data["types"], _ = problem.GetTypes()

	this.Layout = "layout.tpl"
	this.TplNames = "problem/list.tpl"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHead"] = ""
	this.LayoutSections["Sidebar"] = "sidebar/showcategories.tpl"
}
Esempio n. 2
0
// Using list template here as well
// To do : serve in pages, per page 10 problems - done
func (this *ProblemController) ProblemByCategory() {
	problemType := this.Ctx.Input.Param(":type")
	page, _ := strconv.Atoi(this.Ctx.Input.Param(":page"))
	problem := models.Problem{Type: problemType}
	problems, count := problem.GetByType(page)
	if count == 0 {
		this.Redirect("/", 302)
		return
	}
	this.Data["problems"] = problems
	this.Data["title"] = "Home | List "
	this.Data["types"], _ = problem.GetTypes()

	this.Layout = "layout.tpl"
	this.TplNames = "problem/list.tpl"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHead"] = ""
	this.LayoutSections["Sidebar"] = "sidebar/showcategories.tpl"
}