repo MDL-21443 fix phpdocs to match method signatures
[moodle.git] / portfolio / mahara / preconfig.php
CommitLineData
254f2d05 1<?php
edf1fc35 2require_once(dirname(dirname(dirname(__FILE__))). '/config.php');
add560f3 3
4if (empty($CFG->enableportfolios)) {
5 print_error('disabled', 'portfolio');
6}
7
254f2d05 8require_once($CFG->libdir . '/portfoliolib.php');
24ba58ee
PL
9require_once($CFG->libdir . '/portfolio/plugin.php');
10require_once($CFG->libdir . '/portfolio/exporter.php');
254f2d05 11require_once($CFG->dirroot . '/mnet/lib.php');
12
add560f3 13require_login();
14
557b2a3b
PL
15$id = required_param('id', PARAM_INT); // id of current export
16$landed = optional_param('landed', false, PARAM_BOOL); // this is the parameter we get back after we've jumped to mahara
17
18if (!$landed) {
254f2d05 19 $exporter = portfolio_exporter::rewaken_object($id);
20 $exporter->verify_rewaken();
21
22 $mnetauth = get_auth_plugin('mnet');
edf1fc35 23 if (!$url = $mnetauth->start_jump_session($exporter->get('instance')->get_config('mnethostid'), '/portfolio/mahara/preconfig.php?landed=1&id=' . $id, true)) {
254f2d05 24 throw new porfolio_exception('failedtojump', 'portfolio_mahara');
25 }
26 redirect($url);
27} else {
28 // now we have the sso session set up, start sending intent stuff and then redirect back to portfolio/add.php when we're done
557b2a3b 29 $exporter = portfolio_exporter::rewaken_object($id);
254f2d05 30 $exporter->verify_rewaken();
31
32 $exporter->get('instance')->send_intent();
89223416 33 redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&sesskey=' . sesskey() . '&id=' . $id);
254f2d05 34}
4317f92f 35