2008-09-16 14:23:41 +00:00
|
|
|
<?php
|
|
|
|
|
2009-05-02 13:23:22 +00:00
|
|
|
// this script is a slightly more user friendly way to 'send' the file to them
|
|
|
|
// (using portfolio/file.php) but still give them the 'return to where you were' link
|
|
|
|
// to go back to their assignment, or whatever
|
|
|
|
|
2009-11-18 13:27:38 +00:00
|
|
|
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
2009-03-28 22:15:12 +00:00
|
|
|
|
|
|
|
if (empty($CFG->enableportfolios)) {
|
|
|
|
print_error('disabled', 'portfolio');
|
|
|
|
}
|
|
|
|
|
2008-11-27 22:46:34 +00:00
|
|
|
require_once($CFG->libdir.'/portfoliolib.php');
|
2009-12-12 11:27:07 +00:00
|
|
|
require_once($CFG->libdir.'/portfolio/exporter.php');
|
|
|
|
|
2008-09-16 14:23:41 +00:00
|
|
|
$id = required_param('id', PARAM_INT);
|
|
|
|
|
2009-11-18 13:27:38 +00:00
|
|
|
$PAGE->set_url('/portfolio/download/file.php', array('id' => $id));
|
2009-03-28 22:15:12 +00:00
|
|
|
|
2008-09-16 14:23:41 +00:00
|
|
|
$exporter = portfolio_exporter::rewaken_object($id);
|
2010-08-06 09:38:36 +00:00
|
|
|
portfolio_export_pagesetup($PAGE, $exporter->get('caller'));
|
2008-09-16 14:23:41 +00:00
|
|
|
$exporter->verify_rewaken();
|
|
|
|
|
|
|
|
$exporter->print_header(get_string('downloading', 'portfolio_download'), false);
|
|
|
|
$returnurl = $exporter->get('caller')->get_return_url();
|
2009-08-18 05:18:28 +00:00
|
|
|
echo $OUTPUT->notification('<a href="' . $returnurl . '">' . get_string('returntowhereyouwere', 'portfolio') . '</a><br />');
|
2008-09-16 14:23:41 +00:00
|
|
|
|
2009-11-18 13:27:38 +00:00
|
|
|
$PAGE->requires->js('/portfolio/download/helper.js');
|
2010-02-06 14:45:17 +00:00
|
|
|
$PAGE->requires->js_function_call('submit_download_form', null, true);
|
2009-11-16 14:55:38 +00:00
|
|
|
|
2009-05-02 13:23:22 +00:00
|
|
|
// if they don't have javascript, they can submit the form here to get the file.
|
|
|
|
// if they do, it does it nicely for them.
|
2008-09-16 14:23:41 +00:00
|
|
|
echo '<div id="redirect">
|
|
|
|
<form action="' . $exporter->get('instance')->get_base_file_url() . '" method="post" id="redirectform">
|
|
|
|
<input type="submit" value="' . get_string('downloadfile', 'portfolio_download') . '" />
|
|
|
|
</form>
|
2009-11-16 14:55:38 +00:00
|
|
|
';
|
2009-08-06 14:09:50 +00:00
|
|
|
echo $OUTPUT->footer();
|
2008-09-16 14:23:41 +00:00
|
|
|
|
2009-11-01 12:51:40 +00:00
|
|
|
|