diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 397235f4b..1b95ef895 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -154,6 +154,19 @@ class AdminController < ApplicationController
end
end
+ # 单位名称列表下的已审批按照名字排序
+ def apply_shcool_sort
+ @order = ""
+ @sort = ""
+ if params[:sort] && (params[:order] == 'name')
+ # courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
+ school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' GROUP BY CONVERT(name USING gbk) #{params[:sort]}, aas.id desc ")
+ @order = params[:order]
+ @sort = params[:sort]
+ end
+ redirect_to unapplied_schools_url
+ end
+
#精品课程下的全部课程
def excellent_all_courses
name = params[:name]
@@ -700,8 +713,10 @@ class AdminController < ApplicationController
user.update_column("school_id", nil)
end
applied_school.school.destroy
- respond_to do |format|
- format.html{ redirect_to unapplied_schools_url }
+ if params[:tip] == "unapplied"
+ redirect_to unapplied_schools_url
+ elsif params[:tip] == "applied"
+ redirect_to applied_schools_url
end
end
diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb
index dd3169905..ec585e2b2 100644
--- a/app/controllers/school_controller.rb
+++ b/app/controllers/school_controller.rb
@@ -184,6 +184,9 @@ class SchoolController < ApplicationController
applyschool.user_id = User.current.id
if applyschool.save
data[:school_id] = school.id
+ user_extention= User.current.extensions
+ user_extention.school_id = school.id
+ user_extention.save!
else
data[:result] = 3
end
diff --git a/app/views/admin/_all_schools.html.erb b/app/views/admin/_all_schools.html.erb
index 0ecb38544..af59d7687 100644
--- a/app/views/admin/_all_schools.html.erb
+++ b/app/views/admin/_all_schools.html.erb
@@ -16,7 +16,7 @@
function school_submit() {
var checkboxs = $("input[name='school_id[]']:checked");
if(checkboxs.length == 0) {
- $("#choose_courses_notice").text("请先选择班级");
+ $("#choose_courses_notice").text("请选择单位");
} else{
$("#choose_courses_notice").text("");
$("#schools_list_form").submit();
diff --git a/app/views/admin/applied_schools.html.erb b/app/views/admin/applied_schools.html.erb
index 4f48897ce..32e67914f 100644
--- a/app/views/admin/applied_schools.html.erb
+++ b/app/views/admin/applied_schools.html.erb
@@ -23,8 +23,11 @@
<% @apply_status.each do |apply| %>
<% if apply.status == 0 %>
- ">
+
">
<%= apply.id %>
|
@@ -54,7 +57,13 @@
<%= apply.name %>
- <%= apply.province + apply.city %>
+ <% user = User.where("id=?", apply.user_id).first %>
+ <% unless user.nil? %>
+ <%= user.login %>
+ <% end %>
+ |
+
+ <%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
<%= apply.address %>
@@ -67,13 +76,13 @@
<%= format_date(apply.created_at) %>
|
- <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => 'icon-del') %>
- <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
+ <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }) %>
+ <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure)) %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %>
|
- <% unless apply.remarks.empty? %>
+ <% unless apply.remarks.blank? %>
diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb
index 07459fa0f..11361dbac 100644
--- a/app/views/admin/has_applied_schools.html.erb
+++ b/app/views/admin/has_applied_schools.html.erb
@@ -26,6 +26,9 @@
|
单位名称
|
+
+ 申请者
+ |
地区
|
@@ -51,10 +54,22 @@
<%= apply.id %>
- <%= (School.find apply.school_id).name %>
+ <% unless apply.school_id.nil? %>
+ <% school_name = School.where("id=?", apply.school_id).first %>
+ <%= school_name.name %>
+ <% end %>
+ |
+
+ <% user = User.where("id=?", apply.user_id).first %>
+ <% unless user.nil? %>
+ <%= user.login %>
+ <% end %>
|
- <%= (School.find apply.school_id).province %>
+ <% unless apply.school_id.nil? %>
+ <% school_province = School.where("id=?", apply.school_id).first %>
+ <%= school_province.province %>
+ <% end %>
|
<%= apply.address %>
@@ -66,10 +81,10 @@
<%= format_date(apply.created_at) %>
|
- <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
+ <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
|
- <% unless apply.remarks.empty? %>
+ <% unless apply.remarks.blank? %>
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index f35d47079..46e8e015a 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -369,7 +369,7 @@
function apply_add_school(){
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
pop_up_box(htmlvalue,580,20,48);
-
+ $("#schoolname").val($("input[name='province']").val());
}
function add_school(name){
$.ajax({
diff --git a/config/routes.rb b/config/routes.rb
index 2cc2bd906..b07600400 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1074,6 +1074,7 @@ RedmineApp::Application.routes.draw do
get 'admin/approve_applied_schools'
post 'admin/edit_applied_schools'
get 'admin/all_schools'
+ get 'admin/apply_shcool_sort', as: :apply_shcool_sort
delete 'admin/delete_applied_schools'
get 'admin/leave_messages'
|