parent
5c33c578bb
commit
d8a568e685
|
@ -205,7 +205,12 @@ class CoursesController < ApplicationController
|
||||||
@is_remote = true
|
@is_remote = true
|
||||||
q = "#{params[:name].strip}"
|
q = "#{params[:name].strip}"
|
||||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
#(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)
|
||||||
|
else
|
||||||
|
group = CourseGroup.find(params[:search_group_id])
|
||||||
|
@results = searchgroupstudent_by_name(group, @course, q)
|
||||||
|
end
|
||||||
@result_count = @results.count
|
@result_count = @results.count
|
||||||
@results = paginateHelper @results
|
@results = paginateHelper @results
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,18 @@ module CoursesHelper
|
||||||
end
|
end
|
||||||
members
|
members
|
||||||
end
|
end
|
||||||
|
def searchgroupstudent_by_name(group, project, q)
|
||||||
|
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
|
def searchStudent_by_group group, project
|
||||||
#searchPeopleByRoles(project, StudentRoles)
|
#searchPeopleByRoles(project, StudentRoles)
|
||||||
members = []
|
members = []
|
||||||
|
|
|
@ -8,7 +8,11 @@
|
||||||
<% if @subPage_title == l(:label_student_list) %>
|
<% if @subPage_title == l(:label_student_list) %>
|
||||||
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
|
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
|
||||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%>
|
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%>
|
||||||
<%= submit_tag l(:label_search), :class => "f_2"%>
|
<% if @group %>
|
||||||
|
<%= hidden_field "#{@group.id}", params[:search_group_id], name: 'search_group_id' %>
|
||||||
|
<%= submit_tag l(:label_search), :name => "ingroup",:class => "f_2"%>
|
||||||
|
<% end %>
|
||||||
|
<%= submit_tag l(:label_search), :name => 'incourse',:class => "f_2"%>
|
||||||
<%#= link_to l(:label_search),'' , :class => 'f_2' %>
|
<%#= link_to l(:label_search),'' , :class => 'f_2' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue