portfolio MDL-20896 added the ability to set mime info for "intended" files
This means for places in Moodle that are going to write a file, like a CSV file, they can set the intended mimetype of the generated file. Previously you had to use a stored_file object. This also gets rid of portfolio_fake_add_url function and replaces the data module implementation with a button. I also refactored portfolio_add_button::to_html to use moodle_url so it's easy to return the same parameters to hidden form fields, an escaped url (for a link), and a non escaped url (to redirect to, which is what the data module does)
This commit is contained in:
@@ -58,17 +58,21 @@ class mod_data_export_form extends moodleform {
|
||||
}
|
||||
}
|
||||
$this->add_checkbox_controller(1, null, null, 1);
|
||||
require_once($CFG->libdir . '/portfoliolib.php');
|
||||
require_once($CFG->dirroot . '/mod/data/locallib.php');
|
||||
if ($CFG->enableportfolios && has_capability('mod/data:exportallentries', get_context_instance(CONTEXT_MODULE, $this->_cm->id))) {
|
||||
require_once($CFG->libdir . '/portfoliolib.php');
|
||||
require_once($CFG->dirroot . '/mod/data/locallib.php');
|
||||
if ($portfoliooptions = portfolio_instance_select(
|
||||
portfolio_instances(),
|
||||
call_user_func(array('data_portfolio_caller', 'base_supported_formats')),
|
||||
'data_portfolio_caller', '/mod/data/locallib.php', '', true, true)) {
|
||||
$mform->addElement('header', 'notice', get_string('portfolionotfile', 'data') . ':');
|
||||
$portfoliooptions[0] = get_string('none');
|
||||
ksort($portfoliooptions);
|
||||
$mform->addElement('select', 'portfolio', get_string('portfolio', 'portfolio'), $portfoliooptions);
|
||||
'data_portfolio_caller',
|
||||
mimeinfo('type', 'export.csv'),
|
||||
'instance',
|
||||
true,
|
||||
true)) {
|
||||
$mform->addElement('header', 'notice', get_string('portfolionotfile', 'data') . ':');
|
||||
$portfoliooptions[0] = get_string('none');
|
||||
ksort($portfoliooptions);
|
||||
$mform->addElement('select', 'portfolio', get_string('portfolio', 'portfolio'), $portfoliooptions);
|
||||
}
|
||||
}
|
||||
$this->add_action_buttons(true, get_string('exportdatabaserecords', 'data'));
|
||||
|
||||
Reference in New Issue
Block a user