Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.6.x will end 11 November 2019 (12 months).
  • Bug fixes for security issues in 3.6.x will end 11 May 2020 (18 months) - Support has ended.
  • minimum PHP 7.0.0 Note: minimum PHP version has increased since Moodle 3.3. PHP 7.1.x and 7.2.x are supported too. PHP 7.3.x support is being implemented (@ MDL-63420) and not ready for production with this release.
  •    1  <?php
       2  // This file is part of Moodle - http://moodle.org/
       3  //
       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.
       8  //
       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.
      13  //
      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/>.
      16  
      17  
      18  /**
      19   * This file is the landing point for returning to moodle after authenticating at mahara
      20   *
      21   * @since Moodle 2.0
      22   * @package moodlecore
      23   * @subpackage portfolio
      24   * @copyright 2009 Penny Leach
      25   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
      26   */
      27  require_once(__DIR__ . '/../../config.php');
      28  
      29  if (empty($CFG->enableportfolios)) {
      30      print_error('disabled', 'portfolio');
      31  }
      32  
      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');
      37  
      38  require_login();
      39  
      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
      42  
      43  if (!$landed) {
      44      $exporter = portfolio_exporter::rewaken_object($id);
      45      $exporter->verify_rewaken();
      46  
      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');
      50      }
      51      redirect($url);
      52  } else {
      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();
      56  
      57      $exporter->get('instance')->send_intent();
      58      redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&sesskey=' . sesskey() . '&id=' . $id);
      59  }
      60