21 lines
585 B
Ruby
21 lines
585 B
Ruby
module StudentWorkHelper
|
|
def user_projects_option
|
|
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
|
memberships = User.current.memberships.all(:conditions => cond)
|
|
projects = memberships.map(&:project)
|
|
not_have_project = []
|
|
not_have_project << Setting.please_chose
|
|
not_have_project << 0
|
|
type = []
|
|
type << not_have_project
|
|
projects.each do |project|
|
|
if project != nil
|
|
option = []
|
|
option << project.name
|
|
option << project.id
|
|
type << option
|
|
end
|
|
end
|
|
type
|
|
end
|
|
end |