diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index cd3322283..4d704ba5f 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -42,6 +42,11 @@ module OrganizationsHelper Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") end + # 获取两种类型的隐藏状态,数量大于0说明是可见 + def double_field_show org + OrgSubfield.find_by_sql("SELECT * FROM `org_subfields` where organization_id = #{org.id} and (field_type = 'Compstu' or field_type = 'Comptec') and hide = 0;").count + end + def get_attach_org2(field) org_attachments = field.attachments attachments = User.current.admin? ? org_attachments.first(5) : visable_attachemnts(org_attachments).first(5) @@ -189,4 +194,17 @@ module OrganizationsHelper from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 order by course_count desc").first(5) end + def excellent_students + User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity = 1 and u.excellent_student = 1 order by course_count desc").first(5) + end + + def excellent_teachers_hide? org + org.org_subfields.where(:field_type => "Comptec").first.hide + end + + def excellent_students_hide? org + org.org_subfields.where(:field_type => "Compstu").first.hide + end + end diff --git a/app/views/organizations/_org_custom_right3.html.erb b/app/views/organizations/_org_custom_right3.html.erb index c29097400..34612a8ee 100644 --- a/app/views/organizations/_org_custom_right3.html.erb +++ b/app/views/organizations/_org_custom_right3.html.erb @@ -1,7 +1,7 @@ <% if field.field_type == "Resource" %> -
<%= teacher.my_workplace %>
+ ++ <% unless teacher.my_blogs_count == 0 %> + 博客 <%= teacher.my_blogs_count %> + <% end %> + <% unless teacher.courses.count == 0 %> + 课程 <%= teacher.courses.count %> + <% end %> + <% unless teacher.my_students == 0 %> + 学生 <%= teacher.my_students %> + <% end %> +
+<%= student.my_workplace %>
+ ++ <% unless student.my_blogs_count == 0 %> + 博客 <%= student.my_blogs_count %> + <% end %> + <% unless student.courses.count == 0 %> + 课程 <%= student.courses.count %> + <% end %> +
+