Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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
 
17
namespace core_badges\external;
18
 
19
defined('MOODLE_INTERNAL') || die();
20
 
21
use core\external\exporter;
22
use stdClass;
23
 
24
/**
1441 ariadna 25
 * Class for displaying a badge collection.
1 efrain 26
 *
27
 * @package   core_badges
28
 * @copyright 2019 Damyon Wiese
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class collection_exporter extends exporter {
32
 
33
    /**
34
     * Either map version 1 data to version 2 or return it untouched.
35
     *
36
     * @param stdClass $data The remote data.
37
     * @param string $apiversion The backpack version used to communicate remotely.
38
     * @return stdClass
39
     */
40
    public static function map_external_data($data, $apiversion) {
41
        return $data;
42
    }
43
 
44
    /**
45
     * Return the list of properties.
46
     *
47
     * @return array
48
     */
49
    protected static function define_properties() {
50
        return [
51
            'entityType' => [
52
                'type' => PARAM_ALPHA,
53
                'description' => 'BackpackCollection',
54
            ],
55
            'entityId' => [
56
                'type' => PARAM_RAW,
57
                'description' => 'Unique identifier for this collection',
58
            ],
59
            'name' => [
60
                'type' => PARAM_TEXT,
61
                'description' => 'Collection name',
62
            ],
63
            'description' => [
64
                'type' => PARAM_TEXT,
65
                'description' => 'Collection description',
66
            ],
67
            'share_url' => [
68
                'type' => PARAM_URL,
69
                'description' => 'Url to view this collection',
70
            ],
71
            'published' => [
72
                'type' => PARAM_BOOL,
73
                'description' => 'True means this collection is public.',
74
            ],
75
            'assertions' => [
76
                'type' => PARAM_RAW,
77
                'description' => 'List of assertion ids in this collection',
78
                'multiple' => true,
79
            ],
80
        ];
81
    }
82
 
83
    /**
84
     * Returns a list of objects that are related.
85
     *
86
     * @return array
87
     */
88
    protected static function define_related() {
89
        return array(
90
            'context' => 'context',
91
        );
92
    }
93
}