|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00017 00027 require_once(dirname(dirname(dirname(__FILE__))). '/config.php'); 00028 00029 if (empty($CFG->enableportfolios)) { 00030 print_error('disabled', 'portfolio'); 00031 } 00032 00033 require_once($CFG->libdir . '/portfoliolib.php'); 00034 require_once($CFG->libdir . '/portfolio/plugin.php'); 00035 require_once($CFG->libdir . '/portfolio/exporter.php'); 00036 require_once($CFG->dirroot . '/mnet/lib.php'); 00037 00038 require_login(); 00039 00040 $id = required_param('id', PARAM_INT); // id of current export 00041 $landed = optional_param('landed', false, PARAM_BOOL); // this is the parameter we get back after we've jumped to mahara 00042 00043 if (!$landed) { 00044 $exporter = portfolio_exporter::rewaken_object($id); 00045 $exporter->verify_rewaken(); 00046 00047 $mnetauth = get_auth_plugin('mnet'); 00048 if (!$url = $mnetauth->start_jump_session($exporter->get('instance')->get_config('mnethostid'), '/portfolio/mahara/preconfig.php?landed=1&id=' . $id, true)) { 00049 throw new porfolio_exception('failedtojump', 'portfolio_mahara'); 00050 } 00051 redirect($url); 00052 } else { 00053 // now we have the sso session set up, start sending intent stuff and then redirect back to portfolio/add.php when we're done 00054 $exporter = portfolio_exporter::rewaken_object($id); 00055 $exporter->verify_rewaken(); 00056 00057 $exporter->get('instance')->send_intent(); 00058 redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&sesskey=' . sesskey() . '&id=' . $id); 00059 } 00060