Class: Moodle2CC::Moodle2Converter::LabelConverter

Inherits:
Object
  • Object
show all
Includes:
ConverterHelper
Defined in:
lib/moodle2cc/moodle2converter/label_converter.rb

Constant Summary

Constants included from ConverterHelper

ConverterHelper::ACTIVITY_LOOKUP, ConverterHelper::ASSESSMENT_SUFFIX, ConverterHelper::ASSIGNMENT_SUFFIX, ConverterHelper::CHAPTER_SUFFIX, ConverterHelper::CHOICE_ASSESSMENT_SUFFIX, ConverterHelper::COURSE_SUFFIX, ConverterHelper::DISCUSSION_SUFFIX, ConverterHelper::EXTERNAL_URL_SUFFIX, ConverterHelper::FEEDBACK_ASSESSMENT_SUFFIX, ConverterHelper::FILE_SUFFIX, ConverterHelper::FOLDER_SUFFIX, ConverterHelper::GLOSSARY_SUFFIX, ConverterHelper::INTRO_SUFFIX, ConverterHelper::LTI_SUFFIX, ConverterHelper::MAX_TITLE_LENGTH, ConverterHelper::MODULE_SUFFIX, ConverterHelper::PAGE_SUFFIX, ConverterHelper::QUESTIONNAIRE_ASSESSMENT_SUFFIX, ConverterHelper::QUESTION_BANK_SUFFIX, ConverterHelper::SUMMARY_PAGE_SUFFIX

Instance Method Summary collapse

Methods included from ConverterHelper

#activity_content_type, #generate_unique_identifier, #generate_unique_identifier_for, #generate_unique_identifier_for_activity, #generate_unique_resource_path, #get_unique_identifier_for_activity, #truncate_text, #workflow_state

Instance Method Details

#convert_to_module_items(moodle_label) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/moodle2cc/moodle2converter/label_converter.rb', line 5

def convert_to_module_items(moodle_label)
  return [] unless moodle_label.convert_to_page? || moodle_label.convert_to_header?
  module_item = CanvasCC::Models::ModuleItem.new
  module_item.identifier = generate_unique_identifier
  module_item.workflow_state = workflow_state(moodle_label.visible)
  module_item.title = truncate_text(moodle_label.converted_title)
  module_item.indent = '0'

  if moodle_label.convert_to_page?
    module_item.identifierref = get_unique_identifier_for_activity(moodle_label)
    module_item.content_type = CanvasCC::Models::ModuleItem::CONTENT_TYPE_WIKI_PAGE
  elsif moodle_label.convert_to_header?
    module_item.content_type = CanvasCC::Models::ModuleItem::CONTENT_TYPE_CONTEXT_MODULE_SUB_HEADER
  end

  [module_item]
end

#convert_to_pages(moodle_label) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/moodle2cc/moodle2converter/label_converter.rb', line 23

def convert_to_pages(moodle_label)
  pages = []
  if moodle_label.convert_to_page?
    canvas_page = CanvasCC::Models::Page.new
    canvas_page.identifier = generate_unique_identifier_for_activity(moodle_label)
    canvas_page.title = truncate_text(moodle_label.converted_title)
    canvas_page.workflow_state = workflow_state(moodle_label.visible)
    canvas_page.editing_roles = CanvasCC::Models::Page::EDITING_ROLE_TEACHER
    canvas_page.body = moodle_label.intro
    pages << canvas_page
  end
  pages
end