Class: BigbluebuttonRoomOptions

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ActiveModel::ForbiddenAttributesProtection
Defined in:
app/models/bigbluebutton_room_options.rb

Instance Method Summary collapse

Instance Method Details

#get_available_layoutsObject



9
10
11
# File 'app/models/bigbluebutton_room_options.rb', line 9

def get_available_layouts
  ["Default", "Video Chat", "Meeting", "Webinar", "Lecture assistant", "Lecture"]
end

#is_modified?Boolean

Returns true if any of the attributes was set. Is used to check whether the options have to be sent to the server (setConfigXML) or not.

Returns:

  • (Boolean)


42
43
44
45
# File 'app/models/bigbluebutton_room_options.rb', line 42

def is_modified?
  !self.default_layout.nil? || !self.presenter_share_only.nil? || !self.auto_start_audio.nil? ||
  !self.auto_start_video.nil?
end

#set_on_config_xml(xml) ⇒ Object

Sets the attributes from the model into the config.xml passed in the arguments. If anything was modified in the XML, returns the new XML generated as string. Otherwise returns false.

xml (string)

The config.xml in which the attributes will be set



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/models/bigbluebutton_room_options.rb', line 18

def set_on_config_xml(xml)
  config_xml = BigBlueButton::BigBlueButtonConfigXml.new(xml)
  unless self.default_layout.blank?
    config_xml.set_attribute("layout", "defaultLayout", self.default_layout, false)
  end
  unless self.presenter_share_only.nil?
    config_xml.set_attribute("VideoconfModule", "presenterShareOnly", self.presenter_share_only, true)
    config_xml.set_attribute("PhoneModule", "presenterShareOnly", self.presenter_share_only, true)
  end
  unless self.auto_start_video.nil?
    config_xml.set_attribute("VideoconfModule", "autoStart", self.auto_start_video, true)
  end
  unless self.auto_start_audio.nil?
    config_xml.set_attribute("PhoneModule", "autoJoin", self.auto_start_audio, true)
  end
  if config_xml.is_modified?
    config_xml.as_string
  else
    false
  end
end