class TimetableExporter2
Public Class Methods
Public Instance Methods
export()
click to toggle source
Contract None => IsA
# File lib/tmis/engine/export/timetable_exporter.rb, line 209 def export rows_export @table end
Private Instance Methods
columns()
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 253 def columns @stratagy.columns.zip((3..(@stratagy.columns.to_a.size * 2) + (3 - 1)).each_slice(2)) end
columns_export(row_ent, rows)
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 227 def columns_export(row_ent, rows) columns.each do |ent, cols| columns_format(rows, cols) @table[rows[0], cols[0]] = @stratagy.column_value(ent) export_studies(@stratagy.studies(row_ent, ent), rows, cols) end end
columns_format(rows, cols)
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 286 def columns_format(rows, cols) @table.column(cols[0]).width = 25 @table.merge(rows[0], cols[0], rows[0], cols[1]) end
export_studies(studies, rows, cols)
click to toggle source
Contract ArrayOf, [Pos, Pos], [Pos, Pos] => Any
# File lib/tmis/engine/export/timetable_exporter.rb, line 236 def export_studies(studies, rows, cols) prepare_studies(studies).each do |number, studies| @table.merge(real_row(rows, number), cols[0], real_row(rows, number) + 1, cols[0]) @table.merge(real_row(rows, number), cols[1], real_row(rows, number) + 1, cols[1]) studies.each_with_index do |study, i| @table[real_row(rows, number) + i, cols[0]] = "#{study.subject.title}\n#{study.groupable.get_group.title} " + (study.groupable.subgroup? ? "(#{study.groupable.number}п)" : '') @table[real_row(rows, number) + i, cols[1]] = study.cabinet.title end end end
pair_format(rows, row)
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 280 def pair_format(rows, row) @table.row((rows[0] - 1) + row * 2).height = 30 @table.row(rows[0] + row * 2).height = 30 @table.merge((rows[0] - 1) + row * 2, 2, rows[0] + row * 2, 2) end
prepare_studies(studies)
click to toggle source
real_row(rows, number)
click to toggle source
Contract ArrayOf, Pos => Pos
# File lib/tmis/engine/export/timetable_exporter.rb, line 263 def real_row(rows, number) (rows[0] - 1) + (number * 2) end
rows()
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 249 def rows @stratagy.rows.zip((1..(7 * @stratagy.rows.to_a.size)).each_slice(7).map{ |i| [i.first, i.last] }) end
rows_export()
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 215 def rows_export rows.each do |entity, rows| rows_format(rows) @table[rows[0] + 1, 1] = @stratagy.row_value(entity) (1..6).each do |row| pair_format(rows, row) @table[(rows[0] - 1) + row * 2, 2] = "#{row} пара" end columns_export(entity, rows) end end
rows_format(rows)
click to toggle source
# File lib/tmis/engine/export/timetable_exporter.rb, line 267 def rows_format(rows) @table.merge(rows[0] + 1, 1, rows[1], 1) format = Spreadsheet::Format.new format.rotation = 90 format.horizontal_align = :center format.vertical_align = :middle format.top = :medium format.bottom = :medium format.right = :medium format.left = :medium @table.format(rows[0] + 1, 1, format) end