mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-48894 core_registration: make it more obvious if site is registered
This commit is contained in:
parent
88cd577ef3
commit
806c06fc7b
5 changed files with 42 additions and 9 deletions
|
@ -69,6 +69,7 @@ class registration_manager {
|
|||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$this->update_registeredhub($hub); // To update timemodified.
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
|
@ -118,6 +119,7 @@ class registration_manager {
|
|||
*/
|
||||
public function add_registeredhub($hub) {
|
||||
global $DB;
|
||||
$hub->timemodified = time();
|
||||
$id = $DB->insert_record('registration_hubs', $hub);
|
||||
return $id;
|
||||
}
|
||||
|
@ -171,15 +173,16 @@ class registration_manager {
|
|||
|
||||
/**
|
||||
* Update a registered hub (mostly use to update the confirmation status)
|
||||
* @param object $communication the hub
|
||||
* @param object $hub the hub
|
||||
*/
|
||||
public function update_registeredhub($communication) {
|
||||
public function update_registeredhub($hub) {
|
||||
global $DB;
|
||||
$DB->update_record('registration_hubs', $communication);
|
||||
$hub->timemodified = time();
|
||||
$DB->update_record('registration_hubs', $hub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all hubs where the site is registered on
|
||||
* Return all hubs where the site is registered
|
||||
*/
|
||||
public function get_registered_on_hubs() {
|
||||
global $DB;
|
||||
|
|
|
@ -116,6 +116,7 @@ if ($update and confirm_sesskey()) {
|
|||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$registrationmanager->update_registeredhub($registeredhub); // To update timemodified.
|
||||
} catch (Exception $e) {
|
||||
$error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
|
||||
}
|
||||
|
@ -175,8 +176,20 @@ if (!empty($error)) {
|
|||
echo $error;
|
||||
}
|
||||
|
||||
//some Moodle.org resitration explanation
|
||||
// Some Moodle.org registration explanation.
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
if (!empty($registeredhub->token)) {
|
||||
if ($registeredhub->timemodified == 0) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
|
||||
} else {
|
||||
$lastupdated = userdate($registeredhub->timemodified, get_string('strftimedate', 'langconfig'));
|
||||
$registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
|
||||
}
|
||||
} else {
|
||||
$registrationmessage = get_string('registrationwarning', 'admin');
|
||||
}
|
||||
echo $OUTPUT->notification($registrationmessage);
|
||||
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue