Fixes issue #170 - icon images fetched via pluginfile - #173
Fixes issue #170 - icon images fetched via pluginfile#173christina-roperto wants to merge 5 commits into
Conversation
| if (!in_array($exporttype, ['csv','json', 'ods', 'xls']) ){ | ||
| send_file_not_found(); | ||
| } | ||
| $filename = $CFG->dirroot.'/blocks/configurable_reports/'.$filearea.'/'.$exporttype.'/pix.gif'; |
There was a problem hiding this comment.
This one doesn't feel right, shouldn't this just be normal pix serving which ends up via /theme/image.php/xxx ?
There was a problem hiding this comment.
Hey @brendanheywood - I tried using theme url, but that doesn't work in pluginfile.
In UI, the image URL is showing like it is coming from pluginfile. I hope this is fine.

| $url = moodle_url::make_pluginfile_url($cid, 'block_configurable_reports', 'export', null, '/', $e); | ||
| $download .= '<a href="viewreport.php?id='.$r->id.'&download=1&format='.$e.'">'. | ||
| '<img src="'.$CFG->wwwroot.'/blocks/configurable_reports/export/'.$e.'/pix.gif" alt="'.$e.'">'. | ||
| '<img src="'.$url.'" alt="'.$e.'">'. |
There was a problem hiding this comment.
please convert this to html_writer
There was a problem hiding this comment.
Hey @brendanheywood - this has been fixed in another pr - #204 (i couldn't push anything to here). Please review.
Thanks,
Anu
| $context = \context_system::instance(); | ||
| $cid = $context->id; | ||
| $url = moodle_url::make_pluginfile_url($cid, 'block_configurable_reports', 'export', null, '/', $e); | ||
| $output .= '<a href="'.$wwwpath.'&download=1&format='.$e.'"><img src="'.$url.'" alt="'.$e.'"> '.(strtoupper($e)).'</a> '; |
There was a problem hiding this comment.
please convert this to html_writer
There was a problem hiding this comment.
Hey @brendanheywood - this has been fixed in another pr - #204 (i couldn't push anything to here). Please review.
Thanks,
Anu
This PR fixes issue #170 so the static images will go through pluginfile.php and can be cached for a longer period of time.