Class: Moodle2CC::CC::DiscussionTopic
- Inherits:
-
Object
- Object
- Moodle2CC::CC::DiscussionTopic
- Includes:
- CCHelper, Resource
- Defined in:
- lib/canvas_cc/cc/discussion_topic.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #create_files(export_dir) ⇒ Object
- #create_resource_node(resources_node) ⇒ Object
- #create_resource_sub_nodes(resource_node) ⇒ Object
- #create_topic_xml(export_dir) ⇒ Object
- #identifierref ⇒ Object
-
#initialize(mod, position = 0) ⇒ DiscussionTopic
constructor
A new instance of DiscussionTopic.
Constructor Details
#initialize(mod, position = 0) ⇒ DiscussionTopic
Returns a new instance of DiscussionTopic.
9 10 11 12 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 9 def initialize(mod, position=0) super @text = convert_file_path_tokens(mod.intro) end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 7 def text @text end |
Instance Method Details
#create_files(export_dir) ⇒ Object
31 32 33 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 31 def create_files(export_dir) create_topic_xml(export_dir) end |
#create_resource_node(resources_node) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 18 def create_resource_node(resources_node) resources_node.resource( :type => DISCUSSION_TOPIC, :identifier => identifier ) do |resource_node| resource_node.file(:href => "#{identifier}.xml") create_resource_sub_nodes(resource_node) end end |
#create_resource_sub_nodes(resource_node) ⇒ Object
28 29 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 28 def create_resource_sub_nodes(resource_node) end |
#create_topic_xml(export_dir) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 35 def create_topic_xml(export_dir) path = File.join(export_dir, "#{identifier}.xml") File.open(path, 'w') do |file| document = Builder::XmlMarkup.new(:target => file, :indent => 2) document.instruct! document.topicMeta( :identifier => identifierref, 'xsi:schemaLocation' => "http://www.imsglobal.org/xsd/imsccv1p1/imsdt_v1p1 http://www.imsglobal.org/profile/cc/ccv1p1/ccv1p1_imsdt_v1p1.xsd", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns' => "http://www.imsglobal.org/xsd/imsccv1p1/imsdt_v1p1" ) do |topic| topic.title @title topic.text @text, :texttype => 'text/html' end end end |
#identifierref ⇒ Object
14 15 16 |
# File 'lib/canvas_cc/cc/discussion_topic.rb', line 14 def identifierref create_key(id, 'topic_meta_') end |