diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a14ade71a..326ae0f42 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -205,7 +205,12 @@ class CoursesController < ApplicationController @is_remote = true q = "#{params[:name].strip}" #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? - @results = searchStudent_by_name(@course, q) + if params[:incourse] + @results = searchStudent_by_name(@course, q) + elsif params[:ingroup] + @group = CourseGroup.find(params[:search_group_id]) + @results = searchgroupstudent_by_name(@group, @course, q) + end @result_count = @results.count @results = paginateHelper @results @@ -226,6 +231,16 @@ class CoursesController < ApplicationController @course_groups = @course.course_groups end + def deletegroup + CourseGroup.delete(params[:group_id]) + @subPage_title = l :label_student_list + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @members = searchStudent(@course) + @membercount = @members.count + @course_groups = @course.course_groups + end + def updategroupname @subPage_title = l :label_student_list if params[:group_name] diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 3b7e811f6..a1199a55a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -184,6 +184,18 @@ module CoursesHelper end members end + def searchgroupstudent_by_name(group, project, name) + members = [] + group.members.each do |m| + if m && m.user && m.user.allowed_to?(:as_student,project) + username = m.user[:lastname].to_s + m.user[:firstname].to_s + if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name)) + members << m + end + end + end + members + end def searchStudent_by_group group, project #searchPeopleByRoles(project, StudentRoles) members = [] diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb index 096e84372..ca0fed9c2 100644 --- a/app/views/courses/_groups_name.html.erb +++ b/app/views/courses/_groups_name.html.erb @@ -1,40 +1,4 @@ -