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
 
17
/**
18
 * Class for exporting user evidence competency data.
19
 *
20
 * @package    tool_lp
21
 * @copyright  2016 Serge Gauthier - <serge.gauthier.2@umontreal.ca>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
namespace tool_lp\external;
25
defined('MOODLE_INTERNAL') || die();
26
 
27
use moodle_url;
28
use renderer_base;
29
use core_competency\external\competency_exporter;
30
use core_competency\external\user_competency_exporter;
31
 
32
/**
33
 * Class for exporting user evidence competency data.
34
 *
35
 * @copyright  2016 Serge Gauthier - <serge.gauthier.2@umontreal.ca>
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 */
38
class user_evidence_competency_summary_exporter extends \core\external\exporter {
39
 
40
    protected static function define_related() {
41
        return array('competency' => '\\core_competency\\competency',
42
                     'usercompetency' => '\\core_competency\\user_competency',
43
                     'scale' => 'grade_scale',
44
                     'context' => '\\context'
45
                    );
46
    }
47
 
48
    protected static function define_other_properties() {
49
        return array(
50
            'competency' => array(
51
                'type' => competency_exporter::read_properties_definition()
52
            ),
53
            'usercompetency' => array(
54
                'type' => user_competency_exporter::read_properties_definition(),
55
            )
56
        );
57
    }
58
 
59
    protected function get_other_values(renderer_base $output) {
60
        $competencyexporter = new competency_exporter($this->related['competency'],
61
                array('context' => $this->related['context']));
62
        $usercompetencyexporter = new user_competency_exporter($this->related['usercompetency'],
63
                array('scale' => $this->related['scale']));
64
 
65
        $values = array(
66
            'competency' => $competencyexporter->export($output),
67
            'usercompetency' => $usercompetencyexporter->export($output)
68
        );
69
 
70
        return $values;
71
    }
72
 
73
}