mirror of
https://github.com/moodle/moodle.git
synced 2025-03-15 05:00:06 +01:00
Merge branch 'MDL-58694-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
e747059693
@ -249,6 +249,11 @@ class site_registration_form extends moodleform {
|
||||
$mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
|
||||
$participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
|
||||
$modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
|
||||
// Mobile related information.
|
||||
$mobileservicesenabled = get_config('hub', 'site_mobileservicesenabled_' . $cleanhuburl);
|
||||
$mobilenotificacionsenabled = get_config('hub', 'site_mobilenotificacionsenabled_' . $cleanhuburl);
|
||||
$registereduserdevices = get_config('hub', 'site_registereduserdevices_' . $cleanhuburl);
|
||||
$registeredactiveuserdevices = get_config('hub', 'site_registeredactiveuserdevices_' . $cleanhuburl);
|
||||
|
||||
//hidden parameters
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
@ -386,6 +391,21 @@ class site_registration_form extends moodleform {
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
$badges = $DB->count_records_select('badge', 'status <> ' . BADGE_STATUS_ARCHIVED);
|
||||
$issuedbadges = $DB->count_records('badge_issued');
|
||||
// Mobile related information.
|
||||
$ismobileenabled = false;
|
||||
$aremobilenotificationsenabled = false;
|
||||
$registereduserdevicescount = 0;
|
||||
$registeredactiveuserdevicescount = 0;
|
||||
if (!empty($CFG->enablewebservices) && !empty($CFG->enablemobilewebservice)) {
|
||||
$ismobileenabled = true;
|
||||
$registereduserdevicescount = $DB->count_records('user_devices');
|
||||
$airnotifierextpath = $CFG->dirroot . '/message/output/airnotifier/externallib.php';
|
||||
if (file_exists($airnotifierextpath)) { // Maybe some one uninstalled the plugin.
|
||||
require_once($airnotifierextpath);
|
||||
$aremobilenotificationsenabled = (bool) message_airnotifier_external::is_system_configured();
|
||||
$registeredactiveuserdevicescount = $DB->count_records('message_airnotifier_devices', array('enable' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (HUB_MOODLEORGHUBURL != $huburl) {
|
||||
$mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
|
||||
@ -438,6 +458,28 @@ class site_registration_form extends moodleform {
|
||||
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
|
||||
$mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
|
||||
$mform->setType('modulenumberaverage', PARAM_FLOAT);
|
||||
|
||||
$mobileservicestatus = $ismobileenabled ? 'yes' : 'no';
|
||||
$mform->addElement('checkbox', 'mobileservicesenabled', '',
|
||||
" " . get_string('mobileservicesenabled', 'hub', $mobileservicestatus));
|
||||
$mform->setDefault('mobileservicesenabled', $mobileservicesenabled != -1);
|
||||
$mform->setType('mobileservicesenabled', PARAM_INT);
|
||||
|
||||
$mobilenotificationsstatus = $aremobilenotificationsenabled ? 'yes' : 'no';
|
||||
$mform->addElement('checkbox', 'mobilenotificacionsenabled', '',
|
||||
" " . get_string('mobilenotificacionsenabled', 'hub', $mobilenotificationsstatus));
|
||||
$mform->setDefault('mobilenotificacionsenabled', $mobilenotificacionsenabled != -1);
|
||||
$mform->setType('mobilenotificacionsenabled', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'registereduserdevices', '',
|
||||
" " . get_string('registereduserdevices', 'hub', $registereduserdevicescount));
|
||||
$mform->setDefault('registereduserdevices', $registereduserdevices != -1);
|
||||
$mform->setType('registereduserdevices', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'registeredactiveuserdevices', '',
|
||||
" " . get_string('registeredactiveuserdevices', 'hub', $registeredactiveuserdevicescount));
|
||||
$mform->setDefault('registeredactiveuserdevices', $registeredactiveuserdevices != -1);
|
||||
$mform->setType('registeredactiveuserdevices', PARAM_INT);
|
||||
} else {
|
||||
$mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
|
||||
" " . get_string('coursesnumber', 'hub', $coursecount));
|
||||
@ -489,6 +531,28 @@ class site_registration_form extends moodleform {
|
||||
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
|
||||
$mform->addElement('hidden', 'modulenumberaverage', 1);
|
||||
$mform->setType('modulenumberaverage', PARAM_FLOAT);
|
||||
|
||||
$mobileservicestatus = $ismobileenabled ? 'yes' : 'no';
|
||||
$mform->addElement('static', 'mobileservicesenabledlabel', '',
|
||||
" " . get_string('mobileservicesenabled', 'hub', $mobileservicestatus));
|
||||
$mform->addElement('hidden', 'mobileservicesenabled', 1);
|
||||
$mform->setType('mobileservicesenabled', PARAM_INT);
|
||||
|
||||
$mobilenotificationsstatus = $aremobilenotificationsenabled ? 'yes' : 'no';
|
||||
$mform->addElement('static', 'mobilenotificacionsenabledlabel', '',
|
||||
" " . get_string('mobilenotificacionsenabled', 'hub', $mobilenotificationsstatus));
|
||||
$mform->addElement('hidden', 'mobilenotificacionsenabled', 1);
|
||||
$mform->setType('mobilenotificacionsenabled', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'registereduserdeviceslabel', '',
|
||||
" " . get_string('registereduserdevices', 'hub', $registereduserdevicescount));
|
||||
$mform->addElement('hidden', 'registereduserdevices', 1);
|
||||
$mform->setType('registereduserdevices', PARAM_INT);
|
||||
|
||||
$mform->addElement('static', 'registeredactiveuserdeviceslabel', '',
|
||||
" " . get_string('registeredactiveuserdevices', 'hub', $registeredactiveuserdevicescount));
|
||||
$mform->addElement('hidden', 'registeredactiveuserdevices', 1);
|
||||
$mform->setType('registeredactiveuserdevices', PARAM_INT);
|
||||
}
|
||||
|
||||
//check if it's a first registration or update
|
||||
|
@ -280,6 +280,21 @@ class registration_manager {
|
||||
$siteinfo['moodleversion'] = $CFG->version;
|
||||
$siteinfo['moodlerelease'] = $CFG->release;
|
||||
$siteinfo['url'] = $CFG->wwwroot;
|
||||
// Mobile related information.
|
||||
$siteinfo['mobileservicesenabled'] = 0;
|
||||
$siteinfo['mobilenotificacionsenabled'] = 0;
|
||||
$siteinfo['registereduserdevices'] = 0;
|
||||
$siteinfo['registeredactiveuserdevices'] = 0;
|
||||
if (!empty($CFG->enablewebservices) && !empty($CFG->enablemobilewebservice)) {
|
||||
$siteinfo['mobileservicesenabled'] = 1;
|
||||
$siteinfo['registereduserdevices'] = $DB->count_records('user_devices');
|
||||
$airnotifierextpath = $CFG->dirroot . '/message/output/airnotifier/externallib.php';
|
||||
if (file_exists($airnotifierextpath)) { // Maybe some one uninstalled the plugin.
|
||||
require_once($airnotifierextpath);
|
||||
$siteinfo['mobilenotificacionsenabled'] = message_airnotifier_external::is_system_configured();
|
||||
$siteinfo['registeredactiveuserdevices'] = $DB->count_records('message_airnotifier_devices', array('enable' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
return $siteinfo;
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ if (!empty($fromform) and confirm_sesskey()) {
|
||||
// Set to -1 all optional data marked as "don't send" by the admin.
|
||||
// The function get_site_info() will not calculate the optional data if config is set to -1.
|
||||
$inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
|
||||
'badges', 'issuedbadges', 'modulenumberaverage', 'participantnumberaverage');
|
||||
'badges', 'issuedbadges', 'modulenumberaverage', 'participantnumberaverage',
|
||||
'mobileservicesenabled', 'mobilenotificacionsenabled', 'registereduserdevices', 'registeredactiveuserdevices');
|
||||
foreach ($inputnames as $inputname) {
|
||||
if (empty($fromform->{$inputname})) {
|
||||
$fromform->{$inputname} = -1;
|
||||
@ -101,6 +102,10 @@ if (!empty($fromform) and confirm_sesskey()) {
|
||||
set_config('site_issuedbadges_' . $cleanhuburl, $fromform->issuedbadges, 'hub');
|
||||
set_config('site_modulenumberaverage_' . $cleanhuburl, $fromform->modulenumberaverage, 'hub');
|
||||
set_config('site_participantnumberaverage_' . $cleanhuburl, $fromform->participantnumberaverage, 'hub');
|
||||
set_config('site_mobileservicesenabled_' . $cleanhuburl, $fromform->mobileservicesenabled, 'hub');
|
||||
set_config('site_mobilenotificacionsenabled_' . $cleanhuburl, $fromform->mobilenotificacionsenabled, 'hub');
|
||||
set_config('site_registereduserdevices_' . $cleanhuburl, $fromform->registereduserdevices, 'hub');
|
||||
set_config('site_registeredactiveuserdevices_' . $cleanhuburl, $fromform->registeredactiveuserdevices, 'hub');
|
||||
}
|
||||
|
||||
/////// UPDATE ACTION ////////
|
||||
@ -143,6 +148,10 @@ if (!empty($fromform) and empty($update) and confirm_sesskey()) {
|
||||
$fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
|
||||
$fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
|
||||
$fromform->street = $siteinfo['street'];
|
||||
$fromform->mobileservicesenabled = $siteinfo['mobileservicesenabled'];
|
||||
$fromform->mobilenotificacionsenabled = $siteinfo['mobilenotificacionsenabled'];
|
||||
$fromform->registereduserdevices = $siteinfo['registereduserdevices'];
|
||||
$fromform->registeredactiveuserdevices = $siteinfo['registeredactiveuserdevices'];
|
||||
|
||||
$params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
|
||||
|
||||
|
@ -117,6 +117,8 @@ $string['licence'] = 'Licence';
|
||||
$string['licence_help'] = 'Select the licence you want to distribute your course under.';
|
||||
$string['licence_link'] = 'licenses';
|
||||
$string['logourl'] = 'Logo URL';
|
||||
$string['mobilenotificacionsenabled'] = 'Mobile notifications enabled ({$a})';
|
||||
$string['mobileservicesenabled'] = 'Mobile services enabled ({$a})';
|
||||
$string['modulenumberaverage'] = 'Average number of course modules ({$a})';
|
||||
$string['moodleorg'] = 'Moodle';
|
||||
$string['mustselectsubject'] = 'You must select a subject';
|
||||
@ -160,6 +162,8 @@ $string['registeredsites'] = 'Registered sites';
|
||||
$string['registrationinfo'] = 'Registration information';
|
||||
$string['registeredmoodleorg'] = 'Moodle ({$a})';
|
||||
$string['registeredon'] = 'Where your site is registered';
|
||||
$string['registereduserdevices'] = 'Number of user\'s registered mobile devices ({$a})';
|
||||
$string['registeredactiveuserdevices'] = 'Number of active user\'s registered mobile devices ({$a})';
|
||||
$string['registermoochtips'] = 'Register your site with Moodle to get security alerts and access to Moodle.net, our course sharing platform.';
|
||||
$string['registersite'] = 'Register with {$a}';
|
||||
$string['registerwith'] = 'Register with a hub';
|
||||
|
Loading…
x
Reference in New Issue
Block a user