func (c *ProjectController) ProjectList() { c.TplNames = "project/list.tpl" filter := c.HandleFilter() getAll := make(map[string]interface{}) allProjects, err := project.NewProjectList().GetList(getAll) if err == nil { c.Data["AllProjects"] = allProjects } projects, err := project.NewProjectList().GetList(filter) if err == nil { c.Data["Projects"] = projects } users := user.NewUserList() c.Data["BussinessUser"] = users.GetRoleList(user.BussinessMen) err, progress := project.GetProgressList() if err == nil { c.Data["Progress"] = progress } c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), len(allProjects)) }
func (c *JobAssignController) GetUserList(department string) ([]*models.User, error) { //fork shitty codes! var filterRoleType user.RoleType if department == user.TechGuy.Desc() { filterRoleType = user.TechGuy } else if department == user.ArtGuy.Desc() { filterRoleType = user.ArtGuy } users := user.NewUserList().GetRoleListExcept(filterRoleType, []uint{uint(c.userId)}) return users, nil }
func (c *UserController) List() { c.GetViewData() p, _ := c.GetInt("p") userList := user.NewUserList().IncludeDeleted(true) c.Data["users"] = userList.SetCondition("company__code", c.GetString("company")).SetCondition("limit", 10).SetCondition("offset", p). SetCondition("id", c.GetString("user_id")).SetCondition("roles", c.GetString("role")). SetCondition("email", c.GetString("email")).SetCondition("mobile", c.GetString("mobile")).GetList() c.Data["count"] = userList.GetCount() c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), userList.GetCount()) c.TplNames = "users/list.tpl" }
func (c *ProjectController) ViewEditProject() { id := c.Ctx.Input.Param(":id") c.TplNames = "project/edit.tpl" project := project.NewProject() project, _ = project.GetOne(id) c.Data["Project"] = project.GetModelProject() users := user.NewUserList() c.Data["Priority"] = c.GetPriority() c.Data["return"] = 1 err, progress := models.GetProgressList() if err == nil { c.Data["Progress"] = progress } c.Data["BussinessUser"] = users.GetRoleList(user.BussinessMen) //[]map[string]string{{"Id": "1", "Name": "许航"}} c.Data["ArtUser"] = users.GetRoleList(user.ArtGuy) // []map[string]string{{"Id": "1", "Name": "许航"}} c.Data["TechUser"] = users.GetRoleList(user.TechGuy) //[]map[string]string{{"Id": "1", "Name": "许航"}} c.Data["Id"] = id }
func (c *ProjectController) ViewCreateProject() { c.TplNames = "project/create.tpl" if c.Data["RoleError"] != nil && c.Data["RoleError"].(bool) { return } c.Data["CreateJobStatus"] = "active" users := user.NewUserList() c.Data["Priority"] = c.GetPriority() err, progress := models.GetProgressList() if err == nil { c.Data["Progress"] = progress } c.Data["BussinessUser"] = users.GetRoleList(user.BussinessMen) //[]map[string]string{{"Id": "1", "Name": "许航"}} c.Data["ArtUser"] = users.GetRoleList(user.ArtGuy) // []map[string]string{{"Id": "1", "Name": "许航"}} c.Data["TechUser"] = users.GetRoleList(user.TechGuy) //[]map[string]string{{"Id": "1", "Name": "许航"}} c.Data["Now"] = time.Now().Local() c.GetProjectNames() }