mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
portfolio: MDL-21030 - leap2a portfolio format support.
This commit includes: - leap2a portfolio format, and xml writer - proof of concept implementation in forum and assignment modules - a lot of refactoring of the portfolio formats in general: - addition of "abstract" formats - this is necessary for plugins to be able to support groups of formats - addition of the idea of portfolio formats conflicting with eachother - eg richhtml & plainhtml it touches modules other than assignment and forum, because the format api changed and now each place in moodle that exports portfolio content has to deal with the formats it supports slightly differently. At the moment the Mahara portfolio still doesn't support this format, because I haven't done the Mahara side yet. The "file download" plugin supports it though. Still todo: - Add support for the other places in Moodle (glossary, data, etc) - Write tests, once the rest of the portfolio tests have been updated to use the new DB mocking stuff - Fix a bunch of TODOs
This commit is contained in:
parent
9cbced1d2e
commit
59dd457e4b
26 changed files with 994 additions and 111 deletions
|
@ -47,6 +47,7 @@ $stage = optional_param('stage', PORTFOLIO_STAGE_CONFIG, PARAM_INT); //
|
|||
$postcontrol = optional_param('postcontrol', 0, PARAM_INT); // when returning from some bounce to an external system, this gets passed
|
||||
$callbackfile = optional_param('callbackfile', null, PARAM_PATH); // callback file eg /mod/forum/lib.php - the location of the exporting content
|
||||
$callbackclass = optional_param('callbackclass', null, PARAM_ALPHAEXT); // callback class eg forum_portfolio_caller - the class to handle the exporting content.
|
||||
$callerformats = optional_param('callerformats', null, PARAM_TAGLIST); // comma separated list of formats the specific place exporting content supports
|
||||
|
||||
require_login(); // this is selectively called again with $course later when we know for sure which one we're in.
|
||||
$PAGE->set_url('/portfolio/add.php', array('id' => $dataid, 'sesskey' => sesskey()));
|
||||
|
@ -91,14 +92,14 @@ if (!empty($dataid)) {
|
|||
if ($cancelsure) {
|
||||
$exporter->cancel_request($logreturn);
|
||||
} else {
|
||||
$yesurl = $CFG->wwwroot . '/portfolio/add.php?id=' . $dataid . '&cancel=1&cancelsure=1&logreturn=' . $logreturn . '&sesskey=' . sesskey();
|
||||
$nourl = $CFG->wwwroot . '/portfolio/add.php?id=' . $dataid . '&sesskey=' . sesskey();
|
||||
if ($logreturn) {
|
||||
$nourl = $CFG->wwwroot . '/user/portfoliologs.php';
|
||||
}
|
||||
$exporter->print_header('confirmcancel');
|
||||
echo $OUTPUT->box_start();
|
||||
echo $OUTPUT->confirm(get_string('confirmcancel', 'portfolio'), $yesurl, $nourl);
|
||||
$yesbutton = html_form::make_button($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid, 'cancel' => 1, 'cancelsure' => 1, 'logreturn' => $logreturn));
|
||||
$nobutton = html_form::make_button($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid), get_string('no'));
|
||||
if ($logreturn) {
|
||||
$nobutton->url = $CFG->wwwroot . '/user/portfoliologs.php';
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string('confirmcancel', 'portfolio'), $yesbutton, $nobutton);
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
|
@ -151,6 +152,7 @@ if (!empty($dataid)) {
|
|||
// we must be passed this from the caller, we cannot start a new export
|
||||
// without knowing information about what part of moodle we come from.
|
||||
if (empty($callbackfile) || empty($callbackclass)) {
|
||||
debugging('no callback file or class');
|
||||
portfolio_exporter::print_expired_export();
|
||||
}
|
||||
|
||||
|
@ -179,6 +181,9 @@ if (!empty($dataid)) {
|
|||
}
|
||||
$caller = new $callbackclass($callbackargs);
|
||||
$caller->set('user', $USER);
|
||||
if ($formats = explode(',', $callerformats)) {
|
||||
$caller->set_formats_from_button($formats);
|
||||
}
|
||||
$caller->load_data();
|
||||
// this must check capabilities and either throw an exception or return false.
|
||||
if (!$caller->check_permissions()) {
|
||||
|
@ -200,7 +205,25 @@ if (!$exporter->get('instance')) {
|
|||
// in this case the exporter object and the caller object have been set up above
|
||||
// so just make a little form to select the portfolio plugin instance,
|
||||
// which is the last thing to do before starting the export.
|
||||
$mform = new portfolio_instance_select('', array('id' => $exporter->get('id'), 'caller' => $exporter->get('caller')));
|
||||
//
|
||||
// first check to make sure there is actually a point
|
||||
$options = portfolio_instance_select(
|
||||
portfolio_instances(),
|
||||
$exporter->get('caller')->supported_formats(),
|
||||
get_class($exporter->get('caller')),
|
||||
$exporter->get('caller')->get('singlefile'),
|
||||
'instance',
|
||||
true,
|
||||
true
|
||||
);
|
||||
if (empty($options)) {
|
||||
throw new portfolio_export_exception($exporter, 'noavailableplugins', 'portfolio');
|
||||
} else if (count($options) == 1) {
|
||||
// no point displaying a form, just redirect.
|
||||
$instance = array_shift(array_keys($options));
|
||||
redirect($CFG->wwwroot . '/portfolio/add.php?id= ' . $exporter->get('id') . '&instance=' . $instance . '&sesskey=' . sesskey());
|
||||
}
|
||||
$mform = new portfolio_instance_select('', array('id' => $exporter->get('id'), 'caller' => $exporter->get('caller'), 'options' => $options));
|
||||
if ($mform->is_cancelled()) {
|
||||
$exporter->cancel_request();
|
||||
} else if ($fromform = $mform->get_data()){
|
||||
|
|
|
@ -32,6 +32,8 @@ class portfolio_plugin_mahara extends portfolio_plugin_pull_base {
|
|||
|
||||
public static function supported_formats() {
|
||||
return array(PORTFOLIO_FORMAT_FILE);
|
||||
// TODO remove above line once leap over mnet is tested
|
||||
return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_LEAP2A);
|
||||
}
|
||||
|
||||
public function expected_time($callertime) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue