See Release Notes
Long Term Support Release
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * @package moodle 20 * @subpackage registration 21 * @author Jerome Mouneyrac <jerome@mouneyrac.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL 23 * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com 24 * 25 * This page displays the site registration form. 26 * It handles redirection to the hub to continue the registration workflow process. 27 * It also handles update operation by web service. 28 */ 29 30 require_once('../../config.php'); 31 require_once($CFG->libdir . '/adminlib.php'); 32 33 admin_externalpage_setup('registrationmoodleorg'); 34 35 $unregistration = optional_param('unregistration', false, PARAM_BOOL); 36 $confirm = optional_param('confirm', false, PARAM_BOOL); 37 38 if ($unregistration && \core\hub\registration::is_registered()) { 39 if ($confirm) { 40 require_sesskey(); 41 \core\hub\registration::unregister(false, false); 42 43 if (!\core\hub\registration::is_registered()) { 44 redirect(new moodle_url('/admin/registration/index.php')); 45 } 46 } 47 48 echo $OUTPUT->header(); 49 echo $OUTPUT->confirm( 50 get_string('registerwithmoodleorgremove', 'core_hub'), 51 new moodle_url(new moodle_url('/admin/registration/index.php', ['unregistration' => 1, 'confirm' => 1])), 52 new moodle_url(new moodle_url('/admin/registration/index.php')) 53 ); 54 echo $OUTPUT->footer(); 55 exit; 56 } 57 58 $isinitialregistration = \core\hub\registration::show_after_install(true); 59 if (!$returnurl = optional_param('returnurl', null, PARAM_LOCALURL)) { 60 $returnurl = $isinitialregistration ? '/admin/index.php' : '/admin/registration/index.php'; 61 } 62 63 $siteregistrationform = new \core\hub\site_registration_form(); 64 $siteregistrationform->set_data(['returnurl' => $returnurl]); 65 if ($fromform = $siteregistrationform->get_data()) { 66 67 // Save the settings. 68 \core\hub\registration::save_site_info($fromform); 69 70 if (\core\hub\registration::is_registered()) { 71 if (\core\hub\registration::update_manual()) { 72 redirect(new moodle_url($returnurl)); 73 } 74 redirect(new moodle_url('/admin/registration/index.php', ['returnurl' => $returnurl])); 75 } else { 76 \core\hub\registration::register($returnurl); 77 // This method will redirect away. 78 } 79 80 } 81 82 // OUTPUT SECTION. 83 84 echo $OUTPUT->header(); 85 86 // Current status of registration. 87 88 $notificationtype = \core\output\notification::NOTIFY_ERROR; 89 if (\core\hub\registration::is_registered()) { 90 $lastupdated = \core\hub\registration::get_last_updated(); 91 if ($lastupdated == 0) { 92 $registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin'); 93 } else if (\core\hub\registration::get_new_registration_fields()) { 94 $registrationmessage = get_string('pleaserefreshregistrationnewdata', 'admin'); 95 } else { 96 $lastupdated = userdate($lastupdated, get_string('strftimedate', 'langconfig')); 97 $registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated); 98 $notificationtype = \core\output\notification::NOTIFY_INFO; 99 } 100 echo $OUTPUT->notification($registrationmessage, $notificationtype); 101 } else if (!$isinitialregistration) { 102 $registrationmessage = get_string('registrationwarning', 'admin'); 103 echo $OUTPUT->notification($registrationmessage, $notificationtype); 104 } 105 106 // Heading. 107 if (\core\hub\registration::is_registered()) { 108 echo $OUTPUT->heading(get_string('registerwithmoodleorgupdate', 'core_hub')); 109 } else if ($isinitialregistration) { 110 echo $OUTPUT->heading(get_string('registerwithmoodleorgcomplete', 'core_hub')); 111 } else { 112 echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'core_hub')); 113 } 114 115 $renderer = $PAGE->get_renderer('core', 'admin'); 116 echo $renderer->moodleorg_registration_message(); 117 118 $siteregistrationform->display(); 119 120 if (\core\hub\registration::is_registered()) { 121 // Unregister link. 122 $unregisterhuburl = new moodle_url("/admin/registration/index.php", ['unregistration' => 1]); 123 echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister mt-2'); 124 } else if ($isinitialregistration) { 125 echo html_writer::div(html_writer::link(new moodle_url($returnurl), get_string('skipregistration', 'hub')), 126 'skipregistration mt-2'); 127 } 128 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body