Skip to content
Permalink
Browse files

Merge branch 'MDL-54941-master' of git://github.com/jleyva/moodle

  • Loading branch information...
stronk7 committed Aug 2, 2016
2 parents dffeff0 + 1459007 commit 8c7840df32c10903d2651bd4a770081786780097
@@ -2267,7 +2267,10 @@ public static function search_courses($criterianame,
$files[] = array(
'filename' => $file->get_filename(),
'fileurl' => $fileurl,
'filesize' => $file->get_filesize()
'filesize' => $file->get_filesize(),
'filepath' => $file->get_filepath(),
'mimetype' => $file->get_mimetype(),
'timemodified' => $file->get_timemodified(),
);
}
@@ -2337,16 +2340,7 @@ public static function search_courses_returns() {
'categoryname' => new external_value(PARAM_TEXT, 'category name'),
'summary' => new external_value(PARAM_RAW, 'summary'),
'summaryformat' => new external_format_value('summary'),
'overviewfiles' => new external_multiple_structure(
new external_single_structure(
array(
'filename' => new external_value(PARAM_FILE, 'overview file name'),
'fileurl' => new external_value(PARAM_URL, 'overview file url'),
'filesize' => new external_value(PARAM_INT, 'overview file size'),
)
),
'additional overview files attached to this course'
),
'overviewfiles' => new external_files('additional overview files attached to this course'),
'contacts' => new external_multiple_structure(
new external_single_structure(
array(
@@ -4,4 +4,7 @@ information provided here is intended especially for developers.
=== 3.2 ===

* External function core_course_external::get_course_contents now returns the section's number in the course (new section field).
* External functions that were returning file information now return the following file fields:
filename, filepath, mimetype, filesize, timemodified and fileurl.
Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.

@@ -455,22 +455,8 @@ public static function get_assignments($courseids = array(), $capabilities = arr
$assignment['introfiles'] = external_util::get_area_files($context->id, 'mod_assign', 'intro', false,
false);
$fs = get_file_storage();
if ($files = $fs->get_area_files($context->id, 'mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA,
0, 'timemodified', false)) {
$assignment['introattachments'] = array();
foreach ($files as $file) {
$filename = $file->get_filename();
$assignment['introattachments'][] = array(
'filename' => $filename,
'mimetype' => $file->get_mimetype(),
'fileurl' => moodle_url::make_webservice_pluginfile_url(
$context->id, 'mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0, '/', $filename)->out(false)
);
}
}
$assignment['introattachments'] = external_util::get_area_files($context->id, 'mod_assign',
ASSIGN_INTROATTACHMENT_FILEAREA, 0);
}
if ($module->requiresubmissionstatement) {
@@ -541,15 +527,7 @@ private static function get_assignments_assignment_structure() {
'assignment intro, not allways returned because it deppends on the activity configuration', VALUE_OPTIONAL),
'introformat' => new external_format_value('intro', VALUE_OPTIONAL),
'introfiles' => new external_files('Files in the introduction text', VALUE_OPTIONAL),
'introattachments' => new external_multiple_structure(
new external_single_structure(
array (
'filename' => new external_value(PARAM_FILE, 'file name'),
'mimetype' => new external_value(PARAM_RAW, 'mime type'),
'fileurl' => new external_value(PARAM_URL, 'file download url')
)
), 'intro attachments files', VALUE_OPTIONAL
)
'introattachments' => new external_files('intro attachments files', VALUE_OPTIONAL),
), 'assignment information object');
}
@@ -637,24 +615,14 @@ private static function get_plugins_data($assign, $assignplugins, $item) {
$fileareas = $assignplugin->get_file_areas();
foreach ($fileareas as $filearea => $name) {
$fileareainfo = array('area' => $filearea);
$files = $fs->get_area_files(
$fileareainfo['files'] = external_util::get_area_files(
$assign->get_context()->id,
$component,
$filearea,
$item->id,
"timemodified",
false
$item->id
);
foreach ($files as $file) {
$filepath = $file->get_filepath().$file->get_filename();
$fileurl = file_encode_url($CFG->wwwroot . '/webservice/pluginfile.php', '/' . $assign->get_context()->id .
'/' . $component. '/'. $filearea . '/' . $item->id . $filepath);
$fileinfo = array(
'filepath' => $filepath,
'fileurl' => $fileurl
);
$fileareainfo['files'][] = $fileinfo;
}
$plugin['fileareas'][] = $fileareainfo;
}
@@ -822,15 +790,7 @@ private static function get_plugin_structure() {
new external_single_structure(
array (
'area' => new external_value (PARAM_TEXT, 'file area'),
'files' => new external_multiple_structure(
new external_single_structure(
array (
'filepath' => new external_value (PARAM_TEXT, 'file path'),
'fileurl' => new external_value (PARAM_URL, 'file download url',
VALUE_OPTIONAL)
)
), 'files', VALUE_OPTIONAL
)
'files' => new external_files('files', VALUE_OPTIONAL),
)
), 'fileareas', VALUE_OPTIONAL
),
@@ -1945,7 +1945,8 @@ public function test_get_submission_status_in_draft_status() {
$submissionplugins[$plugin['type']] = $plugin;
}
$this->assertEquals('Submission text', $submissionplugins['onlinetext']['editorfields'][0]['text']);
$this->assertEquals('/t.txt', $submissionplugins['file']['fileareas'][0]['files'][0]['filepath']);
$this->assertEquals('/', $submissionplugins['file']['fileareas'][0]['files'][0]['filepath']);
$this->assertEquals('t.txt', $submissionplugins['file']['fileareas'][0]['files'][0]['filename']);
}
/**
@@ -2087,7 +2088,8 @@ public function test_get_submission_status_in_reopened_status() {
$submissionplugins[$plugin['type']] = $plugin;
}
$this->assertEquals('Submission text', $submissionplugins['onlinetext']['editorfields'][0]['text']);
$this->assertEquals('/t.txt', $submissionplugins['file']['fileareas'][0]['files'][0]['filepath']);
$this->assertEquals('/', $submissionplugins['file']['fileareas'][0]['files'][0]['filepath']);
$this->assertEquals('t.txt', $submissionplugins['file']['fileareas'][0]['files'][0]['filename']);
}
/**
@@ -7,6 +7,10 @@ This files describes API changes in the assign code.
* Proper checking for empty submissions
* Submission modification time checking - this will help students working in groups not clobber each others'
submissions
* External functions that were returning file information now return the following file fields:
filename, filepath, mimetype, filesize, timemodified and fileurl.
Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.
Please, note that previously the filename was part of the filepath field, now they are separated.

=== 3.1 ===
* The feedback plugins now need to implement the is_feedback_modified() method. The default is to return true
@@ -283,22 +283,7 @@ public static function get_forum_discussion_posts($discussionid, $sortby = "crea
// List attachments.
if (!empty($post->attachment)) {
$post->attachments = array();
$fs = get_file_storage();
if ($files = $fs->get_area_files($modcontext->id, 'mod_forum', 'attachment', $post->id, "filename", false)) {
foreach ($files as $file) {
$filename = $file->get_filename();
$fileurl = moodle_url::make_webservice_pluginfile_url(
$modcontext->id, 'mod_forum', 'attachment', $post->id, '/', $filename);
$post->attachments[] = array(
'filename' => $filename,
'mimetype' => $file->get_mimetype(),
'fileurl' => $fileurl->out(false)
);
}
}
$post->attachments = external_util::get_area_files($modcontext->id, 'mod_forum', 'attachment', $post->id);
}
$posts[] = $post;
@@ -334,15 +319,7 @@ public static function get_forum_discussion_posts_returns() {
'messageformat' => new external_format_value('message'),
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
'attachment' => new external_value(PARAM_RAW, 'Has attachments?'),
'attachments' => new external_multiple_structure(
new external_single_structure(
array (
'filename' => new external_value(PARAM_FILE, 'file name'),
'mimetype' => new external_value(PARAM_RAW, 'mime type'),
'fileurl' => new external_value(PARAM_URL, 'file download url')
)
), 'attachments', VALUE_OPTIONAL
),
'attachments' => new external_files('attachments', VALUE_OPTIONAL),
'totalscore' => new external_value(PARAM_INT, 'The post message total score'),
'mailnow' => new external_value(PARAM_INT, 'Mail now?'),
'children' => new external_multiple_structure(new external_value(PARAM_INT, 'children post id')),
@@ -518,22 +495,8 @@ public static function get_forum_discussions_paginated($forumid, $sortby = 'time
// List attachments.
if (!empty($discussion->attachment)) {
$discussion->attachments = array();
$fs = get_file_storage();
if ($files = $fs->get_area_files($modcontext->id, 'mod_forum', 'attachment',
$discussion->id, "filename", false)) {
foreach ($files as $file) {
$filename = $file->get_filename();
$discussion->attachments[] = array(
'filename' => $filename,
'mimetype' => $file->get_mimetype(),
'fileurl' => file_encode_url($CFG->wwwroot.'/webservice/pluginfile.php',
'/'.$modcontext->id.'/mod_forum/attachment/'.$discussion->id.'/'.$filename)
);
}
}
$discussion->attachments = external_util::get_area_files($modcontext->id, 'mod_forum', 'attachment',
$discussion->id);
}
$discussions[] = $discussion;
@@ -577,15 +540,7 @@ public static function get_forum_discussions_paginated_returns() {
'messageformat' => new external_format_value('message'),
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
'attachment' => new external_value(PARAM_RAW, 'Has attachments?'),
'attachments' => new external_multiple_structure(
new external_single_structure(
array (
'filename' => new external_value(PARAM_FILE, 'file name'),
'mimetype' => new external_value(PARAM_RAW, 'mime type'),
'fileurl' => new external_value(PARAM_URL, 'file download url')
)
), 'attachments', VALUE_OPTIONAL
),
'attachments' => new external_files('attachments', VALUE_OPTIONAL),
'totalscore' => new external_value(PARAM_INT, 'The post message total score'),
'mailnow' => new external_value(PARAM_INT, 'Mail now?'),
'userfullname' => new external_value(PARAM_TEXT, 'Post author full name'),
@@ -30,6 +30,9 @@ information provided here is intended especially for developers.
- forum_get_subscribed_forums
- forum_get_optional_subscribed_forums
- forum_get_potential_subscribers
* External functions that were returning file information now return the following file fields:
filename, filepath, mimetype, filesize, timemodified and fileurl.
Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.

=== 3.1 ===
* The inteface to forum_get_email_message_id() has changed and no longer needs the $host argument.
@@ -91,13 +91,7 @@ protected static function get_entry_return_structure($includecat = false) {
'definitionformat' => new external_format_value('definition'),
'definitiontrust' => new external_value(PARAM_BOOL, 'The definition trust flag'),
'attachment' => new external_value(PARAM_BOOL, 'Whether or not the entry has attachments'),
'attachments' => new external_multiple_structure(
new external_single_structure(array(
'filename' => new external_value(PARAM_FILE, 'File name'),
'mimetype' => new external_value(PARAM_RAW, 'Mime type'),
'fileurl' => new external_value(PARAM_URL, 'File download URL')
)), 'attachments', VALUE_OPTIONAL
),
'attachments' => new external_files('attachments', VALUE_OPTIONAL),
'timecreated' => new external_value(PARAM_INT, 'Time created'),
'timemodified' => new external_value(PARAM_INT, 'Time modified'),
'teacherentry' => new external_value(PARAM_BOOL, 'The entry was created by a teacher, or equivalent.'),
@@ -148,19 +142,7 @@ protected static function fill_entry_details($entry, $context) {
$entry->attachment = !empty($entry->attachment) ? 1 : 0;
$entry->attachments = array();
if ($entry->attachment) {
$fs = get_file_storage();
if ($files = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id, 'filename', false)) {
foreach ($files as $file) {
$filename = $file->get_filename();
$fileurl = moodle_url::make_webservice_pluginfile_url($context->id, 'mod_glossary', 'attachment',
$entry->id, '/', $filename);
$entry->attachments[] = array(
'filename' => $filename,
'mimetype' => $file->get_mimetype(),
'fileurl' => $fileurl->out(false)
);
}
}
$files = external_util::get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id);
}
}
@@ -1,6 +1,11 @@
This files describes API changes in /mod/glossary/*,
information provided here is intended especially for developers.

=== 3.2 ===
* External functions that were returning file information now return the following file fields:
filename, filepath, mimetype, filesize, timemodified and fileurl.
Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.

=== 2.8 ===
* The glossary_print_entry_attachment function no longer takes an `align`
or `insidetable` property. Instead the attachments are printed within a

0 comments on commit 8c7840d

Please sign in to comment.
You can’t perform that action at this time.