Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/registration/renewregistration.php
Go to the documentation of this file.
00001 <?php
00002 
00004 //                                                                       //
00005 // This file is part of Moodle - http://moodle.org/                      //
00006 // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
00007 //                                                                       //
00008 // Moodle is free software: you can redistribute it and/or modify        //
00009 // it under the terms of the GNU General Public License as published by  //
00010 // the Free Software Foundation, either version 3 of the License, or     //
00011 // (at your option) any later version.                                   //
00012 //                                                                       //
00013 // Moodle is distributed in the hope that it will be useful,             //
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of        //
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
00016 // GNU General Public License for more details.                          //
00017 //                                                                       //
00018 // You should have received a copy of the GNU General Public License     //
00019 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.       //
00020 //                                                                       //
00022 
00023 /*
00024  * @package    moodle
00025  * @subpackage registration
00026  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
00027  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
00028  * @copyright  (C) 1999 onwards Martin Dougiamas  http://dougiamas.com
00029  *
00030  * The administrator is redirect to this page from the hub to renew a registration
00031  * process because
00032  */
00033 
00034 require('../../config.php');
00035 require_once($CFG->libdir . '/adminlib.php');
00036 require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
00037 
00038 $url = optional_param('url', '', PARAM_URL);
00039 $hubname = optional_param('hubname', '', PARAM_TEXT);
00040 $token = optional_param('token', '', PARAM_TEXT);
00041 
00042 admin_externalpage_setup('registrationindex');
00043 
00044 //check that we are waiting a confirmation from this hub, and check that the token is correct
00045 $registrationmanager = new registration_manager();
00046 $registeredhub = $registrationmanager->get_unconfirmedhub($url);
00047 if (!empty($registeredhub) and $registeredhub->token == $token) {
00048 
00049     echo $OUTPUT->header();
00050     echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
00051     $hublink = html_writer::tag('a', $hubname, array('href' => $url));
00052 
00053     $registrationmanager->delete_registeredhub($url);
00054 
00055     //Mooch case, need to recreate the siteidentifier
00056     if ($url == HUB_MOODLEORGHUBURL) {
00057         $CFG->siteidentifier = null;
00058         get_site_identifier();
00059     }
00060 
00061     $deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
00062 
00063     $button = new single_button(new moodle_url('/admin/registration/index.php'),
00064                     get_string('restartregistration', 'hub'));
00065     $button->class = 'restartregbutton';
00066 
00067     echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
00068             array('class' => 'mdl-align'));
00069 
00070     echo $OUTPUT->footer();
00071 } else {
00072     throw new moodle_exception('wrongtoken', 'hub',
00073             $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
00074 }
00075 
00076 
 All Data Structures Namespaces Files Functions Variables Enumerations