mirror of
https://github.com/moodle/moodle.git
synced 2025-04-12 03:52:16 +02:00
Merge branch 'MDL-72894' of https://github.com/paulholden/moodle
This commit is contained in:
commit
9b72750cee
@ -141,6 +141,12 @@ class exportable_textarea extends exportable_item {
|
||||
$exporteditem->set_content($text);
|
||||
}
|
||||
|
||||
if (!empty($this->textformatfield)) {
|
||||
$formattedcontent = format_text($exporteditem->get_content(), $record->{$this->textformatfield},
|
||||
['context' => $this->get_context()]);
|
||||
$exporteditem->set_content($formattedcontent);
|
||||
}
|
||||
|
||||
$exporteditem->set_title($this->get_user_visible_name());
|
||||
return $exporteditem;
|
||||
}
|
||||
|
@ -118,7 +118,8 @@ class course_exporter extends component_exporter {
|
||||
|
||||
if ($summarydata->has_any_data()) {
|
||||
$hascontent = true;
|
||||
$templatedata->summary = $summarydata->get_content();
|
||||
$templatedata->summary = format_text($summarydata->get_content(), $this->course->summaryformat,
|
||||
['context' => $this->get_context()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,20 +162,28 @@ class course_exporter extends component_exporter {
|
||||
protected function get_course_section(array $exportedcontexts, section_info $section): stdClass {
|
||||
$sectiondata = (object) [
|
||||
'number' => $section->section,
|
||||
'title' => $section->name,
|
||||
'title' => format_string($section->name, true, ['context' => $this->get_context()]),
|
||||
'summary' => '',
|
||||
'activities' => [],
|
||||
];
|
||||
|
||||
$sectiondata->summary = $this->get_archive()->add_pluginfiles_for_content(
|
||||
$this->get_context(),
|
||||
"_course",
|
||||
$section->summary,
|
||||
'course',
|
||||
'section',
|
||||
$section->id,
|
||||
$section->id
|
||||
)->get_template_data()->content;
|
||||
// Fetch the section summary content.
|
||||
if ($section->summary) {
|
||||
$summarydata = $this->get_archive()->add_pluginfiles_for_content(
|
||||
$this->get_context(),
|
||||
'_course',
|
||||
$section->summary,
|
||||
'course',
|
||||
'section',
|
||||
$section->id,
|
||||
$section->id
|
||||
);
|
||||
|
||||
if ($summarydata->has_any_data()) {
|
||||
$sectiondata->summary = format_text($summarydata->get_content(), $section->summaryformat,
|
||||
['context' => $this->get_context()]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->modinfo->sections[$section->section])) {
|
||||
return $sectiondata;
|
||||
@ -196,7 +205,7 @@ class course_exporter extends component_exporter {
|
||||
$url = $cm->url;
|
||||
}
|
||||
$sectiondata->activities[] = (object) [
|
||||
'title' => $cm->name,
|
||||
'title' => $cm->get_formatted_name(),
|
||||
'modname' => $cm->modfullname,
|
||||
'link' => $url,
|
||||
];
|
||||
@ -253,20 +262,23 @@ class course_exporter extends component_exporter {
|
||||
$cm = $this->modinfo->get_cm($modcontext->instanceid);
|
||||
$modname = $cm->modname;
|
||||
|
||||
$record = $DB->get_record($modname, ['id' => $cm->instance], 'intro');
|
||||
$record = $DB->get_record($modname, ['id' => $cm->instance], 'intro,introformat');
|
||||
|
||||
$exporteditem = $this->get_archive()->add_pluginfiles_for_content(
|
||||
$modcontext,
|
||||
'',
|
||||
$record->intro,
|
||||
"mod_{$modname}",
|
||||
'intro',
|
||||
0,
|
||||
null
|
||||
);
|
||||
// Fetch the module intro content.
|
||||
if ($record->intro) {
|
||||
$exporteditem = $this->get_archive()->add_pluginfiles_for_content(
|
||||
$modcontext,
|
||||
'',
|
||||
$record->intro,
|
||||
"mod_{$modname}",
|
||||
'intro',
|
||||
0,
|
||||
null
|
||||
);
|
||||
|
||||
if ($exporteditem->has_any_data()) {
|
||||
return $exporteditem->get_content();
|
||||
if ($exporteditem->has_any_data()) {
|
||||
return format_text($exporteditem->get_content(), $record->introformat, ['context' => $modcontext]);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -249,6 +249,7 @@ class zipwriter {
|
||||
|
||||
$exportedcourse = $this->get_course();
|
||||
$courselink = (new moodle_url('/course/view.php', ['id' => $exportedcourse->id]))->out(false);
|
||||
$coursename = format_string($exportedcourse->fullname, true, ['context' => $this->coursecontext]);
|
||||
|
||||
$this->add_template_requirements();
|
||||
|
||||
@ -260,16 +261,16 @@ class zipwriter {
|
||||
'pathtotop' => $this->get_relative_context_path($context, $this->rootcontext, '/'),
|
||||
'contentexportfooter' => get_string('contentexport_footersummary', 'core', (object) [
|
||||
'courselink' => $courselink,
|
||||
'coursename' => $exportedcourse->fullname,
|
||||
'coursename' => $coursename,
|
||||
'userfullname' => fullname($USER),
|
||||
'date' => userdate(time()),
|
||||
]),
|
||||
'contentexportsummary' => get_string('contentexport_coursesummary', 'core', (object) [
|
||||
'courselink' => $courselink,
|
||||
'coursename' => $exportedcourse->fullname,
|
||||
'coursename' => $coursename,
|
||||
'date' => userdate(time()),
|
||||
]),
|
||||
'coursename' => $exportedcourse->fullname,
|
||||
'coursename' => $coursename,
|
||||
'courseshortname' => $exportedcourse->shortname,
|
||||
'courselink' => $courselink,
|
||||
'exportdate' => userdate(time()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user