Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/registration/confirmregistration.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 confirm that the
00031  * site has been registered. It is an administration page. The administrator
00032  * should be using the same browser during all the registration process.
00033  * This page save the token that the hub gave us, in order to call the hub
00034  * directory later by web service.
00035  */
00036 
00037 require('../../config.php');
00038 require_once($CFG->libdir . '/adminlib.php');
00039 require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
00040 
00041 $newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
00042 $url = optional_param('url', '', PARAM_URL);
00043 $hubname = optional_param('hubname', '', PARAM_TEXT);
00044 $token = optional_param('token', '', PARAM_TEXT);
00045 $error = optional_param('error', '', PARAM_ALPHANUM);
00046 
00047 admin_externalpage_setup('registrationindex');
00048 
00049 if (!empty($error) and $error == 'urlalreadyexist') {
00050     throw new moodle_exception('urlalreadyregistered', 'hub',
00051             $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
00052 }
00053 
00054 //check that we are waiting a confirmation from this hub, and check that the token is correct
00055 $registrationmanager = new registration_manager();
00056 $registeredhub = $registrationmanager->get_unconfirmedhub($url);
00057 if (!empty($registeredhub) and $registeredhub->token == $token) {
00058 
00059     echo $OUTPUT->header();
00060     echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
00061     $hublink = html_writer::tag('a', $hubname, array('href' => $url));
00062 
00063     $registeredhub->token = $newtoken;
00064     $registeredhub->confirmed = 1;
00065     $registeredhub->hubname = $hubname;
00066     $registrationmanager->update_registeredhub($registeredhub);
00067 
00068     //display notficiation message
00069     $notificationmessage = $OUTPUT->notification(
00070             get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
00071     echo $notificationmessage;
00072 
00073     //display continue button
00074     $registrationpage = new moodle_url('/admin/registration/index.php');
00075     $continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
00076     $continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
00077     echo $continuebutton;
00078 
00079     if (!extension_loaded('xmlrpc')) {
00080         //display notice about xmlrpc
00081         $xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
00082         $xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
00083         echo $OUTPUT->notification($xmlrpcnotification);
00084     }
00085 
00086     echo $OUTPUT->footer();
00087 } else {
00088     throw new moodle_exception('wrongtoken', 'hub',
00089             $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
00090 }
00091 
00092 
 All Data Structures Namespaces Files Functions Variables Enumerations