|
|
|
@ -669,24 +669,29 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def feedback
|
|
|
|
|
page = params[:page]
|
|
|
|
|
# Find the page of the requested reply
|
|
|
|
|
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
|
|
|
|
@limit = 10
|
|
|
|
|
if params[:r] && page.nil?
|
|
|
|
|
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
|
|
|
|
page = 1 + offset / @limit
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#@feedback_count = @jours.count
|
|
|
|
|
#@feedback_pages = Paginator.new @feedback_count, @limit, page
|
|
|
|
|
#@offset ||= @feedback_pages.offset
|
|
|
|
|
@jour = paginateHelper @jours,10
|
|
|
|
|
@state = false
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html{render :layout => 'base_courses'}
|
|
|
|
|
format.api
|
|
|
|
|
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
|
|
|
|
page = params[:page]
|
|
|
|
|
# Find the page of the requested reply
|
|
|
|
|
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
|
|
|
|
@limit = 10
|
|
|
|
|
if params[:r] && page.nil?
|
|
|
|
|
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
|
|
|
|
page = 1 + offset / @limit
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#@feedback_count = @jours.count
|
|
|
|
|
#@feedback_pages = Paginator.new @feedback_count, @limit, page
|
|
|
|
|
#@offset ||= @feedback_pages.offset
|
|
|
|
|
@jour = paginateHelper @jours,10
|
|
|
|
|
@state = false
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html{render :layout => 'base_courses'}
|
|
|
|
|
format.api
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
render_403
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|