|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // this script is a slightly more user friendly way to 'send' the file to them 00004 // (using portfolio/file.php) but still give them the 'return to where you were' link 00005 // to go back to their assignment, or whatever 00006 00007 require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); 00008 00009 if (empty($CFG->enableportfolios)) { 00010 print_error('disabled', 'portfolio'); 00011 } 00012 00013 require_once($CFG->libdir.'/portfoliolib.php'); 00014 require_once($CFG->libdir.'/portfolio/exporter.php'); 00015 00016 $PAGE->requires->yui2_lib('dom'); 00017 $id = required_param('id', PARAM_INT); 00018 00019 $PAGE->set_url('/portfolio/download/file.php', array('id' => $id)); 00020 00021 $exporter = portfolio_exporter::rewaken_object($id); 00022 portfolio_export_pagesetup($PAGE, $exporter->get('caller')); 00023 $exporter->verify_rewaken(); 00024 00025 $exporter->print_header(get_string('downloading', 'portfolio_download'), false); 00026 $returnurl = $exporter->get('caller')->get_return_url(); 00027 echo $OUTPUT->notification('<a href="' . $returnurl . '">' . get_string('returntowhereyouwere', 'portfolio') . '</a><br />'); 00028 00029 $PAGE->requires->js('/portfolio/download/helper.js'); 00030 $PAGE->requires->js_function_call('submit_download_form', null, true); 00031 00032 // if they don't have javascript, they can submit the form here to get the file. 00033 // if they do, it does it nicely for them. 00034 echo '<div id="redirect"> 00035 <form action="' . $exporter->get('instance')->get_base_file_url() . '" method="post" id="redirectform"> 00036 <input type="submit" value="' . get_string('downloadfile', 'portfolio_download') . '" /> 00037 </form> 00038 '; 00039 echo $OUTPUT->footer(); 00040 00041