This commit is contained in:
parent
8d891a9faa
commit
057d9a3337
|
@ -55,11 +55,11 @@ class CoursesController < ApplicationController
|
|||
|
||||
def join
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
@user = User.current
|
||||
join = cs.join_course params,@user
|
||||
@state = join[:state]
|
||||
@course = join[:course]
|
||||
cs = CoursesService.new
|
||||
@user = User.current
|
||||
join = cs.join_course params,@user
|
||||
@state = join[:state]
|
||||
@course = join[:course]
|
||||
# else
|
||||
# @course = Course.find_by_id params[:object_id]
|
||||
# CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
|
||||
|
@ -70,7 +70,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
@object_id = params[:object_id]
|
||||
respond_to do |format|
|
||||
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
|
||||
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -85,7 +85,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def join_private_courses
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -98,14 +98,14 @@ class CoursesController < ApplicationController
|
|||
c = cs.edit_course params,@course,User.current
|
||||
@course = c[:course]
|
||||
if @course.errors.full_messages.count <= 0
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# render :layout => 'base_courses'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to settings_course_url(@course)
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# render :layout => 'base_courses'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to settings_course_url(@course)
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -134,8 +134,8 @@ class CoursesController < ApplicationController
|
|||
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
|
||||
@courses = paginateHelper courses,10
|
||||
end
|
||||
@name = params[:name]
|
||||
@type = 'courses'
|
||||
@name = params[:name]
|
||||
@type = 'courses'
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'course_base'
|
||||
|
@ -277,7 +277,7 @@ class CoursesController < ApplicationController
|
|||
def member
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
|
||||
|
||||
@render_file = 'new_member_list'
|
||||
@score_sort_by = "desc"
|
||||
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
|
||||
|
@ -312,7 +312,7 @@ class CoursesController < ApplicationController
|
|||
def export_course_member_excel
|
||||
@all_members = student_homework_score(0,0,0,"desc")
|
||||
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.xls {
|
||||
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
|
||||
|
@ -426,7 +426,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def course
|
||||
@school_id = params[:school_id]
|
||||
@school_id = params[:school_id]
|
||||
per_page_option = 10
|
||||
if @school_id == "0" or @school_id.nil?
|
||||
@courses_all = Course.active.visible.
|
||||
|
@ -514,8 +514,8 @@ class CoursesController < ApplicationController
|
|||
|
||||
def index
|
||||
if !User.current.admin?
|
||||
render_404
|
||||
return
|
||||
render_404
|
||||
return
|
||||
end
|
||||
@course_type = params[:course_type]
|
||||
@school_id = params[:school_id]
|
||||
|
@ -564,7 +564,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base'
|
||||
render :layout => 'base'
|
||||
}
|
||||
format.atom {
|
||||
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||
|
@ -683,10 +683,10 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def feedback
|
||||
@course.journals_for_messages.each do |messages|
|
||||
query = messages.course_messages.where("user_id = ?", User.current.id)
|
||||
query.update_all(:viewed => true);
|
||||
end
|
||||
@course.journals_for_messages.each do |messages|
|
||||
query = messages.course_messages.where("user_id = ?", User.current.id)
|
||||
query.update_all(:viewed => true);
|
||||
end
|
||||
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
page = params[:page]
|
||||
|
@ -737,20 +737,20 @@ class CoursesController < ApplicationController
|
|||
|
||||
#从课程创建的老师那里选择课程大纲
|
||||
def course_outline
|
||||
@teacher = User.find(@course.tea_id)
|
||||
@blog_articles = @teacher.blog.articles
|
||||
@is_in_show_outline_page = params[:is_in_show_outline_page]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@teacher = User.find(@course.tea_id)
|
||||
@blog_articles = @teacher.blog.articles
|
||||
@is_in_show_outline_page = params[:is_in_show_outline_page]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#根据关键字搜索,查找方法一样的,但返回内容不一样
|
||||
def search_course_outline
|
||||
@article_title = params[:title]
|
||||
@teacher = User.find(@course.tea_id)
|
||||
@blog_articles = @teacher.blog.articles.like(@article_title)
|
||||
render :json=>@blog_articles.to_json
|
||||
@article_title = params[:title]
|
||||
@teacher = User.find(@course.tea_id)
|
||||
@blog_articles = @teacher.blog.articles.like(@article_title)
|
||||
render :json=>@blog_articles.to_json
|
||||
end
|
||||
|
||||
#设置或者更改课程的大纲
|
||||
|
@ -796,7 +796,7 @@ class CoursesController < ApplicationController
|
|||
def can_show_course
|
||||
@first_page = FirstPage.find_by_page_type('project')
|
||||
if @first_page.try(:show_course) == 2
|
||||
render_404
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -107,15 +107,15 @@
|
|||
</div><!--talknew end-->
|
||||
<div class="cl"></div>
|
||||
<script type="text/javascript">
|
||||
function select() {
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
</script>
|
||||
function select() {
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue