From 8cd3dd0287f32a43a9a4b3c50fae91fe9eccaf7d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 10 Oct 2014 09:21:10 +0800 Subject: [PATCH] =?UTF-8?q?1.#1249=20=E6=9C=AA=E7=99=BB=E5=BD=95=E5=92=8C?= =?UTF-8?q?=E9=9D=9E=E6=9C=AC=E4=BA=BA=E8=BF=9B=E5=85=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=95=8C=E9=9D=A2=E6=97=B6=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=9A=E5=88=A4=E6=96=AD=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=94=A8=E6=88=B7=E5=92=8C=E6=89=80=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E6=98=AF=E5=90=A6=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E4=B8=80=E8=87=B4=E5=8F=96=E6=B6=88=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=98=BE=E7=A4=BA=202.?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E4=BB=A3=E7=A0=81=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 13 +++- app/views/my/account.html.erb | 96 +++++++++++++---------------- app/views/welcome/course.html.erb | 21 ++++--- config/locales/zh.yml | 1 + 4 files changed, 65 insertions(+), 66 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d8ecb4ef7..638a883d2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -226,7 +226,14 @@ class UsersController < ApplicationController end end - membership = @user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + + if User.current == @user || User.current.admin? + membership = @user.coursememberships.all + else + membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + end + membership.sort! {|older, newer| newer.created_on <=> older.created_on } @memberships = [] membership.collect { |e| @@ -235,9 +242,9 @@ class UsersController < ApplicationController ## 判断课程是否过期 [需封装] @memberships_doing = [] @memberships_done = [] - now_time = Time.now.year + #now_time = Time.now.year @memberships.map { |e| - end_time = e.course.get_time.year + #end_time = e.course.get_time.year isDone = course_endTime_timeout?(e.course) if isDone @memberships_done.push e diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index a57e35e65..3cb4fad80 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -12,8 +12,6 @@ ); - - - -