예제 #1
0
func ViewFeedback(ctx *middleware.Context, params martini.Params) {
	id := params["id"]
	feedback := new(model.Feedback)
	feedback.Id = ParseInt(id)
	err := feedback.SetViewed(true)
	PanicIf(err)
	ctx.Set("success", true)
	ctx.JSON(200, ctx.Response)
}
예제 #2
0
func FeedbackInfo(ctx *middleware.Context) {
	feedback := new(model.Feedback)
	feedback.Viewed = false
	feedbackArray, count, err := feedback.Info()
	PanicIf(err)
	ctx.Set("Array", feedbackArray)
	ctx.Set("Count", count)
	ctx.JSON(200, ctx.Response)
}
예제 #3
0
func DeleteFeedbackArray(ctx *middleware.Context) {
	feedbackArray := ctx.R.FormValue("feedbackArray")
	feedback := new(model.Feedback)
	var res []int
	json.Unmarshal([]byte(feedbackArray), &res)
	err := feedback.DeleteFeedbackArray(res)
	PanicIf(err)
	ctx.Set("success", true)
	ctx.JSON(200, ctx.Response)
}
예제 #4
0
func ContactHandler(ctx *middleware.Context, feedback model.Feedback) {
	switch ctx.R.Method {
	case "POST":
		err := feedback.Insert()
		PanicIf(err)
		ctx.Set("success", true)
		ctx.Set("message", Translate(ctx.S.Get("Lang").(string), "message.send.success"))
		ctx.JSON(200, ctx.Response)
	default:
		ctx.HTML(200, "contact", ctx)
	}
}
예제 #5
0
func AllFeedback(ctx *middleware.Context) {
	switch ctx.R.Method {
	case "POST":
		feedback := new(model.Feedback)
		feedback.SetPageActive(true)
		feedback.SetPageSize(ParseInt(ctx.R.FormValue("iDisplayLength")))
		feedback.SetDisplayStart(ParseInt(ctx.R.FormValue("iDisplayStart")))
		columnNum := ctx.R.FormValue("iSortCol_0")
		sortColumn := ctx.R.FormValue("mDataProp_" + columnNum)
		feedback.AddSortProperty(sortColumn, ctx.R.FormValue("sSortDir_0"))
		feedbackArray, total, err := feedback.SearchByPage()
		PanicIf(err)
		ctx.Set("aaData", feedbackArray)
		ctx.Set("iTotalDisplayRecords", total)
		ctx.Set("iTotalRecords", total)
		ctx.JSON(200, ctx.Response)
	default:
		ctx.HTML(200, "feedback/allFeedback", ctx)
	}
}