Class: Moodle2CC::Canvas::DiscussionTopic
- Inherits:
-
Moodle2CC::CC::DiscussionTopic
- Object
- Moodle2CC::CC::DiscussionTopic
- Moodle2CC::Canvas::DiscussionTopic
- Includes:
- Resource
- Defined in:
- lib/moodle2cc/canvas/discussion_topic.rb
Constant Summary
Constants included from Moodle2CC::CC::CCHelper
Moodle2CC::CC::CCHelper::ASSESSMENT_CC_QTI, Moodle2CC::CC::CCHelper::ASSESSMENT_META, Moodle2CC::CC::CCHelper::ASSESSMENT_NON_CC_FOLDER, Moodle2CC::CC::CCHelper::ASSESSMENT_TYPE, Moodle2CC::CC::CCHelper::ASSIGNMENT_GROUPS, Moodle2CC::CC::CCHelper::ASSIGNMENT_SETTINGS, Moodle2CC::CC::CCHelper::BASIC_LTI, Moodle2CC::CC::CCHelper::BLTI_NAMESPACE, Moodle2CC::CC::CCHelper::CANVAS_NAMESPACE, Moodle2CC::CC::CCHelper::CANVAS_PLATFORM, Moodle2CC::CC::CCHelper::CC_ASSIGNMENT_FOLDER, Moodle2CC::CC::CCHelper::CC_EXTENSION, Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER, Moodle2CC::CC::CCHelper::COURSE_SETTINGS, Moodle2CC::CC::CCHelper::COURSE_SETTINGS_DIR, Moodle2CC::CC::CCHelper::COURSE_TOKEN, Moodle2CC::CC::CCHelper::DISCUSSION_TOPIC, Moodle2CC::CC::CCHelper::EVENTS, Moodle2CC::CC::CCHelper::EXTERNAL_FEEDS, Moodle2CC::CC::CCHelper::EXTERNAL_TOOLS, Moodle2CC::CC::CCHelper::FILES_META, Moodle2CC::CC::CCHelper::GRADING_STANDARDS, Moodle2CC::CC::CCHelper::IMS_DATE, Moodle2CC::CC::CCHelper::IMS_DATETIME, Moodle2CC::CC::CCHelper::LEARNING_OUTCOMES, Moodle2CC::CC::CCHelper::LOR, Moodle2CC::CC::CCHelper::MANIFEST, Moodle2CC::CC::CCHelper::MEDIA_OBJECTS_FOLDER, Moodle2CC::CC::CCHelper::MODULE_META, Moodle2CC::CC::CCHelper::MOODLE_FILEBASE_TOKEN, Moodle2CC::CC::CCHelper::MOODLE_SLASH_TOKEN, Moodle2CC::CC::CCHelper::OBJECT_TOKEN, Moodle2CC::CC::CCHelper::QTI_ASSESSMENT_TYPE, Moodle2CC::CC::CCHelper::QTI_EXTENSION, Moodle2CC::CC::CCHelper::QUESTION_BANK, Moodle2CC::CC::CCHelper::RUBRICS, Moodle2CC::CC::CCHelper::SYLLABUS, Moodle2CC::CC::CCHelper::WEBCONTENT, Moodle2CC::CC::CCHelper::WEB_CONTENT_TOKEN, Moodle2CC::CC::CCHelper::WEB_LINK, Moodle2CC::CC::CCHelper::WEB_RESOURCES_FOLDER, Moodle2CC::CC::CCHelper::WIKI_FOLDER, Moodle2CC::CC::CCHelper::WIKI_TOKEN, Moodle2CC::CC::CCHelper::XSD_URI
Instance Attribute Summary collapse
-
#identifierref ⇒ Object
Returns the value of attribute identifierref.
-
#position ⇒ Object
Returns the value of attribute position.
-
#posted_at ⇒ Object
Returns the value of attribute posted_at.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Moodle2CC::CC::DiscussionTopic
Instance Method Summary collapse
- #create_files(export_dir) ⇒ Object
- #create_module_meta_item_elements(item_node) ⇒ Object
- #create_resource_node(resources_node) ⇒ Object
- #create_resource_sub_nodes(resource_node) ⇒ Object
- #create_topic_meta_xml(export_dir) ⇒ Object
-
#initialize(mod, position = 0) ⇒ DiscussionTopic
constructor
A new instance of DiscussionTopic.
Methods included from Resource
Methods inherited from Moodle2CC::CC::DiscussionTopic
Methods included from Moodle2CC::CC::Resource
#create_organization_item_node, included
Methods included from Moodle2CC::CC::CCHelper
#convert_file_path_tokens, convert_file_path_tokens, #create_key, create_key, create_mod_key, #create_mod_key, #create_resource_key, create_resource_key, file_query_string, #file_slug, file_slug, #get_html_title_and_body, #get_html_title_and_body_and_id, #get_html_title_and_body_and_meta_fields, ims_date, #ims_date, ims_datetime, #ims_datetime, media_object_info
Constructor Details
#initialize(mod, position = 0) ⇒ DiscussionTopic
Returns a new instance of DiscussionTopic.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 6 def initialize(mod, position=0) super @text = convert_file_path_tokens(mod.intro) if mod.section_mod && mod.section_mod.added.to_i > 0 @posted_at = ims_datetime(Time.at(mod.section_mod.added)) end @position = position @type = 'topic' @identifierref = create_key(@id, 'topic_meta_') end |
Instance Attribute Details
#identifierref ⇒ Object
Returns the value of attribute identifierref.
4 5 6 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 4 def identifierref @identifierref end |
#position ⇒ Object
Returns the value of attribute position.
4 5 6 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 4 def position @position end |
#posted_at ⇒ Object
Returns the value of attribute posted_at.
4 5 6 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 4 def posted_at @posted_at end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 4 def type @type end |
Instance Method Details
#create_files(export_dir) ⇒ Object
34 35 36 37 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 34 def create_files(export_dir) super (export_dir) end |
#create_module_meta_item_elements(item_node) ⇒ Object
59 60 61 62 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 59 def (item_node) item_node.content_type 'DiscussionTopic' item_node.identifierref @identifier end |
#create_resource_node(resources_node) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 19 def create_resource_node(resources_node) super resources_node.resource( :type => LOR, :identifier => @identifierref, :href => "#{@identifierref}.xml" ) do |resource_node| resource_node.file(:href => "#{@identifierref}.xml") end end |
#create_resource_sub_nodes(resource_node) ⇒ Object
30 31 32 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 30 def create_resource_sub_nodes(resource_node) resource_node.dependency(:identifierref => @identifierref) end |
#create_topic_meta_xml(export_dir) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/moodle2cc/canvas/discussion_topic.rb', line 39 def (export_dir) path = File.join(export_dir, "#{@identifierref}.xml") File.open(path, 'w') do |file| document = Builder::XmlMarkup.new(:target => file, :indent => 2) document.instruct! document.topicMeta( :identifier => @identifierref, 'xsi:schemaLocation' => "http://canvas.instructure.com/xsd/cccv1p0 http://canvas.instructure.com/xsd/cccv1p0.xsd", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns' => "http://canvas.instructure.com/xsd/cccv1p0" ) do || .topic_id identifier .title @title .posted_at @posted_at .position @position .type @type end end end |