Updated the HEAD build version to 20091212
[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');
9require_once($CFG->dirroot . '/mnet/lib.php');
10
add560f3 11require_login();
12
557b2a3b
PL
13$id = required_param('id', PARAM_INT); // id of current export
14$landed = optional_param('landed', false, PARAM_BOOL); // this is the parameter we get back after we've jumped to mahara
15
16if (!$landed) {
254f2d05 17 $exporter = portfolio_exporter::rewaken_object($id);
18 $exporter->verify_rewaken();
19
20 $mnetauth = get_auth_plugin('mnet');
edf1fc35 21 if (!$url = $mnetauth->start_jump_session($exporter->get('instance')->get_config('mnethostid'), '/portfolio/mahara/preconfig.php?landed=1&id=' . $id, true)) {
254f2d05 22 throw new porfolio_exception('failedtojump', 'portfolio_mahara');
23 }
24 redirect($url);
25} else {
26 // 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 27 $exporter = portfolio_exporter::rewaken_object($id);
254f2d05 28 $exporter->verify_rewaken();
29
30 $exporter->get('instance')->send_intent();
89223416 31 redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&sesskey=' . sesskey() . '&id=' . $id);
254f2d05 32}
4317f92f 33