Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
namespace mod_hvp;
17
 
18
use Exception;
19
use moodle_url;
20
 
21
defined('MOODLE_INTERNAL') || die();
22
 
23
/**
24
 * Service for communicating with the content hub
25
 *
26
 * @package    mod_hvp
27
 * @copyright  2020 Joubel AS
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
30
class content_hub_service {
31
 
32
    /**
33
     * Get settings for content hub registration UI
34
     *
35
     * @return array
36
     * @throws Exception
37
     */
38
    public static function get_registration_ui_settings() {
39
        $core               = framework::instance();
40
        $registrationurl    = new moodle_url('/mod/hvp/ajax.php', [
41
            'action' => 'contenthubregistration',
42
        ]);
43
        $accountsettingsurl = new moodle_url('/admin/settings.php?section=modsettinghvp');
44
 
45
        return [
46
            'registrationURL'             => $registrationurl->out(true),
47
            'accountSettingsUrl'          => $accountsettingsurl->out(true),
48
            'token'                       => $core::createToken('contentHubRegistration'),
49
            'l10n'                        => $core->getLocalization(),
50
            'licenseAgreementTitle'       => get_string('contenthub:licenseagreementtitle', 'hvp'),
51
            'licenseAgreementDescription' => get_string('contenthub:licenseagreementdescription', 'hvp'),
52
            'licenseAgreementMainText'    => get_string('contenthub:licenseagreementmaintext', 'hvp'),
53
            'accountInfo'                 => $core->hubAccountInfo(),
54
        ];
55
    }
56
}