MDL-19817 Upgraded calls to helpbutton, print_simple_box* and notify
[moodle.git] / portfolio / type / download / file.php
CommitLineData
abcd0fc5 1<?php
2
4c7a4ef9 3// this script is a slightly more user friendly way to 'send' the file to them
4// (using portfolio/file.php) but still give them the 'return to where you were' link
5// to go back to their assignment, or whatever
6
abcd0fc5 7require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
add560f3 8
9if (empty($CFG->enableportfolios)) {
10 print_error('disabled', 'portfolio');
11}
12
214b1cf7 13require_once($CFG->libdir.'/portfoliolib.php');
25ddb7ef 14$PAGE->requires->yui_lib('dom');
abcd0fc5 15$id = required_param('id', PARAM_INT);
16
add560f3 17require_login();
18
abcd0fc5 19$exporter = portfolio_exporter::rewaken_object($id);
20$exporter->verify_rewaken();
21
22$exporter->print_header(get_string('downloading', 'portfolio_download'), false);
23$returnurl = $exporter->get('caller')->get_return_url();
24notify('<a href="' . $returnurl . '">' . get_string('returntowhereyouwere', 'portfolio') . '</a><br />');
25
4c7a4ef9 26// if they don't have javascript, they can submit the form here to get the file.
27// if they do, it does it nicely for them.
abcd0fc5 28echo '<div id="redirect">
29 <form action="' . $exporter->get('instance')->get_base_file_url() . '" method="post" id="redirectform">
30 <input type="submit" value="' . get_string('downloadfile', 'portfolio_download') . '" />
31 </form>
32 <script language="javascript">
33 f = YAHOO.util.Dom.get("redirectform");
34 YAHOO.util.Dom.addClass(f.parentNode, "hide");
35 f.submit();
36 </script>';
37
e6e565ab 38echo $OUTPUT->footer();
abcd0fc5 39
40?>