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
 * Grade report viewed event.
19
 *
20
 * @package    core
21
 * @copyright  2014 Adrian Greeve <adrian@moodle.com>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
namespace core\event;
26
 
27
defined('MOODLE_INTERNAL') || die();
28
 
29
/**
30
 * Grade report viewed event class.
31
 *
32
 * @package    core
33
 * @since      Moodle 2.8
34
 * @copyright  2014 Adrian Greeve <adrian@moodle.com>
35
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
37
abstract class grade_report_viewed extends base {
38
 
39
    /** string $reporttype The report type being viewed. */
40
    protected $reporttype;
41
 
42
    /**
43
     * Initialise the event data.
44
     */
45
    protected function init() {
46
        $reporttype = explode('\\', $this->eventname);
47
        $shorttype = explode('_', $reporttype[1]);
48
        $this->reporttype = $shorttype[1];
49
 
50
        $this->data['crud'] = 'r';
51
        $this->data['edulevel'] = self::LEVEL_TEACHING;
52
    }
53
 
54
    /**
55
     * Returns localised general event name.
56
     *
57
     * @return string
58
     */
59
    public static function get_name() {
60
        return get_string('eventgradeviewed', 'grades');
61
    }
62
 
63
    /**
64
     * Returns non-localised description of what happened.
65
     *
66
     * @return string
67
     */
68
    public function get_description() {
69
        return "The user with id '$this->userid' viewed the $this->reporttype report in the gradebook.";
70
    }
71
 
72
    /**
73
     * Returns relevant URL.
74
     * @return \moodle_url
75
     */
76
    public function get_url() {
77
        $url = '/grade/report/' . $this->reporttype . '/index.php';
78
        return new \moodle_url($url, array('id' => $this->courseid));
79
    }
80
 
81
    /**
82
     * Custom validation.
83
     *
84
     * To be overwritten by child classes.
85
     */
86
    protected function validate_data() {
87
        parent::validate_data();
88
    }
89
}