class CourseStats
Public Instance Methods
layout()
click to toggle source
# File Views/Course/Stats.rb, line 2 def layout set_data_class :Courses @update = true @order = 100 @functions_need = [:accounting] #@visible = false gui_vboxg do gui_hboxg :nogroup do gui_vbox :nogroup do show_block :accounting end gui_vboxg :nogroup do show_text :contacts, :flexheight => 1 end end show_block :account show_arg :entries, :width => 500 show_button :save, :create_account end end
rpc_list_choice(session, name, args)
click to toggle source
# File Views/Course/Stats.rb, line 41 def rpc_list_choice(session, name, args) dputs(3) { "rpc_list_choice with #{name} - #{args.inspect}" } if name == 'courses' and args['courses'].length > 0 course_id = args['courses'][0] dputs(3) { "replying for course_id #{course_id}" } course = Courses.match_by_course_id(course_id) list = course.students.collect { |s| Persons.match_by_login_name(s) }.compact. collect { |s| [s.phone.to_s, s.email.to_s] }.transpose if list.length > 0 phones = list[0].select { |l| l.to_s.length > 0 }. collect { |l| l.split('/').join("\n") }.join("\n") emails = list[1].select { |l| l.to_s.length > 0 && !(l[1] =~ /@ndjair.net/) }. join("\n") else phones = emails = '' end reply(:empty_nonlists) + reply(:update, :entries => [0]) + update_form_data(course) + reply_visible(course.entries.class != Account, :create_account) + reply(:update, :contacts => "Phones:\n#{phones}\n" + "Emails:\n#{emails}") end end
rpc_update(session)
click to toggle source
# File Views/Course/Stats.rb, line 73 def rpc_update(session) reply(:update, :entries => [0]) end
rpc_update_view(session)
click to toggle source
Calls superclass method
# File Views/Course/Stats.rb, line 66 def rpc_update_view(session) super(session) + reply(:empty_nonlists, :entries) + reply(:update, :entries => [[0, 'None']].concat(AccountRoot.actual.listp_path)) end