diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index a44b58789..25536615a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -395,4 +395,74 @@ class AdminController < ApplicationController end + #留言列表 + def leave_messages + @jour = JournalsForMessage.where("jour_type = 'Principal' or jour_type = 'Course'").reorder('created_on desc') + case params[:format] + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 30}) + else + @limit = 30#per_page_option + end + + @jour_count = @jour.count + @jour_pages = Paginator.new @jour_count, @limit, params['page'] + @offset ||= @jour_pages.offset + @jour = @jour.limit(@limit).offset(@offset).all + + respond_to do |format| + format.html + end + end + + #帖子 + def messages_list + @memo = Memo.reorder("created_at desc") + +=begin + case params[:format] + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 30}) + else + @limit = 30#per_page_option + end + + @memo_count = @memo.count + @memo_pages = Paginator.new @memo_count, @limit, params['page'] + @offset ||= @memo_pages.offset + @memo = @memo.limit(@limit).offset(@offset).all +=end + + respond_to do |format| + format.html + end + end + + #课程讨论区的帖子 + def course_messages + #@boards=Board.where('course_id is NULL') + #@course_ms = Message.reorder('created_on desc') + @course_ms=Message.joins("join boards on messages.board_id=boards.id where boards.course_id is not NULL").reorder('created_on desc') + end + + #项目讨论区的帖子 + def project_messages + @project_ms=Message.joins("join boards on messages.board_id=boards.id where boards.project_id != -1").reorder('created_on desc') + end + + #通知 + def notices + @news = News.where('course_id is not NULL').order('created_on desc') + end + + #最近登录用户列表 + def latest_login_users + @user = User.order('last_login_on desc') + end + + #作业 + def homework + @homework = HomeworkCommon.order('end_time desc') + end + end diff --git a/app/views/admin/_tab_messages.erb b/app/views/admin/_tab_messages.erb new file mode 100644 index 000000000..ec04246ba --- /dev/null +++ b/app/views/admin/_tab_messages.erb @@ -0,0 +1,8 @@ +
+ 序号 + | ++ 来源 + | ++ 作者 + | ++ 时间 + | ++ 标题 + | ++ 回复数 + | +
---|---|---|---|---|---|
+ <%= @count %> + | ++ <%= Board.where('id=?',course.board_id).first.course_id %> + | + ++ <%= format_date(course.created_on) %> + | + ++ <%=course.replies_count %> + | +
+ 序号 + | ++ 作业名称 + | ++ 课程名称 + | ++ 作者 + | ++ 提交作品数 + | ++ 提交截止日期 + | +
---|---|---|---|---|---|
+ <%=@count %> + | + + + ++ <%=StudentWork.where('homework_common_id=?',homework.id).count %> + | ++ <%=format_date(homework.end_time) %> + | +
+ 序号 + | ++ 登录时间 + | ++ 用户id + | ++ 用户姓名 + | ++ 用户昵称 + | ++ 用户身份 + | +
---|---|---|---|---|---|
+ <%=@count %> + | ++ <%=format_date(user.last_login_on) %> + | ++ <%=user.id %> + | + ++ <%=link_to(user.login, user_path(user)) %> + | ++ <% case user.user_extensions.identity %> + <% when 0 %> + <%='老师' %> + <% when 1 %> + <%='学生' %> + <% when 2 %> + <%='企业' %> + <% when 3 %> + <%='开发者' %> + <% else %> + <%='未知身份' %> + <% end %> + | +
+ 序号 + | ++ 类型 + | ++ 来源 + | ++ 留言人 + | ++ 留言时间 + | ++ 留言内容 + | ++ 回复数 + | +
---|---|---|---|---|---|---|
+ <%= @count %> + | ++ <%case journal.jour_type %> + <% when 'Principal' %> + <%='用户主页' %> + <% when 'Course' %> + <%='课程' %> + <% end %> + | ++ <%= journal.jour_id %> + | ++ <%= link_to(journal.try(:user).try(:realname).truncate(6, omission: '...'), user_path(journal.user)) %> + | ++ <%= format_date(journal.created_on) %> + | ++ <%= journal.notes.truncate(15, omission: '...') %> + | ++ <% if(journal.m_reply_count) %> + <%=journal.m_reply_count%> + <% else %> + <%=0 %> + <% end %> + | +
+ 序号 + | ++ 来源 + | ++ 作者 + | ++ 时间 + | ++ 标题 + | ++ 回复数 + | +
---|---|---|---|---|---|
+ <%= @count %> + | ++ <%= memo.forum_id %> + | + ++ <%= format_date(memo.created_at) %> + | + ++ <%=memo.replies_count %> + | +
+ 序号 + | ++ 课程id + | ++ 课程名称 + | ++ 主讲老师 + | ++ 作者 + | ++ 时间 + | ++ 标题 + | ++ 回复数 + | +
---|---|---|---|---|---|---|---|
+ <%= @count %> + | ++ <%=news.course_id %> + | + + + ++ <%= format_date(news.created_on) %> + | + ++ <%=news.comments_count %> + | +
+ 序号 + | ++ 来源 + | ++ 作者 + | ++ 时间 + | ++ 标题 + | ++ 回复数 + | +
---|---|---|---|---|---|
+ <%= @count %> + | ++ <%= Board.where('id=?',project.board_id).first.project_id %> + | + ++ <%= format_date(project.created_on) %> + | + ++ <%=project.replies_count %> + | +