Commit 957fc845 authored by David Mudrák's avatar David Mudrák
Browse files

MDL-32471 preview thumbnails support for blocks

block_xxx_pluginfile() now accepts the $options parameter that is to be passed
to the send_stored_file() function.
parent 261cbbac
...@@ -28,9 +28,10 @@ ...@@ -28,9 +28,10 @@
* @param string $filearea file area * @param string $filearea file area
* @param array $args extra arguments * @param array $args extra arguments
* @param bool $forcedownload whether or not force download * @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
* @return bool * @return bool
*/ */
function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) { function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
global $SCRIPT; global $SCRIPT;
if ($context->contextlevel != CONTEXT_BLOCK) { if ($context->contextlevel != CONTEXT_BLOCK) {
...@@ -64,7 +65,7 @@ function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $a ...@@ -64,7 +65,7 @@ function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $a
} }
session_get_instance()->write_close(); session_get_instance()->write_close();
send_stored_file($file, 60*60, 0, $forcedownload); send_stored_file($file, 60*60, 0, $forcedownload, $options);
} }
/** /**
......
This files describes API changes in /blocks/* - activity modules, This files describes API changes in /blocks/* - activity modules,
information provided here is intended especially for developers. information provided here is intended especially for developers.
=== 2.3 ===
required changes in code:
* block_xxx_pluginfile() is now given the 7th parameter (hopefully the last one) that
contains additional options for the file serving. The array should be re-passed
to send_stored_file().
=== 2.0 === === 2.0 ===
......
...@@ -3976,7 +3976,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) { ...@@ -3976,7 +3976,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) {
$filefunction = $component.'_pluginfile'; $filefunction = $component.'_pluginfile';
if (function_exists($filefunction)) { if (function_exists($filefunction)) {
// if the function exists, it must send the file and terminate. Whatever it returns leads to "not found" // if the function exists, it must send the file and terminate. Whatever it returns leads to "not found"
$filefunction($course, $birecord, $context, $filearea, $args, $forcedownload); $filefunction($course, $birecord, $context, $filearea, $args, $forcedownload, array('preview' => $preview));
} }
send_file_not_found(); send_file_not_found();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment