NOBUG - Added a bunch more phpdocs to the portfolio code
[moodle.git] / portfolio / type / mahara / preconfig.php
CommitLineData
254f2d05 1<?php
2require_once(dirname(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
254f2d05 13if (!$landed = optional_param('landed', false, PARAM_BOOL)) {
14 $id = required_param('id', PARAM_INT);
15 $exporter = portfolio_exporter::rewaken_object($id);
16 $exporter->verify_rewaken();
17
18 $mnetauth = get_auth_plugin('mnet');
19 if (!$url = $mnetauth->start_jump_session($exporter->get('instance')->get_config('mnethostid'), '/portfolio/type/mahara/preconfig.php?landed=1', true)) {
20 throw new porfolio_exception('failedtojump', 'portfolio_mahara');
21 }
22 redirect($url);
23} else {
24 // now we have the sso session set up, start sending intent stuff and then redirect back to portfolio/add.php when we're done
25 $exporter = portfolio_exporter::rewaken_object($SESSION->portfolioexport);
26 $exporter->verify_rewaken();
27
28 $exporter->get('instance')->send_intent();
29 redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&id=' . $exporter->get('id'));
30}
4317f92f 31