2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 * This file is the landing point for returning to moodle after authenticating at mahara
23 * @subpackage portfolio
24 * @copyright 2009 Penny Leach
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 require_once(__DIR__
. '/../../config.php');
29 if (empty($CFG->enableportfolios
)) {
30 print_error('disabled', 'portfolio');
33 require_once($CFG->libdir
. '/portfoliolib.php');
34 require_once($CFG->libdir
. '/portfolio/plugin.php');
35 require_once($CFG->libdir
. '/portfolio/exporter.php');
36 require_once($CFG->dirroot
. '/mnet/lib.php');
40 $id = required_param('id', PARAM_INT
); // id of current export
41 $landed = optional_param('landed', false, PARAM_BOOL
); // this is the parameter we get back after we've jumped to mahara
44 $exporter = portfolio_exporter
::rewaken_object($id);
45 $exporter->verify_rewaken();
47 $mnetauth = get_auth_plugin('mnet');
48 if (!$url = $mnetauth->start_jump_session($exporter->get('instance')->get_config('mnethostid'), '/portfolio/mahara/preconfig.php?landed=1&id=' . $id, true)) {
49 throw new porfolio_exception('failedtojump', 'portfolio_mahara');
53 // now we have the sso session set up, start sending intent stuff and then redirect back to portfolio/add.php when we're done
54 $exporter = portfolio_exporter
::rewaken_object($id);
55 $exporter->verify_rewaken();
57 $exporter->get('instance')->send_intent();
58 redirect($CFG->wwwroot
. '/portfolio/add.php?postcontrol=1&sesskey=' . sesskey() . '&id=' . $id);