|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#encoding utf-8
|
|
|
|
|
class PollController < ApplicationController
|
|
|
|
|
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
|
|
|
|
|
before_filter :find_container, :only => [:new,:create, :index]
|
|
|
|
@ -412,8 +413,10 @@ class PollController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 将其他地方的问卷导出来
|
|
|
|
|
def other_poll
|
|
|
|
|
# 查作者是我,且不在当前课程内的问卷 进行导入
|
|
|
|
|
@polls = Poll.where("user_id = #{User.current.id} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
|
|
|
|
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入
|
|
|
|
|
tea_ids = '('
|
|
|
|
|
tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')'
|
|
|
|
|
@polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
|
|
|
|
@polls_group_id = params[:polls_group_id]
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js
|
|
|
|
@ -427,7 +430,7 @@ class PollController < ApplicationController
|
|
|
|
|
params[:polls].each_with_index do |p,i|
|
|
|
|
|
poll = Poll.find(p)
|
|
|
|
|
option = {
|
|
|
|
|
:polls_name => poll.polls_name,
|
|
|
|
|
:polls_name => poll.polls_name || l(:label_poll_new),
|
|
|
|
|
:polls_type => 'Course',
|
|
|
|
|
:polls_group_id => course_id,
|
|
|
|
|
:polls_status => 1,
|
|
|
|
|