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:
Penny Leach
2009-12-15 12:36:49 +00:00
parent ecea942368
commit 521a6ab04d
8 changed files with 110 additions and 78 deletions
+11 -7
View File
@@ -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'));