43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
# encoding: utf-8
|
|
|
|
wb = xlsx_package.workbook
|
|
protocol = ("#{URI(request.referer).scheme}://" rescue request.protocol)
|
|
host_url = protocol+(request.host_with_port)
|
|
@data.each_with_index do |role,idx|
|
|
data = role["data"]
|
|
wb.add_worksheet(name: role["name"] + "-" + idx.to_s) do |sheet|
|
|
|
|
heading = sheet.styles.add_style(:b => true, :locked => true)
|
|
|
|
row = ["Name"]
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_selected_course.course_title") + " - " + t(locale.to_s)
|
|
end
|
|
row << t("personal_selected_course.course_url")
|
|
@site_in_use_locales.each do |locale|
|
|
row << t("personal_selected_course.course_objective") + " - " + t(locale.to_s)
|
|
end
|
|
|
|
|
|
row << t("personal_selected_course.year")
|
|
row << t("personal_selected_course.selected_course_semester")
|
|
row << t("personal_selected_course.selected_course_category")
|
|
|
|
sheet.add_row row, :style => heading
|
|
|
|
data.each do |selected_course|
|
|
row = [selected_course.member_profile.name]
|
|
@site_in_use_locales.each do |locale|
|
|
row << selected_course.course_title_translations[locale.to_s]
|
|
end
|
|
row << host_url+selected_course.course_url
|
|
@site_in_use_locales.each do |locale|
|
|
row << selected_course.course_objective_translations[locale.to_s]
|
|
end
|
|
row << selected_course.year
|
|
row << selected_course.course.course_semester.title rescue ""
|
|
row << selected_course.course.course_category.title rescue ""
|
|
sheet.add_row row
|
|
end
|
|
end
|
|
end |