Merge branch 'MDL-65026-36' of git://github.com/jleyva/moodle into MOODLE_36_STABLE
This commit is contained in:
@@ -460,9 +460,10 @@ class mod_assign_external extends external_api {
|
||||
|
||||
// Return or not intro and file attachments depending on the plugin settings.
|
||||
if ($assign->show_intro()) {
|
||||
|
||||
list($assignment['intro'], $assignment['introformat']) = external_format_text($module->intro,
|
||||
$module->introformat, $context->id, 'mod_assign', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($assignment['intro'], $assignment['introformat']) =
|
||||
external_format_text($module->intro, $module->introformat, $context->id, 'mod_assign', 'intro', null,
|
||||
$options);
|
||||
$assignment['introfiles'] = external_util::get_area_files($context->id, 'mod_assign', 'intro', false,
|
||||
false);
|
||||
|
||||
|
||||
@@ -205,8 +205,9 @@ class mod_book_external extends external_api {
|
||||
$bookdetails['course'] = $book->course;
|
||||
$bookdetails['name'] = external_format_string($book->name, $context->id);
|
||||
// Format intro.
|
||||
$options = array('noclean' => true);
|
||||
list($bookdetails['intro'], $bookdetails['introformat']) =
|
||||
external_format_text($book->intro, $book->introformat, $context->id, 'mod_book', 'intro', null);
|
||||
external_format_text($book->intro, $book->introformat, $context->id, 'mod_book', 'intro', null, $options);
|
||||
$bookdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_book', 'intro', false, false);
|
||||
$bookdetails['numbering'] = $book->numbering;
|
||||
$bookdetails['navstyle'] = $book->navstyle;
|
||||
|
||||
@@ -549,8 +549,9 @@ class mod_chat_external extends external_api {
|
||||
$chatdetails['course'] = $chat->course;
|
||||
$chatdetails['name'] = external_format_string($chat->name, $chatcontext->id);
|
||||
// Format intro.
|
||||
$options = array('noclean' => true);
|
||||
list($chatdetails['intro'], $chatdetails['introformat']) =
|
||||
external_format_text($chat->intro, $chat->introformat, $chatcontext->id, 'mod_chat', 'intro', null);
|
||||
external_format_text($chat->intro, $chat->introformat, $chatcontext->id, 'mod_chat', 'intro', null, $options);
|
||||
$chatdetails['introfiles'] = external_util::get_area_files($chatcontext->id, 'mod_chat', 'intro', false, false);
|
||||
|
||||
if (has_capability('mod/chat:chat', $chatcontext)) {
|
||||
|
||||
@@ -502,11 +502,10 @@ class mod_choice_external extends external_api {
|
||||
$choicedetails['course'] = $choice->course;
|
||||
$choicedetails['name'] = external_format_string($choice->name, $context->id);
|
||||
// Format intro.
|
||||
$options = array('noclean' => true);
|
||||
list($choicedetails['intro'], $choicedetails['introformat']) =
|
||||
external_format_text($choice->intro, $choice->introformat,
|
||||
$context->id, 'mod_choice', 'intro', null);
|
||||
$choicedetails['introfiles'] = external_util::get_area_files($context->id, 'mod_choice', 'intro', false,
|
||||
false);
|
||||
external_format_text($choice->intro, $choice->introformat, $context->id, 'mod_choice', 'intro', null, $options);
|
||||
$choicedetails['introfiles'] = external_util::get_area_files($context->id, 'mod_choice', 'intro', false, false);
|
||||
|
||||
if (has_capability('mod/choice:choose', $context)) {
|
||||
$choicedetails['publish'] = $choice->publish;
|
||||
|
||||
@@ -237,6 +237,7 @@ class database_summary_exporter extends exporter {
|
||||
return [
|
||||
'component' => 'mod_data',
|
||||
'filearea' => 'intro',
|
||||
'options' => array('noclean' => true),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ class mod_data_external_testcase extends externallib_advanced_testcase {
|
||||
$record = new stdClass();
|
||||
$record->introformat = FORMAT_HTML;
|
||||
$record->course = $course1->id;
|
||||
$record->intro = '<button>Test with HTML allowed.</button>';
|
||||
$database1 = self::getDataGenerator()->create_module('data', $record);
|
||||
|
||||
// Second database.
|
||||
|
||||
@@ -173,6 +173,7 @@ class feedback_summary_exporter extends exporter {
|
||||
return [
|
||||
'component' => 'mod_feedback',
|
||||
'filearea' => 'intro',
|
||||
'options' => array('noclean' => true),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -157,8 +157,9 @@ class mod_folder_external extends external_api {
|
||||
// Entry to return.
|
||||
$folder->name = external_format_string($folder->name, $context->id);
|
||||
|
||||
list($folder->intro, $folder->introformat) = external_format_text($folder->intro,
|
||||
$folder->introformat, $context->id, 'mod_folder', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($folder->intro, $folder->introformat) =
|
||||
external_format_text($folder->intro, $folder->introformat, $context->id, 'mod_folder', 'intro', null, $options);
|
||||
$folder->introfiles = external_util::get_area_files($context->id, 'mod_folder', 'intro', false, false);
|
||||
|
||||
$returnedfolders[] = $folder;
|
||||
|
||||
@@ -90,8 +90,9 @@ class mod_forum_external extends external_api {
|
||||
|
||||
$forum->name = external_format_string($forum->name, $context->id);
|
||||
// Format the intro before being returning using the format setting.
|
||||
list($forum->intro, $forum->introformat) = external_format_text($forum->intro, $forum->introformat,
|
||||
$context->id, 'mod_forum', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($forum->intro, $forum->introformat) =
|
||||
external_format_text($forum->intro, $forum->introformat, $context->id, 'mod_forum', 'intro', null, $options);
|
||||
$forum->introfiles = external_util::get_area_files($context->id, 'mod_forum', 'intro', false, false);
|
||||
// Discussions count. This function does static request cache.
|
||||
$forum->numdiscussions = forum_count_discussions($forum, $cm, $course);
|
||||
|
||||
@@ -217,8 +217,10 @@ class mod_glossary_external extends external_api {
|
||||
foreach ($glossaries as $glossary) {
|
||||
$context = context_module::instance($glossary->coursemodule);
|
||||
$glossary->name = external_format_string($glossary->name, $context->id);
|
||||
list($glossary->intro, $glossary->introformat) = external_format_text($glossary->intro, $glossary->introformat,
|
||||
$context->id, 'mod_glossary', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($glossary->intro, $glossary->introformat) =
|
||||
external_format_text($glossary->intro, $glossary->introformat, $context->id, 'mod_glossary', 'intro', null,
|
||||
$options);
|
||||
$glossary->introfiles = external_util::get_area_files($context->id, 'mod_glossary', 'intro', false, false);
|
||||
|
||||
// Make sure we have a number of entries per page.
|
||||
|
||||
@@ -163,8 +163,10 @@ class mod_imscp_external extends external_api {
|
||||
|
||||
if (has_capability('mod/imscp:view', $context)) {
|
||||
// Format intro.
|
||||
$options = array('noclean' => true);
|
||||
list($imscpdetails['intro'], $imscpdetails['introformat']) =
|
||||
external_format_text($imscp->intro, $imscp->introformat, $context->id, 'mod_imscp', 'intro', null);
|
||||
external_format_text($imscp->intro, $imscp->introformat, $context->id, 'mod_imscp', 'intro', null,
|
||||
$options);
|
||||
$imscpdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_imscp', 'intro', false, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ class mod_label_external extends external_api {
|
||||
$context = context_module::instance($label->coursemodule);
|
||||
// Entry to return.
|
||||
$label->name = external_format_string($label->name, $context->id);
|
||||
|
||||
list($label->intro, $label->introformat) = external_format_text($label->intro,
|
||||
$label->introformat, $context->id, 'mod_label', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($label->intro, $label->introformat) =
|
||||
external_format_text($label->intro, $label->introformat, $context->id, 'mod_label', 'intro', null, $options);
|
||||
$label->introfiles = external_util::get_area_files($context->id, 'mod_label', 'intro', false, false);
|
||||
|
||||
$returnedlabels[] = $label;
|
||||
|
||||
@@ -301,6 +301,7 @@ class lesson_summary_exporter extends exporter {
|
||||
return [
|
||||
'component' => 'mod_lesson',
|
||||
'filearea' => 'intro',
|
||||
'options' => array('noclean' => true),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,8 +306,9 @@ class mod_lti_external extends external_api {
|
||||
|
||||
$viewablefields = [];
|
||||
if (has_capability('mod/lti:view', $context)) {
|
||||
$options = array('noclean' => true);
|
||||
list($module['intro'], $module['introformat']) =
|
||||
external_format_text($lti->intro, $lti->introformat, $context->id, 'mod_lti', 'intro', null);
|
||||
external_format_text($lti->intro, $lti->introformat, $context->id, 'mod_lti', 'intro', null, $options);
|
||||
|
||||
$module['introfiles'] = external_util::get_area_files($context->id, 'mod_lti', 'intro', false, false);
|
||||
$viewablefields = array('launchcontainer', 'showtitlelaunch', 'showdescriptionlaunch', 'icon', 'secureicon');
|
||||
|
||||
@@ -157,8 +157,9 @@ class mod_page_external extends external_api {
|
||||
// Entry to return.
|
||||
$page->name = external_format_string($page->name, $context->id);
|
||||
|
||||
list($page->intro, $page->introformat) = external_format_text($page->intro,
|
||||
$page->introformat, $context->id, 'mod_page', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($page->intro, $page->introformat) =
|
||||
external_format_text($page->intro, $page->introformat, $context->id, 'mod_page', 'intro', null, $options);
|
||||
$page->introfiles = external_util::get_area_files($context->id, 'mod_page', 'intro', false, false);
|
||||
|
||||
$options = array('noclean' => true);
|
||||
|
||||
@@ -105,8 +105,9 @@ class mod_quiz_external extends external_api {
|
||||
|
||||
if (has_capability('mod/quiz:view', $context)) {
|
||||
// Format intro.
|
||||
list($quizdetails['intro'], $quizdetails['introformat']) = external_format_text($quiz->intro,
|
||||
$quiz->introformat, $context->id, 'mod_quiz', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($quizdetails['intro'], $quizdetails['introformat']) =
|
||||
external_format_text($quiz->intro, $quiz->introformat, $context->id, 'mod_quiz', 'intro', null, $options);
|
||||
|
||||
$quizdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_quiz', 'intro', false, false);
|
||||
$viewablefields = array('timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode',
|
||||
|
||||
@@ -172,6 +172,7 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase {
|
||||
// Second quiz.
|
||||
$record = new stdClass();
|
||||
$record->course = $course2->id;
|
||||
$record->intro = '<button>Test with HTML allowed.</button>';
|
||||
$quiz2 = self::getDataGenerator()->create_module('quiz', $record);
|
||||
|
||||
// Execute real Moodle enrolment as we'll call unenrol() method on the instance later.
|
||||
|
||||
@@ -156,9 +156,10 @@ class mod_resource_external extends external_api {
|
||||
$context = context_module::instance($resource->coursemodule);
|
||||
// Entry to return.
|
||||
$resource->name = external_format_string($resource->name, $context->id);
|
||||
|
||||
list($resource->intro, $resource->introformat) = external_format_text($resource->intro,
|
||||
$resource->introformat, $context->id, 'mod_resource', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($resource->intro, $resource->introformat) =
|
||||
external_format_text($resource->intro, $resource->introformat, $context->id, 'mod_resource', 'intro', null,
|
||||
$options);
|
||||
$resource->introfiles = external_util::get_area_files($context->id, 'mod_resource', 'intro', false, false);
|
||||
$resource->contentfiles = external_util::get_area_files($context->id, 'mod_resource', 'content');
|
||||
|
||||
|
||||
@@ -691,8 +691,9 @@ class mod_scorm_external extends external_api {
|
||||
$module['coursemodule'] = $scorm->coursemodule;
|
||||
$module['course'] = $scorm->course;
|
||||
$module['name'] = external_format_string($scorm->name, $context->id);
|
||||
$options = array('noclean' => true);
|
||||
list($module['intro'], $module['introformat']) =
|
||||
external_format_text($scorm->intro, $scorm->introformat, $context->id, 'mod_scorm', 'intro', null);
|
||||
external_format_text($scorm->intro, $scorm->introformat, $context->id, 'mod_scorm', 'intro', null, $options);
|
||||
$module['introfiles'] = external_util::get_area_files($context->id, 'mod_scorm', 'intro', false, false);
|
||||
|
||||
// Check if the SCORM open and return warnings if so.
|
||||
|
||||
@@ -104,8 +104,10 @@ class mod_survey_external extends external_api {
|
||||
}
|
||||
|
||||
// Format intro.
|
||||
$options = array('noclean' => true);
|
||||
list($surveydetails['intro'], $surveydetails['introformat']) =
|
||||
external_format_text($survey->intro, $survey->introformat, $context->id, 'mod_survey', 'intro', null);
|
||||
external_format_text($survey->intro, $survey->introformat, $context->id, 'mod_survey', 'intro', null,
|
||||
$options);
|
||||
$surveydetails['introfiles'] = external_util::get_area_files($context->id, 'mod_survey', 'intro', false,
|
||||
false);
|
||||
|
||||
|
||||
@@ -157,8 +157,9 @@ class mod_url_external extends external_api {
|
||||
// Entry to return.
|
||||
$url->name = external_format_string($url->name, $context->id);
|
||||
|
||||
list($url->intro, $url->introformat) = external_format_text($url->intro,
|
||||
$url->introformat, $context->id, 'mod_url', 'intro', null);
|
||||
$options = array('noclean' => true);
|
||||
list($url->intro, $url->introformat) =
|
||||
external_format_text($url->intro, $url->introformat, $context->id, 'mod_url', 'intro', null, $options);
|
||||
$url->introfiles = external_util::get_area_files($context->id, 'mod_url', 'intro', false, false);
|
||||
|
||||
$returnedurls[] = $url;
|
||||
|
||||
@@ -102,8 +102,9 @@ class mod_wiki_external extends external_api {
|
||||
|
||||
$viewablefields = [];
|
||||
if (has_capability('mod/wiki:viewpage', $context)) {
|
||||
$options = array('noclean' => true);
|
||||
list($module['intro'], $module['introformat']) =
|
||||
external_format_text($wiki->intro, $wiki->introformat, $context->id, 'mod_wiki', 'intro', null);
|
||||
external_format_text($wiki->intro, $wiki->introformat, $context->id, 'mod_wiki', 'intro', null, $options);
|
||||
$module['introfiles'] = external_util::get_area_files($context->id, 'mod_wiki', 'intro', false, false);
|
||||
|
||||
$viewablefields = array('firstpagetitle', 'wikimode', 'defaultformat', 'forceformat', 'editbegin', 'editend',
|
||||
|
||||
@@ -325,6 +325,7 @@ class workshop_summary_exporter extends exporter {
|
||||
return [
|
||||
'component' => 'mod_workshop',
|
||||
'filearea' => 'intro',
|
||||
'options' => array('noclean' => true),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user