Class: Moodle2CC::Moodle2Converter::WikiConverter
- Inherits:
-
Object
- Object
- Moodle2CC::Moodle2Converter::WikiConverter
- Includes:
- ConverterHelper
- Defined in:
- lib/moodle2cc/moodle2converter/wiki_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(moodle_wiki) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/moodle2cc/moodle2converter/wiki_converter.rb', line 5 def convert(moodle_wiki) canvas_pages = [] moodle_wiki.pages.each do |moodle_page| canvas_page = Moodle2CC::CanvasCC::Models::Page.new canvas_page.identifier = generate_unique_identifier_for("#{moodle_wiki.id}#{moodle_page[:id]}") + PAGE_SUFFIX canvas_page.page_name = truncate_text(moodle_page[:title]) canvas_page.workflow_state = workflow_state(moodle_wiki.visible) canvas_page.editing_roles = 'teachers' canvas_page.body = moodle_page[:content] canvas_pages << canvas_page end if moodle_wiki.first_page_title.to_s.strip.length > 0 && (first_page = canvas_pages.detect{|page| page.title.to_s.strip == moodle_wiki.first_page_title.to_s.strip}) first_page.identifier = generate_unique_identifier_for_activity(moodle_wiki) first_page.body = moodle_wiki.intro.to_s + first_page.body.to_s first_page.page_name = moodle_wiki.name else first_page = Moodle2CC::CanvasCC::Models::Page.new first_page.identifier = generate_unique_identifier_for_activity(moodle_wiki) first_page.body = moodle_wiki.intro first_page.workflow_state = workflow_state(moodle_wiki.visible) first_page.editing_roles = 'teachers' first_page.page_name = moodle_wiki.name canvas_pages << first_page end canvas_pages end |