MDL-18734 - documentation and coding style in portfolio/*
[moodle.git] / portfolio / already.php
CommitLineData
a4763136 1<?php
4c7a4ef9 2/**
3 * Moodle - Modular Object-Oriented Dynamic Learning Environment
4 * http://moodle.org
5 * Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * @package moodle
21 * @subpackage portfolio
22 * @author Penny Leach <penny@catalyst.net.nz>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
24 * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
25 *
26 * This file is the handler that gets invoked when there's already an export happening.
27 */
a4763136 28require_once(dirname(dirname(__FILE__)) . '/config.php');
29
30if (empty($CFG->enableportfolios)) {
31 print_error('disabled', 'portfolio');
32}
98335b2d 33
6e6cf8a3 34require_once($CFG->libdir . '/portfoliolib.php');
35
98335b2d 36require_login();
37
6e6cf8a3 38$dataid = 0;
4c7a4ef9 39
40// look for the export id in the request, if it's not there, try the session
6e6cf8a3 41if (!$dataid = optional_param('id', '', PARAM_INT) ) {
42 if (isset($SESSION->portfolioexport)) {
43 $dataid = $SESSION->portfolioexport;
44 }
45}
46
4c7a4ef9 47// all we're going to do is print a table with some information
48// about the current export, with a yes/ no option to resume or cancel.
6e6cf8a3 49$table = new StdClass;
50$table->head = array(
4c7a4ef9 51 get_string('displayarea', 'portfolio'), // the part of moodle exporting content
52 get_string('destination', 'portfolio'), // the portfolio plugin instance
53 get_string('displayinfo', 'portfolio'), // any extra data about what it is we're exporting from the caller
6e6cf8a3 54);
55$table->data = array();
56if ($dataid) {
57 try {
4c7a4ef9 58 // try to reawaken it and get any information about it we can
6e6cf8a3 59 $exporter = portfolio_exporter::rewaken_object($dataid);
60 $exporter->verify_rewaken();
61 $table->data[] = array(
62 $exporter->get('caller')->display_name(),
612a14c5 63 ($exporter->get('instance') ? $exporter->get('instance')->get('name') : get_string('notyetselected', 'portfolio')),
6e6cf8a3 64 $exporter->get('caller')->heading_summary(),
65 );
4c7a4ef9 66 } catch (portfolio_exception $e) { } // maybe in this case we should just kill it and redirect to the new request anyway ?
6e6cf8a3 67}
a4763136 68
69$strheading = get_string('activeexport', 'portfolio');
70print_header($strheading, $strheading);
71
72notice_yesno(get_string('alreadyexporting', 'portfolio'), $CFG->wwwroot . '/portfolio/add.php', $CFG->wwwroot . '/portfolio/add.php?cancel=1');
73
6e6cf8a3 74if (count($table->data) > 0) {
75 print_table($table);
76}
77
a4763136 78print_footer();
79
80?>