Merge branch 'MDL-63153_master' of https://github.com/aanabit/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-10-25 01:11:36 +02:00
commit 3d18697115
7 changed files with 240 additions and 0 deletions

View File

@ -0,0 +1,53 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file gives information about Moodle Services
*
* @package core
* @copyright 2018 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
// Create Moodle Services information.
$moodleservices->add(new admin_setting_heading('moodleservicesintro', '',
new lang_string('moodleservices_help', 'admin')));
// Moodle Partners information.
if (empty($CFG->disableserviceads_partner)) {
$moodleservices->add(new admin_setting_heading('moodlepartners',
new lang_string('moodlepartners', 'admin'),
new lang_string('moodlepartners_help', 'admin')));
}
// Moodle app information.
$moodleservices->add(new admin_setting_heading('moodleapp',
new lang_string('moodleapp', 'admin'),
new lang_string('moodleapp_help', 'admin')));
// Branded Moodle app information.
if (empty($CFG->disableserviceads_branded)) {
$moodleservices->add(new admin_setting_heading('moodlebrandedapp',
new lang_string('moodlebrandedapp', 'admin'),
new lang_string('moodlebrandedapp_help', 'admin')));
}
}

View File

@ -15,6 +15,11 @@ $ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_str
// hidden upgrade script
$ADMIN->add('root', new admin_externalpage('upgradesettings', new lang_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
// Adding Moodle Services information page.
$moodleservices = new admin_settingpage('moodleservices', new lang_string('moodleservices',
'admin'));
$ADMIN->add('root', $moodleservices);
if ($hassiteconfig) {
$optionalsubsystems = new admin_settingpage('optionalsubsystems', new lang_string('advancedfeatures', 'admin'));
$ADMIN->add('root', $optionalsubsystems);

View File

@ -0,0 +1,45 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_admin/setting_description
Admin setting description template.
Context variables required for this template:
* labelfor - id of the form element
* title - Setting title
* name - Setting name
Example context (json):
{
"title": "Setting title",
"name": "Name",
"description": "Description goes here"
}
}}
{{!
Setting description.
}}
<div class="form-item form-horizontal clearfix">
<div class="form-label">
<label>
{{{title}}}
</label>
<span class="form-shortname ">{{{name}}}</span>
</div>
<div class="controls felement fstatic">{{{description}}}</div>
</div>

View File

@ -73,6 +73,14 @@ if ($hassiteconfig) {
$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'tool_mobile'),
new lang_string('configmobilecssurl', 'tool_mobile'), '', PARAM_URL));
// Reference to Branded Mobile App.
if (empty($CFG->disableserviceads_branded)) {
$temp->add(new admin_setting_description('moodlebrandedappreference',
new lang_string('moodlebrandedapp', 'admin'),
new lang_string('moodlebrandedappreference', 'admin')
));
}
$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
new lang_string('smartappbanners', 'tool_mobile'), ''));

View File

@ -810,6 +810,20 @@ $string['nonexistentbookmark'] = 'The bookmark you requested does not exist.';
$string['nosupportedlogstore'] = 'No supported logstore found';
$string['maxtimelimit'] = 'Maximum time limit';
$string['maxtimelimit_desc'] = 'To restrict the maximum PHP execution time that Moodle will allow without any output being displayed, enter a value in seconds here. 0 means that Moodle default restrictions are used. If you have a front-end server with its own time limit, set this value lower to receive PHP errors in logs. Does not apply to CLI scripts.';
$string['moodleapp'] = 'Moodle app';
$string['moodleapp_help'] = '<p>If you have an account on a Moodle site, you can access all your courses on your mobile devices with our free mobile app for Moodle.</p>
<a href="https://moodle.com/mobile-app">Get the Moodle app</a>';
$string['moodlebrandedapp'] = 'Branded Moodle app';
$string['moodlebrandedapp_help'] = '<p>The Branded Moodle app has all the functionality of our free mobile app for Moodle combined with your own custom branding.</p>
<a href="https://moodle.com/branded-app">About the Branded Moodle app</a>';
$string['moodlebrandedappreference'] = '<p>Contact Moodle HQ for our Branded Moodle app service and customise the app with your own branding.</p>
<a href="https://moodle.com/branded-app">About the Branded Moodle app</a>';
$string['moodlepartners'] = 'Moodle Partners';
$string['moodlepartners_help'] = '<p>Moodle Partners are services providers that are certified by Moodle HQ to provide high quality Moodle services for your organisation\'s online learning environment.</p>
<a href="https://moodle.com/about-partners/">About our Partners</a><br />
<a href="https://moodle.com/partners">Find a Partner</a>';
$string['moodleservices'] = 'Moodle services';
$string['moodleservices_help'] = 'Make sure you get the best from your Moodle learning environment by using these Moodle services:';
$string['noreplyaddress'] = 'No-reply address';
$string['noreplydomain'] = 'No-reply and domain';
$string['noreplydomaindetail'] = 'Settings for No-reply and configured domains';

View File

@ -2107,6 +2107,74 @@ class admin_setting_heading extends admin_setting {
}
}
/**
* No setting - just name and description in same row.
*
* @copyright 2018 onwards Amaia Anabitarte
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_description extends admin_setting {
/**
* Not a setting, just text
*
* @param string $name
* @param string $visiblename
* @param string $description
*/
public function __construct($name, $visiblename, $description) {
$this->nosave = true;
parent::__construct($name, $visiblename, $description, '');
}
/**
* Always returns true
*
* @return bool Always returns true
*/
public function get_setting() {
return true;
}
/**
* Always returns true
*
* @return bool Always returns true
*/
public function get_defaultsetting() {
return true;
}
/**
* Never write settings
*
* @param mixed $data Gets converted to str for comparison against yes value
* @return string Always returns an empty string
*/
public function write_setting($data) {
// Do not write any setting.
return '';
}
/**
* Returns an HTML string
*
* @param string $data
* @param string $query
* @return string Returns an HTML string
*/
public function output_html($data, $query='') {
global $OUTPUT;
$context = new stdClass();
$context->title = $this->visiblename;
$context->description = $this->description;
return $OUTPUT->render_from_template('core_admin/setting_description', $context);
}
}
/**
* The most flexible setting, the user enters text.
@ -8223,6 +8291,7 @@ function admin_search_settings_html($query) {
$data = $adminroot->errors[$fullname]->data;
} else {
$data = $setting->get_setting();
$data = $setting->get_setting();
// do not use defaults if settings not available - upgradesettings handles the defaults!
}
$sectionsettings[] = $setting->output_html($data, $query);

View File

@ -0,0 +1,46 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_admin/setting_description
Admin setting description template.
Context variables required for this template:
* labelfor - id of the form element
* title - Setting title
* name - Setting name
Example context (json):
{
"title": "Setting title",
"name": "Name",
"description": "Description goes here"
}
}}
{{!
Setting description.
}}
<div class="form-item row">
<div class="form-label col-sm-3 text-sm-right">
<label>
{{{title}}}
</label>
</div>
<div class="form-setting col-sm-9">
<div class="form-description">{{{description}}}</div>
</div>
</div>